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.DevTowerDataWarningMapper" >
<resultMap type= "DevTowerDataWarning" id= "DevTowerDataWarningResult" >
<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" />
<result property= "comName" column= "com_name" />
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= "deviceKey" column= "device_key" />
<result property= "deviceSource" column= "device_source" />
<result property= "towerId" column= "tower_id" />
<result property= "warnType" column= "warn_type" />
<result property= "warnName" column= "warn_name" />
<result property= "warnNote" column= "warn_note" />
<result property= "warnData" column= "warn_data" />
<result property= "realData" column= "real_data" />
<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= "selectDevTowerDataWarningVo" >
select dtdw.id,
dtdw.cfg_id,
dtdw.project_id,
dtdw.com_id,
sp.dept_name projectName,
2025-03-22 19:04:33 +08:00
sd.dept_name com_name,dtdw.dept_id,pd.sub_dept_name dept_name,
2025-03-16 23:29:04 +08:00
dtdw.device_key,
dtdw.device_source,
dtdw.tower_id,
dtdw.warn_type,
dtdw.warn_name,
dtdw.warn_note,
dtdw.warn_data,
dtdw.real_data,
dtdw.is_del,
dtdw.create_by,
dtdw.create_time,
dtdw.update_by,
dtdw.update_time,
dtdw.remark
from dev_tower_data_warning dtdw
left join sys_dept sp on sp.dept_id = dtdw.project_id
left join sys_dept sd on sd.dept_id = dtdw.com_id
2025-03-22 19:04:33 +08:00
left join pro_project_info_subdepts pd on pd.id=dtdw.dept_id
2025-03-16 23:29:04 +08:00
</sql>
<select id= "selectDevTowerDataWarningList" parameterType= "DevTowerDataWarning" resultMap= "DevTowerDataWarningResult" >
<include refid= "selectDevTowerDataWarningVo" />
<where >
<if test= "cfgId != null" > and dtdw.cfg_id = #{cfgId}</if>
<if test= "projectId != null " > and dtdw.project_id = #{projectId}</if>
<if test= "comId != null " > and dtdw.com_id = #{comId}</if>
2025-03-22 19:04:33 +08:00
<if test= "deptId != null " > and dtdw.dept_id = #{deptId}</if>
2025-03-16 23:29:04 +08:00
<if test= "projectName != null and projectName != ''" > and dtdw.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 dtdw.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 dtdw.device_key = #{deviceKey}</if>
<if test= "deviceSource != null and deviceSource != ''" > and dtdw.device_source = #{deviceSource}</if>
<if test= "towerId != null and towerId != ''" > and dtdw.tower_id = #{towerId}</if>
<if test= "warnType != null " > and dtdw.warn_type = #{warnType}</if>
<if test= "params.beginCreateTime != null and params.beginCreateTime != '' and params.endCreateTime != null and params.endCreateTime != ''" > and dtdw.create_time between #{params.beginCreateTime} and #{params.endCreateTime}</if>
</where>
order by dtdw.id desc
</select>
<select id= "selectDevTowerDataWarningById" parameterType= "Long" resultMap= "DevTowerDataWarningResult" >
<include refid= "selectDevTowerDataWarningVo" />
where dtdw.id = #{id}
</select>
<insert id= "insertDevTowerDataWarning" parameterType= "DevTowerDataWarning" useGeneratedKeys= "true" keyProperty= "id" >
insert into dev_tower_data_warning
<trim prefix= "(" suffix= ")" suffixOverrides= "," >
<if test= "projectId != null" > project_id,</if>
<if test= "cfgId != null" > cfg_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= "warnType != null" > warn_type,</if>
<if test= "warnName != null" > warn_name,</if>
<if test= "warnNote != null" > warn_note,</if>
<if test= "warnData != null" > warn_data,</if>
<if test= "realData != null" > real_data,</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= "warnType != null" > #{warnType},</if>
<if test= "warnName != null" > #{warnName},</if>
<if test= "warnNote != null" > #{warnNote},</if>
<if test= "warnData != null" > #{warnData},</if>
<if test= "realData != null" > #{realData},</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= "updateDevTowerDataWarning" parameterType= "DevTowerDataWarning" >
update dev_tower_data_warning
<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= "warnType != null" > warn_type = #{warnType},</if>
<if test= "warnName != null" > warn_name = #{warnName},</if>
<if test= "warnNote != null" > warn_note = #{warnNote},</if>
<if test= "warnData != null" > warn_data = #{warnData},</if>
<if test= "realData != null" > real_data = #{realData},</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= "deleteDevTowerDataWarningById" parameterType= "Long" >
delete from dev_tower_data_warning where id = #{id}
</delete>
<delete id= "deleteDevTowerDataWarningByIds" parameterType= "String" >
delete from dev_tower_data_warning where id in
<foreach item= "id" collection= "array" open= "(" separator= "," close= ")" >
#{id}
</foreach>
</delete>
</mapper>