<?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">

    <select id="getAlarmMgeList" resultType="com.securitycontrol.entity.screen.vo.AlarmMgeVo">
        SELECT tw.warn_id as warnId,
               sb.city_name AS orgName,
               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,
               twt.team_leader as teamLeader
        FROM tb_warn tw
         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.warn_type = #{warnType}
        <if test="orgId !=null and orgId!=''">
            AND sb.org_id = #{orgId}
        </if>

        <if test="proName !=null and proName!=''">
            AND tp.pro_name LIKE concat('%',#{proName},'%')
        </if>

        <if test="teamLeader !=null and teamLeader!=''">
            AND twt.team_leader LIKE concat('%',#{teamLeader},'%')
        </if>
    </select>
</mapper>