地质所 沉降监测网建设项目
suerwei
2024-05-17 b159e50bbf0f055a69ba5430fb956021ab90b450
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
<?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.ProjectCameraMapper">
    
    <resultMap type="ProjectCamera" id="ProjectCameraResult">
        <result property="id"    column="id"    />
        <result property="projectId"    column="project_id"    />
        <result property="name"    column="name"    />
        <result property="code"    column="code"    />
        <result property="lng"    column="lng"    />
        <result property="lat"    column="lat"    />
        <result property="ip"    column="ip"    />
        <result property="createBy"    column="create_by"    />
        <result property="createTime"    column="create_time"    />
    </resultMap>
 
    <sql id="selectProjectCameraVo">
        select id, project_id, name, code, lng, lat, ip, create_by, create_time from js_project_camera
    </sql>
 
    <select id="selectProjectCameraList" parameterType="ProjectCamera" resultMap="ProjectCameraResult">
        <include refid="selectProjectCameraVo"/>
        <where>  
            <if test="projectId != null  and projectId != ''"> and project_id = #{projectId}</if>
            <if test="name != null  and name != ''"> and name like concat('%', #{name}, '%')</if>
            <if test="code != null  and code != ''"> and code = #{code}</if>
            <if test="lng != null "> and lng = #{lng}</if>
            <if test="lat != null "> and lat = #{lat}</if>
            <if test="ip != null  and ip != ''"> and ip = #{ip}</if>
        </where>
    </select>
    
    <select id="selectProjectCameraById" parameterType="String" resultMap="ProjectCameraResult">
        <include refid="selectProjectCameraVo"/>
        where id = #{id}
    </select>
        
    <insert id="insertProjectCamera" parameterType="ProjectCamera">
        insert into js_project_camera
        <trim prefix="(" suffix=")" suffixOverrides=",">
            <if test="id != null  and id != ''">id,</if>
            <if test="projectId != null  and projectId != ''">project_id,</if>
            <if test="name != null  and name != ''">name,</if>
            <if test="code != null  and code != ''">code,</if>
            <if test="lng != null ">lng,</if>
            <if test="lat != null ">lat,</if>
            <if test="ip != null  and ip != ''">ip,</if>
            <if test="createBy != null ">create_by,</if>
            <if test="createTime != null ">create_time,</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="name != null  and name != ''">#{name},</if>
            <if test="code != null  and code != ''">#{code},</if>
            <if test="lng != null ">#{lng},</if>
            <if test="lat != null ">#{lat},</if>
            <if test="ip != null  and ip != ''">#{ip},</if>
            <if test="createBy != null ">#{createBy},</if>
            <if test="createTime != null ">#{createTime},</if>
         </trim>
    </insert>
 
    <update id="updateProjectCamera" parameterType="ProjectCamera">
        update js_project_camera
        <trim prefix="SET" suffixOverrides=",">
            <if test="projectId != null  and projectId != ''">project_id = #{projectId},</if>
            <if test="name != null  and name != ''">name = #{name},</if>
            <if test="code != null  and code != ''">code = #{code},</if>
            <if test="lng != null ">lng = #{lng},</if>
            <if test="lat != null ">lat = #{lat},</if>
            <if test="ip != null  and ip != ''">ip = #{ip},</if>
            <if test="createBy != null ">create_by = #{createBy},</if>
            <if test="createTime != null ">create_time = #{createTime},</if>
        </trim>
        where id = #{id}
    </update>
 
    <delete id="deleteProjectCameraById" parameterType="String">
        delete from js_project_camera where id = #{id}
    </delete>
 
    <delete id="deleteProjectCameraByIds" parameterType="String">
        delete from js_project_camera where id in 
        <foreach item="id" collection="array" open="(" separator="," close=")">
            #{id}
        </foreach>
    </delete>
    
</mapper>