112 lines
4.0 KiB
XML
112 lines
4.0 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.zhwl.check.point.mapper.ZdyCheckPointDeviceMapper">
|
||
|
|
||
|
<resultMap type="ZdyCheckPointDevice" id="ZdyCheckPointDeviceResult">
|
||
|
<result property="checkPointId" column="check_point_id"/>
|
||
|
<result property="deviceSn" column="device_sn"/>
|
||
|
<result property="deviceType" column="device_type"/>
|
||
|
</resultMap>
|
||
|
|
||
|
<sql id="selectZdyCheckPointDeviceVo">
|
||
|
select check_point_id, device_sn, device_type
|
||
|
from zdy_check_point_device
|
||
|
</sql>
|
||
|
|
||
|
<select id="selectZdyCheckPointDeviceList" parameterType="ZdyCheckPointDevice"
|
||
|
resultMap="ZdyCheckPointDeviceResult">
|
||
|
<include refid="selectZdyCheckPointDeviceVo"/>
|
||
|
<where>
|
||
|
</where>
|
||
|
</select>
|
||
|
|
||
|
<select id="selectZdyCheckPointDeviceByCheckPointId" parameterType="Long"
|
||
|
resultMap="ZdyCheckPointDeviceResult">
|
||
|
<include refid="selectZdyCheckPointDeviceVo"/>
|
||
|
where check_point_id = #{checkPointId}
|
||
|
</select>
|
||
|
|
||
|
<insert id="insertZdyCheckPointDevice" parameterType="ZdyCheckPointDevice">
|
||
|
insert into zdy_check_point_device
|
||
|
<trim prefix="(" suffix=")" suffixOverrides=",">
|
||
|
<if test="checkPointId != null">check_point_id,
|
||
|
</if>
|
||
|
<if test="deviceSn != null">device_sn,
|
||
|
</if>
|
||
|
<if test="deviceType != null">device_type,
|
||
|
</if>
|
||
|
</trim>
|
||
|
<trim prefix="values (" suffix=")" suffixOverrides=",">
|
||
|
<if test="checkPointId != null">#{checkPointId},
|
||
|
</if>
|
||
|
<if test="deviceSn != null">#{deviceSn},
|
||
|
</if>
|
||
|
<if test="deviceType != null">#{deviceType},
|
||
|
</if>
|
||
|
</trim>
|
||
|
</insert>
|
||
|
|
||
|
<update id="updateZdyCheckPointDevice" parameterType="ZdyCheckPointDevice">
|
||
|
update zdy_check_point_device
|
||
|
<trim prefix="SET" suffixOverrides=",">
|
||
|
<if test="deviceSn != null">device_sn =
|
||
|
#{deviceSn},
|
||
|
</if>
|
||
|
<if test="deviceType != null">device_type =
|
||
|
#{deviceType},
|
||
|
</if>
|
||
|
</trim>
|
||
|
where check_point_id = #{checkPointId}
|
||
|
</update>
|
||
|
|
||
|
<delete id="deleteZdyCheckPointDeviceByCheckPointId" parameterType="Long">
|
||
|
delete
|
||
|
from zdy_check_point_device
|
||
|
where check_point_id = #{checkPointId}
|
||
|
</delete>
|
||
|
|
||
|
<delete id="deleteZdyCheckPointDeviceByCheckPointIds" parameterType="String">
|
||
|
delete from zdy_check_point_device where check_point_id in
|
||
|
<foreach item="checkPointId" collection="array" open="(" separator="," close=")">
|
||
|
#{checkPointId}
|
||
|
</foreach>
|
||
|
</delete>
|
||
|
|
||
|
<select id="listSns" parameterType="com.zhwl.check.point.domain.ZdyCheckPointDevice" resultType="java.lang.String">
|
||
|
select device_sn
|
||
|
from zdy_check_point_device
|
||
|
where check_point_id = #{checkPointId}
|
||
|
and device_type = #{deviceType}
|
||
|
</select>
|
||
|
|
||
|
<delete id="delete">
|
||
|
delete from zdy_check_point_device
|
||
|
where check_point_id = #{zdyCheckPointDevice.checkPointId}
|
||
|
and device_type = #{zdyCheckPointDevice.deviceType}
|
||
|
and device_sn in
|
||
|
<foreach item="sn" collection="snList" open="(" separator="," close=")">
|
||
|
#{sn}
|
||
|
</foreach>
|
||
|
</delete>
|
||
|
|
||
|
<select id="getCheckPointIdByDeviceTypeAndDeviceSn" resultType="java.lang.Long">
|
||
|
select check_point_id
|
||
|
from zdy_check_point_device
|
||
|
where device_sn = #{deviceSn}
|
||
|
and device_type = #{deviceType}
|
||
|
</select>
|
||
|
|
||
|
<select id="listDeviceSnsExcludingCheckpoint" parameterType="com.zhwl.check.point.domain.ZdyCheckPointDevice"
|
||
|
resultType="java.lang.String">
|
||
|
select device_sn
|
||
|
from zdy_check_point_device
|
||
|
<where>
|
||
|
device_type = #{deviceType}
|
||
|
<if test="checkPointId != null">
|
||
|
and check_point_id != #{checkPointId}
|
||
|
</if>
|
||
|
</where>
|
||
|
</select>
|
||
|
</mapper>
|