<?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.qwzx.mapper.QwzxStatisticsMapper">
    <select id="getQbfjCount" resultType="Integer">
        select count(1) from mosty_qwgl.tb_qw_bmjlbb_jlmx a,mosty_jcgl.tb_jcgl_xfll c
        where a.jl_id = c.id
        and a.xt_sjzt = '1' and a.xt_scbz = '0' and c.xt_sjzt = '1' and c.xt_scbz = '0'
        and a.jllx = '02'
        <if test="dto.bbrq != null and dto.bbrq != ''">
            and a.bbrq = #{dto.bbrq}
        </if>
        <!--        <if test="dto.ssbmid != null and dto.ssbmid != ''">-->
        <!--            and a.ssbmid = #{dto.ssbmid}-->
        <!--        </if>-->

        <if test="dto.ssbmdm != null and dto.ssbmdm != ''">
            and a.ssbmdm like concat(#{dto.ssbmdm},'%')
        </if>
        <!--        <if test="dto.ssbmid == null or dto.ssbmid == ''">-->
        <!--            ${useSql}-->
        <!--        </if>-->
    </select>

    <select id="getQbfjList" resultType="java.util.Map">
        select c.xm username,c.sfzh sfz,c.mzdm mz,a.ssbm,a.ssbmdm,a.jllx jllx,c.xbdm sex,
        date_format(now(),'%Y') - substring(c.sfzh,7,4) age
        from mosty_qwgl.tb_qw_bmjlbb_jlmx a,mosty_jcgl.tb_jcgl_xfll c
        where a.jl_id = c.id
        and a.xt_sjzt = '1' and a.xt_scbz = '0' and c.xt_sjzt = '1' and c.xt_scbz = '0'
        and a.jllx = '02'
        <if test="dto.bbrq != null and dto.bbrq != ''">
            and a.bbrq = #{dto.bbrq}
        </if>
        <if test="dto.ssbmdm != null and dto.ssbmdm != ''">
            and a.ssbmdm like concat(#{dto.ssbmdm},'%')
        </if>
        <!--        <if test="dto.ssbmid != null and dto.ssbmid != ''">-->
        <!--            and a.ssbmid = #{dto.ssbmid}-->
        <!--        </if>-->
        <!--        ${useSql}-->
        limit #{pageIndex},#{pageSize}
    </select>

    <!-- 警力情况-辅警-全部列表 -->
    <select id="qblb" resultType="java.util.Map">
        select * from mosty_jcgl.tb_jcgl_xfll where fl='02' and xt_sjzt='1' and xt_scbz='0'
        <!--        <if test="dto.ssbmid != null and dto.ssbmid != ''">-->
        <!--            and ssbmid = #{dto.ssbmid}-->
        <!--        </if>-->
        <if test="dto.ssbmdm != null and dto.ssbmdm != ''">
            and ssbmdm like concat(#{dto.ssbmdm},'%')
        </if>
        <if test="dto.xm != null and dto.xm != ''">
            and xm = #{dto.xm}
        </if>
        <!--        ${useSql}-->
        limit #{pageIndex},#{pageSize}
    </select>

    <select id="getQblbCount" resultType="int">
        select count(1) from mosty_jcgl.tb_jcgl_xfll where fl='02' and xt_sjzt='1' and xt_scbz='0'
        <!--        <if test="dto.ssbmid != null and dto.ssbmid != ''">-->
        <!--            and ssbmid = #{dto.ssbmid}-->
        <!--        </if>-->
        <if test="dto.xm != null and dto.xm != ''">
            and xm = #{dto.xm}
        </if>
        <if test="dto.ssbmdm != null and dto.ssbmdm != ''">
            and ssbmdm like concat(#{dto.ssbmdm},'%')
        </if>
        <!--        ${useSql}-->
    </select>

    <!--全部在岗统计 -->
    <select id="qbzgtj" resultType="java.util.Map">
        select a.sl as qbsl,b.sl as zgsl from
        (select count(1) as sl from mosty_qwgl.tb_qw_bmjlbb_jlmx where bblx in ('2','5') and xt_sjzt='1' and xt_scbz='0'
        <if test="dto.bbrq != null and dto.bbrq != ''">
            and bbrq = #{dto.bbrq}
        </if>
        <if test="dto.ssbmdm != null and dto.ssbmdm != ''">
            and ssbmdm like concat(#{dto.ssbmdm},'%')
        </if>
        <!--        <if test="dto.ssbmid != null and dto.ssbmid != ''">-->
        <!--            and ssbmid = #{dto.ssbmid}-->
        <!--        </if>-->
        <!--        ${useSql}-->
        ) a,
        (
        select count(1) as sl from mosty_qwgl.tb_qw_bmjlbb_jlmx where bblx='2' and xt_sjzt='1' and xt_scbz='0'
        <if test="dto.bbrq != null and dto.bbrq != ''">
            and bbrq = #{dto.bbrq}
        </if>
        <if test="dto.ssbmdm != null and dto.ssbmdm != ''">
            and ssbmdm like concat(#{dto.ssbmdm},'%')
        </if>
        <!--        <if test="dto.ssbmid != null and dto.ssbmid != ''">-->
        <!--            and ssbmid = #{dto.ssbmid}-->
        <!--        </if>-->
        <!--        ${useSql}-->
        ) b
        limit #{pageIndex},#{pageSize}
    </select>

    <select id="getQbzgtjCount" resultType="int">
        select count(1) from
        (select count(1) as sl from mosty_qwgl.tb_qw_bmjlbb_jlmx where bblx in ('2','5') and xt_sjzt='1' and xt_scbz='0'
        <if test="dto.bbrq != null and dto.bbrq != ''">
            and bbrq = #{dto.bbrq}
        </if>
        <if test="dto.ssbmdm != null and dto.ssbmdm != ''">
            and ssbmdm like concat(#{dto.ssbmdm},'%')
        </if>
        <!--        <if test="dto.ssbmid != null and dto.ssbmid != ''">-->
        <!--            and ssbmid = #{dto.ssbmid}-->
        <!--        </if>-->
        <!--        ${useSql}-->


        ) a,
        (
        select count(1) as sl from mosty_qwgl.tb_qw_bmjlbb_jlmx where bblx='2' and xt_sjzt='1' and xt_scbz='0'
        <if test="dto.bbrq != null and dto.bbrq != ''">
            and bbrq = #{dto.bbrq}
        </if>
        <if test="dto.ssbmdm != null and dto.ssbmdm != ''">
            and ssbmdm like concat(#{dto.ssbmdm},'%')
        </if>
        <!--        <if test="dto.ssbmid != null and dto.ssbmid != ''">-->
        <!--            and ssbmid = #{dto.ssbmid}-->
        <!--        </if>-->
        <!--        ${useSql}-->
        ) b
    </select>

    <!--    在岗辅警数量-->
    <select id="getZgfjCount" resultType="Integer">
        select count(1) count from tb_qw_bmjlbb_jlmx a where xt_sjzt = '1' and xt_scbz = '0' and (jlzt = '1' or jlzt =
        '2')
        and jllx = '02'
        <if test="dto.bbrq != null and dto.bbrq != ''">
            and bbrq = #{dto.bbrq}
        </if>
        <if test="dto.ssbmdm != null and dto.ssbmdm != ''">
            and ssbmdm like concat(#{dto.ssbmdm},'%')
        </if>
        <!--        <if test="dto.ssbmid != null and dto.ssbmid != ''">-->
        <!--            and ssbmid=#{dto.ssbmid}-->
        <!--        </if>-->

        <!--        ${useSql}-->
    </select>

    <!--    在岗辅警列表-->
    <select id="getZgfjList" resultType="java.util.Map">
        select c.xm username,c.sfzh sfz,c.mzdm mz,a.ssbm,a.ssbmdm,a.ssbmid,a.jllx jllx,c.xbdm sex,
        date_format(now(),'%Y') - substring(c.sfzh,7,4) age
        from mosty_qwgl.tb_qw_bmjlbb_jlmx a,mosty_jcgl.tb_jcgl_xfll c
        where a.jl_id = c.id
        and a.xt_sjzt = '1' and a.xt_scbz = '0' and c.xt_sjzt = '1' and c.xt_scbz = '0' and (a.jlzt = '1' or a.jlzt =
        '2')
        and a.jllx = '02'
        and a.bbrq = #{dto.bbrq}
        <if test="dto.ssbmdm != null and dto.ssbmdm != ''">
            and a.ssbmdm like concat(#{dto.ssbmdm},'%')
        </if>
        <!--        <if test="dto.ssbmid != null and dto.ssbmid != ''">-->
        <!--            and a.ssbmid = #{dto.ssbmid}-->
        <!--        </if>-->
        <if test="dto.jlxm != null and dto.jlxm != ''">
            and a.jlxm like concat('%',#{dto.jlxm},'%')
        </if>
        <if test="dto.jh != null and dto.jh != ''">
            and a.jh like concat('%',#{dto.jh},'%')
        </if>
        <!--        ${useSql}-->
        limit #{pageIndex},#{pageSize}
    </select>

    <!--    在岗列表 -->
    <select id="zglb" resultType="java.util.Map">
        select * from mosty_qwgl.tb_qw_bmjlbb_jlmx where xt_scbz='0' and xt_sjzt='1' and bblx='2'
        <if test="dto.bbrq != null and dto.bbrq != ''">
            and bbrq = #{dto.bbrq}
        </if>
        <if test="dto.ssbmdm != null and dto.ssbmdm != ''">
            and ssbmdm like concat(#{dto.ssbmdm},'%')
        </if>
        <!--        <if test="dto.ssbmid != null and dto.ssbmid != ''">-->
        <!--            and ssbmid = #{dto.ssbmid}-->
        <!--        </if>-->
        <if test="dto.jlxm != null and dto.jlxm != ''">
            and jlxm like concat('%',#{dto.jlxm},'%')
        </if>
        <if test="dto.jh != null and dto.jh != ''">
            and jh like concat('%',#{dto.jh},'%')
        </if>
        <!--        ${useSql}-->
        limit #{pageIndex},#{pageSize}
    </select>

    <select id="getZglbCount" resultType="int">
        select count(1) from mosty_qwgl.tb_qw_bmjlbb_jlmx where xt_scbz='0' and xt_sjzt='1' and bblx='2'
        <if test="dto.bbrq != null and dto.bbrq != ''">
            and bbrq = #{dto.bbrq}
        </if>
        <if test="dto.ssbmdm != null and dto.ssbmdm != ''">
            and ssbmdm like concat(#{dto.ssbmdm},'%')
        </if>
        <!--        <if test="dto.ssbmid != null and dto.ssbmid != ''">-->
        <!--            and ssbmid = #{dto.ssbmid}-->
        <!--        </if>-->
        <if test="dto.jlxm != null and dto.jlxm != ''">
            and jlxm like concat('%',#{dto.jlxm},'%')
        </if>
        <if test="dto.jh != null and dto.jh != ''">
            and jh like concat('%',#{dto.jh},'%')
        </if>
        <!--        ${useSql}-->
    </select>

    <!--  "警力情况-街面警力-辅警列表  -->
    <select id="fjlb" resultType="java.util.Map">
        select * from tb_qw_jl a where jllx = '02' and xt_scbz = '0' and xt_sjzt='1' and ywid in(
        select id from tb_qw_xfbb b where xt_sjzt='1' and xt_scbz='0'
        <if test="dto.kssj != null and dto.kssj != ''">
            and b.bbkssj >= #{dto.kssj}
        </if>
        <if test="dto.ssbmdm != null and dto.ssbmdm != ''">
            and b.ssbmdm like concat(#{dto.ssbmdm},'%')
        </if>
        <!--        <if test="dto.ssbmid != null and dto.ssbmid != ''">-->
        <!--            and b.ssbmid = #{dto.ssbmid}-->
        <!--        </if>-->
        )
        <if test="dto.jlxm != null and dto.jlxm != ''">
            and a.jlxm=#{dto.jlxm}
        </if>
        <if test="dto.ssbmdm != null and dto.ssbmdm != ''">
            and a.ssbmdm like concat(#{dto.ssbmdm},'%')
        </if>
        <!--        ${useSql}-->
    </select>

    <select id="getFjlbCount" resultType="int">
        select count(1) from tb_qw_jl a where jllx = '02' and xt_scbz = '0' and xt_sjzt='1' and ywid in(
        select id from tb_qw_xfbb b where xt_sjzt='1' and xt_scbz='0'
        <if test="dto.kssj != null and dto.kssj != ''">
            and b.bbkssj >= #{dto.kssj}
        </if>
        <if test="dto.ssbmdm != null and dto.ssbmdm != ''">
            and b.ssbmdm like concat(#{dto.ssbmdm},'%')
        </if>
        <!--        <if test="dto.ssbmid != null and dto.ssbmid != ''">-->
        <!--            and b.ssbmid = #{dto.ssbmid}-->
        <!--        </if>-->
        )
        <if test="dto.jlxm != null and dto.jlxm != ''">
            and a.jlxm=#{dto.jlxm}
        </if>
        <!--        ${useSql}-->
    </select>

    <!--    警力情况-民警列表-->
    <select id="mjlb" resultType="java.util.Map">
        select * from tb_qw_jl a where jllx = '01' and xt_scbz = '0' and xt_sjzt='1' and ywid in(
        select id from tb_qw_xfbb b where xt_sjzt='1' and xt_scbz='0'
        and TO_DAYS(xfrq) = TO_DAYS(NOW())
        <if test="dto.ssbmdm != null and dto.ssbmdm != ''">
            and b.ssbmdm like concat(#{dto.ssbmdm},'%')
        </if>
        <!--        <if test="dto.ssbmid != null and dto.ssbmid != ''">-->
        <!--            and b.ssbmid = #{dto.ssbmid}-->
        <!--        </if>-->
        )
        <if test="dto.jlxm != null and dto.jlxm != ''">
            and a.jlxm=#{dto.jlxm}
        </if>
        <if test="dto.ssbmdm != null and dto.ssbmdm != ''">
            and a.ssbmdm like concat(#{dto.ssbmdm},'%')
        </if>
        <!--        ${useSql}-->
        limit #{pageIndex},#{pageSize}
    </select>

    <select id="getMjlbCount" resultType="int">
        select count(1) from tb_qw_jl a where jllx = '01' and xt_scbz = '0' and xt_sjzt='1' and ywid in(
        select id from tb_qw_xfbb b where xt_sjzt='1' and xt_scbz='0'
        and TO_DAYS(xfrq) = TO_DAYS(NOW())
        <if test="dto.ssbmdm != null and dto.ssbmdm != ''">
            and b.ssbmdm like concat(#{dto.ssbmdm},'%')
        </if>
        <!--        <if test="dto.ssbmid != null and dto.ssbmid != ''">-->
        <!--            and b.ssbmid = #{dto.ssbmid}-->
        <!--        </if>-->
        )
        <if test="dto.jlxm != null and dto.jlxm != ''">
            and a.jlxm=#{dto.jlxm}
        </if>
        <if test="dto.ssbmdm != null and dto.ssbmdm != ''">
            and a.ssbmdm like concat(#{dto.ssbmdm},'%')
        </if>
        <!--        ${useSql}-->
    </select>

    <select id="getQbCount" resultType="Integer">
        select count(1) count from tb_qw_bmjlbb_jlmx a where xt_sjzt = '1' and xt_scbz = '0'
        <if test="dto.bbrq != null and dto.bbrq != ''">
            and a.bbrq = #{dto.bbrq}
        </if>
        <if test="dto.ssbmdm != null and dto.ssbmdm != ''">
            and a.ssbmdm like concat(#{dto.ssbmdm},'%')
        </if>
        <!--        <if test="dto.ssbmid != null and dto.ssbmid != ''">-->
        <!--            and a.ssbmid=#{dto.ssbmid}-->
        <!--        </if>-->
        <if test="dto.jllx != null and dto.jllx != ''">
            and a.jllx=#{dto.jllx}
        </if>
        <if test="dto.jlxm != null and dto.jlxm != ''">
            and a.jlxm like concat('%',#{dto.jlxm},'%')
        </if>
        <!--        ${useSql}-->
    </select>

    <select id="qbList" resultType="java.util.Map">
        select a.jlxm username,a.sfzh sfz,'' mz,a.ssbm,a.ssbmdm,a.jllx jllx,a.xbdm sex,
        date_format(now(),'%Y') - substring(a.sfzh,7,4) age
        from mosty_qwgl.tb_qw_bmjlbb_jlmx a
        where a.xt_sjzt = '1' and a.xt_scbz = '0' and (a.jlzt = '1' or a.jlzt =
        '2')
        <if test="dto.jllx != null and dto.jllx != ''">
            and a.jllx = #{dto.jllx}
        </if>
        <if test="dto.bbrq != null and dto.bbrq != ''">
            and a.bbrq = #{dto.bbrq}
        </if>
        <if test="dto.ssbmdm != null and dto.ssbmdm != ''">
            and a.ssbmdm like concat(#{dto.ssbmdm},'%')
        </if>
        <if test="dto.jlxm != null and dto.jlxm != ''">
            and a.jlxm like concat('%',#{dto.jlxm},'%')
        </if>
        limit #{pageIndex},#{pageSize}
    </select>

    <!--    在岗民警辅警数量 -->
    <select id="getZgCount" resultType="Integer">
        select count(1) count from tb_qw_bmjlbb_jlmx a where xt_sjzt = '1' and xt_scbz = '0' and (jlzt = '1' or jlzt =
        '2')
        and bbrq = #{dto.bbrq}
        <if test="dto.bbrq != null and dto.bbrq != ''">
            and bbrq = #{dto.bbrq}
        </if>
        <if test="dto.ssbmdm != null and dto.ssbmdm != ''">
            and ssbmdm like concat(#{dto.ssbmdm},'%')
        </if>
        <!--        <if test="dto.ssbmid != null and dto.ssbmid != ''">-->
        <!--            and ssbmid=#{dto.ssbmid}-->
        <!--        </if>-->
        <if test="dto.jlxm != null and dto.jlxm != ''">
            and jlxm=#{dto.jlxm}
        </if>
        <!--        ${useSql}-->
    </select>

    <select id="zgList" resultType="java.util.Map">
        <!--     select b.user_name username,b.id_entity_card sfz,b.nation mz,a.ssbm,a.ssbmdm,a.jllx jllx,b.sex sex,
             date_format(now(),'%Y') - substring(b.id_entity_card,7,4) age
             from mosty_qwgl.tb_qw_bmjlbb_jlmx a,mosty_base.sys_user b
             where a.jl_id = b.id
             and a.xt_sjzt = '1' and a.xt_scbz = '0' and b.xt_zxbz = '0' and (a.jlzt = '1' or a.jlzt = '2')
             and a.jllx = '01'
             <if test="dto.bbrq != null and dto.bbrq != ''">
                 and a.bbrq = #{dto.bbrq}
             </if>
             <if test="dto.ssbmdm != null and dto.ssbmdm != ''">
                 and a.ssbmdm  like concat(#{dto.ssbmdm},'%')
             </if>
     &lt;!&ndash;        <if test="dto.ssbmid != null and dto.ssbmid != ''">&ndash;&gt;
     &lt;!&ndash;            and a.ssbmid = #{dto.ssbmid}&ndash;&gt;
     &lt;!&ndash;        </if>&ndash;&gt;
             <if test="dto.jlxm != null and dto.jlxm != ''">
                 and b.user_name=#{dto.jlxm}
             </if>
     &lt;!&ndash;        ${useSql}&ndash;&gt;
             union-->
        select a.jlxm username,a.sfzh sfz,'' mz,a.ssbm,a.ssbmdm,a.jllx jllx,a.xbdm sex,
        date_format(now(),'%Y') - substring(a.sfzh,7,4) age
        from mosty_qwgl.tb_qw_bmjlbb_jlmx a
        where a.xt_sjzt = '1' and a.xt_scbz = '0' and (a.jlzt = '1' or a.jlzt =
        '2')

        <if test="dto.bbrq != null and dto.bbrq != ''">
            and a.bbrq = #{dto.bbrq}
        </if>
        <if test="dto.ssbmdm != null and dto.ssbmdm != ''">
            and a.ssbmdm like concat(#{dto.ssbmdm},'%')
        </if>
        <!--        <if test="dto.ssbmid != null and dto.ssbmid != ''">-->
        <!--            and a.ssbmid = #{dto.ssbmid}-->
        <!--        </if>-->
        <if test="dto.jlxm != null and dto.jlxm != ''">
            and a.jlxm like concat('%',#{dto.jlxm},'%')
        </if>
        <!--        ${useSql}-->
        limit #{pageIndex},#{pageSize}
    </select>

    <!--    可抽调辅警列表 -->
    <select id="kcdFjlb" resultType="java.util.Map">
        select * from mosty_qwgl.tb_qw_bmjlbb_jlmx where xt_scbz='0' and xt_sjzt='1' and bblx='2'
        <if test="dto.bbrq != null and dto.bbrq != ''">
            and bbrq = #{dto.bbrq}
        </if>
        <if test="dto.ssbmdm != null and dto.ssbmdm != ''">
            and ssbmdm like concat(#{dto.ssbmdm},'%')
        </if>
        <!--        <if test="dto.ssbmid != null and dto.ssbmid != '' and dto.ssbmid != '1'">-->
        <!--            and ssbmid = #{dto.ssbmid}-->
        <!--        </if>-->
        <if test="dto.jlxm != null and dto.jlxm != ''">
            and jlxm = #{dto.jlxm}
        </if>
        <!--        ${useSql}-->
        limit #{pageIndex},#{pageSize}
    </select>

    <select id="getKcdFjlbCount" resultType="int">
        select count(1) from mosty_qwgl.tb_qw_bmjlbb_jlmx where xt_scbz='0' and xt_sjzt='1' and bblx='2'
        <if test="dto.bbrq != null and dto.bbrq != ''">
            and bbrq = #{dto.bbrq}
        </if>
        <if test="dto.ssbmdm != null and dto.ssbmdm != ''">
            and ssbmdm like concat(#{dto.ssbmdm},'%')
        </if>
        <!--        <if test="dto.ssbmid != null and dto.ssbmid != '' and dto.ssbmid != '1'">-->
        <!--            and ssbmid = #{dto.ssbmid}-->
        <!--        </if>-->
        <if test="dto.jlxm != null and dto.jlxm != ''">
            and jlxm = #{dto.jlxm}
        </if>
        ${useSql}
    </select>

    <!--    可抽调民警辅警数量-->
    <select id="getZbtjCount" resultType="Map">
        select count(1) mj,(
        select count(1) from tb_qw_bmjlbb_jlmx a where a.xt_sjzt='1' and a.xt_scbz='0'
        and a.jllx = '02' and jlzt = '1'
        <if test="dto.bbrq != null and dto.bbrq != ''">
            and bbrq=#{dto.bbrq}
        </if>
        <if test="dto.ssbmdm != null and dto.ssbmdm != ''">
            and a.ssbmdm like concat(#{dto.ssbmdm},'%')
        </if>
        <!--        ${useSql}-->
        ) fj from tb_qw_bmjlbb_jlmx a where a.xt_sjzt='1' and a.xt_scbz='0'
        and a.jllx = '01' and jlzt = '1'
        <if test="dto.bbrq != null and dto.bbrq != ''">
            and bbrq=#{dto.bbrq}
        </if>
        <if test="dto.ssbmdm != null and dto.ssbmdm != ''">
            and a.ssbmdm like concat(#{dto.ssbmdm},'%')
        </if>
        <!--        ${useSql}-->
    </select>

    <!--    可抽调民警列表-->
    <select id="kcdMjList" resultType="java.util.Map">
        select * from tb_qw_bmjlbb_jlmx a
        where xt_scbz='0' and jllx = '01' and bblx = 1
        <if test="dto.bbrq != null and dto.bbrq != ''">
            and bbrq = #{dto.bbrq}
        </if>
        <if test="dto.bbrq == null or dto.bbrq == ''">
            and TO_DAYS(bbrq) = TO_DAYS(NOW())
        </if>
        <if test="dto.jlxm != null and dto.jlxm != ''">
            and a.jlxm like concat('%',#{dto.ssbmdm},'%')
        </if>
        <if test="dto.ssbmdm != null and dto.ssbmdm != ''">
            and a.ssbmdm like concat(#{dto.ssbmdm},'%')
        </if>
        limit #{pageIndex},#{pageSize}
    </select>

    <select id="mjfjzh" resultType="java.util.Map">
        <if test='dto.jllx == 01'>
            select a.id_entity_card as idEntityCard, c.org_name as orgName,a.user_name as userName, a.sex as
            sex,a.in_dust_rial_id as inDustRialId,
            "01" as jllx from mosty_base.sys_user a
            inner JOIN mosty_base.sys_user_dept b ON a.id = b.user_id
            inner JOIN mosty_base.sys_dept c ON b.dept_id = c.id
            where a.xt_zxbz = 0
            and a.is_virtual_user='02'
            <!--            <if test="dto.ssbmid != null and dto.ssbmid != ''">-->
            <!--                and b.dept_id = #{dto.ssbmid}-->
            <!--            </if>-->
            <if test="dto.jlxm != null and dto.jlxm != ''">
                and a.user_name like concat('%',#{dto.jlxm},'%')
            </if>
            <if test="dto.ssbmdm != null and dto.ssbmdm != ''">
                and a.ssbmdm like concat(#{dto.ssbmdm},'%')
            </if>

            <!--            <if test="useDept != null and useDept != ''">-->
            <!--                and b.dept_id in (${useDept})-->
            <!--            </if>-->
        </if>
        <if test='dto.jllx == 02'>
            select sfzh as idEntityCard,ssbm as orgName,xm as userName,xbdm as sex,"" as inDustRialId,"02" as jllx
            from mosty_jcgl.tb_jcgl_xfll a where fl='02' and xt_sjzt='1' and xt_scbz='0'
            <!--            <if test="dto.ssbmid != null and dto.ssbmid != ''">-->
            <!--                and a.ssbmid = #{dto.ssbmid}-->
            <!--            </if>-->
            <if test="dto.jlxm != null and dto.jlxm != ''">
                and a.xm like concat('%',#{dto.jlxm},'%')
            </if>
            <if test="dto.ssbmdm != null and dto.ssbmdm != ''">
                and a.ssbmdm like concat(#{dto.ssbmdm},'%')
            </if>
            <!--            ${useSql}-->
        </if>
        <if test="dto.jllx == null or dto.jllx == ''">
            select a.id_entity_card as idEntityCard, c.org_name as orgName,a.user_name as userName, a.sex as
            sex,a.in_dust_rial_id as inDustRialId,
            "01" as jllx from mosty_base.sys_user a
            inner JOIN mosty_base.sys_user_dept b ON a.id = b.user_id
            inner JOIN mosty_base.sys_dept c ON b.dept_id = c.id
            where a.xt_zxbz = 0
            and a.is_virtual_user='02'
            <!--            <if test="dto.ssbmid != null and dto.ssbmid != ''">-->
            <!--                and b.dept_id = #{dto.ssbmid}-->
            <!--            </if>-->
            <if test="dto.jlxm != null and dto.jlxm != ''">
                and a.user_name like concat('%',#{dto.jlxm},'%')
            </if>
            <if test="dto.ssbmdm != null and dto.ssbmdm != ''">
                and a.ssbmdm like concat(#{dto.ssbmdm},'%')
            </if>
            <!--            <if test="useDept != null and useDept != ''">-->
            <!--                and b.dept_id in (${useDept})-->
            <!--            </if>-->
            union all
            select sfzh as idEntityCard,ssbm as orgName,xm as userName,xbdm as sex,"" as inDustRialId,"02" as jllx
            from mosty_jcgl.tb_jcgl_xfll a where fl='02' and xt_sjzt='1' and xt_scbz='0'
            <!--            <if test="dto.ssbmid != null and dto.ssbmid != ''">-->
            <!--                and a.ssbmid = #{dto.ssbmid}-->
            <!--            </if>-->
            <if test="dto.ssbmdm != null and dto.ssbmdm != ''">
                and a.ssbmdm like concat(#{dto.ssbmdm},'%')
            </if>
            <if test="dto.jlxm != null and dto.jlxm != ''">
                and a.xm like concat('%',#{dto.jlxm},'%')
            </if>
            <!--            ${useSql}-->
        </if>
        limit #{pageIndex},#{pageSize}
    </select>

    <!--    <select id="getMjQblbCount" resultType="int">-->
    <!--        <if test='dto.jllx == 01'>-->
    <!--            select count(1) a.id_entity_card as idEntityCard, c.org_name as orgName,a.user_name as userName, a.sex as sex,a.in_dust_rial_id as inDustRialId,-->
    <!--            "01" as jllx from mosty_base.sys_user a-->
    <!--            inner JOIN mosty_base.sys_user_dept b ON a.id = b.user_id-->
    <!--            inner JOIN mosty_base.sys_dept c ON b.dept_id = c.id-->
    <!--            where a.xt_zxbz = 0-->
    <!--            and a.is_virtual_user='02'-->
    <!--            <if test="dto.ssbmid != null and dto.ssbmid != ''">-->
    <!--                and b.dept_id = #{dto.ssbmid}-->
    <!--            </if>-->
    <!--            <if test="dto.jlxm != null and dto.jlxm != ''">-->
    <!--                and a.user_name like concat('%',#{dto.jlxm},'%')-->
    <!--            </if>-->
    <!--        </if>-->
    <!--        <if test='dto.jllx == 02'>-->
    <!--            select sfzh as idEntityCard,ssbm as orgName,xm as userName,xbdm as sex,"" as inDustRialId,"02" as jllx-->
    <!--            from mosty_jcgl.tb_jcgl_xfll a where fl='02' and xt_sjzt='1' and xt_scbz='0'-->
    <!--            <if test="dto.ssbmid != null and dto.ssbmid != ''">-->
    <!--                and a.ssbmid = #{dto.ssbmid}-->
    <!--            </if>-->
    <!--            <if test="dto.jlxm != null and dto.jlxm != ''">-->
    <!--                and a.xm like concat('%',#{dto.jlxm},'%')-->
    <!--            </if>-->
    <!--        </if>-->
    <!--        <if test="dto.jllx == null or dto.jllx == ''">-->
    <!--            select a.id_entity_card as idEntityCard, c.org_name as orgName,a.user_name as userName, a.sex as sex,a.in_dust_rial_id as inDustRialId,-->
    <!--            "01" as jllx from mosty_base.sys_user a-->
    <!--            inner JOIN mosty_base.sys_user_dept b ON a.id = b.user_id-->
    <!--            inner JOIN mosty_base.sys_dept c ON b.dept_id = c.id-->
    <!--            where a.xt_zxbz = 0-->
    <!--            and a.is_virtual_user='02'-->
    <!--            <if test="dto.ssbmid != null and dto.ssbmid != ''">-->
    <!--                and b.dept_id = #{dto.ssbmid}-->
    <!--            </if>-->
    <!--            <if test="dto.jlxm != null and dto.jlxm != ''">-->
    <!--                and a.user_name like concat('%',#{dto.jlxm},'%')-->
    <!--            </if>-->
    <!--            union all-->
    <!--            select sfzh as idEntityCard,ssbm as orgName,xm as userName,xbdm as sex,"" as inDustRialId,"02" as jllx-->
    <!--            from mosty_jcgl.tb_jcgl_xfll a where fl='02' and xt_sjzt='1' and xt_scbz='0'-->
    <!--            <if test="dto.ssbmid != null and dto.ssbmid != ''">-->
    <!--                and a.ssbmid = #{dto.ssbmid}-->
    <!--            </if>-->
    <!--            <if test="dto.jlxm != null and dto.jlxm != ''">-->
    <!--                and a.xm like concat('%',#{dto.jlxm},'%')-->
    <!--            </if>-->
    <!--        </if>-->
    <!--        <if test="dto.ssbmid == null or dto.ssbmid == ''">-->
    <!--            ${useSql}-->
    <!--        </if>-->
    <!--        limit #{pageIndex},#{pageSize}-->
    <!--    </select>-->

    <!--    警力情况-民警-全部列表-->
    <select id="mjQblb" resultType="java.util.Map">
        SELECT
        DISTINCT
        a.id,
        a.position_id,
        a.position_name,
        a.login_name,
        a.user_name,
        a.mobile,
        a.tele_phone,
        a.sex,
        a.xt_lrsj,
        a.in_dust_rial_id,
        a.id_entity_card,
        a.politic,
        a.marital,
        a.type,
        c.id as deptId,
        c.org_code as deptCode,
        c.org_name as deptName
        FROM
        mosty_base.sys_user a
        inner JOIN mosty_base.sys_user_dept b ON a.id = b.user_id
        inner JOIN mosty_base.sys_dept c ON b.dept_id = c.id
        where a.xt_zxbz = 0
        and a.is_virtual_user='02'
        <!--        <if test="dto.ssbmid != null and dto.ssbmid != ''">-->
        <!--            and b.dept_id = #{dto.ssbmid}-->
        <!--        </if>-->
        <if test="dto.userName != null and dto.userName != ''">
            and a.user_name like concat('%',#{dto.userName} ,'%')
        </if>
        <if test="dto.ssbmdm != null and dto.ssbmdm != ''">
            and c.org_code like concat(#{dto.ssbmdm},'%')
        </if>
        <!--        <if test="useDept != null and useDept != ''">-->
        <!--            and b.dept_id in (${useDept})-->
        <!--        </if>-->
        limit #{pageIndex},#{pageSize}
    </select>

    <!--    警力情况-民警-全部民警-->
    <select id="getQbmjCount" resultType="java.lang.Integer">
        select count(1) count from tb_qw_bmjlbb_jlmx a where xt_sjzt = '1' and xt_scbz = '0'
        and jllx = '01'
        <if test="dto.bbrq != null and dto.bbrq != ''">
            and bbrq = #{dto.bbrq}
        </if>
        <if test="dto.ssbmdm != null and dto.ssbmdm != ''">
            and ssbmdm like concat(#{dto.ssbmdm},'%')
        </if>
        <!--        <if test="dto.ssbmid != null and dto.ssbmid != ''">-->
        <!--            and ssbmid=#{dto.ssbmid}-->
        <!--        </if>-->
        <!--        ${useSql}-->
    </select>

    <!--    警力情况-民警-全部民警列表-->
    <select id="qbmjList" resultType="java.util.Map">
        select b.user_name username,b.id_entity_card sfz,b.nation mz,a.ssbm,a.ssbmdm,a.jllx jllx,b.sex sex,
        date_format(now(),'%Y') - substring(b.id_entity_card,7,4) age
        from mosty_qwgl.tb_qw_bmjlbb_jlmx a,mosty_base.sys_user b
        where a.jl_id = b.id
        and a.xt_sjzt = '1' and a.xt_scbz = '0' and b.xt_zxbz = '0'
        and a.jllx = '01'
        <if test="dto.bbrq != null and dto.bbrq != ''">
            and a.bbrq = #{dto.bbrq}
        </if>
        <if test="dto.ssbmdm != null and dto.ssbmdm != ''">
            and a.ssbmdm like concat(#{dto.ssbmdm},'%')
        </if>
        <!--        <if test="dto.ssbmid != null and dto.ssbmid != ''">-->
        <!--            and a.ssbmid = #{dto.ssbmid}-->
        <!--        </if>-->
        <!--        ${useSql}-->
        limit #{pageIndex},#{pageSize}
    </select>

    <!--   警力情况-民警-全部在岗统计 -->
    <select id="getQbzgCount" resultType="Integer">
        select a.sl as qbsl,b.sl as zgsl from
        (select count(1) as sl from
        mosty_base.sys_user a
        inner JOIN mosty_base.sys_user_dept b ON a.id = b.user_id
        inner JOIN mosty_base.sys_dept c ON b.dept_id = c.id
        where a.is_virtual_user='02' and a.xt_zxbz='0'
        <!--        <if test="dto.ssbmid != null and dto.ssbmid != ''">-->
        <!--            and b.dept_id = #{dto.ssbmid}-->
        <!--        </if>-->
        <!--        <if test="useDept != null and useDept != ''">-->
        <!--            and b.dept_id in (${useDept})-->
        <!--        </if>-->
        <if test="dto.ssbmdm != null and dto.ssbmdm != ''">
            and a.ssbmdm like concat(#{dto.ssbmdm},'%')
        </if>
        ) a,
        (select count(1) as sl from tb_qw_bmjlbb_jlmx where jlbb_id in(
        select id from tb_qw_bmjlbb where xt_scbz='0' and jllx = '01' and bblx = 1
        <if test="dto.bbrq != null and dto.bbrq != ''">
            and bbrq=#{dto.bbrq}
        </if>
        <if test="dto.ssbmdm != null and dto.ssbmdm != ''">
            and ssbmdm like concat(#{dto.ssbmdm},'%')
        </if>
        <!--        <if test="dto.ssbmid != null and dto.ssbmid != ''">-->
        <!--            and ssbmid=#{dto.ssbmid}-->
        <!--        </if>-->
        )
        <if test="dto.ssbmdm != null and dto.ssbmdm != ''">
            and a.ssbmdm like concat(#{dto.ssbmdm},'%')
        </if>
        ) b
    </select>

    <!--    警力情况-民警-在岗列表 -->
    <select id="mjZglb" resultType="java.util.Map">
        select * from tb_qw_bmjlbb_jlmx a where jllx = '01'

        <!-- jlbb_id in(
         select id from tb_qw_bmjlbb b where xt_scbz='0' and jllx = '01' and bblx = 1
         <if test="dto.bbrq != null and dto.bbrq != ''">
             and b.bbrq = #{dto.bbrq}
         </if>
         <if test="dto.bbrq == null or dto.bbrq == ''">
             and TO_DAYS(b.bbrq) = TO_DAYS(NOW())
         </if>
         )-->
        <if test="dto.bbrq != null and dto.bbrq != ''">
            and a.bbrq = #{dto.bbrq}
        </if>
        <if test="dto.bbrq == null or dto.bbrq == ''">
            and TO_DAYS(b.bbrq) = TO_DAYS(NOW())
        </if>


        <if test="dto.ssbmdm != null and dto.ssbmdm != ''">
            and a.ssbmdm like concat(#{dto.ssbmdm},'%')
        </if>
        <!--        <if test="dto.ssbmid != null and dto.ssbmid != ''">-->
        <!--            and a.ssbmid=#{dto.ssbmid}-->
        <!--        </if>-->
        <if test="dto.jlxm != null and dto.jlxm != ''">
            and a.jlxm like concat('%',#{dto.jlxm},'%')
        </if>
        <if test="dto.jh != null and dto.jh != ''">
            and a.jh like concat('%',#{dto.jh},'%')
        </if>
        <!--        ${useSql}-->
        limit #{pageIndex},#{pageSize}
    </select>

    <select id="getmMjzglbCount" resultType="int">
        select count(1) from tb_qw_bmjlbb_jlmx a where jlbb_id in(
        select id from tb_qw_bmjlbb b where xt_scbz='0' and jllx = '01' and bblx = 1
        <if test="dto.bbrq != null and dto.bbrq != ''">
            and b.bbrq = #{dto.bbrq}
        </if>
        <if test="dto.bbrq == null or dto.bbrq == ''">
            and TO_DAYS(b.bbrq) = TO_DAYS(NOW())
        </if>
        )
        <if test="dto.ssbmdm != null and dto.ssbmdm != ''">
            and a.ssbmdm like concat(#{dto.ssbmdm},'%')
        </if>
        <!--        <if test="dto.ssbmid != null and dto.ssbmid != ''">-->
        <!--            and a.ssbmid=#{dto.ssbmid}-->
        <!--        </if>-->
        <if test="dto.jlxm != null and dto.jlxm != ''">
            and a.jlxm like concat('%',#{dto.jlxm},'%')
        </if>
        <if test="dto.jh != null and dto.jh != ''">
            and a.jh like concat('%',#{dto.jh},'%')
        </if>
        <!--        ${useSql}-->
    </select>

    <!--    在岗民警 -->
    <select id="getZgmj" resultType="int">
        select count(1) count from tb_qw_bmjlbb_jlmx where xt_sjzt = '1' and xt_scbz = '0' and (jlzt = '1' or jlzt =
        '2')
        and jllx = '01'
        <if test="dto.bbrq != null and dto.bbrq != ''">
            and bbrq = #{dto.bbrq}
        </if>
        <if test="dto.ssbmdm != null and dto.ssbmdm != ''">
            and ssbmdm like concat(#{dto.ssbmdm},'%')
        </if>
        <!--        <if test="dto.ssbmid != null and dto.ssbmid != ''">-->
        <!--            and ssbmid=#{dto.ssbmid}-->
        <!--        </if>-->
        <!--        ${useSql}-->
    </select>

    <!--    警力情况-民警-在岗民警辅警整合-->
    <select id="zgmjfjzh" resultType="java.util.Map">
        select * from tb_qw_bmjlbb_jlmx a where jlbb_id in(
        select id from tb_qw_bmjlbb b where xt_scbz='0' and bblx = 1
        <if test="dto.bbrq != null and dto.bbrq != ''">
            and b.bbrq=#{dto.bbrq}
        </if>
        <if test="dto.bbrq == null or dto.bbrq == ''">
            and TO_DAYS(b.bbrq) = TO_DAYS(NOW())
        </if>
        <!--        <if test="ssbmid != null and dto.ssbmid != ''">-->
        <!--            and b.ssbmid=#{dto.ssbmid}-->
        <!--        </if>-->
        <if test="dto.ssbmdm != null and dto.ssbmdm != ''">
            and b.ssbmdm like concat(#{dto.ssbmdm},'%')
        </if>
        )
        <if test="dto.jlxm != null and dto.jlxm != ''">
            and a.jlxm like concat('%',#{dto.jlxm},'%')
        </if>
        <if test="dto.jllx != null and dto.jllx != ''">
            and a.jllx #dto.jllx}
        </if>
    </select>

    <!--    警力情况-民警-在岗民警列表-->
    <select id="zgmjList" resultType="java.util.Map">
        select b.user_name username,b.id_entity_card sfz,b.nation mz,a.ssbm,a.ssbmdm,a.jllx jllx,b.sex sex,
        date_format(now(),'%Y') - substring(b.id_entity_card,7,4) age
        from mosty_qwgl.tb_qw_bmjlbb_jlmx a,mosty_base.sys_user b
        where a.jl_id = b.id
        and a.xt_sjzt = '1' and a.xt_scbz = '0' and b.xt_zxbz = '0' and (a.jlzt = '1' or a.jlzt = '2')
        and a.jllx = '01'
        <if test="dto.bbrq != null and dto.bbrq != ''">
            and a.bbrq = #{dto.bbrq}
        </if>
        <if test="dto.ssbmdm != null and dto.ssbmdm != ''">
            and a.ssbmdm like concat(#{dto.ssbmdm},'%')
        </if>
        <!--        <if test="dto.ssbmid != null and dto.ssbmid != ''">-->
        <!--            and a.ssbmid = #{dto.ssbmid}-->
        <!--        </if>-->
        limit #{pageIndex},#{pageSize}
    </select>

    <!--   警力情况-请休假-辅警列表 -->
    <select id="qxFjlb" resultType="java.util.Map">
        select * from tb_qw_qxj a where a.xt_scbz='0' and a.xt_sjzt='1' and a.sqrlx = '02'
        <if test="dto.kssj == null or dto.kssj == ''">
            and curdate() BETWEEN a.kssj and a.jssj
        </if>
        <if test="dto.kssj != null and dto.kssj != ''">
            and a.kssj >= #{dto.kssj}
        </if>
        <if test="dto.jssj != null and dto.jssj != ''">
            and a.jssj &lt;=#{dto.jssj}
        </if>
        <!--        <if test="dto.ssbmid != null and dto.ssbmid != ''">-->
        <!--            and a.ssbmid = #{dto.ssbmid}-->
        <!--        </if>-->
        <if test="dto.ssbmdm != null and dto.ssbmdm != ''">
            and a.ssbmdm like concat(#{dto.ssbmdm},'%')
        </if>
        <if test="dto.jlxm != null and dto.jlxm != ''">
            and a.sqr_xm=#{dto.jlxm}
        </if>

        <!--        ${useSql}-->
        limit #{pageIndex},#{pageSize}
    </select>

    <!--    警力情况-请休假-民警辅警统计 -->
    <select id="mjfjtj" resultType="java.util.Map">
        select count(1) mj,(
        select count(1) fj from tb_qw_qxj a where a.xt_sjzt = '1' and a.xt_scbz = '0' and a.sqrlx = '02'
        <if test="dto.qjrq != null and dto.qjrq != ''">
            and #{dto.qjrq} between date_format(kssj,'%Y-%m-%d') and date_format(jssj,'%Y-%m-%d')
        </if>
        <if test="dto.ssbmdm != null and dto.ssbmdm != ''">
            and a.ssbmdm like concat(#{dto.ssbmdm},'%')
        </if>
        <!--        ${useSql}-->

        ) fj
        from tb_qw_qxj a where a.xt_sjzt = '1' and a.xt_scbz = '0' and a.sqrlx = '01'
        <if test="dto.qjrq != null and dto.qjrq != ''">
            and #{dto.qjrq} between date_format(kssj,'%Y-%m-%d') and date_format(jssj,'%Y-%m-%d')
        </if>
        <if test="dto.ssbmdm != null and dto.ssbmdm != ''">
            and a.ssbmdm like concat(#{dto.ssbmdm},'%')
        </if>
        <!--        ${useSql}-->
    </select>

    <!--    警力情况-请休假-民警列表 -->
    <select id="qxjMjlb" resultType="java.util.Map">
        select user_name as jlxm,sex as xbdm,id_entity_card as sfzh,manager_org_id as ssbmdm,manager_org_name as
        ssbm from mosty_base.sys_user a where xt_zxbz='0' and id in(
        select sqr_id from tb_qw_qxj where xt_scbz='0' and xt_sjzt='1' and sqrlx = '01'
        <if test="dto.kssj == null or dto.kssj == ''">
            and curdate() BETWEEN kssj and jssj
        </if>
        <if test="dto.kssj != null and dto.kssj != ''">
            and kssj >= #{dto.kssj}
        </if>
        <if test="dto.jssj != null and dto.jssj != ''">
            and jssj &lt;=#{dto.jssj}
        </if>
        <if test="dto.ssbmdm != null and dto.ssbmdm != ''">
            and ssbmdm like concat(#{dto.ssbmdm},'%')
        </if>
        <!--        <if test="dto.ssbmid != null and dto.ssbmid != ''">-->
        <!--            and ssbmid = #{dto.ssbmid}-->
        <!--        </if>-->
        <!--        ${useSql}-->
        )
        <if test="dto.jlxm != null and dto.jlxm != ''">
            and a.user_name like concat('%',#{dto.jlxm} ,'%')
        </if>
        limit #{pageIndex},#{pageSize}
    </select>

    <select id="kcdMjCount" resultType="int">
        select count(1) from tb_qw_bmjlbb_jlmx a
        where xt_scbz='0' and jllx = '01' and bblx = 1
        <if test="dto.bbrq != null and dto.bbrq != ''">
            and bbrq = #{dto.bbrq}
        </if>
        <if test="dto.bbrq == null or dto.bbrq == ''">
            and TO_DAYS(bbrq) = TO_DAYS(NOW())
        </if>
        <if test="dto.jlxm != null and dto.jlxm != ''">
            and jlxm like concat('%',#{dto.jlxm},'%')
        </if>
        <if test="dto.ssbmdm != null and dto.ssbmdm != ''">
            and ssbmdm like concat(#{dto.ssbmdm},'%')
        </if>
        <!--        ${useSql}-->
    </select>

    <select id="mjQblbCount" resultType="int">
        SELECT
        count(DISTINCT a.id)
        FROM
        mosty_base.sys_user a
        inner JOIN mosty_base.sys_user_dept b ON a.id = b.user_id
        inner JOIN mosty_base.sys_dept c ON b.dept_id = c.id
        where a.xt_zxbz = 0
        and a.is_virtual_user='02'
        <!--        <if test="dto.ssbmid != null and dto.ssbmid != ''">-->
        <!--            and b.dept_id = #{dto.ssbmid}-->
        <!--        </if>-->
        <if test="dto.userName != null and dto.userName != ''">
            and a.user_name like concat('%',#{dto.userName} ,'%')
        </if>
        <if test="dto.ssbmdm != null and dto.ssbmdm != ''">
            and c.org_code like concat(#{dto.ssbmdm},'%')
        </if>
        <!--        <if test="useDept != null and useDept != ''">-->
        <!--            and b.dept_id in (${useDept})-->
        <!--        </if>-->
    </select>

    <select id="mjfjzhCount" resultType="int">
        <if test='dto.jllx == 01'>
            select count(1) from mosty_base.sys_user a
            inner JOIN mosty_base.sys_user_dept b ON a.id = b.user_id
            inner JOIN mosty_base.sys_dept c ON b.dept_id = c.id
            where a.xt_zxbz = 0
            and a.is_virtual_user='02'
            <!--            <if test="dto.ssbmid != null and dto.ssbmid != ''">-->
            <!--                and b.dept_id = #{dto.ssbmid}-->
            <!--            </if>-->
            <if test="dto.jlxm != null and dto.jlxm != ''">
                and a.user_name like concat('%',#{dto.jlxm},'%')
            </if>
            <if test="dto.ssbmdm != null and dto.ssbmdm != ''">
                and c.ssbmdm like concat(#{dto.ssbmdm},'%')
            </if>
            <!--            <if test="useDept != null and useDept != ''">-->
            <!--                and b.dept_id in (${useDept})-->
            <!--            </if>-->
        </if>
        <if test='dto.jllx == 02'>
            select count(1) mosty_jcgl.tb_jcgl_xfll a where fl='02' and xt_sjzt='1' and xt_scbz='0'
            <!--            <if test="dto.ssbmid != null and dto.ssbmid != ''">-->
            <!--                and a.ssbmid = #{dto.ssbmid}-->
            <!--            </if>-->
            <if test="dto.ssbmdm != null and dto.ssbmdm != ''">
                and a.ssbmdm like concat(#{dto.ssbmdm},'%')
            </if>
            <if test="dto.jlxm != null and dto.jlxm != ''">
                and a.xm like concat('%',#{dto.jlxm},'%')
            </if>
            <!--            ${useSql}-->
        </if>
        <if test="dto.jllx == null or dto.jllx == ''">
            select count(1) from mosty_base.sys_user a
            inner JOIN mosty_base.sys_user_dept b ON a.id = b.user_id
            inner JOIN mosty_base.sys_dept c ON b.dept_id = c.id
            where a.xt_zxbz = 0
            and a.is_virtual_user='02'
            <!--            <if test="dto.ssbmid != null and dto.ssbmid != ''">-->
            <!--                and b.dept_id = #{dto.ssbmid}-->
            <!--            </if>-->
            <if test="dto.jlxm != null and dto.jlxm != ''">
                and a.user_name like concat('%',#{dto.jlxm},'%')
            </if>
            <if test="dto.ssbmdm != null and dto.ssbmdm != ''">
                and a.ssbmdm like concat(#{dto.ssbmdm},'%')
            </if>
            <!--            <if test="useDept != null and useDept != ''">-->
            <!--                and b.dept_id in (${useDept})-->
            <!--            </if>-->
            union all
            select count(1) from mosty_jcgl.tb_jcgl_xfll a where fl='02' and xt_sjzt='1' and xt_scbz='0'
            <!--            <if test="dto.ssbmid != null and dto.ssbmid != ''">-->
            <!--                and a.ssbmid = #{dto.ssbmid}-->
            <!--            </if>-->
            <if test="dto.jlxm != null and dto.jlxm != ''">
                and a.xm like concat('%',#{dto.jlxm},'%')
            </if>
            <if test="dto.ssbmdm != null and dto.ssbmdm != ''">
                and a.ssbmdm like concat(#{dto.ssbmdm},'%')
            </if>
            <!--            ${useSql}-->
        </if>
    </select>

    <select id="qxjMjlbCount" resultType="int">
        select count(1) from mosty_base.sys_user a where xt_zxbz='0' and id in(
        select sqr_id from tb_qw_qxj where xt_scbz='0' and xt_sjzt='1' and sqrlx = '01'
        <if test="dto.kssj == null or dto.kssj == ''">
            and curdate() BETWEEN kssj and jssj
        </if>
        <if test="dto.kssj != null and dto.kssj != ''">
            and kssj >= #{dto.kssj}
        </if>
        <if test="dto.jssj != null and dto.jssj != ''">
            and jssj &lt;=#{dto.jssj}
        </if>
        <if test="dto.ssbmdm != null and dto.ssbmdm != ''">
            and ssbmdm like concat(#{dto.ssbmdm},'%')
        </if>
        <!--        <if test="dto.ssbmid != null and dto.ssbmid != ''">-->
        <!--            and ssbmid = #{dto.ssbmid}-->
        <!--        </if>-->
        <!--        ${useSql}-->
        )
        <if test="dto.jlxm != null and dto.jlxm != ''">
            and a.user_name like concat('%',#{dto.jlxm} ,'%')
        </if>
    </select>

    <select id="qxFjlbCount" resultType="int">
        select count(1) from tb_qw_qxj a where a.xt_scbz='0' and a.xt_sjzt='1' and a.sqrlx = '02'
        <if test="dto.kssj == null or dto.kssj == ''">
            and curdate() BETWEEN a.kssj and a.jssj
        </if>
        <if test="dto.kssj != null and dto.kssj != ''">
            and a.kssj >= #{dto.kssj}
        </if>
        <if test="dto.jssj != null and dto.jssj != ''">
            and a.jssj &lt;=#{dto.jssj}
        </if>
        <!--   <if test="dto.ssbmid != null and dto.ssbmid != ''">
               and a.ssbmid = #{dto.ssbmid}
           </if>-->
        <if test="dto.jlxm != null and dto.jlxm != ''">
            and a.sqr_xm=#{dto.jlxm}
        </if>
        <if test="dto.ssbmdm != null and dto.ssbmdm != ''">
            and a.ssbmdm like concat(#{dto.ssbmdm},'%')
        </if>
        <!--        ${useSql}-->
    </select>
</mapper>