|
@@ -0,0 +1,95 @@
|
|
|
+<?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.taiye.mapper.DeviceLogMapper">
|
|
|
+
|
|
|
+ <resultMap type="DeviceLog" id="DeviceLogResult">
|
|
|
+ <result property="deviceLogId" column="device_log_id" />
|
|
|
+ <result property="deviceId" column="device_id" />
|
|
|
+ <result property="deviceName" column="device_name" />
|
|
|
+ <result property="content" column="content" />
|
|
|
+ <result property="status" column="status" />
|
|
|
+ <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="selectDeviceLogVo">
|
|
|
+ select device_log_id, device_id, device_name, content, status, create_by, create_time, update_by, update_time, remark from device_log
|
|
|
+ </sql>
|
|
|
+
|
|
|
+ <select id="selectDeviceLogList" parameterType="DeviceLog" resultMap="DeviceLogResult">
|
|
|
+ <include refid="selectDeviceLogVo"/>
|
|
|
+ <where>
|
|
|
+ <if test="deviceId != null and deviceId != ''"> and device_id = #{deviceId}</if>
|
|
|
+ <if test="deviceName != null and deviceName != ''"> and device_name like concat('%', #{deviceName}, '%')</if>
|
|
|
+ </where>
|
|
|
+ </select>
|
|
|
+
|
|
|
+ <select id="selectDeviceLogByDeviceLogId" parameterType="Long" resultMap="DeviceLogResult">
|
|
|
+ <include refid="selectDeviceLogVo"/>
|
|
|
+ where device_log_id = #{deviceLogId}
|
|
|
+ </select>
|
|
|
+
|
|
|
+ <insert id="insertDeviceLog" parameterType="DeviceLog">
|
|
|
+ insert into device_log
|
|
|
+ <trim prefix="(" suffix=")" suffixOverrides=",">
|
|
|
+ <if test="deviceLogId != null">device_log_id,</if>
|
|
|
+ <if test="deviceId != null and deviceId != ''">device_id,</if>
|
|
|
+ <if test="deviceName != null and deviceName != ''">device_name,</if>
|
|
|
+ <if test="content != null and content != ''">content,</if>
|
|
|
+ <if test="status != null and status != ''">status,</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="deviceLogId != null">#{deviceLogId},</if>
|
|
|
+ <if test="deviceId != null and deviceId != ''">#{deviceId},</if>
|
|
|
+ <if test="deviceName != null and deviceName != ''">#{deviceName},</if>
|
|
|
+ <if test="content != null and content != ''">#{content},</if>
|
|
|
+ <if test="status != null and status != ''">#{status},</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="updateDeviceLog" parameterType="DeviceLog">
|
|
|
+ update device_log
|
|
|
+ <trim prefix="SET" suffixOverrides=",">
|
|
|
+ <if test="deviceId != null and deviceId != ''">device_id = #{deviceId},</if>
|
|
|
+ <if test="deviceName != null and deviceName != ''">device_name = #{deviceName},</if>
|
|
|
+ <if test="content != null and content != ''">content = #{content},</if>
|
|
|
+ <if test="status != null and status != ''">status = #{status},</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 device_log_id = #{deviceLogId}
|
|
|
+ </update>
|
|
|
+
|
|
|
+ <delete id="deleteDeviceLogByDeviceLogId" parameterType="Long">
|
|
|
+ delete from device_log where device_log_id = #{deviceLogId}
|
|
|
+ </delete>
|
|
|
+
|
|
|
+ <delete id="deleteDeviceLogByDeviceLogIds" parameterType="String">
|
|
|
+ delete from device_log where device_log_id in
|
|
|
+ <foreach item="deviceLogId" collection="array" open="(" separator="," close=")">
|
|
|
+ #{deviceLogId}
|
|
|
+ </foreach>
|
|
|
+ </delete>
|
|
|
+
|
|
|
+ <delete id="cleanUpDataFromAWeekAgo">
|
|
|
+ delete from device_log where DATE(create_time) <= DATE(DATE_SUB(NOW(),INTERVAL 7 DAY));
|
|
|
+ </delete>
|
|
|
+</mapper>
|