地质所 沉降监测网建设项目
chenhuan
2024-05-22 bf8d8aaf62190e0d49bbd34e3bb2aa7707d86537
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
<?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.HoleLogMapper">
    
    <resultMap type="HoleLog" id="HoleLogResult">
        <result property="id"    column="id"    />
        <result property="projectId"    column="project_id"    />
        <result property="holeId"    column="hole_id"    />
        <result property="code"    column="code"    />
        <result property="beginDepth"    column="begin_depth"    />
        <result property="endDepth"    column="end_depth"    />
        <result property="createTime"    column="create_time"    />
        <result property="recordPerson"    column="record_person"    />
        <result property="description"    column="description"    />
        <result property="isDelete"    column="is_delete"    />
    </resultMap>
 
    <sql id="selectHoleLogVo">
        select id, project_id, hole_id, code, begin_depth, end_depth, create_time, record_person, description, is_delete from js_hole_log
    </sql>
 
    <select id="selectHoleLogList" parameterType="HoleLog" resultMap="HoleLogResult">
        <include refid="selectHoleLogVo"/>
        <where>  
            <if test="projectId != null  and projectId != ''"> and project_id = #{projectId}</if>
            <if test="holeId != null  and holeId != ''"> and hole_id = #{holeId}</if>
            <if test="code != null  and code != ''"> and code = #{code}</if>
            <if test="beginDepth != null "> and begin_depth = #{beginDepth}</if>
            <if test="endDepth != null "> and end_depth = #{endDepth}</if>
            <if test="recordPerson != null  and recordPerson != ''"> and record_person = #{recordPerson}</if>
            <if test="description != null  and description != ''"> and description = #{description}</if>
            <!-- 开始时间检索 -->
            <if test="params.beginCreateTime != null and params.beginCreateTime != ''">
                and date_format(create_time,'%y%m%d') &gt;= date_format(#{params.beginCreateTime},'%y%m%d')
            </if>
            <!-- 结束时间检索 -->
            <if test="params.endCreateTime != null and params.endCreateTime != ''">
                and date_format(create_time,'%y%m%d') &lt;= date_format(#{params.endCreateTime},'%y%m%d')
            </if>
        </where>
    </select>
    
    <select id="selectHoleLogById" parameterType="String" resultMap="HoleLogResult">
        <include refid="selectHoleLogVo"/>
        where id = #{id}
    </select>
        
    <insert id="insertHoleLog" parameterType="HoleLog">
        insert into js_hole_log
        <trim prefix="(" suffix=")" suffixOverrides=",">
            <if test="id != null  and id != ''">id,</if>
            <if test="projectId != null  and projectId != ''">project_id,</if>
            <if test="holeId != null  and holeId != ''">hole_id,</if>
            <if test="code != null  and code != ''">code,</if>
            <if test="beginDepth != null ">begin_depth,</if>
            <if test="endDepth != null ">end_depth,</if>
            <if test="createTime != null ">create_time,</if>
            <if test="recordPerson != null  and recordPerson != ''">record_person,</if>
            <if test="description != null  and description != ''">description,</if>
            <if test="isDelete != null  and isDelete != ''">is_delete,</if>
         </trim>
        <trim prefix="values (" suffix=")" suffixOverrides=",">
            <if test="id != null  and id != ''">#{id},</if>
            <if test="projectId != null  and projectId != ''">#{projectId},</if>
            <if test="holeId != null  and holeId != ''">#{holeId},</if>
            <if test="code != null  and code != ''">#{code},</if>
            <if test="beginDepth != null ">#{beginDepth},</if>
            <if test="endDepth != null ">#{endDepth},</if>
            <if test="createTime != null ">#{createTime},</if>
            <if test="recordPerson != null  and recordPerson != ''">#{recordPerson},</if>
            <if test="description != null  and description != ''">#{description},</if>
            <if test="isDelete != null  and isDelete != ''">#{isDelete},</if>
         </trim>
    </insert>
 
    <update id="updateHoleLog" parameterType="HoleLog">
        update js_hole_log
        <trim prefix="SET" suffixOverrides=",">
            <if test="projectId != null  and projectId != ''">project_id = #{projectId},</if>
            <if test="holeId != null  and holeId != ''">hole_id = #{holeId},</if>
            <if test="code != null  and code != ''">code = #{code},</if>
            <if test="beginDepth != null ">begin_depth = #{beginDepth},</if>
            <if test="endDepth != null ">end_depth = #{endDepth},</if>
            <if test="createTime != null ">create_time = #{createTime},</if>
            <if test="recordPerson != null  and recordPerson != ''">record_person = #{recordPerson},</if>
            <if test="description != null  and description != ''">description = #{description},</if>
            <if test="isDelete != null  and isDelete != ''">is_delete = #{isDelete},</if>
        </trim>
        where id = #{id}
    </update>
 
    <delete id="deleteHoleLogById" parameterType="String">
        delete from js_hole_log where id = #{id}
    </delete>
 
    <delete id="deleteHoleLogByIds" parameterType="String">
        delete from js_hole_log where id in 
        <foreach item="id" collection="array" open="(" separator="," close=")">
            #{id}
        </foreach>
    </delete>
    
</mapper>