|
@@ -33,242 +33,254 @@
|
|
</if>
|
|
</if>
|
|
</sql>
|
|
</sql>
|
|
|
|
|
|
- <sql id="Base_Column_List">
|
|
|
|
- <!--@mbg.generated-->
|
|
|
|
- id, tenant_id, company_org_id, dept_org_id, product_id, `name`, attribute_id, `desc`, alarm_category, enabled,
|
|
|
|
- alarm_rule_num, days, times,`status`, create_date, create_by, update_date, update_by, iot_alarm_id
|
|
|
|
- </sql>
|
|
|
|
- <insert id="insertSelective" keyColumn="id" keyProperty="id" parameterType="com.bz.zoneiot.water.core.entity.AlarmType" useGeneratedKeys="true">
|
|
|
|
- <!--@mbg.generated-->
|
|
|
|
- insert into sms_alarm_type
|
|
|
|
- <trim prefix="(" suffix=")" suffixOverrides=",">
|
|
|
|
- <if test="tenantId != null">
|
|
|
|
- tenant_id,
|
|
|
|
- </if>
|
|
|
|
- <if test="attributeId != null">
|
|
|
|
- attribute_id,
|
|
|
|
- </if>
|
|
|
|
- <if test="customerId != null">
|
|
|
|
- customer_id,
|
|
|
|
- </if>
|
|
|
|
- <if test="sceneType != null">
|
|
|
|
- scene_type,
|
|
|
|
- </if>
|
|
|
|
- <if test="deviceId != null">
|
|
|
|
- device_id,
|
|
|
|
- </if>
|
|
|
|
- <if test="iotAlarmId != null">
|
|
|
|
- iot_alarm_id,
|
|
|
|
- </if>
|
|
|
|
- <if test="companyOrgId != null">
|
|
|
|
- company_org_id,
|
|
|
|
- </if>
|
|
|
|
- <if test="deptOrgId != null">
|
|
|
|
- dept_org_id,
|
|
|
|
- </if>
|
|
|
|
- <if test="productId != null">
|
|
|
|
- product_id,
|
|
|
|
- </if>
|
|
|
|
- <if test="name != null">
|
|
|
|
- `name`,
|
|
|
|
- </if>
|
|
|
|
- <if test="code != null">
|
|
|
|
- code,
|
|
|
|
- </if>
|
|
|
|
- <if test="desc != null">
|
|
|
|
- `desc`,
|
|
|
|
- </if>
|
|
|
|
- <if test="days != null">
|
|
|
|
- `days`,
|
|
|
|
- </if>
|
|
|
|
- <if test="times != null">
|
|
|
|
- `times`,
|
|
|
|
- </if>
|
|
|
|
- <if test="alarmCategory != null">
|
|
|
|
- alarm_category,
|
|
|
|
- </if>
|
|
|
|
- <if test="enabled != null">
|
|
|
|
- enabled,
|
|
|
|
- </if>
|
|
|
|
- <if test="alarmRuleNum != null">
|
|
|
|
- alarm_rule_num,
|
|
|
|
- </if>
|
|
|
|
- <if test="status != null">
|
|
|
|
- `status`,
|
|
|
|
- </if>
|
|
|
|
- <if test="createDate != null">
|
|
|
|
- create_date,
|
|
|
|
- </if>
|
|
|
|
- <if test="createBy != null">
|
|
|
|
- create_by,
|
|
|
|
- </if>
|
|
|
|
- <if test="updateDate != null">
|
|
|
|
- update_date,
|
|
|
|
- </if>
|
|
|
|
- <if test="updateBy != null">
|
|
|
|
- update_by,
|
|
|
|
- </if>
|
|
|
|
- </trim>
|
|
|
|
- <trim prefix="values (" suffix=")" suffixOverrides=",">
|
|
|
|
- <if test="tenantId != null">
|
|
|
|
- #{tenantId},
|
|
|
|
- </if>
|
|
|
|
- <if test="attributeId != null">
|
|
|
|
- #{attributeId},
|
|
|
|
- </if>
|
|
|
|
- <if test="customerId != null">
|
|
|
|
- #{customerId},
|
|
|
|
- </if>
|
|
|
|
- <if test="sceneType != null">
|
|
|
|
- #{sceneType},
|
|
|
|
- </if>
|
|
|
|
- <if test="deviceId != null">
|
|
|
|
- #{deviceId},
|
|
|
|
- </if>
|
|
|
|
- <if test="iotAlarmId != null">
|
|
|
|
- #{iotAlarmId},
|
|
|
|
- </if>
|
|
|
|
- <if test="companyOrgId != null">
|
|
|
|
- #{companyOrgId},
|
|
|
|
- </if>
|
|
|
|
|
|
+ <sql id="Base_Column_List">
|
|
|
|
+ <!--@mbg.generated-->
|
|
|
|
+ id, tenant_id, company_org_id, dept_org_id, product_id, `name`, attribute_id, `desc`, alarm_category, enabled,
|
|
|
|
+ alarm_rule_num, days, times,`status`, create_date, create_by, update_date, update_by, iot_alarm_id
|
|
|
|
+ </sql>
|
|
|
|
+ <insert id="insertSelective" keyColumn="id" keyProperty="id" parameterType="com.bz.zoneiot.water.core.entity.AlarmType" useGeneratedKeys="true">
|
|
|
|
+ <!--@mbg.generated-->
|
|
|
|
+ insert into sms_alarm_type
|
|
|
|
+ <trim prefix="(" suffix=")" suffixOverrides=",">
|
|
|
|
+ <if test="tenantId != null">
|
|
|
|
+ tenant_id,
|
|
|
|
+ </if>
|
|
|
|
+ <if test="attributeId != null">
|
|
|
|
+ attribute_id,
|
|
|
|
+ </if>
|
|
|
|
+ <if test="customerId != null">
|
|
|
|
+ customer_id,
|
|
|
|
+ </if>
|
|
|
|
+ <if test="sceneType != null">
|
|
|
|
+ scene_type,
|
|
|
|
+ </if>
|
|
|
|
+ <if test="deviceId != null">
|
|
|
|
+ device_id,
|
|
|
|
+ </if>
|
|
|
|
+ <if test="iotAlarmId != null">
|
|
|
|
+ iot_alarm_id,
|
|
|
|
+ </if>
|
|
|
|
+ <if test="companyOrgId != null">
|
|
|
|
+ company_org_id,
|
|
|
|
+ </if>
|
|
|
|
+ <if test="deptOrgId != null">
|
|
|
|
+ dept_org_id,
|
|
|
|
+ </if>
|
|
|
|
+ <if test="productId != null">
|
|
|
|
+ product_id,
|
|
|
|
+ </if>
|
|
|
|
+ <if test="name != null">
|
|
|
|
+ `name`,
|
|
|
|
+ </if>
|
|
|
|
+ <if test="code != null">
|
|
|
|
+ code,
|
|
|
|
+ </if>
|
|
|
|
+ <if test="desc != null">
|
|
|
|
+ `desc`,
|
|
|
|
+ </if>
|
|
|
|
+ <if test="days != null">
|
|
|
|
+ `days`,
|
|
|
|
+ </if>
|
|
|
|
+ <if test="times != null">
|
|
|
|
+ `times`,
|
|
|
|
+ </if>
|
|
|
|
+ <if test="alarmCategory != null">
|
|
|
|
+ alarm_category,
|
|
|
|
+ </if>
|
|
|
|
+ <if test="enabled != null">
|
|
|
|
+ enabled,
|
|
|
|
+ </if>
|
|
|
|
+ <if test="alarmRuleNum != null">
|
|
|
|
+ alarm_rule_num,
|
|
|
|
+ </if>
|
|
|
|
+ <if test="status != null">
|
|
|
|
+ `status`,
|
|
|
|
+ </if>
|
|
|
|
+ <if test="createDate != null">
|
|
|
|
+ create_date,
|
|
|
|
+ </if>
|
|
|
|
+ <if test="createBy != null">
|
|
|
|
+ create_by,
|
|
|
|
+ </if>
|
|
|
|
+ <if test="updateDate != null">
|
|
|
|
+ update_date,
|
|
|
|
+ </if>
|
|
|
|
+ <if test="updateBy != null">
|
|
|
|
+ update_by,
|
|
|
|
+ </if>
|
|
|
|
+ </trim>
|
|
|
|
+ <trim prefix="values (" suffix=")" suffixOverrides=",">
|
|
|
|
+ <if test="tenantId != null">
|
|
|
|
+ #{tenantId},
|
|
|
|
+ </if>
|
|
|
|
+ <if test="attributeId != null">
|
|
|
|
+ #{attributeId},
|
|
|
|
+ </if>
|
|
|
|
+ <if test="customerId != null">
|
|
|
|
+ #{customerId},
|
|
|
|
+ </if>
|
|
|
|
+ <if test="sceneType != null">
|
|
|
|
+ #{sceneType},
|
|
|
|
+ </if>
|
|
|
|
+ <if test="deviceId != null">
|
|
|
|
+ #{deviceId},
|
|
|
|
+ </if>
|
|
|
|
+ <if test="iotAlarmId != null">
|
|
|
|
+ #{iotAlarmId},
|
|
|
|
+ </if>
|
|
|
|
+ <if test="companyOrgId != null">
|
|
|
|
+ #{companyOrgId},
|
|
|
|
+ </if>
|
|
|
|
|
|
- <if test="deptOrgId != null">
|
|
|
|
- #{deptOrgId},
|
|
|
|
- </if>
|
|
|
|
- <if test="productId != null">
|
|
|
|
- #{productId},
|
|
|
|
- </if>
|
|
|
|
- <if test="name != null">
|
|
|
|
- #{name},
|
|
|
|
- </if>
|
|
|
|
- <if test="code != null">
|
|
|
|
- #{code},
|
|
|
|
- </if>
|
|
|
|
- <if test="desc != null">
|
|
|
|
- #{desc},
|
|
|
|
- </if>
|
|
|
|
- <if test="days != null">
|
|
|
|
- #{days},
|
|
|
|
- </if>
|
|
|
|
- <if test="times != null">
|
|
|
|
- #{times},
|
|
|
|
- </if>
|
|
|
|
- <if test="alarmCategory != null">
|
|
|
|
- #{alarmCategory},
|
|
|
|
- </if>
|
|
|
|
- <if test="enabled != null">
|
|
|
|
- #{enabled},
|
|
|
|
- </if>
|
|
|
|
- <if test="alarmRuleNum != null">
|
|
|
|
- #{alarmRuleNum},
|
|
|
|
- </if>
|
|
|
|
- <if test="status != null">
|
|
|
|
- #{status},
|
|
|
|
- </if>
|
|
|
|
- <if test="createDate != null">
|
|
|
|
- #{createDate},
|
|
|
|
- </if>
|
|
|
|
- <if test="createBy != null">
|
|
|
|
- #{createBy},
|
|
|
|
- </if>
|
|
|
|
- <if test="updateDate != null">
|
|
|
|
- #{updateDate},
|
|
|
|
- </if>
|
|
|
|
- <if test="updateBy != null">
|
|
|
|
- #{updateBy},
|
|
|
|
- </if>
|
|
|
|
- </trim>
|
|
|
|
- </insert>
|
|
|
|
|
|
+ <if test="deptOrgId != null">
|
|
|
|
+ #{deptOrgId},
|
|
|
|
+ </if>
|
|
|
|
+ <if test="productId != null">
|
|
|
|
+ #{productId},
|
|
|
|
+ </if>
|
|
|
|
+ <if test="name != null">
|
|
|
|
+ #{name},
|
|
|
|
+ </if>
|
|
|
|
+ <if test="code != null">
|
|
|
|
+ #{code},
|
|
|
|
+ </if>
|
|
|
|
+ <if test="desc != null">
|
|
|
|
+ #{desc},
|
|
|
|
+ </if>
|
|
|
|
+ <if test="days != null">
|
|
|
|
+ #{days},
|
|
|
|
+ </if>
|
|
|
|
+ <if test="times != null">
|
|
|
|
+ #{times},
|
|
|
|
+ </if>
|
|
|
|
+ <if test="alarmCategory != null">
|
|
|
|
+ #{alarmCategory},
|
|
|
|
+ </if>
|
|
|
|
+ <if test="enabled != null">
|
|
|
|
+ #{enabled},
|
|
|
|
+ </if>
|
|
|
|
+ <if test="alarmRuleNum != null">
|
|
|
|
+ #{alarmRuleNum},
|
|
|
|
+ </if>
|
|
|
|
+ <if test="status != null">
|
|
|
|
+ #{status},
|
|
|
|
+ </if>
|
|
|
|
+ <if test="createDate != null">
|
|
|
|
+ #{createDate},
|
|
|
|
+ </if>
|
|
|
|
+ <if test="createBy != null">
|
|
|
|
+ #{createBy},
|
|
|
|
+ </if>
|
|
|
|
+ <if test="updateDate != null">
|
|
|
|
+ #{updateDate},
|
|
|
|
+ </if>
|
|
|
|
+ <if test="updateBy != null">
|
|
|
|
+ #{updateBy},
|
|
|
|
+ </if>
|
|
|
|
+ </trim>
|
|
|
|
+ </insert>
|
|
|
|
|
|
- <update id="updateByPrimaryKeySelective" parameterType="com.bz.zoneiot.water.core.entity.AlarmType">
|
|
|
|
- update sms_alarm_type
|
|
|
|
- <set>
|
|
|
|
- <if test="deviceId != null">
|
|
|
|
- device_id = #{deviceId},
|
|
|
|
- </if>
|
|
|
|
- <if test="attributeId != null">
|
|
|
|
- attribute_id = #{attributeId}
|
|
|
|
- </if>
|
|
|
|
- <if test="productId != null">
|
|
|
|
- product_id = #{productId},
|
|
|
|
- </if>
|
|
|
|
- <if test="name != null">
|
|
|
|
- `name` = #{name},
|
|
|
|
- </if>
|
|
|
|
- <if test="code != null">
|
|
|
|
- code = #{code},
|
|
|
|
- </if>
|
|
|
|
- <if test="desc != null">
|
|
|
|
- `desc` = #{desc},
|
|
|
|
- </if>
|
|
|
|
- <if test="days != null">
|
|
|
|
- `days` = #{days},
|
|
|
|
- </if>
|
|
|
|
- <if test="times != null">
|
|
|
|
- `times` = #{times},
|
|
|
|
- </if>
|
|
|
|
- <if test="alarmCategory != null">
|
|
|
|
- alarm_category = #{alarmCategory},
|
|
|
|
- </if>
|
|
|
|
- <if test="enabled != null">
|
|
|
|
- enabled = #{enabled},
|
|
|
|
- </if>
|
|
|
|
- <if test="alarmRuleNum != null">
|
|
|
|
- alarm_rule_num = #{alarmRuleNum},
|
|
|
|
- </if>
|
|
|
|
- <if test="status != null">
|
|
|
|
- `status` = #{status},
|
|
|
|
- </if>
|
|
|
|
- <if test="updateDate != null">
|
|
|
|
- update_date = #{updateDate},
|
|
|
|
- </if>
|
|
|
|
- <if test="updateBy != null">
|
|
|
|
- update_by = #{updateBy},
|
|
|
|
- </if>
|
|
|
|
- </set>
|
|
|
|
- where id = #{id}
|
|
|
|
- </update>
|
|
|
|
|
|
+ <update id="updateByPrimaryKeySelective" parameterType="com.bz.zoneiot.water.core.entity.AlarmType">
|
|
|
|
+ update sms_alarm_type
|
|
|
|
+ <set>
|
|
|
|
+ <if test="deviceId != null">
|
|
|
|
+ device_id = #{deviceId},
|
|
|
|
+ </if>
|
|
|
|
+ <if test="attributeId != null">
|
|
|
|
+ attribute_id = #{attributeId},
|
|
|
|
+ </if>
|
|
|
|
+ <if test="productId != null">
|
|
|
|
+ product_id = #{productId},
|
|
|
|
+ </if>
|
|
|
|
+ <if test="name != null">
|
|
|
|
+ `name` = #{name},
|
|
|
|
+ </if>
|
|
|
|
+ <if test="code != null">
|
|
|
|
+ code = #{code},
|
|
|
|
+ </if>
|
|
|
|
+ <if test="desc != null">
|
|
|
|
+ `desc` = #{desc},
|
|
|
|
+ </if>
|
|
|
|
+ <if test="days != null">
|
|
|
|
+ `days` = #{days},
|
|
|
|
+ </if>
|
|
|
|
+ <if test="times != null">
|
|
|
|
+ `times` = #{times},
|
|
|
|
+ </if>
|
|
|
|
+ <if test="alarmCategory != null">
|
|
|
|
+ alarm_category = #{alarmCategory},
|
|
|
|
+ </if>
|
|
|
|
+ <if test="enabled != null">
|
|
|
|
+ enabled = #{enabled},
|
|
|
|
+ </if>
|
|
|
|
+ <if test="alarmRuleNum != null">
|
|
|
|
+ alarm_rule_num = #{alarmRuleNum},
|
|
|
|
+ </if>
|
|
|
|
+ <if test="status != null">
|
|
|
|
+ `status` = #{status},
|
|
|
|
+ </if>
|
|
|
|
+ <if test="updateDate != null">
|
|
|
|
+ update_date = #{updateDate},
|
|
|
|
+ </if>
|
|
|
|
+ <if test="updateBy != null">
|
|
|
|
+ update_by = #{updateBy},
|
|
|
|
+ </if>
|
|
|
|
+ </set>
|
|
|
|
+ where id = #{id}
|
|
|
|
+ </update>
|
|
|
|
|
|
- <select id="findById" resultType="com.bz.zoneiot.water.core.entity.AlarmType">
|
|
|
|
|
|
+ <select id="findById" resultType="com.bz.zoneiot.water.core.entity.AlarmType">
|
|
select
|
|
select
|
|
- <include refid="Base_Column_List" />
|
|
|
|
|
|
+ <include refid="Base_Column_List"></include>
|
|
from sms_alarm_type
|
|
from sms_alarm_type
|
|
where id = #{id} and status = 1
|
|
where id = #{id} and status = 1
|
|
</select>
|
|
</select>
|
|
|
|
|
|
|
|
+ <select id="findAlarmProductInfoById" resultType="com.bz.zoneiot.water.api.vo.AlarmTypeVo">
|
|
|
|
+ select
|
|
|
|
+ sat.id,sat.iot_alarm_id,sat.device_id,sat.product_id,sat.name as alarmName,sat.attribute_id,sat.`desc`,sat.days,sat.times,
|
|
|
|
+ CONCAT(sp.MANUFACTURER_NAME,"/",sp.DEVICE_TYPE,"/",sp.DEVICE_MODE) as productName,
|
|
|
|
+ sd.device_name,sat.alarm_rule_num
|
|
|
|
+ from sms_alarm_type sat
|
|
|
|
+ left join sms_device_type sp on sp.id = sat.product_id
|
|
|
|
+ left join sms_device sd on (sd.id = sat.device_id)
|
|
|
|
+ where
|
|
|
|
+ sat.id = #{id} and sat.status = 1
|
|
|
|
+ </select>
|
|
|
|
+
|
|
<select id="findDeviceIdByIotAlarmId" resultType="java.lang.Long">
|
|
<select id="findDeviceIdByIotAlarmId" resultType="java.lang.Long">
|
|
select device_id from sms_alarm_type where iot_alarm_id = #{id} and status = 1
|
|
select device_id from sms_alarm_type where iot_alarm_id = #{id} and status = 1
|
|
</select>
|
|
</select>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
- <select id="getAlarmTypeList" resultType="com.bz.zoneiot.water.api.vo.AlarmTypeVo">
|
|
|
|
- select
|
|
|
|
- sat.id,
|
|
|
|
- CONCAT(sp.MANUFACTURER_NAME,"/",sp.DEVICE_TYPE,"/",sp.DEVICE_MODE) as productName,
|
|
|
|
- sd.device_name,
|
|
|
|
- sat.name as alarmName,
|
|
|
|
- sat.desc,
|
|
|
|
- sat.alarm_rule_num,
|
|
|
|
- sat.enabled
|
|
|
|
- from sms_alarm_type sat
|
|
|
|
- left join sms_device_type sp on (sp.id = sat.product_id)
|
|
|
|
- left join sms_device sd on (sd.id = sat.device_id)
|
|
|
|
- where
|
|
|
|
- 1=1
|
|
|
|
- <if test="dto.alarmName !=null and dto.alarmName != ''" >
|
|
|
|
- and sat.`name` like concat('%', #{dto.alarmName}, '%')
|
|
|
|
- </if>
|
|
|
|
- <if test="dto.alarmCategory !=null and dto.alarmCategory!=''" >
|
|
|
|
- and sat.alarm_category = #{dto.alarmCategory}
|
|
|
|
- </if>
|
|
|
|
- <if test="dto.sceneType !=null and dto.sceneType!=''" >
|
|
|
|
- and sat.scene_type = #{dto.sceneType}
|
|
|
|
- </if>
|
|
|
|
- and sat.status = 1
|
|
|
|
- <include refid="permissionCondition"></include>
|
|
|
|
- order by sat.create_date desc
|
|
|
|
- </select>
|
|
|
|
|
|
+ <select id="getAlarmTypeList" resultType="com.bz.zoneiot.water.api.vo.AlarmTypeVo">
|
|
|
|
+ select
|
|
|
|
+ sat.id,
|
|
|
|
+ CONCAT(sp.MANUFACTURER_NAME,"/",sp.DEVICE_TYPE,"/",sp.DEVICE_MODE) as productName,
|
|
|
|
+ sd.device_name,
|
|
|
|
+ sat.name as alarmName,
|
|
|
|
+ sat.desc,
|
|
|
|
+ sat.alarm_rule_num,
|
|
|
|
+ sat.enabled
|
|
|
|
+ from sms_alarm_type sat
|
|
|
|
+ left join sms_device_type sp on (sp.id = sat.product_id)
|
|
|
|
+ left join sms_device sd on (sd.id = sat.device_id)
|
|
|
|
+ where
|
|
|
|
+ 1=1
|
|
|
|
+ <if test="dto.alarmName !=null and dto.alarmName != ''" >
|
|
|
|
+ and sat.`name` like concat('%', #{dto.alarmName}, '%')
|
|
|
|
+ </if>
|
|
|
|
+ <if test="dto.alarmCategory !=null and dto.alarmCategory!=''" >
|
|
|
|
+ and sat.alarm_category = #{dto.alarmCategory}
|
|
|
|
+ </if>
|
|
|
|
+ <if test="dto.sceneType !=null and dto.sceneType!=''" >
|
|
|
|
+ and sat.scene_type = #{dto.sceneType}
|
|
|
|
+ </if>
|
|
|
|
+ and sat.status = 1
|
|
|
|
+ <include refid="permissionCondition"></include>
|
|
|
|
+ order by sat.create_date desc
|
|
|
|
+ </select>
|
|
|
|
|
|
<select id="findByNameUnique" resultType="int">
|
|
<select id="findByNameUnique" resultType="int">
|
|
select count(1) from sms_alarm_type where `name` = #{name} and tenant_id = #{tenantId} and status = 1
|
|
select count(1) from sms_alarm_type where `name` = #{name} and tenant_id = #{tenantId} and status = 1
|