<?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.hczx.mapper.TbHcBpcryMapper">
    <resultMap type="com.mosty.base.model.entity.hczx.TbHcBpcry" id="tbHcBpcry">
        <result property="id" column="id" jdbcType="VARCHAR"/>
        <result property="sfzh" column="sfzh" jdbcType="VARCHAR"/>
        <result property="xm" column="xm" jdbcType="VARCHAR"/>
        <result property="xbdm" column="xbdm" jdbcType="VARCHAR"/>
        <result property="csrq" column="csrq" jdbcType="VARCHAR"/>
        <result property="mzdm" column="mzdm" jdbcType="VARCHAR"/>
        <result property="whcddm" column="whcddm" jdbcType="VARCHAR"/>
        <result property="jgdm" column="jgdm" jdbcType="VARCHAR"/>
        <result property="zzxz" column="zzxz" jdbcType="VARCHAR"/>
        <result property="lxdh" column="lxdh" jdbcType="VARCHAR"/>
        <result property="pcrq" column="pcrq" jdbcType="TIMESTAMP"/>
        <result property="pcsj" column="pcsj" jdbcType="TIMESTAMP"/>
        <result property="pcsrlx" column="pcsrlx" jdbcType="VARCHAR"/>
        <result property="jd" column="jd" jdbcType="NUMERIC"/>
        <result property="wd" column="wd" jdbcType="NUMERIC"/>
        <result property="zb" column="zb" typeHandler="com.mosty.base.feign.handle.PointTypeHandler"/>
        <result property="zbhash" column="zbhash" jdbcType="VARCHAR"/>
        <result property="pcclId" column="pccl_id" jdbcType="VARCHAR"/>
        <result property="bqmc" column="bqmc" jdbcType="VARCHAR"/>
        <result property="bqxxsj" column="bqxxsj" jdbcType="VARCHAR"/>
        <result property="pcclJg" column="pccl_jg" jdbcType="VARCHAR"/>
        <result property="pcclJgmc" column="pccl_jgmc" jdbcType="VARCHAR"/>
        <result property="pcclYjdwdm" column="pccl_yjdwdm" jdbcType="VARCHAR"/>
        <result property="pcclYjdw" column="pccl_yjdw" jdbcType="VARCHAR"/>
        <result property="pcclYjyy" column="pccl_yjyy" jdbcType="VARCHAR"/>
        <result property="pcmjId" column="pcmj_id" jdbcType="VARCHAR"/>
        <result property="pcmjSfzh" column="pcmj_sfzh" jdbcType="VARCHAR"/>
        <result property="pcmjXm" column="pcmj_xm" jdbcType="VARCHAR"/>
        <result property="pcmjJh" column="pcmj_jh" jdbcType="VARCHAR"/>
        <result property="kkId" column="kk_id" jdbcType="VARCHAR"/>
        <result property="kkSsdwdm" column="kk_ssdwdm" jdbcType="VARCHAR"/>
        <result property="kkSsdwmc" column="kk_ssdwmc" jdbcType="VARCHAR"/>
        <result property="kkSsfsxdm" column="kk_ssfsxdm" jdbcType="VARCHAR"/>
        <result property="kkSsfsxmc" column="kk_ssfsxmc" jdbcType="VARCHAR"/>
        <result property="kkSsdszdm" column="kk_ssdszdm" jdbcType="VARCHAR"/>
        <result property="kkSsdszmc" column="kk_ssdszmc" jdbcType="VARCHAR"/>
        <result property="kkLx" column="kk_lx" jdbcType="VARCHAR"/>
        <result property="kkMc" column="kk_mc" jdbcType="VARCHAR"/>
        <result property="kkXzqh" column="kk_xzqh" jdbcType="VARCHAR"/>
        <result property="kkSzmc" column="kk_szmc" jdbcType="VARCHAR"/>
        <result property="kkHchrlx" column="kk_hchrlx" jdbcType="VARCHAR"/>
        <result property="kkSfsz" column="kk_sfsz" jdbcType="VARCHAR"/>
        <result property="sjly" column="sjly" jdbcType="VARCHAR"/>
        <result property="zdxh" column="zdxh" jdbcType="VARCHAR"/>
        <result property="zdch" column="zdch" jdbcType="VARCHAR"/>
        <result property="zdsim" column="zdsim" jdbcType="VARCHAR"/>
        <result property="ssdwdycs" column="ssdwdycs" jdbcType="INTEGER"/>
        <result property="glxtdm" column="glxtdm" jdbcType="VARCHAR"/>
        <result property="glxtid" column="glxtid" jdbcType="VARCHAR"/>
        <result property="xsd" column="xsd" jdbcType="VARCHAR"/>
        <result property="sfxf" column="sfxf" jdbcType="VARCHAR"/>
        <result property="yjzlid" column="yjzlid" jdbcType="VARCHAR"/>
        <result property="jzid" column="jzid" jdbcType="VARCHAR"/>
        <result property="bbid" column="bbid" jdbcType="VARCHAR"/>
        <result property="pcfs" column="pcfs" jdbcType="VARCHAR"/>
        <result property="ssbm" column="ssbm" jdbcType="VARCHAR"/>
        <result property="ssbmid" column="ssbmid" jdbcType="VARCHAR"/>
        <result property="ssbmdm" column="ssbmdm" jdbcType="VARCHAR"/>
        <result property="ssxgaj" column="ssxgaj" jdbcType="VARCHAR"/>
        <result property="ssxgajid" column="ssxgajid" jdbcType="VARCHAR"/>
        <result property="ssxgajdm" column="ssxgajdm" jdbcType="VARCHAR"/>
        <result property="sssgaj" column="sssgaj" jdbcType="VARCHAR"/>
        <result property="sssgajid" column="sssgajid" 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"/>
    </resultMap>

    <sql id="base_column_list">
        id
        ,sfzh,xm,xbdm,csrq,mzdm,whcddm,jgdm,zzxz,lxdh,pcrq,pcsj,pcsrlx,jd,wd,zbhash,pccl_id,bqmc,
        ssbmid,ssxgajid,sssgajid,
        bqxxsj,pccl_jg,pccl_jgmc,pccl_yjdwdm,pccl_yjdw,pccl_yjyy,pcmj_id,pcmj_sfzh,pcmj_xm,pcmj_jh,kk_id,
        kk_ssdwdm,kk_ssdwmc,kk_ssfsxdm,kk_ssfsxmc,kk_ssdszdm,kk_ssdszmc,kk_lx,kk_mc,kk_xzqh,kk_szmc,
        kk_hchrlx,kk_sfsz,sjly,zdxh,zdch,zdsim,ssdwdycs,glxtdm,glxtid,xsd,sfxf,yjzlid,jzid,bbid,pcfs,
        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
    </sql>

    <sql id="zb_sql">
        ST_ASWKT
                (zb)
                as zb
    </sql>

    <insert id="insertEntity" parameterType="com.mosty.base.model.entity.hczx.TbHcBpcry">
        insert into tb_hc_bpcry(id, sfzh, xm, xbdm, csrq, mzdm, whcddm, jgdm, zzxz, lxdh, pcrq, pcsj, pcsrlx, jd, wd,
                                zb, zbhash, pccl_id, bqmc, bqxxsj, pccl_jg, pccl_jgmc, pccl_yjdwdm, pccl_yjdw,
                                pccl_yjyy,ssbmid,ssxgajid,sssgajid,
                                pcmj_id, pcmj_sfzh, pcmj_xm, pcmj_jh, kk_id, kk_ssdwdm, kk_ssdwmc, kk_ssfsxdm,
                                kk_ssfsxmc, kk_ssdszdm, kk_ssdszmc, kk_lx, kk_mc, kk_xzqh, kk_szmc, kk_hchrlx,
                                kk_sfsz, sjly, zdxh, zdch, zdsim, ssdwdycs, glxtdm, glxtid, xsd, sfxf, yjzlid, jzid,
                                bbid, pcfs, 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, xjzdz)
        values (#{id}, #{sfzh}, #{xm}, #{xbdm}, #{csrq}, #{mzdm}, #{whcddm}, #{jgdm}, #{zzxz}, #{lxdh}, #{pcrq},
                #{pcsj}, #{pcsrlx}, #{jd}, #{wd},
                ST_GEOMFROMTEXT(#{zb,typeHandler = com.mosty.base.feign.handle.PointTypeHandler}), #{zbhash},
                #{pcclId}, #{bqmc}, #{bqxxsj}, #{pcclJg}, #{pcclJgmc}, #{pcclYjdwdm}, #{pcclYjdw}, #{pcclYjyy},
                #{ssbmid},#{ssxgajid},#{sssgajid},
                #{pcmjId}, #{pcmjSfzh}, #{pcmjXm}, #{pcmjJh}, #{kkId}, #{kkSsdwdm}, #{kkSsdwmc}, #{kkSsfsxdm},
                #{kkSsfsxmc}, #{kkSsdszdm}, #{kkSsdszmc}, #{kkLx}, #{kkMc}, #{kkXzqh}, #{kkSzmc}, #{kkHchrlx},
                #{kkSfsz}, #{sjly}, #{zdxh}, #{zdch}, #{zdsim}, #{ssdwdycs}, #{glxtdm}, #{glxtid}, #{xsd},
                #{sfxf}, #{yjzlid}, #{jzid}, #{bbid}, #{pcfs}, #{ssbm}, #{ssbmdm}, #{ssxgaj}, #{ssxgajdm},
                #{sssgaj}, #{sssgajdm}, #{xtSjly}, #{xtSjzt}, #{xtScbz}, #{xtCjip}, #{xtCjsj}, #{xtCjrId},
                #{xtCjr}, #{xtCjbmdm}, #{xtCjbmmc}, #{xtZhgxip}, #{xtZhgxsj}, #{xtZhgxrid}, #{xtZhgxr}, #{xtZhgxbmdm},
                #{xtZhgxbm}, #{bz}, #{xjzdz})
    </insert>

    <select id="selectCrewCount" resultType="Integer">
        select count(*)
        from tb_hc_bpcry a
        where a.xt_scbz = '0'
          and a.xt_sjzt = '1'
          and DATE_FORMAT(a.pcrq, '%Y-%m-%d') = DATE_FORMAT(NOW(), '%Y-%m-%d')
        <if test="ssbmdm != null and ssbmdm != ''">
            and ssbmdm like concat(#{ssbmdm},'%')
        </if>
    </select>


    <select id="getCount" resultType="Integer" parameterType="Map">
        select count(*)
        from tb_hc_bpcry a where a.xt_scbz = '0' and a.xt_sjzt = '1'
        and DATE_FORMAT(a.pcrq, '%Y-%m-%d') = DATE_FORMAT(NOW(), '%Y-%m-%d')
        <if test="dto.xm != null and dto.xm != ''">
            and xm like concat('%',#{dto.xm},'%')
        </if>
        <if test="dto.sfzh != null and dto.sfzh != ''">
            and sfzh like concat('%',#{dto.sfzh},'%')
        </if>
        <if test="dto.lxdh != null and dto.lxdh != ''">
            and lxdh like concat('%',#{dto.lxdh},'%')
        </if>
        <if test="dto.ssbmdm != null and dto.ssbmdm != ''">
            and ssbmdm like concat(#{dto.ssbmdm},'%')
        </if>
    </select>

    <select id="getList" resultType="com.mosty.base.model.entity.hczx.TbHcBpcry" parameterType="Map">
        select * from tb_hc_bpcry a where a.xt_scbz = '0' and a.xt_sjzt = '1'
        and DATE_FORMAT(a.pcrq, '%Y-%m-%d') = DATE_FORMAT(NOW(), '%Y-%m-%d')
        <if test="dto.xm != null and dto.xm != ''">
            and xm like concat('%',#{dto.xm},'%')
        </if>
        <if test="dto.sfzh != null and dto.sfzh != ''">
            and sfzh like concat('%',#{dto.sfzh},'%')
        </if>
        <if test="dto.lxdh != null and dto.lxdh != ''">
            and lxdh like concat('%',#{dto.lxdh},'%')
        </if>
        <if test="dto.ssbmdm != null and dto.ssbmdm != ''">
            and ssbmdm like concat(#{dto.ssbmdm},'%')
        </if>
        order by pcsj desc
        limit #{pageIndex},#{pageSize}
    </select>

    <select id="getCountRy" resultType="Integer" parameterType="Map">
        select count(*)
        from tb_hc_bpcry a where a.xt_scbz = '0' and a.xt_sjzt = '1'
        <if test="dto.xm != null and dto.xm != ''">
            and xm like concat('%',#{dto.xm},'%')
        </if>

        <if test="dto.pcmjXm != null and dto.pcmjXm != ''">
            and pcmj_xm like concat('%',#{dto.pcmjXm},'%')
        </if>

        <if test="dto.sfzh != null and dto.sfzh != ''">
            and sfzh like concat('%',#{dto.sfzh},'%')
        </if>
        <if test="dto.lxdh != null and dto.lxdh != ''">
            and lxdh like concat('%',#{dto.lxdh},'%')
        </if>
        <if test="dto.pcclJg != null and dto.pcclJg != ''">
            and pccl_jg = #{dto.pcclJg}
        </if>
        <if test="dto.kssj != null and dto.kssj != '' and dto.jssj != null and dto.jssj != ''">
            and DATE_FORMAT(pcrq,'%Y-%m-%d') between #{dto.kssj} and #{dto.jssj}
        </if>
        <if test="dto.ssbmdm != null and dto.ssbmdm != ''">
            and ssbmdm like concat(#{dto.ssbmdm}, '%')
        </if>
        <if test="dto.bqmc != null and dto.bqmc != ''">
            and bqmc like concat('%',#{dto.bqmc}, '%')
        </if>
    </select>

    <select id="getListRy" resultType="com.mosty.base.model.entity.hczx.TbHcBpcry" parameterType="Map">
        select * from tb_hc_bpcry a where a.xt_scbz = '0' and a.xt_sjzt = '1'
        <if test="dto.xm != null and dto.xm != ''">
            and xm like concat('%',#{dto.xm},'%')
        </if>

        <if test="dto.pcmjXm != null and dto.pcmjXm != ''">
            and pcmj_xm like concat('%',#{dto.pcmjXm},'%')
        </if>


        <if test="dto.sfzh != null and dto.sfzh != ''">
            and sfzh like concat('%',#{dto.sfzh},'%')
        </if>
        <if test="dto.lxdh != null and dto.lxdh != ''">
            and lxdh like concat('%',#{dto.lxdh},'%')
        </if>
        <if test="dto.pcclJg != null and dto.pcclJg != ''">
            and pccl_jg = #{dto.pcclJg}
        </if>
        <if test="dto.kssj != null and dto.kssj != '' and dto.jssj != null and dto.jssj != ''">
            and DATE_FORMAT(pcrq,'%Y-%m-%d') between #{dto.kssj} and #{dto.jssj}
        </if>
        <if test="dto.ssbmdm != null and dto.ssbmdm != ''">
            and ssbmdm like concat(#{dto.ssbmdm}, '%')
        </if>
        <if test="dto.bqmc != null and dto.bqmc != ''">
            and bqmc like concat('%',#{dto.bqmc}, '%')
        </if>
        order by pcsj desc
        limit #{pageIndex},#{pageSize}
    </select>

    <update id="updateEntity" parameterType="com.mosty.base.model.entity.hczx.TbHcBpcry">
        update tb_hc_bpcry
        <set>
            <if test="sfzh != null and sfzh != ''">
                sfzh = #{sfzh},
            </if>
            <if test="xm != null and xm != ''">
                xm = #{xm},
            </if>
            <if test="xbdm != null and xbdm != ''">
                xbdm = #{xbdm},
            </if>
            <if test="csrq != null and csrq != ''">
                csrq = #{csrq},
            </if>
            <if test="mzdm != null and mzdm != ''">
                mzdm = #{mzdm},
            </if>
            <if test="whcddm != null and whcddm != ''">
                whcddm = #{whcddm},
            </if>
            <if test="jgdm != null and jgdm != ''">
                jgdm = #{jgdm},
            </if>
            <if test="zzxz != null and zzxz != ''">
                zzxz = #{zzxz},
            </if>
            <if test="xjzdz != null and xjzdz != ''">
                xjzdz = #{xjzdz},
            </if>
            <if test="lxdh != null and lxdh != ''">
                lxdh = #{lxdh},
            </if>
            <if test="pcrq != null">
                pcrq = #{pcrq},
            </if>
            <if test="pcsj != null">
                pcsj = #{pcsj},
            </if>
            <if test="pcsrlx != null and pcsrlx != ''">
                pcsrlx = #{pcsrlx},
            </if>
            <if test="jd != null">
                jd = #{jd},
            </if>
            <if test="wd != null">
                wd = #{wd},
            </if>
            <if test="zb != null">
                zb = ST_GEOMFROMTEXT(#{zb,typeHandler=com.mosty.base.feign.handle.PointTypeHandler}),
            </if>
            <if test="zbhash != null and zbhash != ''">
                zbhash = #{zbhash},
            </if>
            <if test="pcclId != null and pcclId != ''">
                pccl_id = #{pcclId},
            </if>
            <if test="bqmc != null and bqmc != ''">
                bqmc = #{bqmc},
            </if>
            <if test="bqxxsj != null and bqxxsj != ''">
                bqxxsj = #{bqxxsj},
            </if>
            <if test="pcclJg != null and pcclJg != ''">
                pccl_jg = #{pcclJg},
            </if>
            <if test="pcclJgmc != null and pcclJgmc != ''">
                pccl_jgmc = #{pcclJgmc},
            </if>
            <if test="pcclYjdwdm != null and pcclYjdwdm != ''">
                pccl_yjdwdm = #{pcclYjdwdm},
            </if>
            <if test="pcclYjdw != null and pcclYjdw != ''">
                pccl_yjdw = #{pcclYjdw},
            </if>
            <if test="pcclYjyy != null and pcclYjyy != ''">
                pccl_yjyy = #{pcclYjyy},
            </if>
            <if test="pcmjId != null and pcmjId != ''">
                pcmj_id = #{pcmjId},
            </if>
            <if test="pcmjSfzh != null and pcmjSfzh != ''">
                pcmj_sfzh = #{pcmjSfzh},
            </if>
            <if test="pcmjXm != null and pcmjXm != ''">
                pcmj_xm = #{pcmjXm},
            </if>
            <if test="pcmjJh != null and pcmjJh != ''">
                pcmj_jh = #{pcmjJh},
            </if>
            <if test="kkId != null and kkId != ''">
                kk_id = #{kkId},
            </if>
            <if test="kkSsdwdm != null and kkSsdwdm != ''">
                kk_ssdwdm = #{kkSsdwdm},
            </if>
            <if test="kkSsdwmc != null and kkSsdwmc != ''">
                kk_ssdwmc = #{kkSsdwmc},
            </if>
            <if test="kkSsfsxdm != null and kkSsfsxdm != ''">
                kk_ssfsxdm = #{kkSsfsxdm},
            </if>
            <if test="kkSsfsxmc != null and kkSsfsxmc != ''">
                kk_ssfsxmc = #{kkSsfsxmc},
            </if>
            <if test="kkSsdszdm != null and kkSsdszdm != ''">
                kk_ssdszdm = #{kkSsdszdm},
            </if>
            <if test="kkSsdszmc != null and kkSsdszmc != ''">
                kk_ssdszmc = #{kkSsdszmc},
            </if>
            <if test="kkLx != null and kkLx != ''">
                kk_lx = #{kkLx},
            </if>
            <if test="kkMc != null and kkMc != ''">
                kk_mc = #{kkMc},
            </if>
            <if test="kkXzqh != null and kkXzqh != ''">
                kk_xzqh = #{kkXzqh},
            </if>
            <if test="kkSzmc != null and kkSzmc != ''">
                kk_szmc = #{kkSzmc},
            </if>
            <if test="kkHchrlx != null and kkHchrlx != ''">
                kk_hchrlx = #{kkHchrlx},
            </if>
            <if test="kkSfsz != null and kkSfsz != ''">
                kk_sfsz = #{kkSfsz},
            </if>
            <if test="sjly != null and sjly != ''">
                sjly = #{sjly},
            </if>
            <if test="zdxh != null and zdxh != ''">
                zdxh = #{zdxh},
            </if>
            <if test="zdch != null and zdch != ''">
                zdch = #{zdch},
            </if>
            <if test="zdsim != null and zdsim != ''">
                zdsim = #{zdsim},
            </if>
            <if test="ssdwdycs != null">
                ssdwdycs = #{ssdwdycs},
            </if>
            <if test="glxtdm != null and glxtdm != ''">
                glxtdm = #{glxtdm},
            </if>
            <if test="glxtid != null and glxtid != ''">
                glxtid = #{glxtid},
            </if>
            <if test="xsd != null and xsd != ''">
                xsd = #{xsd},
            </if>
            <if test="sfxf != null and sfxf != ''">
                sfxf = #{sfxf},
            </if>
            <if test="yjzlid != null and yjzlid != ''">
                yjzlid = #{yjzlid},
            </if>
            <if test="jzid != null and jzid != ''">
                jzid = #{jzid},
            </if>
            <if test="bbid != null and bbid != ''">
                bbid = #{bbid},
            </if>
            <if test="pcfs != null and pcfs != ''">
                pcfs = #{pcfs},
            </if>
            <if test="ssbm != null and ssbm != ''">
                ssbm = #{ssbm},
            </if>
            <if test="ssbmid != null and ssbmid != ''">
                ssbmid = #{ssbmid},
            </if>
            <if test="ssbmdm != null and ssbmdm != ''">
                ssbmdm = #{ssbmdm},
            </if>
            <if test="ssxgaj != null and ssxgaj != ''">
                ssxgaj = #{ssxgaj},
            </if>
            <if test="ssxgajid != null and ssxgajid != ''">
                ssxgajid = #{ssxgajid},
            </if>
            <if test="ssxgajdm != null and ssxgajdm != ''">
                ssxgajdm = #{ssxgajdm},
            </if>
            <if test="sssgaj != null and sssgaj != ''">
                sssgaj = #{sssgaj},
            </if>
            <if test="sssgajid != null and sssgajid != ''">
                sssgajid = #{sssgajid},
            </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="bz != null and bz != ''">
                bz = #{bz}
            </if>
        </set>
        where id = #{id}
    </update>

    <select id="getRyOf2h" resultMap="tbHcBpcry">
        select
        <include refid="base_column_list"/>,
        <include refid="zb_sql"/>
        from (
        select b.sfzh as sfzh_b,max(b.pcsj) as pcsj_b from tb_hc_bpcry b where b.xt_sjzt = '1' and b.xt_scbz = '0'
        and b.pccl_id is null
        and b.pcmj_sfzh = #{sfzh}
        and DATE_FORMAT(b.pcsj,'%Y-%m-%d %H:%i:%s') >= #{time}
        group by b.sfzh
        ) t left join tb_hc_bpcry a on a.sfzh = t.sfzh_b and t.pcsj_b = a.pcsj
        and a.xt_scbz = '0' and a.xt_sjzt = '1'
    </select>


    <select id="selectPcryTj" resultType="java.util.Map">
        select count(1) count,ssxgaj,ssxgajid from tb_hc_bpcry where pcrq &lt;= #{jssj} and pcrq >= #{kssj}
        and xt_sjzt = '1' and xt_scbz = '0'
        group by ssxgaj,ssxgajid
    </select>

    <select id="selectZdryTj" resultType="java.util.Map">
        select count(1) count,ssxgaj,ssxgajid from tb_hc_bpcry where pcrq &lt;= #{jssj} and pcrq >= #{kssj}
        and bqmc is not null
        and xt_sjzt = '1' and xt_scbz = '0'
        group by ssxgaj,ssxgajid
    </select>


    <select id="getSsbm" resultType="java.lang.String">
       SELECT  DISTINCT ssbmdm  FROM `tb_hc_bpcry_bq`  where xt_sjzt = '1' and xt_scbz = '0'
        <if test="query.ssbmdm != null and query.ssbmdm != ''">
            and ssbmdm like concat(#{query.ssbmdm},'%')
        </if>

        <if test="query.kssj != null and query.kssj != ''">
            and xt_cjsj >= #{query.kssj}
        </if>
        <if test="query.jssj != null and query.jssj != ''">
            and xt_cjsj &lt;= #{query.jssj}
        </if>


    </select>

    <select id="getRyBqtj" resultType="java.util.Map">
        SELECT IFNULL( bqmc, 'ZCRY' ) bqmc, IFNULL( bqxxsj, '正常人员' ) bqxxsj, COUNT( 1 ) sl
        FROM `tb_hc_bpcry` where xt_sjzt = '1' and xt_scbz = '0'
        <if test="ssbmdm != null and ssbmdm != ''">
            and ssbmdm like concat(#{ssbmdm},'%')
        </if>
        <if test="kssj != null and kssj != ''">
            and pcsj >= #{kssj}
        </if>
        <if test="jssj != null and jssj != ''">
            and xt_cjsj &lt;= #{jssj}
        </if>
        GROUP BY bqmc, bqxxsj
    </select>

    <select id="getClBqtj" resultType="java.util.Map">
        SELECT
            ( CASE WHEN bqmc = '' THEN 'ZCCL' ELSE bqmc END ) AS bqmc,
            ( CASE WHEN bqxxsj = '' THEN '正常车辆' ELSE bqxxsj END ) AS bqxxsj,
            COUNT( 1 ) sl
        FROM `tb_hc_bpccl` where xt_sjzt = '1' and xt_scbz = '0'
        <if test="ssbmdm != null and ssbmdm != ''">
            and ssbmdm like concat(#{ssbmdm},'%')
        </if>
        <if test="kssj != null and kssj != ''">
            and pcsj >= #{kssj}
        </if>
        <if test="jssj != null and jssj != ''">
            and xt_cjsj &lt;= #{jssj}
        </if>
        GROUP BY bqmc, bqxxsj
    </select>


</mapper>
