地质所 沉降监测网建设项目
zmk
2024-05-22 28e168f05d3eb48223e69064188c6fce786442d4
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
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
<?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.ProjectMapper">
    
    <resultMap type="Project" id="ProjectResult">
        <result property="ids"    column="ids"    />
        <result property="address"    column="address"    />
        <result property="city"    column="city"    />
        <result property="code"    column="code"    />
        <result property="companyId"    column="company_id"    />
        <result property="companyName"    column="company_name"    />
        <result property="startTime"    column="start_time"    />
        <result property="endTime"    column="end_time"    />
        <result property="district"    column="district"    />
        <result property="fullName"    column="full_name"    />
        <result property="laborUnit"    column="labor_unit"    />
        <result property="leader"    column="leader"    />
        <result property="leaderName"    column="leader_name"    />
        <result property="owner"    column="owner"    />
        <result property="province"    column="province"    />
        <result property="serialNumber"    column="serial_number"    />
        <result property="describe"    column="describe"    />
        <result property="status"    column="status"    />
        <result property="statusNumber"    column="status_number"    />
        <result property="isDeleted"    column="is_deleted"    />
        <result property="statusChangeUser"    column="status_change_user"    />
        <result property="statusChangeReason"    column="status_change_reason"    />
        <result property="dataSource"    column="data_source"    />
        <result property="lng"    column="lng"    />
        <result property="lat"    column="lat"    />
        <result property="rate"    column="rate"    />
        <result property="createTime"    column="create_time"    />
    </resultMap>
 
    <sql id="selectProjectVo">
        select ids, address, city, code, company_id,start_time,end_time, district, full_name, labor_unit, leader, owner, province, serial_number, 'describe', status, is_deleted, status_change_user, status_change_reason, data_source,lng,lat,rate,create_time from js_project
    </sql>
 
    <select id="selectProjectList" parameterType="Project" resultMap="ProjectResult">
       <include refid="selectProjectVo"/>
        <where>
            <if test="address != null  and address != ''"> and address = #{address}</if>
            <if test="city != null "> and city = #{city}</if>
            <if test="code != null  and code != ''"> and code = #{code}</if>
            <if test="district != null  and district != ''"> and district = #{district}</if>
            <if test="fullName != null  and fullName != ''"> and full_name like concat('%', #{fullName}, '%')</if>
            <if test="laborUnit != null  and laborUnit != ''"> and labor_unit = #{laborUnit}</if>
            <if test="leader != null  and leader != ''"> and leader = #{leader}</if>
            <if test="owner != null  and owner != ''"> and owner = #{owner}</if>
            <if test="province != null  and province != ''"> and province = #{province}</if>
            <if test="serialNumber != null  and serialNumber != ''"> and serial_number = #{serialNumber}</if>
            <if test="status != null  and status != ''"> and status = #{status}</if>
            <if test="isDeleted != null  and isDeleted != ''"> and is_deleted = #{isDeleted}</if>
        </where>
    </select>
    
    <select id="selectProjectById" parameterType="String" resultMap="ProjectResult">
        <include refid="selectProjectVo"/>
        WHERE ids = #{ids}
    </select>
 
    <select id="selectProjectCountByStatus" resultMap="ProjectResult">
        SELECT `status`, count( * )  as status_number FROM js_project GROUP BY `status`
    </select>
 
    <insert id="insertProject" parameterType="Project">
        insert into js_project
        <trim prefix="(" suffix=")" suffixOverrides=",">
            <if test="ids != null  and ids != ''">ids,</if>
            <if test="address != null  and address != ''">address,</if>
            <if test="city != null ">city,</if>
            <if test="code != null  and code != ''">code,</if>
            <if test="companyId != null ">company_id,</if>
            <if test="startTime != null ">start_time,</if>
            <if test="endTime != null ">end_time,</if>
            <if test="district != null  and district != ''">district,</if>
            <if test="fullName != null  and fullName != ''">full_name,</if>
            <if test="laborUnit != null  and laborUnit != ''">labor_unit,</if>
            <if test="leader != null  and leader != ''">leader,</if>
            <if test="owner != null  and owner != ''">owner,</if>
            <if test="province != null  and province != ''">province,</if>
            <if test="serialNumber != null  and serialNumber != ''">serial_number,</if>
            <if test="describe != null  and describe != ''">`describe`,</if>
            <if test="status != null  and status != ''">status,</if>
            <if test="isDeleted != null  and isDeleted != ''">is_deleted,</if>
            <if test="statusChangeUser != null  and statusChangeUser != ''">status_change_user,</if>
            <if test="statusChangeReason != null  and statusChangeReason != ''">status_change_reason,</if>
            <if test="dataSource != null  and dataSource != ''">data_source,</if>
            <if test="lng != null">lng,</if>
            <if test="lat != null">lat,</if>
            <if test="rate != null  and rate != ''">rate,</if>
            <if test="createTime != null ">create_time,</if>
         </trim>
        <trim prefix="values (" suffix=")" suffixOverrides=",">
            <if test="ids != null  and ids != ''">#{ids},</if>
            <if test="address != null  and address != ''">#{address},</if>
            <if test="city != null ">#{city},</if>
            <if test="code != null  and code != ''">#{code},</if>
            <if test="companyId != null ">#{companyId},</if>
            <if test="startTime != null ">#{startTime},</if>
            <if test="endTime != null ">#{endTime},</if>
 
            <if test="district != null  and district != ''">#{district},</if>
            <if test="fullName != null  and fullName != ''">#{fullName},</if>
            <if test="laborUnit != null  and laborUnit != ''">#{laborUnit},</if>
            <if test="leader != null  and leader != ''">#{leader},</if>
            <if test="owner != null  and owner != ''">#{owner},</if>
            <if test="province != null  and province != ''">#{province},</if>
            <if test="serialNumber != null  and serialNumber != ''">#{serialNumber},</if>
            <if test="describe != null  and describe != ''">#{describe},</if>
            <if test="status != null  and status != ''">#{status},</if>
            <if test="isDeleted != null  and isDeleted != ''">#{isDeleted},</if>
            <if test="statusChangeUser != null  and statusChangeUser != ''">#{statusChangeUser},</if>
            <if test="statusChangeReason != null  and isDeleted != ''">#{statusChangeReason},</if>
            <if test="dataSource != null  and dataSource != ''">#{dataSource},</if>
            <if test="lng != null">#{lng},</if>
            <if test="lat != null">#{lat},</if>
            <if test="rate != null  and rate != ''">#{rate},</if>
            <if test="createTime != null ">#{createTime},</if>
         </trim>
    </insert>
 
    <update id="updateProject" parameterType="Project">
        update js_project
        <trim prefix="SET" suffixOverrides=",">
            <if test="address != null  and address != ''">address = #{address},</if>
            <if test="city != null ">city = #{city},</if>
            <if test="code != null  and code != ''">code = #{code},</if>
            <if test="companyId != null ">company_id = #{companyId},</if>
            <if test="startTime != null ">start_time = #{startTime},</if>
            <if test="endTime != null ">end_time = #{endTime},</if>
            <if test="district != null  and district != ''">district = #{district},</if>
            <if test="fullName != null  and fullName != ''">full_name = #{fullName},</if>
            <if test="laborUnit != null  and laborUnit != ''">labor_unit = #{laborUnit},</if>
            <if test="leader != null  and leader != ''">leader = #{leader},</if>
            <if test="owner != null  and owner != ''">owner = #{owner},</if>
            <if test="province != null  and province != ''">province = #{province},</if>
            <if test="serialNumber != null  and serialNumber != ''">serial_number = #{serialNumber},</if>
            <if test="describe != null  and describe != ''">`describe` = #{describe},</if>
            <if test="status != null  and status != ''">status = #{status},</if>
            <if test="isDeleted != null  and isDeleted != ''">is_deleted = #{isDeleted},</if>
            <if test="statusChangeUser != null  and statusChangeUser != ''">status_change_user = #{statusChangeUser},</if>
            <if test="statusChangeReason != null  and statusChangeReason != ''">status_change_reason = #{statusChangeReason},</if>
            <if test="dataSource != null  and dataSource != ''">data_source = #{dataSource},</if>
            <if test="lng != null">lng = #{lng},</if>
            <if test="lat != null">lat = #{lat},</if>
            <if test="rate != null  and rate != ''">rate = #{rate},</if>
            <if test="createTime != null ">create_time = #{createTime},</if>
        </trim>
        where ids = #{ids}
    </update>
 
    <delete id="deleteProjectById" parameterType="String">
        delete from js_project where ids = #{ids}
    </delete>
 
    <delete id="deleteProjectByIds" parameterType="String">
        delete from js_project where ids in 
        <foreach item="ids" collection="array" open="(" separator="," close=")">
            #{ids}
        </foreach>
    </delete>
    
</mapper>