<?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.mosty.yjzl.mapper.TbYjxxMapper">
    <resultMap type="com.mosty.base.model.entity.yjzl.TbYjxx" id="tbYjxx">
        <result property="id" column="id" jdbcType="VARCHAR"/>
        <result property="yjLx" column="yj_lx" jdbcType="VARCHAR"/>
        <result property="yjGzyid" column="yj_gzyid" jdbcType="VARCHAR"/>
        <result property="yjGzymc" column="yj_gzymc" jdbcType="DATE"/>
        <result property="yjFsnf" column="yj_fsnf" jdbcType="DATE"/>
        <result property="yjFsyf" column="yj_fsyf" jdbcType="DATE"/>
        <result property="yjFsny" column="yj_fsny" jdbcType="VARCHAR"/>
        <result property="yjFszs" column="yj_fszs" jdbcType="NUMERIC"/>
        <result property="yjFsxs" column="yj_fsxs" jdbcType="NUMERIC"/>
        <result property="yjFsrq" column="yj_fsrq" jdbcType="INTEGER"/>
        <result property="yjFssj" column="yj_fssj" jdbcType="INTEGER"/>
        <result property="yjSj" column="yj_sj" jdbcType="INTEGER"/>
        <result property="yjJb" column="yj_jb" jdbcType="INTEGER"/>
        <result property="yjBt" column="yj_bt" jdbcType="INTEGER"/>
        <result property="yjNr" column="yj_nr" jdbcType="INTEGER"/>
        <result property="yjJrcs" column="yj_jrcs" jdbcType="INTEGER"/>
        <result property="yjCs" column="yj_cs" jdbcType="INTEGER"/>
        <result property="jd" column="jd" jdbcType="NUMERIC"/>
        <result property="wd" column="wd" jdbcType="NUMERIC"/>
        <result property="yjDzXzqh" column="yj_dz_xzqh" jdbcType="VARCHAR"/>
        <result property="yjDz" column="yj_dz" jdbcType="VARCHAR"/>
        <result property="yjRyxm" column="yj_ryxm" jdbcType="VARCHAR"/>
        <result property="yjRysfzh" column="yj_rysfzh" jdbcType="VARCHAR"/>
        <result property="xsd" column="xsd" jdbcType="NUMERIC"/>
        <result property="yjHplx" column="yj_hplx" jdbcType="VARCHAR"/>
        <result property="yjClcph" column="yj_clcph" jdbcType="VARCHAR"/>
        <result property="yjbq" column="yjbq" jdbcType="VARCHAR"/>
        <result property="yjbqmc" column="yjbqxq" jdbcType="VARCHAR"/>
        <result property="sfFszl" column="sf_fszl" jdbcType="VARCHAR"/>
        <result property="sfWb" column="sf_wb" jdbcType="VARCHAR"/>
        <result property="yjTp" column="yj_tp" jdbcType="VARCHAR"/>
        <result property="yjXtp" column="yj_xtp" jdbcType="VARCHAR"/>
        <result property="yjlyid" column="yjlyid" jdbcType="VARCHAR"/>
        <result property="yjlyBqmc" column="yjly_bqmc" jdbcType="VARCHAR"/>
        <result property="ssbm" column="ssbm" jdbcType="VARCHAR"/>
        <result property="ssbmdm" column="ssbmdm" jdbcType="VARCHAR"/>
        <result property="ssxgaj" column="ssxgaj" jdbcType="VARCHAR"/>
        <result property="ssxgajdm" column="ssxgajdm" jdbcType="VARCHAR"/>
        <result property="sssgaj" column="sssgaj" jdbcType="VARCHAR"/>
        <result property="sssgajdm" column="sssgajdm" jdbcType="VARCHAR"/>
        <result property="xtSjly" column="xt_sjly" jdbcType="VARCHAR"/>
        <result property="xtSjzt" column="xt_sjzt" jdbcType="VARCHAR"/>
        <result property="xtScbz" column="xt_scbz" jdbcType="VARCHAR"/>
        <result property="xtCjip" column="xt_cjip" jdbcType="VARCHAR"/>
        <result property="xtCjsj" column="xt_cjsj" jdbcType="VARCHAR"/>
        <result property="xtCjrId" column="xt_cjr_id" jdbcType="VARCHAR"/>
        <result property="xtCjr" column="xt_cjr" jdbcType="VARCHAR"/>
        <result property="xtCjbmdm" column="xt_cjbmdm" jdbcType="VARCHAR"/>
        <result property="xtCjbmmc" column="xt_cjbmmc" jdbcType="VARCHAR"/>
        <result property="xtZhgxip" column="xt_zhgxip" jdbcType="VARCHAR"/>
        <result property="xtZhgxsj" column="xt_zhgxsj" jdbcType="VARCHAR"/>
        <result property="xtZhgxrid" column="xt_zhgxrid" jdbcType="VARCHAR"/>
        <result property="xtZhgxr" column="xt_zhgxr" jdbcType="VARCHAR"/>
        <result property="xtZhgxbmdm" column="xt_zhgxbmdm" jdbcType="VARCHAR"/>
        <result property="xtZhgxbm" column="xt_zhgxbm" jdbcType="VARCHAR"/>
        <result property="bz" column="bz" jdbcType="VARCHAR"/>
        <result property="distance" column="distance" jdbcType="NUMERIC"/>
        <result property="sssgajid" column="sssgajid" jdbcType="VARCHAR"/>
        <result property="ssxgajid" column="ssxgajid" jdbcType="VARCHAR"/>
        <result property="ssbmid" column="ssbmid" jdbcType="VARCHAR"/>
        <result property="sfYjid" column="sf_yjid" jdbcType="VARCHAR"/>
    </resultMap>

    <sql id="base_column_list">

                id
                        ,yj_lx,yj_gzyid,yj_gzymc,yj_fsnf,yj_fsyf,yj_fsny,yj_fszs,yj_fsxs,
                        yj_fsrq, yj_fssj, yj_sj,ssbmid,ssxgajid,sssgajid,
                        yj_jb,yj_bt,yj_nr,yj_jrcs,yj_cs,jd,wd,yj_dz_xzqh,yj_dz,yj_ryxm,xsd,
                        yj_rysfzh,yj_hplx,yj_clcph,yjbq,yjbqmc,sf_fszl,sf_wb,yj_tp,yj_xtp,yjlyid,yjly_bqmc,
                        ssbm, ssbmdm, ssxgaj, ssxgajdm, sssgaj, sssgajdm, xt_sjly, xt_sjzt, xt_scbz,
                        xt_cjip, xt_cjsj, xt_cjr_id, xt_cjr, xt_cjbmdm, xt_cjbmmc, xt_zhgxip, xt_zhgxsj,
                        xt_zhgxrid,xt_zhgxr, xt_zhgxbmdm, xt_zhgxbm, bz,sf_yjid

    </sql>

    <!--获取预警总数-->
    <select id="getCount" resultType="Integer" parameterType="Map">
        select count(1) from tb_yjxx where xt_sjzt = '1' and xt_scbz = '0'
        <if test="yjlxList != null and yjlxList.size > 0">
            and yj_lx in
            <foreach collection="yjlxList" open="(" separator="," close=")" item="item">
                #{item}
            </foreach>
        </if>

        <if test="yjlyList != null and yjlyList.size > 0">
            and yjlyid in
            <foreach collection="yjlyList" open="(" separator="," close=")" item="item">
                #{item}
            </foreach>
        </if>

        <if test="dto.bqfl != null and dto.bqfl != ''">
            <choose>
                <when test="dto.bqfl == '01' ">
                    and (yjbq like '%ZT%' or yjbq like '%在逃%' )
                </when>
                <when test="dto.bqfl == '02' ">
                    and (yjbq like '%抢%' or yjbq like '%盗%' or yjbq like '%侵财%' )
                </when>
                <otherwise>
                    and (yjbq like '%抢%' or yjbq like '%盗%' or yjbq like '%侵财%' or yjbq like '%ZT%' or yjbq like '%在逃%'
                    )
                </otherwise>
            </choose>
        </if>

        <if test="dto.yjGzyid != null and dto.yjGzyid != ''">
            and yj_gzyid = #{dto.yjGzyid}
        </if>
        <if test="dto.yjJb != null and dto.yjJb != ''">
            and yj_jb = #{dto.yjJb}
        </if>
        <if test="dto.yjBt != null and dto.yjBt != ''">
            and yj_bt like concat('%',#{dto.yjBt},'%')
        </if>
        <if test="dto.yjNr != null and dto.yjNr != ''">
            and yj_nr like concat('%',#{dto.yjNr},'%')
        </if>
        <if test="dto.yjRyxm != null and dto.yjRyxm != ''">
            and yj_ryxm = #{dto.yjRyxm}
        </if>
        <if test="dto.yjRysfzh != null and dto.yjRysfzh != ''">
            and yj_rysfzh = #{dto.yjRysfzh}
        </if>
        <if test="dto.yjClcph != null and dto.yjClcph != ''">
            and yj_clcph = #{dto.yjClcph}
        </if>
        <if test="dto.sfFszl != null and dto.sfFszl != ''">
            and sf_fszl = #{dto.sfFszl}
        </if>

        <if test="dto.ssbmdm != null and dto.ssbmdm != ''">
            and ssbmdm like concat(#{dto.ssbmdm},'%')
        </if>
        <if test="dto.startTime != null and dto.startTime != '' and dto.endTime != null and dto.endTime != ''">
            and yj_fsrq &gt;= #{dto.startTime}
            and yj_fsrq &lt;= #{dto.endTime}
        </if>
        <if test="dto.jd != null and dto.wd != null and dto.radius != null">
            <![CDATA[and st_distance_sphere(POINT(jd,wd),POINT(#{dto.jd},#{dto.wd})) <= #{dto.radius}]]>
        </if>
    </select>

    <!--分页获取预警列表-->
    <select id="getListPage" resultMap="tbYjxx" parameterType="Map">
        select
        <include refid="base_column_list"/>
        <if test="dto.jd != null and dto.wd != null and dto.radius != null">
            ,st_distance_sphere(POINT(jd,wd),POINT(#{dto.jd},#{dto.wd})) as distance
        </if>
        from tb_yjxx where xt_sjzt = '1' and xt_scbz = '0'
        <if test="yjlxList != null and yjlxList.size > 0">
            and yj_lx in
            <foreach collection="yjlxList" open="(" separator="," close=")" item="item">
                #{item}
            </foreach>
        </if>


        <if test="yjlyList != null and yjlyList.size > 0">
            and yjlyid in
            <foreach collection="yjlyList" open="(" separator="," close=")" item="item">
                #{item}
            </foreach>
        </if>

        <if test="dto.bqfl != null and dto.bqfl != ''">
            <choose>
                <when test="dto.bqfl == '01' ">
                    and (yjbq like '%ZT%' or yjbq like '%在逃%' )
                </when>
                <when test="dto.bqfl == '02' ">
                    and (yjbq like '%抢%' or yjbq like '%盗%' or yjbq like '%侵财%' )
                </when>
                <otherwise>
                    and (yjbq like '%抢%' or yjbq like '%盗%' or yjbq like '%侵财%' or yjbq like '%ZT%' or yjbq like '%在逃%'
                    )
                </otherwise>
            </choose>
        </if>



        <if test="dto.yjGzyid != null and dto.yjGzyid != ''">
            and yj_gzyid = #{dto.yjGzyid}
        </if>
        <if test="dto.yjJb != null and dto.yjJb != ''">
            and yj_jb = #{dto.yjJb}
        </if>
        <if test="dto.yjBt != null and dto.yjBt != ''">
            and yj_bt like concat('%',#{dto.yjBt},'%')
        </if>
        <if test="dto.yjNr != null and dto.yjNr != ''">
            and yj_nr like concat('%',#{dto.yjNr},'%')
        </if>
        <if test="dto.yjRyxm != null and dto.yjRyxm != ''">
            and yj_ryxm = #{dto.yjRyxm}
        </if>
        <if test="dto.yjRysfzh != null and dto.yjRysfzh != ''">
            and yj_rysfzh = #{dto.yjRysfzh}
        </if>
        <if test="dto.yjClcph != null and dto.yjClcph != ''">
            and yj_clcph = #{dto.yjClcph}
        </if>
        <if test="dto.sfFszl != null and dto.sfFszl != ''">
            and sf_fszl = #{dto.sfFszl}
        </if>

        <if test="dto.ssbmdm != null and dto.ssbmdm != ''">
            and ssbmdm like concat(#{dto.ssbmdm},'%')
        </if>
        <if test="dto.startTime != null and dto.startTime != '' and dto.endTime != null and dto.endTime != ''">
            and yj_fsrq &gt;= #{dto.startTime}
            and yj_fsrq &lt;= #{dto.endTime}
        </if>
        <if test="dto.jd != null and dto.wd != null and dto.radius != null">
            <![CDATA[having distance <= #{dto.radius}]]>
        </if>
        <!--        ${useSql}-->
        order
        by yj_sj desc
        limit #{pageIndex},#{pageSize}
    </select>

    <!--获取所有预警列表-->
    <select id="getList" resultMap="tbYjxx" parameterType="Map">
        select
        <include refid="base_column_list"/>
        <if test="dto.jd != null and dto.wd != null and dto.radius != null">
            ,st_distance_sphere(POINT(jd,wd),POINT(#{dto.jd},#{dto.wd})) as distance
        </if>
        from tb_yjxx where xt_sjzt = '1' and xt_scbz = '0'
        <if test="yjlxList != null and yjlxList.size > 0">
            and yj_lx in
            <foreach collection="yjlxList" open="(" separator="," close=")" item="item">
                #{item}
            </foreach>
        </if>
        <if test="dto.yjGzyid != null and dto.yjGzyid != ''">
            and yj_gzyid = #{dto.yjGzyid}
        </if>
        <if test="dto.yjJb != null and dto.yjJb != ''">
            and yj_jb = #{dto.yjJb}
        </if>
        <if test="dto.yjRyxm != null and dto.yjRyxm != ''">
            and yj_ryxm like concat('%',#{dto.yjRyxm},'%')
        </if>
        <if test="dto.yjBt != null and dto.yjBt != ''">
            and yj_bt like concat('%',#{dto.yjBt},'%')
        </if>
        <if test="dto.yjNr != null and dto.yjNr != ''">
            and yj_nr like concat('%',#{dto.yjNr},'%')
        </if>
        <if test="dto.sfFszl != null and dto.sfFszl != ''">
            and sf_fszl = #{dto.sfFszl}
        </if>
        <if test="dto.ssbmdm != null and dto.ssbmdm != ''">
            and ssbmdm like concat(#{dto.ssbmdm},'%')
        </if>
        <if test="dto.startTime != null and dto.startTime != '' and dto.endTime != null and dto.endTime != ''">
            and yj_sj &gt;= #{dto.startTime}
            and yj_sj &lt;= #{dto.endTime}
        </if>
        <if test="dto.jd != null and dto.wd != null and dto.radius != null">
            <![CDATA[having distance <= #{dto.radius}]]>
        </if>
        <!--        ${useSql}-->
        order by yj_sj desc
    </select>

    <!--查询预警详情-->
    <select id="getInfoById" resultMap="tbYjxx">
        select
        <include refid="base_column_list"/>
        from tb_yjxx where xt_sjzt = '1' and xt_scbz = '0'
        and id = #{id}
    </select>

    <!--查询预警详情-->
    <select id="queryTbYjxx" resultMap="tbYjxx">
        select
        <include refid="base_column_list"/>
        from mosty_yjzl.tb_yjxx where xt_sjzt = '1' and xt_scbz = '0'
        and yjlyid = #{yjlyid}
    </select>

    <select id="countBySfzhOrCph" resultType="java.lang.Integer">
        select count(1) from mosty_yjzl.tb_yjxx where xt_sjzt = '1' and xt_scbz = '0'
        <if test="sfzh != null and sfzh != ''">
            and yj_rysfzh = #{sfzh}
        </if>
        <if test="cphm != null and cphm != ''">
            and yj_clcph = #{cphm}
        </if>
    </select>

    <select id="countCurrentBySfzhOrCph" resultType="int">
        select count(1) from mosty_yjzl.tb_yjxx where xt_sjzt = '1' and xt_scbz = '0' and yj_sj >= CURRENT_DATE
        <if test="sfzh != null and sfzh != ''">
            and yj_rysfzh = #{sfzh}
        </if>
        <if test="cphm != null and cphm != ''">
            and yj_clcph = #{cphm}
        </if>
    </select>

    <insert id="insertEntity">

                insert into mosty_yjzl.tb_yjxx(id, yj_lylx, yj_lx, yj_gzyid, yj_gzymc, yj_fsnf, yj_fsyf, yj_fsny, yj_fszs,
                                               yj_fsxs, ssbmid, ssxgajid, sssgajid,
                                               yj_fsrq,
                                               yj_fssj, yj_sj, yj_jb, yj_bt, yj_nr, yj_jrcs, yj_cs, jd, wd,
                                               yj_dz_xzqh, yj_dz, yj_ryxm, yj_rysfzh, xsd,
                                               yj_hplx, yj_clcph, yjbq, yjbqmc, sf_fszl, sf_wb, yj_tp, yj_xtp, yjlyid,
                                               yjly_bqmc,
                                               ssbm, ssbmdm, ssxgaj, ssxgajdm, sssgaj, sssgajdm, xt_sjly, xt_sjzt, xt_scbz,
                                               xt_cjip, xt_cjsj, xt_cjr_id, xt_cjr, xt_cjbmdm, xt_cjbmmc, xt_zhgxip, xt_zhgxsj,
                                               xt_zhgxrid, xt_zhgxr, xt_zhgxbmdm, xt_zhgxbm, bz, sf_yjid)
                values (#{id}, #{yjLylx}, #{yjLx}, #{yjGzyid}, #{yjGzymc}, #{yjFsnf}, #{yjFsyf}, #{yjFsny}, #{yjFszs},
                        #{yjFsxs}, #{ssbmid}, #{ssxgajid}, #{sssgajid},
                        #{yjFsrq},
                        #{yjFssj}, #{yjSj}, #{yjJb}, #{yjBt}, #{yjNr}, #{yjJrcs}, #{yjCs}, #{jd}, #{wd},
                        #{yjDzXzqh}, #{yjDz}, #{yjRyxm}, #{yjRysfzh}, #{xsd},
                        #{yjHplx}, #{yjClcph}, #{yjbq}, #{yjbqmc}, #{sfFszl}, #{sfWb}, #{yjTp}, #{yjXtp}, #{yjlyid},
                        #{yjlyBqmc},
                        #{ssbm}, #{ssbmdm}, #{ssxgaj}, #{ssxgajdm}, #{sssgaj}, #{sssgajdm}, #{xtSjly}, #{xtSjzt},
                        #{xtScbz}, #{xtCjip}, #{xtCjsj}, #{xtCjrId}, #{xtCjr}, #{xtCjbmdm}, #{xtCjbmmc}, #{xtZhgxip},
                        #{xtZhgxsj}, #{xtZhgxrid}, #{xtZhgxr}, #{xtZhgxbmdm}, #{xtZhgxbm}, #{bz}, #{sfYjid})

    </insert>

    <select id="getYjxxTj" resultType="java.util.Map">
        select count(yj_jb) count, yj_jb
        from tb_yjxx
        where xt_scbz = '0'
        and xt_sjzt = '1'
        <if test="dto.yjGzyid != null and dto.yjGzyid != ''">
            and yj_gzyid = #{dto.yjGzyid}
        </if>
        <if test="dto.yjRysfzh != null and dto.yjRysfzh != ''">
            and yj_rysfzh = #{dto.yjRysfzh}
        </if>
        <if test="dto.yjRyxm != null and dto.yjRyxm != ''">
            and yj_ryxm = #{dto.yjRyxm}
        </if>
        <if test="dto.yjClcph != null and dto.yjClcph != ''">
            and yj_clcph = #{dto.yjClcph}
        </if>
        <if test="dto.kssj != null and dto.kssj != ''">
            and yj_fsrq >= #{dto.kssj}
        </if>
        <if test="dto.jssj != null and dto.jssj != ''">
            and yj_fsrq &lt;= #{dto.jssj}
        </if>
        <if test="dto.ssbmdm != null and dto.ssbmdm != ''">
            and ssbmdm like concat(#{dto.ssbmdm},'%')
        </if>
        <!--        ${useSql}-->
        group by yj_jb
    </select>

    <select id="getYjxxTjYjlx" resultType="java.util.Map">
        select count(yj_lx) count, yj_lx
        from tb_yjxx
        where xt_scbz = '0'
        and xt_sjzt = '1'
        <if test="kssj != null and kssj != '' and jssj != null and jssj != ''">
            and yj_fsrq &gt;= #{kssj}
            and yj_fsrq &lt;= #{jssj}
        </if>
        <if test="ssbmdm != null and ssbmdm != ''">
            and ssbmdm like concat(#{ssbmdm},'%')
        </if>
        <!--        ${useSql}-->
        group by yj_lx
    </select>

    <select id="todayGsdyj" resultType="java.util.Map">

                SELECT IFNULL(SUM(quantity), 0) total,
                       '1'                      type,
                       h
                FROM (
                             SELECT COUNT(1)                                    quantity,
                                    yj_lx,
                                    (FLOOR(DATE_FORMAT(yj_fssj, '%H') / 2) * 2) h
                             FROM tb_yjxx
                             WHERE date_format(yj_fssj, '%y-%m-%d') = DATE_FORMAT(now(), '%y-%m-%d')
                             GROUP BY yj_lx,
                                      (FLOOR(DATE_FORMAT(yj_fssj, '%H') / 2) * 2)
                             ORDER BY (FLOOR(DATE_FORMAT(yj_fssj, '%H') / 2) * 2)
                             ) s
                WHERE yj_lx IN ('1', '3', '4')
                GROUP BY h

                UNION
                SELECT IFNULL(SUM(quantity), 0) total,
                       '2'                      type,
                       h
                FROM (
                             SELECT COUNT(1)                                    quantity,
                                    yj_lx,
                                    (FLOOR(DATE_FORMAT(yj_fssj, '%H') / 2) * 2) h
                             FROM tb_yjxx
                             WHERE date_format(yj_fssj, '%y-%m-%d') = DATE_FORMAT(now(), '%y-%m-%d')
                             GROUP BY yj_lx,
                                      (FLOOR(DATE_FORMAT(yj_fssj, '%H') / 2) * 2)
                             ORDER BY (FLOOR(DATE_FORMAT(yj_fssj, '%H') / 2) * 2)
                             ) s
                WHERE yj_lx IN ('2', '4')
                GROUP BY h
                UNION
                SELECT IFNULL(SUM(quantity), 0) total,
                       '3'                      type,
                       h
                FROM (
                             SELECT COUNT(1)                                    quantity,
                                    yj_lx,
                                    (FLOOR(DATE_FORMAT(yj_fssj, '%H') / 2) * 2) h
                             FROM tb_yjxx
                             WHERE date_format(yj_fssj, '%y-%m-%d') = DATE_FORMAT(now(), '%y-%m-%d')
                             GROUP BY yj_lx,
                                      (FLOOR(DATE_FORMAT(yj_fssj, '%H') / 2) * 2)
                             ORDER BY (FLOOR(DATE_FORMAT(yj_fssj, '%H') / 2) * 2)
                             ) s
                WHERE yj_lx = '5'
                GROUP BY h

    </select>

    <update id="updateEntity">
        update tb_yjxx
        <set>
            <if test="yjLx != null and yjLx != ''">
                yj_lx = #{yjLx},
            </if>
            <if test="yjGzyid != null and yjGzyid != ''">
                yj_gzyid = #{yjGzyid},
            </if>
            <if test="yjGzymc != null and yjGzymc != ''">
                yj_gzymc = #{yjGzymc},
            </if>
            <if test="yjFsnf != null">
                yj_fsnf = #{yjFsnf},
            </if>
            <if test="yjFsyf != null">
                yj_fsyf = #{yjFsyf},
            </if>
            <if test="yjFsny != null">
                yj_fsny = #{yjFsny},
            </if>
            <if test="yjFszs != null">
                yj_fszs = #{yjFszs},
            </if>
            <if test="yjFsrq != null">
                yj_fsrq = #{yjFsrq},
            </if>
            <if test="yjFssj != null">
                yj_fssj = #{yjFssj},
            </if>
            <if test="yjSj != null">
                yj_sj = #{yjSj},
            </if>
            <if test="yjJb != null">
                yj_jb = #{yjJb},
            </if>
            <if test="yjBt != null and yjBt != ''">
                yj_bt = #{yjBt},
            </if>
            <if test="yjNr != null and yjNr != ''">
                yj_nr = #{yjNr},
            </if>
            <if test="yjJrcs != null">
                yj_jrcs = #{yjJrcs},
            </if>
            <if test="yjCs != null">
                yj_cs = #{yjCs},
            </if>
            <if test="jd != null">
                jd = #{jd},
            </if>
            <if test="wd != null">
                wd = #{wd},
            </if>

            <if test="yjDzXzqh != null and yjDzXzqh != ''">
                yj_dz_xzqh = #{yjDzXzqh},
            </if>
            <if test="yjDz != null and yjDz != ''">
                yj_dz = #{yjDz},
            </if>
            <if test="yjRyxm != null and yjRyxm != ''">
                yj_ryxm = #{yjRyxm},
            </if>
            <if test="yjRysfzh != null and yjRysfzh != ''">
                yj_rysfzh = #{yjRysfzh},
            </if>
            <if test="xsd != null">
                xsd = #{xsd},
            </if>
            <if test="yjHplx != null and yjHplx != ''">
                yj_hplx = #{yjHplx},
            </if>
            <if test="yjClcph != null and yjClcph != ''">
                yj_clcph = #{yjClcph},
            </if>
            <if test="yjbq != null and yjbq != ''">
                yjbq = #{yjbq},
            </if>
            <if test="yjbqmc != null and yjbqmc != ''">
                yjbqmc = #{yjbqmc},
            </if>
            <if test="sfFszl != null and sfFszl != ''">
                sf_fszl = #{sfFszl},
            </if>
            <if test="sfWb != null and sfWb != ''">
                sf_wb = #{sfWb},
            </if>
            <if test="yjTp != null and yjTp != ''">
                yj_tp = #{yjTp},
            </if>
            <if test="yjXtp != null and yjXtp != ''">
                yj_xtp = #{yjXtp},
            </if>
            <if test="yjlyid != null and yjlyid != ''">
                yjlyid = #{yjlyid},
            </if>
            <if test="yjlyBqmc != null and yjlyBqmc != ''">
                yjly_bqmc = #{yjlyBqmc},
            </if>
            <if test="ssbm != null and ssbm != ''">
                ssbm = #{ssbm},
            </if>
            <if test="ssbmdm != null and ssbmdm != ''">
                ssbmdm = #{ssbmdm},
            </if>
            <if test="ssxgaj != null and ssxgaj != ''">
                ssxgaj = #{ssxgaj},
            </if>
            <if test="ssbmid != null and ssbmid != ''">
                ssbmid = #{ssbmid},
            </if>
            <if test="ssxgajid != null and ssxgajid != ''">
                ssxgajid = #{ssxgajid},
            </if>
            <if test="sssgajid != null and sssgajid != ''">
                sssgajid = #{sssgajid},
            </if>
            <if test="ssxgajdm != null and ssxgajdm != ''">
                ssxgajdm = #{ssxgajdm},
            </if>
            <if test="sssgaj != null and sssgaj != ''">
                sssgaj = #{sssgaj},
            </if>
            <if test="sssgajdm != null and sssgajdm != ''">
                sssgajdm = #{sssgajdm},
            </if>
            <if test="xtSjly != null and xtSjly != ''">
                xt_sjly = #{xtSjly},
            </if>
            <if test="xtSjzt != null and xtSjzt != ''">
                xt_sjzt = #{xtSjzt},
            </if>
            <if test="xtScbz != null and xtScbz != ''">
                xt_scbz = #{xtScbz},
            </if>
            <if test="xtCjip != null and xtCjip != ''">
                xt_cjip = #{xtCjip},
            </if>
            <if test="xtCjsj != null">
                xt_cjsj = #{xtCjsj},
            </if>
            <if test="xtCjrId != null and xtCjrId != ''">
                xt_cjr_id = #{xtCjrId},
            </if>
            <if test="xtCjr != null and xtCjr != ''">
                xt_cjr = #{xtCjr},
            </if>
            <if test="xtCjbmdm != null and xtCjbmdm != ''">
                xt_cjbmdm = #{xtCjbmdm},
            </if>
            <if test="xtCjbmmc != null and xtCjbmmc != ''">
                xt_cjbmmc = #{xtCjbmmc},
            </if>
            <if test="xtZhgxip != null and xtZhgxip != ''">
                xt_zhgxip = #{xtZhgxip},
            </if>
            <if test="xtZhgxsj != null">
                xt_zhgxsj = #{xtZhgxsj},
            </if>
            <if test="xtZhgxrid != null and xtZhgxrid != ''">
                xt_zhgxrid = #{xtZhgxrid},
            </if>
            <if test="xtZhgxr != null and xtZhgxr != ''">
                xt_zhgxr = #{xtZhgxr},
            </if>
            <if test="xtZhgxbmdm != null and xtZhgxbmdm != ''">
                xt_zhgxbmdm = #{xtZhgxbmdm},
            </if>
            <if test="xtZhgxbm != null and xtZhgxbm != ''">
                xt_zhgxbm = #{xtZhgxbm},
            </if>
            <if test="sfYjid != null and sfYjid != ''">
                sf_yjid = #{sfYjid},
            </if>
            <if test="bz != null and bz != ''">
                bz = #{bz},
            </if>
        </set>
        where id = #{id}
    </update>

    <!--获取所有预警列表-->
    <select id="queryJq" resultType="com.mosty.base.model.entity.sjzx.TbJq">
        select
        *
        from mosty_sjzx.tb_jq where xt_sjzt = '1' and xt_scbz = '0' and jd is not null
        and bjlb in (01000000,02000000,06000000,07000000,09000000,10000000,11000000)
        <if test="kssj != null and kssj != ''">
            and bjsj &gt;= #{kssj}
        </if>
        <if test="jssj != null and jssj != ''">
            and bjsj &lt;= #{jssj}
        </if>
    </select>

</mapper>
