IotAlertLogMapper.xml
7.1 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
<?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.system.mapper.IotAlertLogMapper">
<resultMap type="com.ruoyi.system.domain.iot.IotAlertLog" 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" />
<result property="userId" column="user_id" />
<result property="userName" column="user_name" />
<result property="tenantId" column="tenant_id" />
<result property="tenantName" column="tenant_name" />
</resultMap>
<sql id="selectAlertLogVo">
select alert_log__id, alert_name, alert_level, status, product_id, product_name, device_id, device_name,user_id, user_name, tenant_id, tenant_name, create_by, create_time, update_by, update_time, remark from iot_alert_log
</sql>
<select id="selectAlertLogList" parameterType="com.ruoyi.system.domain.iot.IotAlertLog" resultMap="AlertLogResult">
<include refid="selectAlertLogVo"/>
<where>
<if test="userId != null and userId != 0"> and user_id = #{userId}</if>
<if test="tenantId != null and tenantId != 0"> and tenant_id = #{tenantId}</if>
<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.system.domain.iot.IotAlertLog" 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>
<if test="userId != null">user_id,</if>
<if test="userName != null and userName != ''">user_name,</if>
<if test="tenantId != null">tenant_id,</if>
<if test="tenantName != null and tenantName != ''">tenant_name,</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>
<if test="userId != null">#{userId},</if>
<if test="userName != null and userName != ''">#{userName},</if>
<if test="tenantId != null">#{tenantId},</if>
<if test="tenantName != null and tenantName != ''">#{tenantName},</if>
</trim>
</insert>
<update id="updateAlertLog" parameterType="com.ruoyi.system.domain.iot.IotAlertLog">
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>
<if test="userId != null">user_id = #{userId},</if>
<if test="userName != null and userName != ''">user_name = #{userName},</if>
<if test="tenantId != null">tenant_id = #{tenantId},</if>
<if test="tenantName != null and tenantName != ''">tenant_name = #{tenantName},</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>