地质所 沉降监测网建设项目
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
<?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.platform.mapper.ProjectApplyHoleMapper">
    
    <resultMap type="ProjectApplyHole" id="ProjectApplyHoleResult">
        <result property="id"    column="id"    />
        <result property="applyId"    column="apply_id"    />
        <result property="holeId"    column="hole_id"    />
        <result property="userId"    column="user_id"    />
        <result property="status"    column="status"    />
        <result property="createTime"    column="create_time"    />
        <result property="overTime"    column="over_time"    />
        <result property="holeType"    column="hole_type"    />
    </resultMap>
    
     <resultMap type="ProjectApplyHole" id="ProjectApplyHoleResult2">
        <result property="id"    column="id"    />
        <result property="applyId"    column="apply_id"    />
        <result property="holeId"    column="hole_id"    />
        <result property="userId"    column="user_id"    />
        <result property="status"    column="status"    />
        <result property="createTime"    column="create_time"    />
        <result property="overTime"    column="over_time"    />
        <result property="projNo"    column="proj_no"    />
        <result property="holeNo"    column="hole_no"    />
        <result property="holeType"    column="hole_type"    />
        <result property="holeDepth"    column="hole_depth"    />
        <result property="longitude"    column="longitude"    />
        <result property="latitude"    column="latitude"    />
    </resultMap>
 
    <sql id="selectProjectApplyHoleVo">
        select id, apply_id, hole_id, user_id, status, create_time, over_time,hole_type from js_project_apply_hole
    </sql>
    
     <sql id="selectProjectApplyHoleVo2">
        select a.id, a.apply_id, a.hole_id, a.user_id, a.status, a.create_time, a.over_time,
        b.proj_no, b.hole_no,b.hole_type, b.hole_depth ,b.longitude,b.latitude 
        from js_project_apply_hole a join js_hole_info b on a.hole_id =b.id 
    </sql>
 
    <select id="selectProjectApplyHoleList" parameterType="ProjectApplyHole" resultMap="ProjectApplyHoleResult">
        <include refid="selectProjectApplyHoleVo"/>
        <where>  
            <if test="applyId != null  and applyId != ''"> and apply_id = #{applyId}</if>
            <if test="holeId != null  and holeId != ''"> and hole_id = #{holeId}</if>
            <if test="userId != null and userId != ''"> and user_id = #{userId}</if>
            <if test="status != null  and status != ''"> and status = #{status}</if>
            <if test="overTime != null "> and over_time = #{overTime}</if>
        </where>
    </select>
    
    <select id="selectProjectApplyHoleListJoinHoleInfo" parameterType="ProjectApplyHole" resultMap="ProjectApplyHoleResult2"> 
       <include refid="selectProjectApplyHoleVo2"/>
         <where>  
            <if test="applyId != null  and applyId != ''"> and apply_id = #{applyId}</if>
            <if test="holeId != null  and holeId != ''"> and hole_id = #{holeId}</if>
            <if test="userId != null and userId != ''"> and user_id = #{userId}</if>
            <if test="status != null  and status != ''"> and status = #{status}</if>
            <if test="overTime != null "> and over_time = #{overTime}</if>
        </where>
    </select>
    
    
    <select id="selectProjectApplyHoleById" parameterType="String" resultMap="ProjectApplyHoleResult">
        <include refid="selectProjectApplyHoleVo"/>
        where id = #{id}
    </select>
        
    <insert id="insertProjectApplyHole" parameterType="ProjectApplyHole">
        insert into js_project_apply_hole
        <trim prefix="(" suffix=")" suffixOverrides=",">
            <if test="id != null  and id != ''">id,</if>
            <if test="applyId != null  and applyId != ''">apply_id,</if>
            <if test="holeId != null  and holeId != ''">hole_id,</if>
            <if test="userId != null ">user_id,</if>
            <if test="status != null  and status != ''">status,</if>
            <if test="createTime != null ">create_time,</if>
            <if test="overTime != null ">over_time,</if>
            <if test="holeType != null  and holeType != ''">hole_type,</if>
         </trim>
        <trim prefix="values (" suffix=")" suffixOverrides=",">
            <if test="id != null  and id != ''">#{id},</if>
            <if test="applyId != null  and applyId != ''">#{applyId},</if>
            <if test="holeId != null  and holeId != ''">#{holeId},</if>
            <if test="userId != null ">#{userId},</if>
            <if test="status != null  and status != ''">#{status},</if>
            <if test="createTime != null ">#{createTime},</if>
            <if test="overTime != null ">#{overTime},</if>
            <if test="holeType != null  and holeType != ''">#{holeType},</if>
         </trim>
    </insert>
 
    <update id="updateProjectApplyHole" parameterType="ProjectApplyHole">
        update js_project_apply_hole
        <trim prefix="SET" suffixOverrides=",">
            <if test="applyId != null  and applyId != ''">apply_id = #{applyId},</if>
            <if test="holeId != null  and holeId != ''">hole_id = #{holeId},</if>
            <if test="userId != null ">user_id = #{userId},</if>
            <if test="status != null  and status != ''">status = #{status},</if>
            <if test="createTime != null ">create_time = #{createTime},</if>
            <if test="overTime != null ">over_time = #{overTime},</if>
        </trim>
        where id = #{id}
    </update>
    
    <update id="updateProjectApplyStatus" parameterType="ProjectApplyHole">
       update js_project_apply_hole set status = #{status} where apply_id = #{applyId}
    </update>
 
    <delete id="deleteProjectApplyHoleById" parameterType="String">
        delete from js_project_apply_hole where id = #{id}
    </delete>
 
    <delete id="deleteProjectApplyHoleByIds" parameterType="String">
        delete from js_project_apply_hole where id in 
        <foreach item="id" collection="array" open="(" separator="," close=")">
            #{id}
        </foreach>
    </delete>
    
</mapper>