150 lines
6.1 KiB
XML
150 lines
6.1 KiB
XML
<?xml version="1.0" encoding="UTF-8" ?>
|
|||
|
|
<!DOCTYPE mapper
|
||
|
|
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||
|
|
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||
|
|
<mapper namespace="com.ruoyi.rocketmq.mapper.InitialSwitchInfoMapper">
|
||
|
|
|
||
|
|
<resultMap type="InitialSwitchInfo" id="InitialSwitchInfoResult">
|
||
|
|
<id property="id" column="id"/>
|
||
|
|
<result property="clientId" column="client_id"/>
|
||
|
|
<result property="name" column="name"/>
|
||
|
|
<result property="inBytes" column="in_bytes"/>
|
||
|
|
<result property="outBytes" column="out_bytes"/>
|
||
|
|
<result property="status" column="status"/>
|
||
|
|
<result property="type" column="type"/>
|
||
|
|
<result property="inSpeed" column="in_speed"/>
|
||
|
|
<result property="outSpeed" column="out_speed"/>
|
||
|
|
<result property="createBy" column="create_by"/>
|
||
|
|
<result property="updateBy" column="update_by"/>
|
||
|
|
<result property="createTime" column="create_time"/>
|
||
|
|
<result property="updateTime" column="update_time"/>
|
||
|
|
</resultMap>
|
||
|
|
|
||
|
|
<sql id="selectInitialSwitchInfoVo">
|
||
|
|
SELECT
|
||
|
|
id, client_id, `name`, in_bytes, out_bytes, status, `type`,
|
||
|
|
in_speed, out_speed, create_by, update_by, create_time, update_time
|
||
|
|
FROM initial_switch_info
|
||
|
|
</sql>
|
||
|
|
|
||
|
|
<select id="selectInitialSwitchInfoList" parameterType="InitialSwitchInfo" resultMap="InitialSwitchInfoResult">
|
||
|
|
<include refid="selectInitialSwitchInfoVo"/>
|
||
|
|
<where>
|
||
|
|
<if test="clientId != null and clientId != ''">
|
||
|
|
AND client_id = #{clientId}
|
||
|
|
</if>
|
||
|
|
<if test="name != null and name != ''">
|
||
|
|
AND name LIKE CONCAT('%', #{name}, '%')
|
||
|
|
</if>
|
||
|
|
<if test="status != null and status != ''">
|
||
|
|
AND status = #{status}
|
||
|
|
</if>
|
||
|
|
<if test="type != null and type != ''">
|
||
|
|
AND type = #{type}
|
||
|
|
</if>
|
||
|
|
<if test="params.beginTime != null and params.beginTime != ''">
|
||
|
|
AND create_time >= #{params.beginTime}
|
||
|
|
</if>
|
||
|
|
<if test="params.endTime != null and params.endTime != ''">
|
||
|
|
AND create_time <= #{params.endTime}
|
||
|
|
</if>
|
||
|
|
</where>
|
||
|
|
ORDER BY create_time DESC
|
||
|
|
</select>
|
||
|
|
|
||
|
|
<select id="selectInitialSwitchInfoById" parameterType="Long" resultMap="InitialSwitchInfoResult">
|
||
|
|
<include refid="selectInitialSwitchInfoVo"/>
|
||
|
|
where id = #{id}
|
||
|
|
</select>
|
||
|
|
|
||
|
|
<insert id="insertInitialSwitchInfo" parameterType="InitialSwitchInfo" useGeneratedKeys="true" keyProperty="id">
|
||
|
|
INSERT INTO initial_switch_info
|
||
|
|
<trim prefix="(" suffix=")" suffixOverrides=",">
|
||
|
|
client_id,
|
||
|
|
<if test="name != null">name,</if>
|
||
|
|
<if test="inBytes != null">in_bytes,</if>
|
||
|
|
<if test="outBytes != null">out_bytes,</if>
|
||
|
|
<if test="status != null">status,</if>
|
||
|
|
<if test="type != null">type,</if>
|
||
|
|
<if test="inSpeed != null">in_speed,</if>
|
||
|
|
<if test="outSeppd != null">out_speed,</if>
|
||
|
|
<if test="createBy != null">create_by,</if>
|
||
|
|
<if test="updateBy != null">update_by,</if>
|
||
|
|
create_time,
|
||
|
|
update_time
|
||
|
|
</trim>
|
||
|
|
<trim prefix="VALUES (" suffix=")" suffixOverrides=",">
|
||
|
|
#{clientId},
|
||
|
|
<if test="name != null">#{name},</if>
|
||
|
|
<if test="inBytes != null">#{inBytes},</if>
|
||
|
|
<if test="outBytes != null">#{outBytes},</if>
|
||
|
|
<if test="status != null">#{status},</if>
|
||
|
|
<if test="type != null">#{type},</if>
|
||
|
|
<if test="inSpeed != null">#{inSpeed},</if>
|
||
|
|
<if test="outSeppd != null">#{outSpeed},</if>
|
||
|
|
<if test="createBy != null">#{createBy},</if>
|
||
|
|
<if test="updateBy != null">#{updateBy},</if>
|
||
|
|
NOW(),
|
||
|
|
NOW()
|
||
|
|
</trim>
|
||
|
|
</insert>
|
||
|
|
|
||
|
|
<update id="updateInitialSwitchInfo" parameterType="InitialSwitchInfo">
|
||
|
|
UPDATE initial_switch_info
|
||
|
|
<set>
|
||
|
|
<if test="clientId != null">client_id = #{clientId},</if>
|
||
|
|
<if test="name != null">name = #{name},</if>
|
||
|
|
<if test="inBytes != null">in_bytes = #{inBytes},</if>
|
||
|
|
<if test="outBytes != null">out_bytes = #{outBytes},</if>
|
||
|
|
<if test="status != null">status = #{status},</if>
|
||
|
|
<if test="type != null">type = #{type},</if>
|
||
|
|
<if test="inSpeed != null">in_speed = #{inSpeed}</if>
|
||
|
|
<if test="outSeppd != null">out_speed = #{outSpeed}</if>
|
||
|
|
<if test="updateBy != null">update_by = #{updateBy},</if>
|
||
|
|
update_time = NOW()
|
||
|
|
</set>
|
||
|
|
WHERE id = #{id}
|
||
|
|
</update>
|
||
|
|
|
||
|
|
<delete id="deleteInitialSwitchInfoById" parameterType="Long">
|
||
|
|
delete from initial_switch_info where id = #{id}
|
||
|
|
</delete>
|
||
|
|
|
||
|
|
<delete id="deleteInitialSwitchInfoByIds" parameterType="String">
|
||
|
|
delete from initial_switch_info where id in
|
||
|
|
<foreach item="id" collection="array" open="(" separator="," close=")">
|
||
|
|
#{id}
|
||
|
|
</foreach>
|
||
|
|
</delete>
|
||
|
|
|
||
|
|
<insert id="batchInsertInitialSwitchInfo" parameterType="java.util.List" useGeneratedKeys="true" keyProperty="id">
|
||
|
|
INSERT INTO initial_switch_info
|
||
|
|
(
|
||
|
|
client_id, name, in_bytes, out_bytes, status, type, in_speed, out_speed,
|
||
|
|
create_by, update_by, create_time, update_time
|
||
|
|
)
|
||
|
|
VALUES
|
||
|
|
<foreach collection="list" item="item" separator=",">
|
||
|
|
(
|
||
|
|
#{item.clientId}, #{item.name}, #{item.inBytes}, #{item.outBytes},
|
||
|
|
#{item.status}, #{item.type}, #{item.inSpeed}, #{item.outSpeed}, #{item.createBy}, #{item.updateBy},
|
||
|
|
<choose>
|
||
|
|
<when test="item.createTime != null">
|
||
|
|
#{item.createTime}
|
||
|
|
</when>
|
||
|
|
<otherwise>
|
||
|
|
NOW()
|
||
|
|
</otherwise>
|
||
|
|
</choose>,
|
||
|
|
<choose>
|
||
|
|
<when test="item.updateTime != null">
|
||
|
|
#{item.updateTime}
|
||
|
|
</when>
|
||
|
|
<otherwise>
|
||
|
|
NOW()
|
||
|
|
</otherwise>
|
||
|
|
</choose>
|
||
|
|
)
|
||
|
|
</foreach>
|
||
|
|
</insert>
|
||
|
|
</mapper>
|