wlzboy
1 天以前 08f95b2f159b56fa3bd4f4b348855989de8aa456
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
125
126
127
128
129
130
131
132
133
134
135
136
<?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.SysTaskLogMapper">
    
    <resultMap type="SysTaskLog" id="SysTaskLogResult">
        <result property="logId"            column="log_id"            />
        <result property="taskId"           column="task_id"           />
        <result property="operationType"    column="operation_type"    />
        <result property="operationDesc"    column="operation_desc"    />
        <result property="oldValue"         column="old_value"         />
        <result property="newValue"         column="new_value"         />
        <result property="operatorId"       column="operator_id"       />
        <result property="operatorName"     column="operator_name"     />
        <result property="operationTime"    column="operation_time"    />
        <result property="ipAddress"        column="ip_address"        />
        <result property="latitude"         column="latitude"          />
        <result property="longitude"        column="longitude"         />
        <result property="locationAddress"  column="location_address"  />
        <result property="locationProvince" column="location_province" />
        <result property="locationCity"     column="location_city"     />
        <result property="locationDistrict" column="location_district" />
        <result property="gpsAccuracy"      column="gps_accuracy"      />
        <result property="altitude"         column="altitude"          />
        <result property="speed"            column="speed"             />
        <result property="heading"          column="heading"           />
    </resultMap>
 
    <sql id="selectSysTaskLogVo">
        select log_id, task_id, operation_type, operation_desc, old_value, new_value, 
               operator_id, operator_name, operation_time, ip_address,
               latitude, longitude, location_address, location_province, 
               location_city, location_district, gps_accuracy, altitude, speed, heading
        from sys_task_log
    </sql>
 
    <select id="selectSysTaskLogList" parameterType="SysTaskLog" resultMap="SysTaskLogResult">
        <include refid="selectSysTaskLogVo"/>
        <where>  
            <if test="taskId != null "> and task_id = #{taskId}</if>
            <if test="operationType != null  and operationType != ''"> and operation_type = #{operationType}</if>
            <if test="operatorId != null "> and operator_id = #{operatorId}</if>
            <if test="operatorName != null  and operatorName != ''"> and operator_name like concat('%', #{operatorName}, '%')</if>
        </where>
        order by operation_time desc
    </select>
    
    <select id="selectSysTaskLogByLogId" parameterType="Long" resultMap="SysTaskLogResult">
        <include refid="selectSysTaskLogVo"/>
        where log_id = #{logId}
    </select>
 
    <select id="selectSysTaskLogByTaskId" parameterType="Long" resultMap="SysTaskLogResult">
        <include refid="selectSysTaskLogVo"/>
        where task_id = #{taskId}
        order by operation_time desc
    </select>
        
    <insert id="insertSysTaskLog" parameterType="SysTaskLog" useGeneratedKeys="true" keyProperty="logId">
        insert into sys_task_log
        <trim prefix="(" suffix=")" suffixOverrides=",">
            <if test="taskId != null">task_id,</if>
            <if test="operationType != null and operationType != ''">operation_type,</if>
            <if test="operationDesc != null">operation_desc,</if>
            <if test="oldValue != null">old_value,</if>
            <if test="newValue != null">new_value,</if>
            <if test="operatorId != null">operator_id,</if>
            <if test="operatorName != null and operatorName != ''">operator_name,</if>
            <if test="operationTime != null">operation_time,</if>
            <if test="ipAddress != null">ip_address,</if>
            <if test="latitude != null">latitude,</if>
            <if test="longitude != null">longitude,</if>
            <if test="locationAddress != null">location_address,</if>
            <if test="locationProvince != null">location_province,</if>
            <if test="locationCity != null">location_city,</if>
            <if test="locationDistrict != null">location_district,</if>
            <if test="gpsAccuracy != null">gps_accuracy,</if>
            <if test="altitude != null">altitude,</if>
            <if test="speed != null">speed,</if>
            <if test="heading != null">heading,</if>
         </trim>
        <trim prefix="values (" suffix=")" suffixOverrides=",">
            <if test="taskId != null">#{taskId},</if>
            <if test="operationType != null and operationType != ''">#{operationType},</if>
            <if test="operationDesc != null">#{operationDesc},</if>
            <if test="oldValue != null">#{oldValue},</if>
            <if test="newValue != null">#{newValue},</if>
            <if test="operatorId != null">#{operatorId},</if>
            <if test="operatorName != null and operatorName != ''">#{operatorName},</if>
            <if test="operationTime != null">#{operationTime},</if>
            <if test="ipAddress != null">#{ipAddress},</if>
            <if test="latitude != null">#{latitude},</if>
            <if test="longitude != null">#{longitude},</if>
            <if test="locationAddress != null">#{locationAddress},</if>
            <if test="locationProvince != null">#{locationProvince},</if>
            <if test="locationCity != null">#{locationCity},</if>
            <if test="locationDistrict != null">#{locationDistrict},</if>
            <if test="gpsAccuracy != null">#{gpsAccuracy},</if>
            <if test="altitude != null">#{altitude},</if>
            <if test="speed != null">#{speed},</if>
            <if test="heading != null">#{heading},</if>
         </trim>
    </insert>
 
    <update id="updateSysTaskLog" parameterType="SysTaskLog">
        update sys_task_log
        <trim prefix="SET" suffixOverrides=",">
            <if test="taskId != null">task_id = #{taskId},</if>
            <if test="operationType != null and operationType != ''">operation_type = #{operationType},</if>
            <if test="operationDesc != null">operation_desc = #{operationDesc},</if>
            <if test="oldValue != null">old_value = #{oldValue},</if>
            <if test="newValue != null">new_value = #{newValue},</if>
            <if test="operatorId != null">operator_id = #{operatorId},</if>
            <if test="operatorName != null and operatorName != ''">operator_name = #{operatorName},</if>
            <if test="operationTime != null">operation_time = #{operationTime},</if>
            <if test="ipAddress != null">ip_address = #{ipAddress},</if>
        </trim>
        where log_id = #{logId}
    </update>
 
    <delete id="deleteSysTaskLogByLogId" parameterType="Long">
        delete from sys_task_log where log_id = #{logId}
    </delete>
 
    <delete id="deleteSysTaskLogByLogIds" parameterType="String">
        delete from sys_task_log where log_id in 
        <foreach item="logId" collection="array" open="(" separator="," close=")">
            #{logId}
        </foreach>
    </delete>
 
    <delete id="deleteSysTaskLogByTaskId" parameterType="Long">
        delete from sys_task_log where task_id = #{taskId}
    </delete>
</mapper>