210 lines
14 KiB
XML
210 lines
14 KiB
XML
<?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.yanzhu.jh.device.mapper.DevTowerDataCollideMapper">
|
|
|
|
<resultMap type="DevTowerDataCollide" id="DevTowerDataCollideResult">
|
|
<result property="id" column="id" />
|
|
<result property="cfgId" column="cfg_id" />
|
|
<result property="projectId" column="project_id" />
|
|
<result property="projectName" column="projectName" />
|
|
<result property="deptId" column="dept_id" />
|
|
<result property="deptName" column="dept_name" />
|
|
<result property="deviceKey" column="device_key" />
|
|
<result property="deviceSource" column="device_source" />
|
|
<result property="towerId" column="tower_id" />
|
|
<result property="coordinateX" column="coordinate_x" />
|
|
<result property="coordinateY" column="coordinate_y" />
|
|
<result property="frontBrachium" column="front_brachium" />
|
|
<result property="afterBrachium" column="after_brachium" />
|
|
<result property="towerBodyHeight" column="tower_body_height" />
|
|
<result property="height" column="height" />
|
|
<result property="angle" column="angle" />
|
|
<result property="range" column="range" />
|
|
<result property="earlyWarningDistance" column="early_warning_distance" />
|
|
<result property="alarmWarningDistance" column="alarm_warning_distance" />
|
|
<result property="contourValue" column="contour_value" />
|
|
<result property="isDel" column="is_del" />
|
|
<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="remark" column="remark" />
|
|
</resultMap>
|
|
|
|
<resultMap id="DevTowerDataCollideDevTowerDataCollideDetailResult" type="DevTowerDataCollide" extends="DevTowerDataCollideResult">
|
|
<collection property="devTowerDataCollideDetailList" notNullColumn="sub_id" javaType="java.util.List" resultMap="DevTowerDataCollideDetailResult" />
|
|
</resultMap>
|
|
|
|
<resultMap type="DevTowerDataCollideDetail" id="DevTowerDataCollideDetailResult">
|
|
<result property="id" column="sub_id" />
|
|
<result property="collideId" column="sub_collide_id" />
|
|
<result property="deviceKey" column="sub_device_key" />
|
|
<result property="deviceSource" column="sub_device_source" />
|
|
<result property="towerId" column="sub_tower_id" />
|
|
<result property="coordinateX" column="sub_coordinate_x" />
|
|
<result property="coordinateY" column="sub_coordinate_y" />
|
|
<result property="frontBrachium" column="sub_front_brachium" />
|
|
<result property="afterBrachium" column="sub_after_brachium" />
|
|
<result property="towerBodyHeight" column="sub_tower_body_height" />
|
|
<result property="height" column="sub_height" />
|
|
<result property="angle" column="sub_angle" />
|
|
<result property="range" column="sub_range" />
|
|
<result property="collideHorizontalDistance" column="sub_collide_horizontal_distance" />
|
|
<result property="collideVerticalDistance" column="sub_collide_vertical_distance" />
|
|
<result property="collideState" column="sub_collide_state" />
|
|
</resultMap>
|
|
|
|
<sql id="selectDevTowerDataCollideVo">
|
|
select dtdc.id, dtdc.cfg_id, dtdc.project_id, dtdc.dept_id, sp.projectName, sd.dept_name, dtdc.device_key, dtdc.device_source, dtdc.tower_id, dtdc.coordinate_x, dtdc.coordinate_y, dtdc.front_brachium, dtdc.after_brachium, dtdc.tower_body_height, dtdc.height, dtdc.angle, dtdc.range, dtdc.early_warning_distance, dtdc.alarm_warning_distance, dtdc.contour_value, dtdc.is_del, dtdc.create_by, dtdc.create_time, dtdc.update_by, dtdc.update_time, dtdc.remark from dev_tower_data_collide dtdc
|
|
left join sur_project sp on sp.id = dtdc.project_id
|
|
left join sys_dept sd on sd.dept_id = dtdc.dept_id
|
|
</sql>
|
|
|
|
<select id="selectDevTowerDataCollideList" parameterType="DevTowerDataCollide" resultMap="DevTowerDataCollideResult">
|
|
<include refid="selectDevTowerDataCollideVo"/>
|
|
<where>
|
|
<if test="cfgId != null">and dtdl.cfg_id = #{cfgId}</if>
|
|
<if test="projectId != null "> and dtdc.project_id = #{projectId}</if>
|
|
<if test="deptId != null "> and dtdc.dept_id = #{deptId}</if>
|
|
<if test="projectName != null and projectName != ''"> and dtdc.project_id in (select spv.id from sur_project spv where spv.projectName like concat('%', #{projectName}, '%'))</if>
|
|
<if test="deptName != null and deptName != ''"> and dtdc.dept_id in (select sdv.dept_id from sys_dept sdv where sdv.dept_name like concat('%', #{deptName}, '%'))</if>
|
|
<if test="deviceKey != null and deviceKey != ''"> and dtdc.device_key = #{deviceKey}</if>
|
|
<if test="deviceSource != null and deviceSource != ''"> and dtdc.device_source = #{deviceSource}</if>
|
|
<if test="towerId != null and towerId != ''"> and dtdc.tower_id = #{towerId}</if>
|
|
<if test="params.beginCreateTime != null and params.beginCreateTime != '' and params.endCreateTime != null and params.endCreateTime != ''"> and dtdc.create_time between #{params.beginCreateTime} and #{params.endCreateTime}</if>
|
|
</where>
|
|
order by dtdc.id desc
|
|
</select>
|
|
|
|
<select id="selectDevTowerDataCollideById" parameterType="Long" resultMap="DevTowerDataCollideDevTowerDataCollideDetailResult">
|
|
select a.id, a.project_id, a.dept_id, a.device_key, a.device_source, a.tower_id, a.coordinate_x, a.coordinate_y, a.front_brachium, a.after_brachium, a.tower_body_height, a.height, a.angle, a.range, a.early_warning_distance, a.alarm_warning_distance, a.contour_value, a.is_del, a.create_by, a.create_time, a.update_by, a.update_time, a.remark,
|
|
b.id as sub_id, b.collide_id as sub_collide_id, b.device_key as sub_device_key, b.device_source as sub_device_source, b.tower_id as sub_tower_id, b.coordinate_x as sub_coordinate_x, b.coordinate_y as sub_coordinate_y, b.front_brachium as sub_front_brachium, b.after_brachium as sub_after_brachium, b.tower_body_height as sub_tower_body_height, b.height as sub_height, b.angle as sub_angle, b.range as sub_range, b.collide_horizontal_distance as sub_collide_horizontal_distance, b.collide_vertical_distance as sub_collide_vertical_distance, b.collide_state as sub_collide_state
|
|
from dev_tower_data_collide a
|
|
left join dev_tower_data_collide_detail b on b.collide_id = a.id
|
|
where a.id = #{id}
|
|
</select>
|
|
|
|
<insert id="insertDevTowerDataCollide" parameterType="DevTowerDataCollide" useGeneratedKeys="true" keyProperty="id">
|
|
insert into dev_tower_data_collide
|
|
<trim prefix="(" suffix=")" suffixOverrides=",">
|
|
<if test="cfgId != null">cfg_id,</if>
|
|
<if test="projectId != null">project_id,</if>
|
|
<if test="deptId != null">dept_id,</if>
|
|
<if test="deviceKey != null">device_key,</if>
|
|
<if test="deviceSource != null">device_source,</if>
|
|
<if test="towerId != null">tower_id,</if>
|
|
<if test="coordinateX != null">coordinate_x,</if>
|
|
<if test="coordinateY != null">coordinate_y,</if>
|
|
<if test="frontBrachium != null">front_brachium,</if>
|
|
<if test="afterBrachium != null">after_brachium,</if>
|
|
<if test="towerBodyHeight != null">tower_body_height,</if>
|
|
<if test="height != null">height,</if>
|
|
<if test="angle != null">angle,</if>
|
|
<if test="range != null">`range`,</if>
|
|
<if test="earlyWarningDistance != null">early_warning_distance,</if>
|
|
<if test="alarmWarningDistance != null">alarm_warning_distance,</if>
|
|
<if test="contourValue != null">contour_value,</if>
|
|
<if test="isDel != null">is_del,</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="remark != null">remark,</if>
|
|
</trim>
|
|
<trim prefix="values (" suffix=")" suffixOverrides=",">
|
|
<if test="cfgId != null">#{cfgId},</if>
|
|
<if test="projectId != null">#{projectId},</if>
|
|
<if test="deptId != null">#{deptId},</if>
|
|
<if test="deviceKey != null">#{deviceKey},</if>
|
|
<if test="deviceSource != null">#{deviceSource},</if>
|
|
<if test="towerId != null">#{towerId},</if>
|
|
<if test="coordinateX != null">#{coordinateX},</if>
|
|
<if test="coordinateY != null">#{coordinateY},</if>
|
|
<if test="frontBrachium != null">#{frontBrachium},</if>
|
|
<if test="afterBrachium != null">#{afterBrachium},</if>
|
|
<if test="towerBodyHeight != null">#{towerBodyHeight},</if>
|
|
<if test="height != null">#{height},</if>
|
|
<if test="angle != null">#{angle},</if>
|
|
<if test="range != null">#{range},</if>
|
|
<if test="earlyWarningDistance != null">#{earlyWarningDistance},</if>
|
|
<if test="alarmWarningDistance != null">#{alarmWarningDistance},</if>
|
|
<if test="contourValue != null">#{contourValue},</if>
|
|
<if test="isDel != null">#{isDel},</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="remark != null">#{remark},</if>
|
|
</trim>
|
|
</insert>
|
|
|
|
<update id="updateDevTowerDataCollide" parameterType="DevTowerDataCollide">
|
|
update dev_tower_data_collide
|
|
<trim prefix="SET" suffixOverrides=",">
|
|
<if test="cfgId != null">cfg_id = #{cfgId},</if>
|
|
<if test="projectId != null">project_id = #{projectId},</if>
|
|
<if test="deptId != null">dept_id = #{deptId},</if>
|
|
<if test="deviceKey != null">device_key = #{deviceKey},</if>
|
|
<if test="deviceSource != null">device_source = #{deviceSource},</if>
|
|
<if test="towerId != null">tower_id = #{towerId},</if>
|
|
<if test="coordinateX != null">coordinate_x = #{coordinateX},</if>
|
|
<if test="coordinateY != null">coordinate_y = #{coordinateY},</if>
|
|
<if test="frontBrachium != null">front_brachium = #{frontBrachium},</if>
|
|
<if test="afterBrachium != null">after_brachium = #{afterBrachium},</if>
|
|
<if test="towerBodyHeight != null">tower_body_height = #{towerBodyHeight},</if>
|
|
<if test="height != null">height = #{height},</if>
|
|
<if test="angle != null">angle = #{angle},</if>
|
|
<if test="range != null">`range` = #{range},</if>
|
|
<if test="earlyWarningDistance != null">early_warning_distance = #{earlyWarningDistance},</if>
|
|
<if test="alarmWarningDistance != null">alarm_warning_distance = #{alarmWarningDistance},</if>
|
|
<if test="contourValue != null">contour_value = #{contourValue},</if>
|
|
<if test="isDel != null">is_del = #{isDel},</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="remark != null">remark = #{remark},</if>
|
|
</trim>
|
|
where id = #{id}
|
|
</update>
|
|
|
|
<delete id="deleteDevTowerDataCollideById" parameterType="Long">
|
|
delete from dev_tower_data_collide where id = #{id}
|
|
</delete>
|
|
|
|
<delete id="deleteDevTowerDataCollideByIds" parameterType="String">
|
|
delete from dev_tower_data_collide where id in
|
|
<foreach item="id" collection="array" open="(" separator="," close=")">
|
|
#{id}
|
|
</foreach>
|
|
</delete>
|
|
|
|
<delete id="deleteDevTowerDataCollideDetailByCollideIds" parameterType="String">
|
|
delete from dev_tower_data_collide_detail where collide_id in
|
|
<foreach item="collideId" collection="array" open="(" separator="," close=")">
|
|
#{collideId}
|
|
</foreach>
|
|
</delete>
|
|
|
|
<delete id="deleteDevTowerDataCollideDetailByCollideId" parameterType="Long">
|
|
delete from dev_tower_data_collide_detail where collide_id = #{collideId}
|
|
</delete>
|
|
|
|
<insert id="batchDevTowerDataCollideDetail">
|
|
insert into dev_tower_data_collide_detail( id, collide_id, device_key, device_source, tower_id, coordinate_x, coordinate_y, front_brachium, after_brachium, tower_body_height, height, angle, range, collide_horizontal_distance, collide_vertical_distance, collide_state) values
|
|
<foreach item="item" index="index" collection="list" separator=",">
|
|
( #{item.id}, #{item.collideId}, #{item.deviceKey}, #{item.deviceSource}, #{item.towerId}, #{item.coordinateX}, #{item.coordinateY}, #{item.frontBrachium}, #{item.afterBrachium}, #{item.towerBodyHeight}, #{item.height}, #{item.angle}, #{item.range}, #{item.collideHorizontalDistance}, #{item.collideVerticalDistance}, #{item.collideState})
|
|
</foreach>
|
|
</insert>
|
|
|
|
<select id="findCollideCountByDeviceKey" parameterType="DevTowerDataRound" resultType="Int">
|
|
select count(1) as total from dev_tower_data_collide
|
|
<where>
|
|
<if test="deviceKey != null and deviceKey != ''">and cfg_id = (select dc.id from dev_tower_project_config dc where dc.device_sn=#{deviceKey}) and device_key = #{deviceKey}</if>
|
|
<if test="params.beginCreateTime != null and params.beginCreateTime != '' and params.endCreateTime != null and params.endCreateTime != ''"> and date(create_time) between #{params.beginCreateTime} and #{params.endCreateTime}</if>
|
|
</where>
|
|
</select>
|
|
|
|
</mapper> |