skyeyesystem/backend/Skyeye-sys-dev/skyeye-service-manager/target/classes/mapping/device/PayloadMapping.xml

97 lines
2.8 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.zhangy.skyeye.device.mapper.PayloadMapper">
<sql id="selectSql">
select
p.id,
p.name,
p.type,
p.ip,
p.dr
from se_payload p
</sql>
<select id="selectPage" resultType="com.zhangy.skyeye.device.entity.SkyeyePayload">
<include refid="selectSql"/>
where p.dr = '0'
<if test="type != null">
and p.type = #{type}
</if>
</select>
<select id="selectList" resultType="com.zhangy.skyeye.device.entity.SkyeyePayload">
<include refid="selectSql"/>
where p.dr = '0'
<if test="type != null">
and p.type = #{type}
</if>
</select>
<select id="selectById" resultType="com.zhangy.skyeye.device.entity.SkyeyePayload">
<include refid="selectSql"/>
where p.id in
<foreach item="item" collection="array" open="(" separator="," close=")">
#{item}
</foreach>
<if test="type != null and type != ''">
and p.type = #{type}
</if>
</select>
<select id="selectByIp" resultType="com.zhangy.skyeye.device.entity.SkyeyePayload">
<include refid="selectSql"/>
where p.ip = #{ip}
</select>
<insert id="insert" useGeneratedKeys="true" keyProperty="id">
insert into se_payload(
name,
type,
ip
) values
<foreach item="item" index="index" collection="array" separator=",">
(
#{item.name},
#{item.type},
#{item.ip}
)
</foreach>
</insert>
<update id="updateNotNull">
update se_payload
<trim prefix="SET" suffixOverrides=",">
<if test="name != null">name = #{name},</if>
<if test="type != null">type = #{type},</if>
<if test="ip != null">ip = #{ip},</if>
<if test="dr != null">dr = #{dr},</if>
</trim>
where id = #{id}
</update>
<update id="update">
update se_payload
<trim prefix="SET" suffixOverrides=",">
type = #{type},
name = #{name},
ip = #{ip},
dr = #{dr},
</trim>
where id = #{id}
</update>
<delete id="delete">
delete from se_payload where id in
<foreach item="item" collection="array" open="(" separator="," close=")">
#{item}
</foreach>
</delete>
<delete id="deleteLogic">
update se_payload set dr = '1' where id in
<foreach item="item" collection="array" open="(" separator="," close=")">
#{item}
</foreach>
</delete>
</mapper>