2025-03-16 23:29:04 +08:00
<?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.device.mapper.DevTowerDataRoundMapper" >
<resultMap type= "DevTowerDataRound" id= "DevTowerDataRoundResult" >
<result property= "id" column= "id" />
<result property= "cfgId" column= "cfg_id" />
<result property= "projectId" column= "project_id" />
<result property= "projectName" column= "projectName" />
<result property= "comId" column= "com_id" />
2025-03-22 19:04:33 +08:00
<result property= "deptId" column= "dept_id" />
<result property= "deptName" column= "dept_name" />
2025-03-16 23:29:04 +08:00
<result property= "comName" column= "com_name" />
<result property= "deviceKey" column= "device_key" />
<result property= "deviceSource" column= "device_source" />
<result property= "towerId" column= "tower_id" />
<result property= "workStartTime" column= "work_start_time" />
<result property= "workEndTime" column= "work_end_time" />
<result property= "minHeight" column= "min_height" />
<result property= "maxHeight" column= "max_height" />
<result property= "minRange" column= "min_range" />
<result property= "maxRange" column= "max_range" />
<result property= "startHeight" column= "start_height" />
<result property= "endHeight" column= "end_height" />
<result property= "startRange" column= "start_range" />
<result property= "endRange" column= "end_range" />
<result property= "startRotation" column= "start_rotation" />
<result property= "endRotation" column= "end_rotation" />
<result property= "maxLoad" column= "max_load" />
<result property= "maxLoadPercent" column= "max_load_percent" />
<result property= "maxMoment" column= "max_moment" />
<result property= "maxMomentPercent" column= "max_moment_percent" />
<result property= "startWindSpeed" column= "start_wind_speed" />
<result property= "endWindSpeed" column= "end_wind_speed" />
<result property= "startWindSpeedPercent" column= "start_wind_speed_percent" />
<result property= "endWindSpeedPercent" column= "end_wind_speed_percent" />
<result property= "startLeanAngleX" column= "start_lean_angle_x" />
<result property= "endLeanAngleX" column= "end_lean_angle_x" />
<result property= "startLeanAngleY" column= "start_lean_angle_y" />
<result property= "endLeanAngleY" column= "end_lean_angle_y" />
<result property= "warnings" column= "warnings" />
<result property= "isAlarm" column= "is_alarm" />
<result property= "isOverload" column= "is_overload" />
<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>
<sql id= "selectDevTowerDataRoundVo" >
select dtdr.id,
dtdr.cfg_id,
dtdr.project_id,
dtdr.com_id,
sp.dept_name projectName,
2025-03-22 19:04:33 +08:00
sd.dept_name com_name,dtdr.dept_id,pd.sub_dept_name dept_name,
2025-03-16 23:29:04 +08:00
dtdr.device_key,
dtdr.device_source,
dtdr.tower_id,
dtdr.work_start_time,
dtdr.work_end_time,
dtdr.min_height,
dtdr.max_height,
dtdr.min_range,
dtdr.max_range,
dtdr.start_height,
dtdr.end_height,
dtdr.start_range,
dtdr.end_range,
dtdr.start_rotation,
dtdr.end_rotation,
dtdr.max_load,
dtdr.max_load_percent,
dtdr.max_moment,
dtdr.max_moment_percent,
dtdr.start_wind_speed,
dtdr.end_wind_speed,
dtdr.start_wind_speed_percent,
dtdr.end_wind_speed_percent,
dtdr.start_lean_angle_x,
dtdr.end_lean_angle_x,
dtdr.start_lean_angle_y,
dtdr.end_lean_angle_y,
dtdr.warnings,
dtdr.is_alarm,
dtdr.is_del,
dtdr.create_by,
dtdr.create_time,
dtdr.update_by,
dtdr.update_time,
dtdr.remark
from dev_tower_data_round dtdr
left join sys_dept sp on sp.dept_id = dtdr.project_id
left join sys_dept sd on sd.dept_id = dtdr.com_id
2025-03-22 19:04:33 +08:00
left join pro_project_info_subdepts pd on pd.id=dtdr.dept_id
2025-03-16 23:29:04 +08:00
</sql>
<select id= "selectDevTowerDataRoundList" parameterType= "DevTowerDataRound" resultMap= "DevTowerDataRoundResult" >
<include refid= "selectDevTowerDataRoundVo" />
<where >
<if test= "cfgId != null" > and dtdr.cfg_id = #{cfgId}</if>
<if test= "projectId != null " > and dtdr.project_id = #{projectId}</if>
<if test= "comId != null " > and dtdr.com_id = #{comId}</if>
2025-03-22 19:04:33 +08:00
<if test= "deptId != null " > and dtdr.dept_id = #{deptId}</if>
2025-03-16 23:29:04 +08:00
<if test= "projectName != null and projectName != ''" > and dtdr.project_id in (select spv.dept_id from sys_dept spv where spv.dept_name like concat('%', #{projectName}, '%'))</if>
<if test= "comName != null and comName != ''" > and dtdr.dept_id in (select sdv.dept_id from sys_dept sdv where sdv.dept_name like concat('%', #{comName}, '%'))</if>
<if test= "deviceKey != null and deviceKey != ''" > and dtdr.device_key = #{deviceKey}</if>
<if test= "deviceSource != null and deviceSource != ''" > and dtdr.device_source = #{deviceSource}</if>
<if test= "towerId != null and towerId != ''" > and dtdr.tower_id = #{towerId}</if>
<if test= "params.beginCreateTime != null and params.beginCreateTime != '' and params.endCreateTime != null and params.endCreateTime != ''" > and dtdr.create_time between #{params.beginCreateTime} and #{params.endCreateTime}</if>
</where>
order by dtdr.id desc
</select>
<select id= "selectDevTowerDataRoundById" parameterType= "Long" resultMap= "DevTowerDataRoundResult" >
<include refid= "selectDevTowerDataRoundVo" />
where dtdr.id = #{id}
</select>
<insert id= "insertDevTowerDataRound" parameterType= "DevTowerDataRound" useGeneratedKeys= "true" keyProperty= "id" >
insert into dev_tower_data_round
<trim prefix= "(" suffix= ")" suffixOverrides= "," >
<if test= "cfgId != null" > cfg_id,</if>
<if test= "projectId != null" > project_id,</if>
<if test= "comId != null" > com_id,</if>
2025-03-22 19:04:33 +08:00
<if test= "deptId != null" > dept_id,</if>
2025-03-16 23:29:04 +08:00
<if test= "deviceKey != null" > device_key,</if>
<if test= "deviceSource != null" > device_source,</if>
<if test= "towerId != null" > tower_id,</if>
<if test= "workStartTime != null" > work_start_time,</if>
<if test= "workEndTime != null" > work_end_time,</if>
<if test= "minHeight != null" > min_height,</if>
<if test= "maxHeight != null" > max_height,</if>
<if test= "minRange != null" > min_range,</if>
<if test= "maxRange != null" > max_range,</if>
<if test= "startHeight != null" > start_height,</if>
<if test= "endHeight != null" > end_height,</if>
<if test= "startRange != null" > start_range,</if>
<if test= "endRange != null" > end_range,</if>
<if test= "startRotation != null" > start_rotation,</if>
<if test= "endRotation != null" > end_rotation,</if>
<if test= "maxLoad != null" > max_load,</if>
<if test= "maxLoadPercent != null" > max_load_percent,</if>
<if test= "maxMoment != null" > max_moment,</if>
<if test= "maxMomentPercent != null" > max_moment_percent,</if>
<if test= "startWindSpeed != null" > start_wind_speed,</if>
<if test= "endWindSpeed != null" > end_wind_speed,</if>
<if test= "startWindSpeedPercent != null" > start_wind_speed_percent,</if>
<if test= "endWindSpeedPercent != null" > end_wind_speed_percent,</if>
<if test= "startLeanAngleX != null" > start_lean_angle_x,</if>
<if test= "endLeanAngleX != null" > end_lean_angle_x,</if>
<if test= "startLeanAngleY != null" > start_lean_angle_y,</if>
<if test= "endLeanAngleY != null" > end_lean_angle_y,</if>
<if test= "warnings != null" > warnings,</if>
<if test= "isAlarm != null" > is_alarm,</if>
<if test= "isOverload != null" > is_overload,</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= "comId != null" > #{comId},</if>
2025-03-22 19:04:33 +08:00
<if test= "deptId != null" > #{deptId},</if>
2025-03-16 23:29:04 +08:00
<if test= "deviceKey != null" > #{deviceKey},</if>
<if test= "deviceSource != null" > #{deviceSource},</if>
<if test= "towerId != null" > #{towerId},</if>
<if test= "workStartTime != null" > #{workStartTime},</if>
<if test= "workEndTime != null" > #{workEndTime},</if>
<if test= "minHeight != null" > #{minHeight},</if>
<if test= "maxHeight != null" > #{maxHeight},</if>
<if test= "minRange != null" > #{minRange},</if>
<if test= "maxRange != null" > #{maxRange},</if>
<if test= "startHeight != null" > #{startHeight},</if>
<if test= "endHeight != null" > #{endHeight},</if>
<if test= "startRange != null" > #{startRange},</if>
<if test= "endRange != null" > #{endRange},</if>
<if test= "startRotation != null" > #{startRotation},</if>
<if test= "endRotation != null" > #{endRotation},</if>
<if test= "maxLoad != null" > #{maxLoad},</if>
<if test= "maxLoadPercent != null" > #{maxLoadPercent},</if>
<if test= "maxMoment != null" > #{maxMoment},</if>
<if test= "maxMomentPercent != null" > #{maxMomentPercent},</if>
<if test= "startWindSpeed != null" > #{startWindSpeed},</if>
<if test= "endWindSpeed != null" > #{endWindSpeed},</if>
<if test= "startWindSpeedPercent != null" > #{startWindSpeedPercent},</if>
<if test= "endWindSpeedPercent != null" > #{endWindSpeedPercent},</if>
<if test= "startLeanAngleX != null" > #{startLeanAngleX},</if>
<if test= "endLeanAngleX != null" > #{endLeanAngleX},</if>
<if test= "startLeanAngleY != null" > #{startLeanAngleY},</if>
<if test= "endLeanAngleY != null" > #{endLeanAngleY},</if>
<if test= "warnings != null" > #{warnings},</if>
<if test= "isAlarm != null" > #{isAlarm},</if>
<if test= "isOverload != null" > #{isOverload},</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= "updateDevTowerDataRound" parameterType= "DevTowerDataRound" >
update dev_tower_data_round
<trim prefix= "SET" suffixOverrides= "," >
<if test= "cfgId != null" > cfg_id = #{cfgId},</if>
<if test= "projectId != null" > project_id = #{projectId},</if>
<if test= "comId != null" > com_id = #{comId},</if>
2025-03-22 19:04:33 +08:00
<if test= "deptId != null" > dept_id = #{deptId},</if>
2025-03-16 23:29:04 +08:00
<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= "workStartTime != null" > work_start_time = #{workStartTime},</if>
<if test= "workEndTime != null" > work_end_time = #{workEndTime},</if>
<if test= "minHeight != null" > min_height = #{minHeight},</if>
<if test= "maxHeight != null" > max_height = #{maxHeight},</if>
<if test= "minRange != null" > min_range = #{minRange},</if>
<if test= "maxRange != null" > max_range = #{maxRange},</if>
<if test= "startHeight != null" > start_height = #{startHeight},</if>
<if test= "endHeight != null" > end_height = #{endHeight},</if>
<if test= "startRange != null" > start_range = #{startRange},</if>
<if test= "endRange != null" > end_range = #{endRange},</if>
<if test= "startRotation != null" > start_rotation = #{startRotation},</if>
<if test= "endRotation != null" > end_rotation = #{endRotation},</if>
<if test= "maxLoad != null" > max_load = #{maxLoad},</if>
<if test= "maxLoadPercent != null" > max_load_percent = #{maxLoadPercent},</if>
<if test= "maxMoment != null" > max_moment = #{maxMoment},</if>
<if test= "maxMomentPercent != null" > max_moment_percent = #{maxMomentPercent},</if>
<if test= "startWindSpeed != null" > start_wind_speed = #{startWindSpeed},</if>
<if test= "endWindSpeed != null" > end_wind_speed = #{endWindSpeed},</if>
<if test= "startWindSpeedPercent != null" > start_wind_speed_percent = #{startWindSpeedPercent},</if>
<if test= "endWindSpeedPercent != null" > end_wind_speed_percent = #{endWindSpeedPercent},</if>
<if test= "startLeanAngleX != null" > start_lean_angle_x = #{startLeanAngleX},</if>
<if test= "endLeanAngleX != null" > end_lean_angle_x = #{endLeanAngleX},</if>
<if test= "startLeanAngleY != null" > start_lean_angle_y = #{startLeanAngleY},</if>
<if test= "endLeanAngleY != null" > end_lean_angle_y = #{endLeanAngleY},</if>
<if test= "warnings != null" > warnings = #{warnings},</if>
<if test= "isAlarm != null" > is_alarm = #{isAlarm},</if>
<if test= "isOverload != null" > is_overload = #{isOverload},</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= "deleteDevTowerDataRoundById" parameterType= "Long" >
delete from dev_tower_data_round where id = #{id}
</delete>
<delete id= "deleteDevTowerDataRoundByIds" parameterType= "String" >
delete from dev_tower_data_round where id in
<foreach item= "id" collection= "array" open= "(" separator= "," close= ")" >
#{id}
</foreach>
</delete>
<select id= "findRoundCountByDeviceKey" parameterType= "DevTowerDataRound" resultType= "Int" >
select count(1) as total from dev_tower_data_round
<where >
2025-03-22 19:04:33 +08:00
<if test= "deviceKey != null and deviceKey != ''" > and cfg_id in (select dc.id from dev_tower_project_config dc where dc.device_sn=#{deviceKey}) and device_key = #{deviceKey}</if>
2025-03-16 23:29:04 +08:00
<if test= 'activeName == "cz"' > and is_overload = 1 </if>
<if test= 'activeName == "gj"' > and is_alarm = 1 </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>