Files
fastbee/springboot/wumei-iot/src/main/resources/mapper/iot/AlertLogMapper.xml
2022-03-16 14:10:17 +08:00

106 lines
5.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.ruoyi.iot.mapper.AlertLogMapper">
<resultMap type="com.ruoyi.iot.domain.AlertLog" id="AlertLogResult">
<result property="alertLogId" column="alert_log__id" />
<result property="alertName" column="alert_name" />
<result property="alertLevel" column="alert_level" />
<result property="status" column="status" />
<result property="productId" column="product_id" />
<result property="productName" column="product_name" />
<result property="deviceId" column="device_id" />
<result property="deviceName" column="device_name" />
<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="selectAlertLogVo">
select alert_log__id, alert_name, alert_level, status, product_id, product_name, device_id, device_name, create_by, create_time, update_by, update_time, remark from iot_alert_log
</sql>
<select id="selectAlertLogList" parameterType="com.ruoyi.iot.domain.AlertLog" resultMap="AlertLogResult">
<include refid="selectAlertLogVo"/>
<where>
<if test="alertName != null and alertName != ''"> and alert_name like concat('%', #{alertName}, '%')</if>
<if test="alertLevel != null "> and alert_level = #{alertLevel}</if>
<if test="status != null "> and status = #{status}</if>
<if test="productId != null "> and product_id = #{productId}</if>
<if test="productName != null and productName != ''"> and product_name like concat('%', #{productName}, '%')</if>
<if test="deviceId != null "> and device_id = #{deviceId}</if>
<if test="deviceName != null and deviceName != ''"> and device_name like concat('%', #{deviceName}, '%')</if>
</where>
</select>
<select id="selectAlertLogByAlertLogId" parameterType="Long" resultMap="AlertLogResult">
<include refid="selectAlertLogVo"/>
where alert_log__id = #{alertLogId}
</select>
<insert id="insertAlertLog" parameterType="com.ruoyi.iot.domain.AlertLog" useGeneratedKeys="true" keyProperty="alertLogId">
insert into iot_alert_log
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="alertName != null and alertName != ''">alert_name,</if>
<if test="alertLevel != null">alert_level,</if>
<if test="status != null">status,</if>
<if test="productId != null">product_id,</if>
<if test="productName != null and productName != ''">product_name,</if>
<if test="deviceId != null">device_id,</if>
<if test="deviceName != null and deviceName != ''">device_name,</if>
<if test="createBy != null">create_by,</if>
<if test="createTime != null">create_time,</if>
<if test="updateBy != null">update_by,</if>
<if test="updateTime != null">update_time,</if>
<if test="remark != null">remark,</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="alertName != null and alertName != ''">#{alertName},</if>
<if test="alertLevel != null">#{alertLevel},</if>
<if test="status != null">#{status},</if>
<if test="productId != null">#{productId},</if>
<if test="productName != null and productName != ''">#{productName},</if>
<if test="deviceId != null">#{deviceId},</if>
<if test="deviceName != null and deviceName != ''">#{deviceName},</if>
<if test="createBy != null">#{createBy},</if>
<if test="createTime != null">#{createTime},</if>
<if test="updateBy != null">#{updateBy},</if>
<if test="updateTime != null">#{updateTime},</if>
<if test="remark != null">#{remark},</if>
</trim>
</insert>
<update id="updateAlertLog" parameterType="com.ruoyi.iot.domain.AlertLog">
update iot_alert_log
<trim prefix="SET" suffixOverrides=",">
<if test="alertName != null and alertName != ''">alert_name = #{alertName},</if>
<if test="alertLevel != null">alert_level = #{alertLevel},</if>
<if test="status != null">status = #{status},</if>
<if test="productId != null">product_id = #{productId},</if>
<if test="productName != null and productName != ''">product_name = #{productName},</if>
<if test="deviceId != null">device_id = #{deviceId},</if>
<if test="deviceName != null and deviceName != ''">device_name = #{deviceName},</if>
<if test="createBy != null">create_by = #{createBy},</if>
<if test="createTime != null">create_time = #{createTime},</if>
<if test="updateBy != null">update_by = #{updateBy},</if>
<if test="updateTime != null">update_time = #{updateTime},</if>
<if test="remark != null">remark = #{remark},</if>
</trim>
where alert_log__id = #{alertLogId}
</update>
<delete id="deleteAlertLogByAlertLogId" parameterType="Long">
delete from iot_alert_log where alert_log__id = #{alertLogId}
</delete>
<delete id="deleteAlertLogByAlertLogIds" parameterType="String">
delete from iot_alert_log where alert_log__id in
<foreach item="alertLogId" collection="array" open="(" separator="," close=")">
#{alertLogId}
</foreach>
</delete>
</mapper>