2025-04-15 10:41:27 +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.bonus.base.basic.mapper.CollectDeviceMapper">
|
|
|
|
|
<insert id="insertData">
|
|
|
|
|
INSERT INTO tb_collect_device(
|
|
|
|
|
id, dev_name, dev_type_id, dev_code,
|
|
|
|
|
dev_type, is_active, is_online,dev_location, background_image, remark,
|
2025-04-16 11:07:25 +08:00
|
|
|
config_data, del_flag, create_time,update_time, const_id
|
2025-04-15 10:41:27 +08:00
|
|
|
)values (#{id},#{devName},#{typeId},#{devCode},#{devType} ,#{isActive},#{isOnline},#{devLocation},#{backImage},
|
|
|
|
|
#{remark},#{configData},0,now(),now(),#{constId} )
|
|
|
|
|
|
|
|
|
|
</insert>
|
|
|
|
|
<insert id="addAttrData">
|
|
|
|
|
INSERT INTO tb_collect_device_attr(
|
|
|
|
|
dev_id, attr_id,attr_name,remark,
|
|
|
|
|
data_type, unit, attr_code, attr_val, create_time,
|
2025-04-16 11:07:25 +08:00
|
|
|
update_time, max_value, min_value,change_val ,is_warn
|
2025-04-15 10:41:27 +08:00
|
|
|
)values (#{devId},#{attrId},#{attrName},#{remark},#{dataType},#{unit},#{attrCode},
|
2025-04-16 11:07:25 +08:00
|
|
|
#{attrVal},now(),#{updateTime},#{maxVal},#{minVal},#{changeVal},#{isWarn})
|
2025-04-15 10:41:27 +08:00
|
|
|
|
|
|
|
|
</insert>
|
|
|
|
|
<update id="updateData">
|
|
|
|
|
update tb_collect_device set
|
|
|
|
|
dev_name=#{devName}, dev_type_id=#{typeId}, dev_code=#{devCode},
|
|
|
|
|
dev_type=#{devType}, is_active=#{isActive}, is_online=#{isOnline},dev_location=#{devLocation},
|
|
|
|
|
background_image=#{backImage}, remark=#{remark},
|
2025-04-16 11:07:25 +08:00
|
|
|
config_data=#{configData},update_time=#{updateTime}, const_id=#{constId}
|
2025-04-15 10:41:27 +08:00
|
|
|
where id=#{id}
|
|
|
|
|
</update>
|
|
|
|
|
<update id="updateAttrData">
|
|
|
|
|
update tb_collect_device_attr set attr_name=#{attrName},remark=#{remark},
|
|
|
|
|
data_type=#{dataType}, unit=#{unit}, attr_code=#{attrCode}, attr_val=#{attrVal},
|
2025-04-16 11:07:25 +08:00
|
|
|
update_time=now(), max_value=#{maxVal}, min_value=#{minVal},change_val=#{changeVal},is_warn=#{isWarn}
|
2025-04-15 10:41:27 +08:00
|
|
|
where attr_id=#{attrId}
|
|
|
|
|
</update>
|
|
|
|
|
<update id="delData">
|
|
|
|
|
update tb_collect_device set del_flag=1,update_time=now()
|
|
|
|
|
where id=#{id}
|
|
|
|
|
</update>
|
|
|
|
|
<delete id="delDataAttr">
|
|
|
|
|
delete from tb_collect_device_attr where attr_id=#{attrId}
|
|
|
|
|
|
|
|
|
|
</delete>
|
|
|
|
|
|
|
|
|
|
<select id="getPageList" resultType="com.bonus.base.basic.domain.CollectDevVo">
|
|
|
|
|
SELECT tcd.id,tcd.dev_name devName ,tcd.dev_type_id typeId,tcd.dev_code devCode,tdt.type_name devType ,tcd.is_active isActive,
|
|
|
|
|
tcd.is_online onLione ,tcd.dev_location devLocation ,tcd.background_image backImage ,tcd.remark,tcd.config_data configData,
|
|
|
|
|
tcd.create_time createTime ,tcd.update_time updateTime ,tcd.const_id constId ,tci.`name` constName,
|
|
|
|
|
tdt.type_code typeCode
|
|
|
|
|
from tb_collect_device tcd
|
|
|
|
|
left join tb_dev_type tdt on tdt.id=tcd.dev_type_id
|
|
|
|
|
left join tb_const_info tci on tci.id =tcd.const_id
|
|
|
|
|
where tcd.del_flag=0
|
|
|
|
|
<if test="typeId!=null and typeId!=''">
|
|
|
|
|
and tcd.dev_type_id=#{typeId}
|
|
|
|
|
</if>
|
|
|
|
|
<if test="devCode!=null and devCode!=''">
|
|
|
|
|
and tcd.dev_code=#{devCode}
|
|
|
|
|
</if>
|
|
|
|
|
<if test="devName!=null and devName!=''">
|
|
|
|
|
and tcd.dev_name=#{devName}
|
|
|
|
|
</if>
|
|
|
|
|
<if test="keyWord!=null and keyWord!=''">
|
|
|
|
|
and (tcd.dev_code like concat('%',#{keyWord},'%') or
|
2025-04-16 11:07:25 +08:00
|
|
|
tcd.dev_name like concat('%',#{keyWord},'%') or
|
2025-04-15 10:41:27 +08:00
|
|
|
)
|
|
|
|
|
</if>
|
|
|
|
|
|
|
|
|
|
</select>
|
|
|
|
|
<select id="getDataNumByParam" resultType="java.lang.Integer">
|
|
|
|
|
select count(1)
|
|
|
|
|
from tb_collect_device tcd
|
|
|
|
|
where del_flag=0
|
|
|
|
|
<if test="param.id!=null and param.id!=''">
|
|
|
|
|
and id!=#{param.id}
|
|
|
|
|
</if>
|
|
|
|
|
<if test='type=="1"'>
|
|
|
|
|
and tcd.dev_code=#{param.devCode}
|
|
|
|
|
</if>
|
|
|
|
|
|
|
|
|
|
</select>
|
|
|
|
|
<select id="getAttrDataById" resultType="java.lang.Integer">
|
|
|
|
|
select count(1)
|
|
|
|
|
FROM tb_collect_device_attr
|
|
|
|
|
WHERE dev_id=#{param.devId}
|
|
|
|
|
<if test="param.attrId!=null and param.attrId!=''">
|
|
|
|
|
and attr_id!=#{param.attrId}
|
|
|
|
|
</if>
|
|
|
|
|
<if test='type=="1"'>
|
|
|
|
|
and attr_code=#{param.attrCode}
|
|
|
|
|
</if>
|
|
|
|
|
<if test='type=="2"'>
|
|
|
|
|
and attr_name=#{param.attrName}
|
|
|
|
|
</if>
|
|
|
|
|
</select>
|
|
|
|
|
<select id="getAttrPageList" resultType="com.bonus.base.basic.domain.CollectDevAttrVo">
|
|
|
|
|
select dev_id devId, attr_id attrId, attr_name attrName,
|
|
|
|
|
remark, data_type dataType, unit,
|
|
|
|
|
attr_code attrCode, attr_val attrVal,
|
|
|
|
|
create_time createTime, update_time updateTime,
|
2025-04-16 11:07:25 +08:00
|
|
|
max_value maxVal, min_value minVal,change_val changeVal,is_warn isWarn
|
2025-04-15 10:41:27 +08:00
|
|
|
from tb_collect_device_attr
|
|
|
|
|
where dev_id=#{devId}
|
|
|
|
|
<if test="attrName!=null and attrName!=''">
|
|
|
|
|
and attr_name like concat('%',#{attrName},'%')
|
|
|
|
|
</if>
|
|
|
|
|
<if test="attrCode!=null and attrCode!=''">
|
|
|
|
|
and attr_code like concat('%',#{attrCode},'%')
|
|
|
|
|
</if>
|
|
|
|
|
<if test="keyWord!=null and keyWord!=''">
|
|
|
|
|
and (attr_name like concat('%',#{keyWord},'%') or
|
|
|
|
|
attr_code like concat('%',#{keyWord},'%')
|
|
|
|
|
)
|
|
|
|
|
</if>
|
|
|
|
|
|
|
|
|
|
</select>
|
|
|
|
|
<select id="queryDetail" resultType="com.bonus.base.basic.domain.CollectDevVo">
|
|
|
|
|
SELECT tcd.id,tcd.dev_name devName ,tcd.dev_type_id typeId,tcd.dev_code devCode,tdt.type_name devType ,tcd.is_active isActive,
|
|
|
|
|
tcd.is_online onLione ,tcd.dev_location devLocation ,tcd.background_image backImage ,tcd.remark,tcd.config_data configData,
|
|
|
|
|
tcd.create_time createTime ,tcd.update_time updateTime ,tcd.const_id constId ,tci.`name` constName,
|
|
|
|
|
tdt.type_code typeCode
|
|
|
|
|
from tb_collect_device tcd
|
|
|
|
|
left join tb_dev_type tdt on tdt.id=tcd.dev_type_id
|
|
|
|
|
left join tb_const_info tci on tci.id =tcd.const_id
|
|
|
|
|
where tcd.del_flag=0 and tcd.id=#{id}
|
|
|
|
|
|
|
|
|
|
</select>
|
|
|
|
|
<select id="queryAttrDetail" resultType="com.bonus.base.basic.domain.CollectDevAttrVo">
|
|
|
|
|
select dev_id devId, attr_id attrId, attr_name attrName,
|
|
|
|
|
remark, data_type dataType, unit,
|
|
|
|
|
attr_code attrCode, attr_val attrVal,
|
|
|
|
|
create_time createTime, update_time updateTime,
|
2025-04-16 11:07:25 +08:00
|
|
|
max_value maxVal, min_value minVal,change_val changeVal,is_warn isWarn
|
2025-04-15 10:41:27 +08:00
|
|
|
from tb_collect_device_attr
|
|
|
|
|
where attr_id=#{attrId}
|
|
|
|
|
</select>
|
|
|
|
|
<select id="queryBdSelected" resultType="com.bonus.base.basic.domain.BdDevVo">
|
|
|
|
|
select id bdId,bd_name bdName,bd_code bdCode, del_flag
|
|
|
|
|
from tb_bd_device
|
|
|
|
|
where del_flag=0
|
|
|
|
|
|
|
|
|
|
</select>
|
|
|
|
|
</mapper>
|