| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118 |
- <?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.ufo.project.config.mapper.ConfigDeviceMapper">
- <resultMap type="ConfigDevice" id="ConfigDeviceResult">
- <result property="id" column="id" />
- <result property="name" column="name" />
- <result property="tp" column="tp" />
- <result property="brand" column="brand" />
- <result property="model" column="model" />
- <result property="serialNumber" column="serial_number" />
- <result property="status" column="status" />
- <result property="installDate" column="install_date" />
- <result property="configChannelId" column="config_channel_id" />
- <result property="configStationId" column="config_station_id" />
- <result property="configDeviceId" column="config_device_id" />
- <result property="remark" column="remark" />
- </resultMap>
- <sql id="selectConfigDeviceVo">
- select id, name, tp, brand, model, serial_number, status, install_date, config_channel_id, config_station_id, config_device_id, remark from config_device
- </sql>
- <select id="selectConfigDeviceList" parameterType="ConfigDevice" resultMap="ConfigDeviceResult">
- <include refid="selectConfigDeviceVo"/>
- <where>
- <if test="configStationId != null"> and config_station_id = #{configStationId}</if>
- <if test="configChannelId != null"> and config_channel_id = #{configChannelId}</if>
- <if test="name != null and name != ''"> and name like concat('%', #{name}, '%')</if>
- <if test="configDeviceId != null"> and config_device_id = #{configDeviceId}</if>
- </where>
- order by id desc
- </select>
- <select id="selectConfigDeviceById" parameterType="Long" resultMap="ConfigDeviceResult">
- <include refid="selectConfigDeviceVo"/>
- where id = #{id}
- </select>
- <select id="selectConfigDeviceByIds" parameterType="Long" resultMap="ConfigDeviceResult">
- <include refid="selectConfigDeviceVo"/>
- where id in
- <foreach item="id" collection="array" open="(" separator="," close=")">
- #{id}
- </foreach>
- </select>
- <select id="selectConfigDeviceByChannelIds" parameterType="Long" resultMap="ConfigDeviceResult">
- <include refid="selectConfigDeviceVo"/>
- where config_channel_id in
- <foreach item="channelId" collection="array" open="(" separator="," close=")">
- #{channelId}
- </foreach>
- order by id asc
- </select>
- <insert id="insertConfigDevice" parameterType="ConfigDevice" useGeneratedKeys="true" keyProperty="id">
- insert into config_device
- <trim prefix="(" suffix=")" suffixOverrides=",">
- <if test="name != null and name != ''">name,</if>
- <if test="tp != null and tp != ''">tp,</if>
- <if test="brand != null and brand != ''">brand,</if>
- <if test="model != null and model != ''">model,</if>
- <if test="serialNumber != null and serialNumber != ''">serial_number,</if>
- <if test="status != null and status != ''">status,</if>
- <if test="installDate != null">install_date,</if>
- <if test="configChannelId != null">config_channel_id,</if>
- <if test="configStationId != null">config_station_id,</if>
- <if test="configDeviceId != null">config_device_id,</if>
- <if test="remark != null and remark != ''">remark,</if>
- </trim>
- <trim prefix="values (" suffix=")" suffixOverrides=",">
- <if test="name != null and name != ''">#{name},</if>
- <if test="tp != null and tp != ''">#{tp},</if>
- <if test="brand != null and brand != ''">#{brand},</if>
- <if test="model != null and model != ''">#{model},</if>
- <if test="serialNumber != null and serialNumber != ''">#{serialNumber},</if>
- <if test="status != null and status != ''">#{status},</if>
- <if test="installDate != null">#{installDate},</if>
- <if test="configChannelId != null">#{configChannelId},</if>
- <if test="configStationId != null">#{configStationId},</if>
- <if test="configDeviceId != null">#{configDeviceId},</if>
- <if test="remark != null and remark != ''">#{remark},</if>
- </trim>
- </insert>
- <update id="updateConfigDevice" parameterType="ConfigDevice">
- update config_device
- <trim prefix="SET" suffixOverrides=",">
- <if test="name != null and name != ''">name = #{name},</if>
- <if test="tp != null and tp != ''">tp = #{tp},</if>
- <if test="brand != null and brand != ''">brand = #{brand},</if>
- <if test="model != null and model != ''">model = #{model},</if>
- <if test="serialNumber != null and serialNumber != ''">serial_number = #{serialNumber},</if>
- <if test="status != null and status != ''">status = #{status},</if>
- <if test="installDate != null">install_date = #{installDate},</if>
- <if test="configChannelId != null">config_channel_id = #{configChannelId},</if>
- <if test="configStationId != null">config_station_id = #{configStationId},</if>
- <if test="configDeviceId != null">config_device_id = #{configDeviceId},</if>
- <if test="remark != null and remark != ''">remark = #{remark},</if>
- update_time = CURRENT_TIMESTAMP,
- </trim>
- where id = #{id}
- </update>
- <delete id="deleteConfigDeviceById" parameterType="Long">
- delete from config_device where id = #{id}
- </delete>
- <delete id="deleteConfigDeviceByIds" parameterType="Long">
- delete from config_device where id in
- <foreach item="id" collection="array" open="(" separator="," close=")">
- #{id}
- </foreach>
- </delete>
- </mapper>
|