| <?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.ruoyi.device.radar.mapper.ArdEquipRadarMapper"> | 
|      | 
|     <resultMap type="ArdEquipRadar" id="ArdEquipRadarResult"> | 
|         <result property="id"    column="id"    /> | 
|         <result property="name"    column="name"    /> | 
|         <result property="createBy"    column="create_by"    /> | 
|         <result property="port"    column="port"    /> | 
|         <result property="operate"    column="operate"    /> | 
|         <result property="createTime"    column="create_time"    /> | 
|         <result property="updateBy"    column="update_by"    /> | 
|         <result property="updateTime"    column="update_time"    /> | 
|         <result property="delFlag"    column="del_flag"    /> | 
|         <result property="userId"    column="user_id"    /> | 
|         <result property="longitude"    column="longitude"    /> | 
|         <result property="latitude"    column="latitude"    /> | 
|         <result property="altitude"    column="altitude"    /> | 
|         <result property="radarDate"    column="radar_date"    /> | 
|         <result property="deptId"    column="dept_id"    /> | 
|         <result property="pitch"    column="pitch"    /> | 
|         <result property="towerId"    column="tower_id"    /> | 
|         <result property="imageWidth"    column="image_width"    /> | 
|         <result property="imageHeight"    column="image_height"    /> | 
|         <result property="type"    column="type"    /> | 
|         <result property="ip"    column="ip"    /> | 
|         <result property="towerName"    column="name"    /> | 
|     </resultMap> | 
|   | 
|     <sql id="selectArdEquipRadarVo"> | 
|         select c.id, | 
|                c.name, | 
|                c.create_by, | 
|                c.port, | 
|                c.operate, | 
|                c.create_time, | 
|                c.update_by, | 
|                c.update_time, | 
|                c.del_flag, | 
|                c.user_id, | 
|                c.longitude, | 
|                c.latitude, | 
|                c.altitude, | 
|                c.radar_date, | 
|                c.dept_id, | 
|                c.pitch, | 
|                c.tower_id, | 
|                c.image_width, | 
|                c.image_height, | 
|                c.type, | 
|                c.ip | 
|         from ard_equip_radar 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="selectArdEquipRadarList" parameterType="ArdEquipRadar" resultMap="ArdEquipRadarResult"> | 
|         select c.id, | 
|         c.name, | 
|         c.create_by, | 
|         c.port, | 
|         c.operate, | 
|         c.create_time, | 
|         c.update_by, | 
|         c.update_time, | 
|         c.del_flag, | 
|         c.user_id, | 
|         c.longitude, | 
|         c.latitude, | 
|         c.altitude, | 
|         c.radar_date, | 
|         c.dept_id, | 
|         c.pitch, | 
|         c.tower_id, | 
|         c.image_width, | 
|         c.image_height, | 
|         c.type, | 
|         c.ip, | 
|         t.name | 
|         from ard_equip_radar 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 | 
|         left join ard_towers t on t.id = c.tower_id | 
|         <where> | 
|             <if test="towerId != null  and towerId != ''"> and c.tower_id = #{towerId}</if> | 
|             <if test="userId != null  and userId != ''">and c.user_id = #{userId}</if> | 
|             <if test="deptId != null ">and (c.dept_id = #{deptId} OR c.dept_id IN ( SELECT t.dept_id FROM sys_dept t | 
|                 WHERE cast(#{deptId} as varchar) = any(string_to_array(ancestors,',')) )) | 
|             </if> | 
|             <if test="params.beginTime != null and params.beginTime != ''"><!-- 开始时间检索 --> | 
|                 and create_time >= to_timestamp(#{params.beginTime},'yyyy-MM-DD') | 
|             </if> | 
|             <if test="params.endTime != null and params.endTime != ''"><!-- 结束时间检索 --> | 
|                 and create_time <= to_timestamp(#{params.endTime},'yyyy-MM-DD') | 
|             </if> | 
|             <!-- 数据范围过滤 --> | 
|             ${params.dataScope} | 
|         </where> | 
|     </select> | 
|      | 
|     <select id="selectArdEquipRadarById" parameterType="String" resultMap="ArdEquipRadarResult"> | 
|         <include refid="selectArdEquipRadarVo"/> | 
|         where id = #{id} | 
|     </select> | 
|          | 
|     <insert id="insertArdEquipRadar" parameterType="ArdEquipRadar"> | 
|         insert into ard_equip_radar | 
|         <trim prefix="(" suffix=")" suffixOverrides=","> | 
|             <if test="id != null">id,</if> | 
|             <if test="name != null">name,</if> | 
|             <if test="createBy != null">create_by,</if> | 
|             <if test="port != null">port,</if> | 
|             <if test="operate != null">operate,</if> | 
|             <if test="createTime != null">create_time,</if> | 
|             <if test="updateBy != null">update_by,</if> | 
|             <if test="updateTime != null">update_time,</if> | 
|             <if test="delFlag != null">del_flag,</if> | 
|             <if test="userId != null">user_id,</if> | 
|             <if test="longitude != null">longitude,</if> | 
|             <if test="latitude != null">latitude,</if> | 
|             <if test="altitude != null">altitude,</if> | 
|             <if test="radarDate != null">radar_date,</if> | 
|             <if test="deptId != null">dept_id,</if> | 
|             <if test="pitch != null">pitch,</if> | 
|             <if test="towerId != null">tower_id,</if> | 
|             <if test="imageWidth != null">image_width,</if> | 
|             <if test="imageHeight != null">image_height,</if> | 
|             <if test="type != null">type,</if> | 
|             <if test="ip != null">ip,</if> | 
|          </trim> | 
|         <trim prefix="values (" suffix=")" suffixOverrides=","> | 
|             <if test="id != null">#{id},</if> | 
|             <if test="name != null">#{name},</if> | 
|             <if test="createBy != null">#{createBy},</if> | 
|             <if test="port != null">#{port},</if> | 
|             <if test="operate != null">#{operate},</if> | 
|             <if test="createTime != null">#{createTime},</if> | 
|             <if test="updateBy != null">#{updateBy},</if> | 
|             <if test="updateTime != null">#{updateTime},</if> | 
|             <if test="delFlag != null">#{delFlag},</if> | 
|             <if test="userId != null">#{userId},</if> | 
|             <if test="longitude != null">#{longitude},</if> | 
|             <if test="latitude != null">#{latitude},</if> | 
|             <if test="altitude != null">#{altitude},</if> | 
|             <if test="radarDate != null">#{radarDate},</if> | 
|             <if test="deptId != null">#{deptId},</if> | 
|             <if test="pitch != null">#{pitch},</if> | 
|             <if test="towerId != null">#{towerId},</if> | 
|             <if test="imageWidth != null">#{imageWidth},</if> | 
|             <if test="imageHeight != null">#{imageHeight},</if> | 
|             <if test="type != null">#{type},</if> | 
|             <if test="ip != null">#{ip},</if> | 
|          </trim> | 
|     </insert> | 
|   | 
|     <update id="updateArdEquipRadar" parameterType="ArdEquipRadar"> | 
|         update ard_equip_radar | 
|         <trim prefix="SET" suffixOverrides=","> | 
|             <if test="name != null">name = #{name},</if> | 
|             <if test="createBy != null">create_by = #{createBy},</if> | 
|             <if test="port != null">port = #{port},</if> | 
|             <if test="operate != null">operate = #{operate},</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="delFlag != null">del_flag = #{delFlag},</if> | 
|             <if test="userId != null">user_id = #{userId},</if> | 
|             <if test="longitude != null">longitude = #{longitude},</if> | 
|             <if test="latitude != null">latitude = #{latitude},</if> | 
|             <if test="altitude != null">altitude = #{altitude},</if> | 
|             <if test="radarDate != null">radar_date = #{radarDate},</if> | 
|             <if test="deptId != null">dept_id = #{deptId},</if> | 
|             <if test="pitch != null">pitch = #{pitch},</if> | 
|             <if test="towerId != null">tower_id = #{towerId},</if> | 
|             <if test="imageWidth != null">image_width = #{imageWidth},</if> | 
|             <if test="imageHeight != null">image_height = #{imageHeight},</if> | 
|             <if test="type != null">type = #{type},</if> | 
|             <if test="ip != null">ip = #{ip},</if> | 
|         </trim> | 
|         where id = #{id} | 
|     </update> | 
|   | 
|     <delete id="deleteArdEquipRadarById" parameterType="String"> | 
|         delete from ard_equip_radar where id = #{id} | 
|     </delete> | 
|   | 
|     <delete id="deleteArdEquipRadarByIds" parameterType="String"> | 
|         delete from ard_equip_radar where id in  | 
|         <foreach item="id" collection="array" open="(" separator="," close=")"> | 
|             #{id} | 
|         </foreach> | 
|     </delete> | 
| </mapper> |