105 lines
5.7 KiB
XML
105 lines
5.7 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.device.mapper.PayloadMapper">
|
|
|
|
<resultMap type="com.ruoyi.device.mapper.entity.PayloadEntity" id="PayloadResult">
|
|
<result property="payloadId" column="payload_id" />
|
|
<result property="payloadName" column="payload_name" />
|
|
<result property="payloadType" column="payload_type" />
|
|
<result property="payloadDisplayName" column="payload_display_name" />
|
|
<result property="payloadDynamicInfo" column="payload_dynamic_info" />
|
|
<result property="payloadSn" column="payload_sn" />
|
|
<result property="iotDeviceId" column="iot_device_id" />
|
|
<result property="createBy" column="create_by" />
|
|
<result property="createTime" column="create_time" />
|
|
<result property="updateBy" column="update_by" />
|
|
<result property="updateTime" column="update_time" />
|
|
<result property="remark" column="remark" />
|
|
</resultMap>
|
|
|
|
<sql id="selectPayloadVo">
|
|
select payload_id, payload_name, payload_type, payload_display_name,
|
|
payload_dynamic_info, payload_sn, iot_device_id,
|
|
create_by, create_time, update_by, update_time, remark
|
|
from device_payload
|
|
</sql>
|
|
|
|
<select id="selectPayloadByPayloadId" parameterType="Long" resultMap="PayloadResult">
|
|
<include refid="selectPayloadVo"/>
|
|
where payload_id = #{payloadId}
|
|
</select>
|
|
|
|
<select id="selectPayloadList" parameterType="com.ruoyi.device.mapper.entity.PayloadEntity" resultMap="PayloadResult">
|
|
<include refid="selectPayloadVo"/>
|
|
<where>
|
|
<if test="payloadName != null and payloadName != ''">
|
|
and payload_name like concat('%', #{payloadName}, '%')
|
|
</if>
|
|
<if test="payloadType != null and payloadType != ''">
|
|
and payload_type = #{payloadType}
|
|
</if>
|
|
<if test="payloadSn != null and payloadSn != ''">
|
|
and payload_sn = #{payloadSn}
|
|
</if>
|
|
<if test="iotDeviceId != null and iotDeviceId != ''">
|
|
and iot_device_id = #{iotDeviceId}
|
|
</if>
|
|
</where>
|
|
</select>
|
|
|
|
<insert id="insertPayload" parameterType="com.ruoyi.device.mapper.entity.PayloadEntity" useGeneratedKeys="true" keyProperty="payloadId">
|
|
insert into device_payload
|
|
<trim prefix="(" suffix=")" suffixOverrides=",">
|
|
<if test="payloadName != null and payloadName != ''">payload_name,</if>
|
|
<if test="payloadType != null and payloadType != ''">payload_type,</if>
|
|
<if test="payloadDisplayName != null and payloadDisplayName != ''">payload_display_name,</if>
|
|
<if test="payloadDynamicInfo != null and payloadDynamicInfo != ''">payload_dynamic_info,</if>
|
|
<if test="payloadSn != null and payloadSn != ''">payload_sn,</if>
|
|
<if test="iotDeviceId != null and iotDeviceId != ''">iot_device_id,</if>
|
|
<if test="createBy != null and createBy != ''">create_by,</if>
|
|
<if test="remark != null and remark != ''">remark,</if>
|
|
create_time
|
|
</trim>
|
|
<trim prefix="values (" suffix=")" suffixOverrides=",">
|
|
<if test="payloadName != null and payloadName != ''">#{payloadName},</if>
|
|
<if test="payloadType != null and payloadType != ''">#{payloadType},</if>
|
|
<if test="payloadDisplayName != null and payloadDisplayName != ''">#{payloadDisplayName},</if>
|
|
<if test="payloadDynamicInfo != null and payloadDynamicInfo != ''">#{payloadDynamicInfo},</if>
|
|
<if test="payloadSn != null and payloadSn != ''">#{payloadSn},</if>
|
|
<if test="iotDeviceId != null and iotDeviceId != ''">#{iotDeviceId},</if>
|
|
<if test="createBy != null and createBy != ''">#{createBy},</if>
|
|
<if test="remark != null and remark != ''">#{remark},</if>
|
|
now()
|
|
</trim>
|
|
</insert>
|
|
|
|
<update id="updatePayload" parameterType="com.ruoyi.device.mapper.entity.PayloadEntity">
|
|
update device_payload
|
|
<trim prefix="SET" suffixOverrides=",">
|
|
<if test="payloadName != null and payloadName != ''">payload_name = #{payloadName},</if>
|
|
<if test="payloadType != null and payloadType != ''">payload_type = #{payloadType},</if>
|
|
<if test="payloadDisplayName != null and payloadDisplayName != ''">payload_display_name = #{payloadDisplayName},</if>
|
|
<if test="payloadDynamicInfo != null">payload_dynamic_info = #{payloadDynamicInfo},</if>
|
|
<if test="payloadSn != null and payloadSn != ''">payload_sn = #{payloadSn},</if>
|
|
<if test="iotDeviceId != null and iotDeviceId != ''">iot_device_id = #{iotDeviceId},</if>
|
|
<if test="updateBy != null and updateBy != ''">update_by = #{updateBy},</if>
|
|
<if test="remark != null">remark = #{remark},</if>
|
|
update_time = now()
|
|
</trim>
|
|
where payload_id = #{payloadId}
|
|
</update>
|
|
|
|
<delete id="deletePayloadByPayloadId" parameterType="Long">
|
|
delete from device_payload where payload_id = #{payloadId}
|
|
</delete>
|
|
|
|
<delete id="deletePayloadByPayloadIds" parameterType="Long">
|
|
delete from device_payload where payload_id in
|
|
<foreach item="payloadId" collection="array" open="(" separator="," close=")">
|
|
#{payloadId}
|
|
</foreach>
|
|
</delete>
|
|
|
|
</mapper> |