<?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="cn.com.ctop.alarm.modules.mapper.AlarmRuleCampaignRelMapper">

    <delete id="deleteByRuleId">
        delete from ctop_alarm_rule_campaign_rel
        where event_rule_id = #{id}
    </delete>

    <select id="selectByRuleId" resultType="cn.com.ctop.alarm.modules.entity.AlarmRuleCampaignRel">
       SELECT t1.*,t2.unit_name AS unitName,t3.campaign_name AS campaignName
       FROM
        ctop_alarm_rule_campaign_rel t1
        LEFT JOIN ctop_kuaishou_group t2 ON t1.unit_id =  t2.unit_id
		LEFT JOIN ctop_kuaishou_campaign t3 ON t1.campaign_id = t3.campaign_id
        WHERE event_rule_id = #{id}
    </select>
</mapper>