地质所 沉降监测网建设项目
zmk
2024-05-17 5e697a70c7e49e18bc3bc2f75c2e9ad5bda17489
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
<?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.javaweb.geo.mapper.DeviceLogMapper">
    
    <resultMap type="DeviceLog" id="DeviceLogResult">
        <result property="id"    column="id"    />
        <result property="code"    column="code"    />
        <result property="projectId"    column="project_id"    />
        <result property="projectName"    column="project_name"    />
        <result property="deviceId"    column="device_id"    />
        <result property="deviceCode"    column="device_code"    />
        <result property="deviceName"    column="device_name"    />
        <result property="type"    column="type"    />
        <result property="transactionDate"    column="transaction_date"    />
        <result property="optUser"    column="opt_user"    />
        <result property="applyUser"    column="apply_user"    />
        <result property="number"    column="number"    />
        <result property="createDate"    column="create_date"    />
        <result property="remark"    column="remark"    />
    </resultMap>
 
    <sql id="selectDeviceLogVo">
        select id, code, project_id, project_name, device_id, device_code, device_name, type, transaction_date, opt_user, apply_user, number, create_date, remark from js_device_log
    </sql>
 
    <select id="selectDeviceLogList" parameterType="DeviceLog" resultMap="DeviceLogResult">
        <include refid="selectDeviceLogVo"/>
        <where>
            <if test="code != null  and code != ''"> and code = #{code}</if>
            <if test="projectId != null  and projectId != ''"> and project_id = #{projectId}</if>
            <if test="projectName != null  and projectName != ''"> and project_name like concat('%', #{projectName}, '%')</if>
            <if test="deviceId != null  and deviceId != ''"> and device_id = #{deviceId}</if>
            <if test="deviceCode != null  and deviceCode != ''"> and device_code = #{deviceCode}</if>
            <if test="deviceName != null  and deviceName != ''"> and device_name like concat('%', #{deviceName}, '%')</if>
            <if test="type != null  and type != ''"> and type = #{type}</if>
            <if test="optUser != null  and optUser != ''"> and opt_user = #{optUser}</if>
            <if test="applyUser != null  and applyUser != ''"> and apply_user = #{applyUser}</if>
        </where>
        ORDER BY create_date
    </select>
    
    <select id="selectDeviceLogById" parameterType="String" resultMap="DeviceLogResult">
        <include refid="selectDeviceLogVo"/>
        where id = #{id}
    </select>
        
    <insert id="insertDeviceLog" parameterType="DeviceLog">
        insert into js_device_log
        <trim prefix="(" suffix=")" suffixOverrides=",">
            <if test="id != null  and id != ''">id,</if>
            <if test="code != null  and code != ''">code,</if>
            <if test="projectId != null  and projectId != ''">project_id,</if>
            <if test="projectName != null  and projectName != ''">project_name,</if>
            <if test="deviceId != null  and deviceId != ''">device_id,</if>
            <if test="deviceCode != null  and deviceCode != ''">device_code,</if>
            <if test="deviceName != null  and deviceName != ''">device_name,</if>
            <if test="type != null  and type != ''">type,</if>
            <if test="transactionDate != null  and transactionDate != ''">transaction_date,</if>
            <if test="optUser != null  and optUser != ''">opt_user,</if>
            <if test="applyUser != null  and applyUser != ''">apply_user,</if>
            <if test="number != null  and number != ''">number,</if>
            <if test="createDate != null ">create_date,</if>
            <if test="remark != null  and remark != ''">remark,</if>
         </trim>
        <trim prefix="values (" suffix=")" suffixOverrides=",">
            <if test="id != null  and id != ''">#{id},</if>
            <if test="code != null  and code != ''">#{code},</if>
            <if test="projectId != null  and projectId != ''">#{projectId},</if>
            <if test="projectName != null  and projectName != ''">#{projectName},</if>
            <if test="deviceId != null  and deviceId != ''">#{deviceId},</if>
            <if test="deviceCode != null  and deviceCode != ''">#{deviceCode},</if>
            <if test="deviceName != null  and deviceName != ''">#{deviceName},</if>
            <if test="type != null  and type != ''">#{type},</if>
            <if test="transactionDate != null  and transactionDate != ''">#{transactionDate},</if>
            <if test="optUser != null  and optUser != ''">#{optUser},</if>
            <if test="applyUser != null  and applyUser != ''">#{applyUser},</if>
            <if test="number != null  and number != ''">#{number},</if>
            <if test="createDate != null ">#{createDate},</if>
            <if test="remark != null  and remark != ''">#{remark},</if>
         </trim>
    </insert>
 
    <update id="updateDeviceLog" parameterType="DeviceLog">
        update js_device_log
        <trim prefix="SET" suffixOverrides=",">
            <if test="code != null  and code != ''">code = #{code},</if>
            <if test="projectId != null  and projectId != ''">project_id = #{projectId},</if>
            <if test="projectName != null  and projectName != ''">project_name = #{projectName},</if>
            <if test="deviceId != null  and deviceId != ''">device_id = #{deviceId},</if>
            <if test="deviceCode != null  and deviceCode != ''">device_code = #{deviceCode},</if>
            <if test="deviceName != null  and deviceName != ''">device_name = #{deviceName},</if>
            <if test="type != null  and type != ''">type = #{type},</if>
            <if test="transactionDate != null  and transactionDate != ''">transaction_date = #{transactionDate},</if>
            <if test="optUser != null  and optUser != ''">opt_user = #{optUser},</if>
            <if test="applyUser != null  and applyUser != ''">apply_user = #{applyUser},</if>
            <if test="number != null  and number != ''">number = #{number},</if>
            <if test="createDate != null ">create_date = #{createDate},</if>
            <if test="remark != null  and remark != ''">remark = #{remark},</if>
        </trim>
        where id = #{id}
    </update>
 
    <delete id="deleteDeviceLogById" parameterType="String">
        delete from js_device_log where id = #{id}
    </delete>
 
    <delete id="deleteDeviceLogByIds" parameterType="String">
        delete from js_device_log where id in 
        <foreach item="id" collection="array" open="(" separator="," close=")">
            #{id}
        </foreach>
    </delete>
    
</mapper>