地质所 沉降监测网建设项目
zmk
2024-05-15 9e3afc6d0fa514f986d3fea40fa23124e6fb5070
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
<?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.HandleExceptionMapper">
    
    <resultMap type="HandleException" id="HandleExceptionResult">
        <result property="ids"    column="ids"    />
        <result property="companyId"    column="company_id"    />
        <result property="description"    column="description"    />
        <result property="handleStatus"    column="handle_status"    />
        <result property="holeCode"    column="hole_code"    />
        <result property="holeId"    column="hole_id"    />
        <result property="level"    column="level"    />
        <result property="mapTime"    column="map_time"    />
        <result property="projectId"    column="project_id"    />
        <result property="projectName"    column="project_name"    />
        <result property="type"    column="type"    />
        <result property="isDelete"    column="is_delete"    />
    </resultMap>
 
    <sql id="selectHandleExceptionVo">
        select ids, company_id, description, handle_status, hole_code, hole_id, level, map_time, project_id, type, is_delete from js_handle_exception
    </sql>
 
    <select id="selectHandleExceptionList" parameterType="HandleException" resultMap="HandleExceptionResult">
        select
        e.ids,
        e.company_id,
        e.description,
        e.handle_status,
        e.hole_code,
        e.hole_id,
        e.`level`,
        e.map_time,
        e.project_id,
        p.full_name as project_name,
        e.type,
        e.is_delete
        FROM
        js_handle_exception e
        LEFT JOIN js_project p ON e.project_id = p.ids
        <where>
            e.is_delete='0'
            <if test="companyId != null  and companyId != ''"> and e.company_id = #{companyId}</if>
            <if test="description != null  and description != ''"> and e.description = #{description}</if>
            <if test="handleStatus != null  and handleStatus != ''"> and e.handle_status = #{handleStatus}</if>
            <if test="holeCode != null  and holeCode != ''"> and e.hole_code = #{holeCode}</if>
            <if test="holeId != null  and holeId != ''"> and e.hole_id = #{holeId}</if>
            <if test="level != null  and level != ''"> and e.level = #{level}</if>
            <if test="mapTime != null "> and e.map_time = #{mapTime}</if>
            <if test="projectId != null  and projectId != ''"> and e.project_id = #{projectId}</if>
            <if test="projectName != null  and projectName != ''"> and p.full_name like concat('%', #{projectName}, '%')</if>
            <if test="type != null  and type != ''"> and e.type = #{type}</if>
            <if test="isDelete != null  and isDelete != ''"> and e.is_delete = #{isDelete}</if>
        </where>
    </select>
    
    <select id="selectHandleExceptionById" parameterType="String" resultMap="HandleExceptionResult">
        <include refid="selectHandleExceptionVo"/>
        where ids = #{ids}
    </select>
 
    <select id="selectAllExceptionNum" resultType="java.lang.Long">
        SELECT count(ids) FROM js_handle_exception WHERE is_delete = '0'
    </select>
 
    <select id="selectExceptionNum" resultType="java.lang.Long">
        SELECT count(ids) FROM js_handle_exception WHERE is_delete = '0' AND project_id = any(SELECT ids FROM js_project WHERE `status` = '0' AND is_deleted = '0')
    </select>
 
    <select id="selectListByProjectId"  parameterType="String" resultMap="HandleExceptionResult">
        <include refid="selectHandleExceptionVo"/> WHERE is_delete = '0' AND project_id = #{projectId} ORDER BY map_time ASC
    </select>
    <select id="selectListByHoleId"  parameterType="String" resultMap="HandleExceptionResult">
        <include refid="selectHandleExceptionVo"/> WHERE is_delete = '0' AND hole_id = #{holeId} ORDER BY map_time ASC
    </select>
 
    <select id="selectExceptionNumByCompanyId" resultType="java.lang.Integer">
        select count(ids) from js_handle_exception where company_id = #{companyId}
    </select>
 
    <select id="selectExceptionNumByProjectId" resultType="java.lang.Integer">
        select count(ids) from js_handle_exception where project_id = #{projectId}
    </select>
 
    <insert id="insertHandleException" parameterType="HandleException">
        insert into js_handle_exception
        <trim prefix="(" suffix=")" suffixOverrides=",">
            <if test="ids != null  and ids != ''">ids,</if>
            <if test="companyId != null  and companyId != ''">company_id,</if>
            <if test="description != null  and description != ''">description,</if>
            <if test="handleStatus != null  and handleStatus != ''">handle_status,</if>
            <if test="holeCode != null  and holeCode != ''">hole_code,</if>
            <if test="holeId != null  and holeId != ''">hole_id,</if>
            <if test="level != null  and level != ''">level,</if>
            <if test="mapTime != null ">map_time,</if>
            <if test="projectId != null  and projectId != ''">project_id,</if>
            <if test="type != null  and type != ''">type,</if>
            <if test="isDelete != null  and isDelete != ''">is_delete,</if>
         </trim>
        <trim prefix="values (" suffix=")" suffixOverrides=",">
            <if test="ids != null  and ids != ''">#{ids},</if>
            <if test="companyId != null  and companyId != ''">#{companyId},</if>
            <if test="description != null  and description != ''">#{description},</if>
            <if test="handleStatus != null  and handleStatus != ''">#{handleStatus},</if>
            <if test="holeCode != null  and holeCode != ''">#{holeCode},</if>
            <if test="holeId != null  and holeId != ''">#{holeId},</if>
            <if test="level != null  and level != ''">#{level},</if>
            <if test="mapTime != null ">#{mapTime},</if>
            <if test="projectId != null  and projectId != ''">#{projectId},</if>
            <if test="type != null  and type != ''">#{type},</if>
            <if test="isDelete != null  and isDelete != ''">#{isDelete},</if>
         </trim>
    </insert>
 
    <update id="updateHandleException" parameterType="HandleException">
        update js_handle_exception
        <trim prefix="SET" suffixOverrides=",">
            <if test="companyId != null  and companyId != ''">company_id = #{companyId},</if>
            <if test="description != null  and description != ''">description = #{description},</if>
            <if test="handleStatus != null  and handleStatus != ''">handle_status = #{handleStatus},</if>
            <if test="holeCode != null  and holeCode != ''">hole_code = #{holeCode},</if>
            <if test="holeId != null  and holeId != ''">hole_id = #{holeId},</if>
            <if test="level != null  and level != ''">level = #{level},</if>
            <if test="mapTime != null ">map_time = #{mapTime},</if>
            <if test="projectId != null  and projectId != ''">project_id = #{projectId},</if>
            <if test="type != null  and type != ''">type = #{type},</if>
            <if test="isDelete != null  and isDelete != ''">is_delete = #{isDelete},</if>
        </trim>
        where ids = #{ids}
    </update>
 
    <delete id="deleteHandleExceptionById" parameterType="String">
        delete from js_handle_exception where ids = #{ids}
    </delete>
 
    <delete id="deleteHandleExceptionByIds" parameterType="String">
        delete from js_handle_exception where ids in 
        <foreach item="ids" collection="array" open="(" separator="," close=")">
            #{ids}
        </foreach>
    </delete>
    
</mapper>