You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

69 lines
2.0 KiB

<?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.techsor.datacenter.business.dao.ex.DeviceAlertConfigMapperExt">
<select id="getConfigInfo" resultType="com.techsor.datacenter.business.model.DeviceAlertConfig">
select
id,
device_config_id,
alert_name
from
device_alert_config
where flag != 1
<if test="deviceConfigId != null">
and device_config_id = #{deviceConfigId}
</if>
limit 1
</select>
<select id="getInfoByParam" resultType="map">
select
dac.id,
dac.contents,
dac.target_id targetIdMapper,
tic.target_id_value targetId,
tic.target_id targetIdField
from
device_alert_config dac
inner join target_id_check tic on tic.alert_config_id = dac.id
<where>
<if test="targetId != null">
and tic.target_id_value = #{targetId}
</if>
</where>
</select>
<update id="updateInfo">
update
device_alert_config
set
contents = #{contents}
where id = #{id}
</update>
<update id="deleteByDeviceConfigId">
update
device_alert_config
set
flag = 1
where device_config_id = #{deviceConfigId}
</update>
<select id="checkTargetIds" resultType="java.lang.String">
select
tic.target_id_value
from
device_alert_config dac
inner join target_id_check tic on tic.alert_config_id = dac.id
inner join device_info dinfo on dinfo.id = dac.device_config_id
<where>
<if test="companyId != null">
and dinfo.company_id = #{companyId}
</if>
<if test="targetIds != null">
and tic.target_id_value in (${targetIds})
</if>
</where>
</select>
</mapper>