<?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.securitycontrol.screen.mapper.AlarmMgeMapper">
    <update id="warnProcess">
            update   tb_warn set user_id=#{userId},status=#{status},
                remark=#{remark}
                        where  warn_id=#{warnId}
    </update>

    <select id="getAlarmMgeList" resultType="com.securitycontrol.entity.screen.vo.AlarmMgeVo">
            SELECT tw.warn_id as warnId,
                sb.city_name AS orgName,tw.warn_time warnTime,
                sb.org_id AS orgId, tp.pro_id as proId,
                tp.pro_name as proName, tw.warn_content as warnContent,
                twt.team_id as teamId,
                twt.team_name as teamName,tdd.mode_name module ,td.device_name deviceName,
                twt.team_leader as teamLeader,su.update_time updateTime,
                su.login_name userName, tw.remark,tw.`status`
                FROM tb_warn tw
                LEFT JOIN tb_device_detail tdd on  tw.attribute_id=tdd.id
                LEFT JOIN tb_bd_device td on tdd.device_id=td.device_id
                LEFT JOIN sys_user su on su.user_id=tw.user_id
                LEFT JOIN sys_build sb ON sb.org_id = tw.org_id
                LEFT JOIN tb_project tp ON tp.bid_code = tw.bid_code
                LEFT JOIN tb_work_team twt ON twt.team_id = tw.team_id
        where tw.bid_code = #{bidCode} and tw.warn_type = #{warnType}
        <if test="warnContent!=null and warnContent!=''">
            and tw.warn_content like concat('%',#{warnContent},'%')
        </if>
        order by  tw.warn_time desc
    </select>
</mapper>