liusuyi
2026-05-14 9958bc1501d0daee954d9bba383475e55e24ebab
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
167
168
169
170
<?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.ard.work.point.tower.mapper.ArdTowerMapper">
    
    <resultMap type="ArdTower" id="ArdTowerResult">
        <result property="id"    column="id"    />
        <result property="name"    column="name"    />
        <result property="longitude"    column="longitude"    />
        <result property="latitude"    column="latitude"    />
        <result property="altitude"    column="altitude"    />
        <result property="userId"    column="user_id"    />
        <result property="deptId"    column="dept_id"    />
        <result property="createBy"    column="create_by"    />
        <result property="createTime"    column="create_time"    />
        <result property="updateBy"    column="update_by"    />
        <result property="updateTime"    column="update_time"    />
        <result property="direction"    column="direction"    />
        <result property="towerScale"    column="tower_scale"    />
        <result property="towerPath"    column="tower_path"    />
        <result property="peOffset"    column="pe_offset"    />
        <result property="peScale"    column="pe_scale"    />
        <result property="pePath"    column="pe_path"    />
        <result property="radarOffset"    column="radar_offset"    />
        <result property="radarScale"    column="radar_scale"    />
        <result property="radarPath"    column="radar_path"    />
    </resultMap>
 
    <sql id="selectArdTowerVo">
        select c.id,
               c.name,
               c.longitude,
               c.latitude,
               c.altitude,
               c.user_id,
               c.dept_id,
               c.create_by,
               c.create_time,
               c.update_by,
               c.update_time,
               c.direction,
               c.tower_scale,
               c.tower_path,
               c.pe_offset,
               c.pe_scale,
               c.pe_path,
               c.radar_offset,
               c.radar_scale,
               c.radar_path
        from ard_tower c
                 left join sys_dept d on d.dept_id = c.dept_id
                 left join sys_user u on u.user_id = c.user_id
    </sql>
 
    <select id="selectArdTowerList" parameterType="ArdTower" resultMap="ArdTowerResult">
        <include refid="selectArdTowerVo"/>
        <where>  
            <if test="name != null  and name != ''"> and name like concat('%', #{name}, '%')</if>
            <if test="longitude != null "> and longitude = #{longitude}</if>
            <if test="latitude != null "> and latitude = #{latitude}</if>
            <if test="altitude != null "> and altitude = #{altitude}</if>
            <if test="userId != null  and userId != ''"> and user_id = #{userId}</if>
            <if test="direction != null  and direction != ''"> and direction = #{direction}</if>
            <if test="towerScale != null  and towerScale != ''"> and tower_scale = #{towerScale}</if>
            <if test="towerPath != null  and towerPath != ''"> and tower_path = #{towerPath}</if>
            <if test="peOffset != null  and peOffset != ''"> and pe_offset = #{peOffset}</if>
            <if test="peScale != null  and peScale != ''"> and pe_scale = #{peScale}</if>
            <if test="pePath != null  and pePath != ''"> and pe_path = #{pePath}</if>
            <if test="radarOffset != null  and radarOffset != ''"> and radar_offset = #{radarOffset}</if>
            <if test="radarScale != null  and radarScale != ''"> and radar_scale = #{radarScale}</if>
            <if test="radarPath != null  and radarPath != ''"> and radar_path = #{radarPath}</if>
            <if test="deptId != null and deptId != 0">
                AND (c.dept_id = #{deptId} OR c.dept_id IN ( SELECT t.dept_id FROM sys_dept t WHERE find_in_set(#{deptId}, ancestors) ))
            </if>
            <!-- 数据范围过滤 -->
            ${params.dataScope}
        </where>
    </select>
    
    <select id="selectArdTowerById" parameterType="String" resultMap="ArdTowerResult">
        <include refid="selectArdTowerVo"/>
        where c.id = #{id}
    </select>
 
    <insert id="insertArdTower" parameterType="ArdTower">
        insert into ard_tower
        <trim prefix="(" suffix=")" suffixOverrides=",">
            <if test="id != null">id,</if>
            <if test="name != null">name,</if>
            <if test="longitude != null">longitude,</if>
            <if test="latitude != null">latitude,</if>
            <if test="altitude != null">altitude,</if>
            <if test="userId != null">user_id,</if>
            <if test="deptId != null">dept_id,</if>
            <if test="createBy != null">create_by,</if>
            <if test="createTime != null">create_time,</if>
            <if test="updateBy != null">update_by,</if>
            <if test="updateTime != null">update_time,</if>
            <if test="direction != null">direction,</if>
            <if test="towerScale != null">tower_scale,</if>
            <if test="towerPath != null">tower_path,</if>
            <if test="peOffset != null">pe_offset,</if>
            <if test="peScale != null">pe_scale,</if>
            <if test="pePath != null">pe_path,</if>
            <if test="radarOffset != null">radar_offset,</if>
            <if test="radarScale != null">radar_scale,</if>
            <if test="radarPath != null">radar_path,</if>
         </trim>
        <trim prefix="values (" suffix=")" suffixOverrides=",">
            <if test="id != null">#{id},</if>
            <if test="name != null">#{name},</if>
            <if test="longitude != null">#{longitude},</if>
            <if test="latitude != null">#{latitude},</if>
            <if test="altitude != null">#{altitude},</if>
            <if test="userId != null">#{userId},</if>
            <if test="deptId != null">#{deptId},</if>
            <if test="createBy != null">#{createBy},</if>
            <if test="createTime != null">#{createTime},</if>
            <if test="updateBy != null">#{updateBy},</if>
            <if test="updateTime != null">#{updateTime},</if>
            <if test="direction != null">#{direction},</if>
            <if test="towerScale != null">#{towerScale},</if>
            <if test="towerPath != null">#{towerPath},</if>
            <if test="peOffset != null">#{peOffset},</if>
            <if test="peScale != null">#{peScale},</if>
            <if test="pePath != null">#{pePath},</if>
            <if test="radarOffset != null">#{radarOffset},</if>
            <if test="radarScale != null">#{radarScale},</if>
            <if test="radarPath != null">#{radarPath},</if>
         </trim>
    </insert>
 
    <update id="updateArdTower" parameterType="ArdTower">
        update ard_tower
        <trim prefix="SET" suffixOverrides=",">
            <if test="name != null">name = #{name},</if>
            <if test="longitude != null">longitude = #{longitude},</if>
            <if test="latitude != null">latitude = #{latitude},</if>
            <if test="altitude != null">altitude = #{altitude},</if>
            <if test="userId != null">user_id = #{userId},</if>
            <if test="deptId != null">dept_id = #{deptId},</if>
            <if test="createBy != null">create_by = #{createBy},</if>
            <if test="createTime != null">create_time = #{createTime},</if>
            <if test="updateBy != null">update_by = #{updateBy},</if>
            <if test="updateTime != null">update_time = #{updateTime},</if>
            <if test="direction != null">direction = #{direction},</if>
            <if test="towerScale != null">tower_scale = #{towerScale},</if>
            <if test="towerPath != null">tower_path = #{towerPath},</if>
            <if test="peOffset != null">pe_offset = #{peOffset},</if>
            <if test="peScale != null">pe_scale = #{peScale},</if>
            <if test="pePath != null">pe_path = #{pePath},</if>
            <if test="radarOffset != null">radar_offset = #{radarOffset},</if>
            <if test="radarScale != null">radar_scale = #{radarScale},</if>
            <if test="radarPath != null">radar_path = #{radarPath},</if>
        </trim>
        where id = #{id}
    </update>
 
    <delete id="deleteArdTowerById" parameterType="String">
        delete from ard_tower where id = #{id}
    </delete>
 
    <delete id="deleteArdTowerByIds" parameterType="String">
        delete from ard_tower where id in 
        <foreach item="id" collection="array" open="(" separator="," close=")">
            #{id}
        </foreach>
    </delete>
</mapper>