<?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.YjzlStatisticsMapper">
    <select id="clyjlb" resultType="java.util.Map">
        select * from tb_yjxx
        where xt_sjzt = '1' and yj_lx = '2' and xt_scbz= '0'
        and yj_clcph in
        (
        select yj_clcph from (
        select yj_clcph, count(1) as sl from tb_yjxx
        where xt_sjzt = '1' and yj_lx = '2' and xt_scbz= '0'
        <if test="dto.kssj != null and dto.kssj != ''">
            and yj_sj >= #{dto.kssj}
        </if>
        <if test="dto.jssj != null and dto.jssj != ''">
            and yj_sj &lt;= #{dto.jssj}
        </if>

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

<!--        <if test="dto.ssbmid != null and dto.ssbmid != ''">-->
<!--            and ssbmid = #{dto.ssbmid}-->
<!--        </if>-->


<!--        ${useSql}-->
        group by yj_clcph order by sl desc limit 20
        ) a
        )
    </select>

    <select id="queryBycCphm" resultType="java.util.Map">
        select a.*, b.yj_clbq from tb_yjxx a left join tb_yjxx_cl b on a.id = b.yj_id
        where a.xt_sjzt = '1' and a.yj_lx = '2' and a.xt_scbz= '0' and b.xt_scbz= '0'
        <if test="dto.hphm != null and dto.hphm != ''">
            and a.yj_clcph = #{dto.hphm}
        </if>
        <if test="dto.ssbmdm != null and dto.ssbmdm != ''">
            and a.ssbmdm like concat(#{dto.ssbmdm,jdbcType=VARCHAR},'%')
        </if>
<!--        <if test="dto.ssbmid != null and dto.ssbmid != ''">-->
<!--            and a.ssbmid = #{dto.ssbmid}-->
<!--        </if>-->
<!--        ${useSql}-->
        order by a.yj_sj desc limit 1
    </select>

    <select id="queryBycCphmlb" resultType="java.util.Map">
        select a.*, b.yj_clbq from tb_yjxx a left join tb_yjxx_cl b on a.id = b.yj_id
        where a.xt_sjzt = '1' and a.yj_lx = '2' and a.xt_scbz= '0' and b.xt_scbz= '0'
        <if test="dto.kssj != null and dto.kssj != ''">
            and a.yj_sj >= #{dto.kssj}
        </if>
        <if test="dto.jssj != null and dto.jssj != ''">
            and a.yj_sj &lt;= #{dto.jssj}
        </if>
        <if test="dto.hphm != null and dto.hphm != ''">
            and a.yj_clcph = #{dto.hphm}
        </if>
<!--        <if test="dto.ssbmid != null and dto.ssbmid != ''">-->
<!--            and a.ssbmid = #{dto.ssbmid}-->
<!--        </if>-->
        <if test="dto.yjjb != null and dto.yjjb != ''">
            and a.yj_jb = #{dto.yjjb}
        </if>
        <if test="dto.bqmc != null and dto.bqmc != ''">
            and a.yjly_bqmc = #{dto.bqmc}
        </if>
        <if test="dto.ssbmdm != null and dto.ssbmdm != ''">
            and a.ssbmdm like concat(#{dto.ssbmdm,jdbcType=VARCHAR},'%')
        </if>



<!--        ${useSql}-->
        order by a.yj_sj desc
    </select>

    <select id="yqueryBycCphmlb" resultType="java.util.Map">
        select a.*, b.yj_clbq from tb_yjxx a left join tb_yjxx_cl b on a.id = b.yj_id
        where a.xt_sjzt = '1' and a.yj_lx = '2' and a.xt_scbz= '0' and b.xt_scbz= '0'
        <if test="dto.ksny != null and dto.ksny != ''">
            and a.yj_fsny >= #{dto.ksny}
        </if>
        <if test="dto.jsny != null and dto.jsny != ''">
            and a.yj_fsny &lt;= #{dto.jsny}
        </if>
        <if test="dto.hphm != null and dto.hphm != ''">
            and a.yj_clcph = #{dto.hphm}
        </if>
<!--        <if test="dto.ssbmid != null and dto.ssbmid != ''">-->
<!--            and a.ssbmid = #{ssbmid}-->
<!--        </if>-->
        <if test="dto.yjjb != null and dto.yjjb != ''">
            and a.yj_jb = #{dto.yjjb}
        </if>
        <if test="dto.ssbmdm != null and dto.ssbmdm != ''">
            and a.ssbmdm like concat(#{dto.ssbmdm,jdbcType=VARCHAR},'%')
        </if>
        <!--        ${useSql}-->
        order by a.yj_sj desc
    </select>

    <select id="zqueryBycCphmlb" resultType="java.util.Map">
        select a.*, b.yj_clbq from tb_yjxx a left join tb_yjxx_cl b on a.id = b.yj_id
        where a.xt_sjzt = '1' and a.yj_lx = '2' and a.xt_scbz= '0' and b.xt_scbz= '0'
        <if test="dto.kssj != null and dto.kssj != ''">
            and a.yj_sj >= #{dto.kssj}
        </if>
        <if test="dto.jssj != null and dto.jssj != ''">
            and a.yj_sj &lt;= #{dto.jssj}
        </if>
        <if test="dto.hphm != null and dto.hphm != ''">
            and a.yj_clcph = #{dto.hphm}
        </if>
<!--        <if test="dto.ssbmid != null and dto.ssbmid != ''">-->
<!--            and a.ssbmid = #{dto.ssbmid}-->
<!--        </if>-->
        <if test="dto.yjjb != null and dto.yjjb != ''">
            and a.yj_jb = #{dto.yjjb}
        </if>
        <if test="dto.ssbmdm != null and dto.ssbmdm != ''">
            and a.ssbmdm like concat(#{dto.ssbmdm,jdbcType=VARCHAR},'%')
        </if>
<!--        ${useSql}-->
        order by a.yj_sj desc
    </select>

    <select id="yjcltj" resultType="java.util.Map">
        select yj_clcph, count(1) as sl from tb_yjxx
        where xt_sjzt = '1' and yj_lx = '2' and xt_scbz= '0'
        <if test="dto.kssj != null and dto.kssj != ''">
            and yj_sj >= #{dto.kssj}
        </if>
        <if test="dto.jssj != null and dto.jssj != ''">
            and yj_sj &lt;= #{dto.jssj}
        </if>
        <if test="dto.ssbmdm != null and dto.ssbmdm != ''">
            and ssbmdm like concat(#{dto.ssbmdm,jdbcType=VARCHAR},'%')
        </if>
<!--        <if test="dto.ssbmid != null and dto.ssbmid != ''">-->
<!--            and ssbmid = #{dto.ssbmid}-->
<!--        </if>-->
<!--        ${useSql}-->
        group by yj_clcph order by sl desc limit 20
    </select>

    <select id="yjbqtj" resultType="java.util.Map">
        select yjly_bqmc as bqmc, count(1) as sl from tb_yjxx
        where xt_sjzt = '1' and yj_lx = '2' and xt_scbz= '0'
        and yjly_bqmc is not null
        <if test="dto.kssj != null and dto.kssj != ''">
            and yj_sj >= #{kssj}
        </if>
        <if test="dto.jssj != null and dto.jssj != ''">
            and yj_sj &lt;= #{dto.jssj}
        </if>
        <if test="dto.ssbmdm != null and dto.ssbmdm != ''">
            and ssbmdm like concat(#{dto.ssbmdm,jdbcType=VARCHAR},'%')
        </if>
<!--        <if test="dto.ssbmid != null and dto.ssbmid != ''">-->
<!--            and ssbmid = #{dto.ssbmid}-->
<!--        </if>-->
<!--        ${useSql}-->
        group by bqmc order by sl desc
    </select>

    <select id="yjjbtj" resultType="java.util.Map">
        select yj_jb as yjjb, count(1) as sl from tb_yjxx
        where xt_sjzt = '1' and yj_lx = '2' and xt_scbz= '0'
        <if test="dto.kssj != null and dto.kssj != ''">
            and yj_sj >= #{dto.kssj}
        </if>
        <if test="dto.jssj != null and dto.jssj != ''">
            and yj_sj &lt;= #{dto.jssj}
        </if>
        <if test="dto.ssbmdm != null and dto.ssbmdm != ''">
            and ssbmdm like concat(#{dto.ssbmdm,jdbcType=VARCHAR},'%')
        </if>
<!--        <if test="dto.ssbmid != null and dto.ssbmid != ''">-->
<!--            and ssbmid = #{dto.ssbmid}-->
<!--        </if>-->
<!--        ${useSql}-->
        group by yjjb order by sl desc
    </select>

    <select id="yyjcltj" resultType="java.util.Map">
        select yj_clcph, count(1) as sl from tb_yjxx
        where xt_sjzt = '1' and yj_lx = '2' and xt_scbz= '0'
        <if test="dto.ksny != null and dto.ksny != ''">
            and yj_fsny >= #{dto.ksny}
        </if>
        <if test="dto.jsny != null and dto.jsny != ''">
            and yj_fsny &lt;= #{dto.jsny}
        </if>
        <if test="dto.ssbmdm != null and dto.ssbmdm != ''">
            and ssbmdm like concat(#{dto.ssbmdm,jdbcType=VARCHAR},'%')
        </if>
<!--        <if test="dto.ssbmid != null and dto.ssbmid != ''">-->
<!--            and ssbmid = #{dto.ssbmid}-->
<!--        </if>-->
<!--        ${useSql}-->
        group by yj_clcph order by sl desc limit 20
    </select>

    <select id="zyjcltj" resultType="java.util.Map">
        select yj_clcph, count(1) as sl from tb_yjxx
        where xt_sjzt = '1' and yj_lx = '2' and xt_scbz= '0'
        <if test="dto.kssj != null and dto.kssj != ''">
            and yj_sj >= #{dto.kssj}
        </if>
        <if test="dto.jssj != null and dto.jssj != ''">
            and yj_sj &lt;= #{jssj}
        </if>
        <if test="dto.ssbmdm != null and dto.ssbmdm != ''">
            and ssbmdm like concat(#{dto.ssbmdm,jdbcType=VARCHAR},'%')
        </if>
<!--        <if test="dto.ssbmid != null and dto.ssbmid != ''">-->
<!--            and ssbmid = #{ssbmid}-->
<!--        </if>-->
<!--        ${useSql}-->
        group by yj_clcph order by sl desc limit 20
    </select>

    <select id="queryBySfzh" resultType="java.util.Map">
        select a.*, b.yj_rybq, b.yj_xsd from tb_yjxx a left join tb_yjxx_ry b on a.id = b.yj_id
        where a.xt_sjzt = '1' and a.yj_lx = '1' and a.xt_scbz= '0'
        <if test="dto.sfzh != null and dto.sfzh != ''">
            and a.yj_rysfzh = #{dto.sfzh}
        </if>
        <if test="dto.ssbmdm != null and dto.ssbmdm != ''">
            and a.ssbmdm like concat(#{dto.ssbmdm,jdbcType=VARCHAR},'%')
        </if>
<!--        <if test="dto.ssbmid != null and dto.ssbmid != ''">-->
<!--            and a.ssbmid = #{dto.ssbmid}-->
<!--        </if>-->
<!--        ${useSql}-->
        order by a.yj_sj desc limit 1
    </select>

    <select id="queryBySfzhlb" resultType="java.util.Map">
        select a.*, b.yj_rybq, b.yj_xsd, b.cover_image from tb_yjxx a left join tb_yjxx_ry b on a.id = b.yj_id
        where a.xt_sjzt = '1' and a.yj_lx = '1' and a.xt_scbz= '0'
        <if test="dto.kssj != null and dto.kssj != ''">
            and a.yj_sj >= #{dto.kssj}
        </if>
        <if test="dto.jssj != null and dto.jssj != ''">
            and a.yj_sj &lt;= #{dto.jssj}
        </if>
        <if test="dto.sfzh != null and dto.sfzh != ''">
            and a.yj_rysfzh = #{dto.sfzh}
        </if>
<!--        <if test="dto.ssbmid != null and dto.ssbmid != ''">-->
<!--            and a.ssbmid = #{dto.ssbmid}-->
<!--        </if>-->
        <if test="dto.yjjb != null and dto.yjjb != ''">
            and a.yj_jb = #{yjjb}
        </if>
        <if test="dto.ssbmdm != null and dto.ssbmdm != ''">
            and a.ssbmdm like concat(#{dto.ssbmdm,jdbcType=VARCHAR},'%')
        </if>
<!--        ${useSql}-->
        order by a.yj_sj desc
    </select>

    <select id="queryBySfzhlbsc" resultType="java.util.Map">
        select a.*, b.yj_rybq, b.yj_xsd, b.cover_image from tb_yjxx a left join tb_yjxx_ry b on a.id = b.yj_id
        where a.xt_sjzt = '1' and a.yj_lx = '1' and a.xt_scbz= '0'
        and (a.yj_nr like '%2020年以来扒窃及盗窃电动车人员（刑侦）%' or a.yj_nr
        like '%遂宁籍飞车抢夺前科人员（刑侦）%' or a.yj_nr like '%盗窃非机动车前科人员专业库（刑侦）%')
        <if test="dto.kssj != null and dto.kssj != ''">
            and a.yj_sj >= #{dto.kssj}
        </if>
        <if test="dto.jssj != null and dto.jssj != ''">
            and a.yj_sj &lt;= #{dto.jssj}
        </if>
        <if test="dto.sfzh != null and dto.sfzh != ''">
            and a.yj_rysfzh = #{dto.sfzh}
        </if>
<!--        <if test="dto.ssbmid != null and dto.ssbmid != ''">-->
<!--            and a.ssbmid = #{dto.ssbmid}-->
<!--        </if>-->
        <if test="dto.yjjb != null and dto.yjjb != ''">
            and a.yj_jb = #{dto.yjjb}
        </if>
        <if test="dto.ssbmdm != null and dto.ssbmdm != ''">
            and a.ssbmdm like concat(#{dto.ssbmdm,jdbcType=VARCHAR},'%')
        </if>
<!--        ${useSql}-->
        order by a.yj_sj desc
    </select>

    <select id="yqueryBySfzhlb" resultType="java.util.Map">
        select a.*, b.yj_rybq, b.yj_xsd, b.cover_image from tb_yjxx a left join tb_yjxx_ry b on a.id = b.yj_id
        where a.xt_sjzt = '1' and a.yj_lx = '1' and a.xt_scbz= '0'
        <if test="dto.ksny != null and dto.ksny != ''">
            and a.yj_fsny >= #{dto.ksny}
        </if>
        <if test="dto.jsny != null and dto.jsny != ''">
            and a.yj_fsny &lt;= #{dto.jsny}
        </if>
        <if test="dto.sfzh != null and dto.sfzh != ''">
            and a.yj_rysfzh = #{dto.sfzh}
        </if>
<!--        <if test="dto.ssbmid != null and dto.ssbmid != ''">-->
<!--            and a.ssbmid = #{dto.ssbmid}-->
<!--        </if>-->
        <if test="dto.yjjb != null and dto.yjjb != ''">
            and a.yj_jb = #{dto.yjjb}
        </if>
        <if test="dto.ssbmdm != null and dto.ssbmdm != ''">
            and a.ssbmdm like concat(#{dto.ssbmdm,jdbcType=VARCHAR},'%')
        </if>
<!--        ${useSql}-->
        order by a.yj_sj desc
    </select>

    <select id="yqueryBySfzhlbsc" resultType="java.util.Map">
        select a.*, b.yj_rybq, b.yj_xsd, b.cover_image from tb_yjxx a left join tb_yjxx_ry b on a.id = b.yj_id
        where a.xt_sjzt = '1' and a.yj_lx = '1' and a.xt_scbz= '0'
        and (a.yj_nr like '%2020年以来扒窃及盗窃电动车人员（刑侦）%' or a.yj_nr
        like '%遂宁籍飞车抢夺前科人员（刑侦）%' or a.yj_nr like '%盗窃非机动车前科人员专业库（刑侦）%')
        <if test="dto.ksny != null and dto.ksny != ''">
            and a.yj_fsny >= #{dto.ksny}
        </if>
        <if test="dto.jsny != null and dto.jsny != ''">
            and a.yj_fsny &lt;= #{dto.jsny}
        </if>
        <if test="dto.sfzh != null and dto.sfzh != ''">
            and a.yj_rysfzh = #{dto.sfzh}
        </if>
<!--        <if test="dto.ssbmid != null and dto.ssbmid != ''">-->
<!--            and a.ssbmid = #{dto.ssbmid}-->
<!--        </if>-->
        <if test="dto.yjjb != null and dto.yjjb != ''">
            and a.yj_jb = #{dto.yjjb}
        </if>
        <if test="dto.ssbmdm != null and dto.ssbmdm != ''">
            and a.ssbmdm like concat(#{dto.ssbmdm,jdbcType=VARCHAR},'%')
        </if>
<!--        ${useSql}-->
        order by a.yj_sj desc
    </select>

    <select id="zqueryBySfzhlb" resultType="java.util.Map">
        select a.*, b.yj_rybq, b.yj_xsd, b.cover_image from tb_yjxx a left join tb_yjxx_ry b on a.id = b.yj_id
        where a.xt_sjzt = '1' and a.yj_lx = '1' and a.xt_scbz= '0'
        <if test="dto.kssj != null and dto.kssj != ''">
            and a.yj_sj >= #{dto.kssj}
        </if>
        <if test="dto.jssj != null and dto.jssj != ''">
            and a.yj_sj &lt;= #{jssj}
        </if>
        <if test="dto.sfzh != null and dto.sfzh != ''">
            and a.yj_rysfzh = #{dto.sfzh}
        </if>
<!--        <if test="dto.ssbmid != null and dto.ssbmid != ''">-->
<!--            and a.ssbmid = #{dto.ssbmid}-->
<!--        </if>-->
        <if test="dto.yjjb != null and dto.yjjb != ''">
            and a.yj_jb = #{dto.yjjb}
        </if>
        <if test="dto.ssbmdm != null and dto.ssbmdm != ''">
            and a.ssbmdm like concat(#{dto.ssbmdm,jdbcType=VARCHAR},'%')
        </if>
<!--        ${useSql}-->
        order by a.yj_sj desc
    </select>

    <select id="zqueryBySfzhlbsc" resultType="java.util.Map">
        select a.*, b.yj_rybq, b.yj_xsd, b.cover_image from tb_yjxx a left join tb_yjxx_ry b on a.id = b.yj_id
        where a.xt_sjzt = '1' and a.yj_lx = '1' and a.xt_scbz= '0'
        and (a.yj_nr like '%2020年以来扒窃及盗窃电动车人员（刑侦）%' or a.yj_nr like
        '%遂宁籍飞车抢夺前科人员（刑侦）%' or a.yj_nr like '%盗窃非机动车前科人员专业库（刑侦）%')
        <if test="dto.kssj != null and dto.kssj != ''">
            and a.yj_sj >= #{dto.kssj}
        </if>
        <if test="dto.jssj != null and dto.jssj != ''">
            and a.yj_sj &lt;= #{dto.jssj}
        </if>
        <if test="dto.sfzh != null and dto.sfzh != ''">
            and a.yj_rysfzh = #{dto.sfzh}
        </if>
<!--        <if test="dto.ssbmid != null and dto.ssbmid != ''">-->
<!--            and a.ssbmid = #{dto.ssbmid}-->
<!--        </if>-->
        <if test="dto.yjjb != null and dto.yjjb != ''">
            and a.yj_jb = #{dto.yjjb}
        </if>
        <if test="dto.ssbmdm != null and dto.ssbmdm != ''">
            and a.ssbmdm like concat(#{dto.ssbmdm,jdbcType=VARCHAR},'%')
        </if>
<!--        ${useSql}-->
        order by a.yj_sj desc
    </select>

    <select id="ryyjlb" resultType="java.util.Map">
        select * from tb_yjxx
        where xt_sjzt = '1' and yj_lx = '1' and xt_scbz= '0'
        and yj_rysfzh in
        (
        select yj_rysfzh from (
        select yj_rysfzh, count(1) as sl from tb_yjxx
        where xt_sjzt = '1' and yj_lx = '1' and xt_scbz= '0'
        <if test="dto.kssj != null and dto.kssj != ''">
            and yj_sj >= #{dto.kssj}
        </if>
        <if test="dto.jssj != null and dto.jssj != ''">
            and yj_sj &lt;= #{dto.jssj}
        </if>
        <if test="dto.ssbmdm != null and dto.ssbmdm != ''">
            and ssbmdm like concat(#{dto.ssbmdm,jdbcType=VARCHAR},'%')
        </if>
<!--        <if test="dto.ssbmid != null and dto.ssbmid != ''">-->
<!--            and ssbmid = #{dto.ssbmid}-->
<!--        </if>-->
<!--        ${useSql}-->
        group by yj_rysfzh order by sl desc limit 20
        ) a
        )
    </select>

    <select id="yjjbtjRy" resultType="java.util.Map">
        select yj_jb as yjjb, count(1) as sl from tb_yjxx
        where xt_sjzt = '1' and yj_lx = '1' and xt_scbz= '0'
        <if test="dto.kssj != null and dto.kssj != ''">
            and yj_sj >= #{dto.kssj}
        </if>
        <if test="dto.jssj != null and dto.jssj != ''">
            and yj_sj &lt;= #{dto.jssj}
        </if>
        <if test="dto.ssbmdm != null and dto.ssbmdm != ''">
            and ssbmdm like concat(#{dto.ssbmdm,jdbcType=VARCHAR},'%')
        </if>
<!--        <if test="dto.ssbmid != null and dto.ssbmid != ''">-->
<!--            and ssbmid = #{dto.ssbmid}-->
<!--        </if>-->
<!--        ${useSql}-->
        group by yjjb order by sl
    </select>

    <select id="jbtj" resultType="java.util.Map">
        select yj_jb as yjjb, count(1) as sl from tb_yjxx
        where xt_sjzt = '1' and yj_lx = '1' and xt_scbz= '0'
        <if test="dto.kssj != null and dto.kssj != ''">
            and yj_sj >= #{dto.kssj}
        </if>
        <if test="dto.jssj != null and dto.jssj != ''">
            and yj_sj &lt;= #{dto.jssj}
        </if>
        <if test="dto.ssbmdm != null and dto.ssbmdm != ''">
            and ssbmdm like concat(#{dto.ssbmdm,jdbcType=VARCHAR},'%')
        </if>
<!--        <if test="dto.ssbmid != null and dto.ssbmid != ''">-->
<!--            and ssbmid = #{dto.ssbmid}-->
<!--        </if>-->
<!--        ${useSql}-->
        group by yjjb order by sl desc
    </select>

    <select id="yjrytj" resultType="java.util.Map">
        select yj_rysfzh, count(1) as sl from tb_yjxx
        where xt_sjzt = '1' and yj_lx = '1' and xt_scbz= '0'
        <if test="dto.kssj != null and dto.kssj != ''">
            and yj_sj >= #{dto.kssj}
        </if>
        <if test="dto.jssj != null and dto.jssj != ''">
            and yj_sj &lt;= #{dto.jssj}
        </if>
        <if test="dto.ssbmdm != null and dto.ssbmdm != ''">
            and ssbmdm like concat(#{dto.ssbmdm,jdbcType=VARCHAR},'%')
        </if>
<!--        <if test="dto.ssbmid != null and dto.ssbmid != ''">-->
<!--            and ssbmid = #{dto.ssbmid}-->
<!--        </if>-->
<!--        ${useSql}-->
        group by yj_rysfzh order by sl desc limit 20
    </select>

    <select id="yjrytjsc" resultType="java.util.Map">
        select yj_rysfzh, count(1) as sl from tb_yjxx
        where xt_sjzt = '1' and yj_lx = '1' and xt_scbz= '0'
        and (yj_nr like '%2020年以来扒窃及盗窃电动车人员（刑侦）%' or yj_nr like '%遂宁籍飞车抢夺前科人员（刑侦）%'
        or yj_nr like '%盗窃非机动车前科人员专业库（刑侦）%')
        <if test="dto.kssj != null and dto.kssj != ''">
            and yj_sj >= #{dto.kssj}
        </if>
        <if test="dto.jssj != null and dto.jssj != ''">
            and yj_sj &lt;= #{dto.jssj}
        </if>
        <if test="dto.ssbmdm != null and dto.ssbmdm != ''">
            and ssbmdm like concat(#{dto.ssbmdm,jdbcType=VARCHAR},'%')
        </if>
<!--        <if test="dto.ssbmid != null and dto.ssbmid != ''">-->
<!--            and ssbmid = #{dto.ssbmid}-->
<!--        </if>-->
<!--        ${useSql}-->
        group by yj_rysfzh order by sl desc limit 20
    </select>

    <select id="yyjrytj" resultType="java.util.Map">
        select yj_rysfzh, count(1) as sl from tb_yjxx
        where xt_sjzt = '1' and yj_lx = '1' and xt_scbz= '0'
        <if test="dto.ksny != null and dto.ksny != ''">
            and yj_fsny >= #{dto.ksny}
        </if>
        <if test="dto.jsny != null and dto.jsny != ''">
            and yj_fsny &lt;= #{dto.jsny}
        </if>
        <if test="dto.ssbmdm != null and dto.ssbmdm != ''">
            and ssbmdm like concat(#{dto.ssbmdm,jdbcType=VARCHAR},'%')
        </if>
<!--        <if test="dto.ssbmid != null and dto.ssbmid != ''">-->
<!--            and ssbmid = #{dto.ssbmid}-->
<!--        </if>-->
<!--        ${useSql}-->
        group by yj_rysfzh order by sl desc limit 20
    </select>

    <select id="yyjrytjsc" resultType="java.util.Map">
        select yj_rysfzh, count(1) as sl from tb_yjxx
        where xt_sjzt = '1' and yj_lx = '1' and xt_scbz= '0'
        and (yj_nr like '%2020年以来扒窃及盗窃电动车人员（刑侦）%' or yj_nr like '%遂宁籍飞车抢夺前科人员（刑侦）%'
        or yj_nr like '%盗窃非机动车前科人员专业库（刑侦）%')
        <if test="dto.ksny != null and dto.ksny != ''">
            and yj_fsny >= #{dto.ksny}
        </if>
        <if test="dto.jsny != null and dto.jsny != ''">
            and yj_fsny &lt;= #{dto.jsny}
        </if>
        <if test="dto.ssbmdm != null and dto.ssbmdm != ''">
            and ssbmdm like concat(#{dto.ssbmdm,jdbcType=VARCHAR},'%')
        </if>
<!--        <if test="dto.ssbmid != null and dto.ssbmid != ''">-->
<!--            and ssbmid = #{dto.ssbmid}-->
<!--        </if>-->
<!--        ${useSql}-->
        group by yj_rysfzh order by sl desc limit 20
    </select>

    <select id="zyjrytj" resultType="java.util.Map">
        select yj_rysfzh, count(1) as sl from tb_yjxx
        where xt_sjzt = '1' and yj_lx = '1' and xt_scbz= '0'
        <if test="dto.kssj != null and dto.kssj != ''">
            and yj_sj >= #{dto.kssj}
        </if>
        <if test="dto.jssj != null and dto.jssj != ''">
            and yj_sj &lt;= #{dto.jssj}
        </if>
        <if test="dto.ssbmdm != null and dto.ssbmdm != ''">
            and ssbmdm like concat(#{dto.ssbmdm,jdbcType=VARCHAR},'%')
        </if>
<!--        <if test="dto.ssbmid != null and dto.ssbmid != ''">-->
<!--            and ssbmid = #{dto.ssbmid}-->
<!--        </if>-->
<!--        ${useSql}-->
        group by yj_rysfzh order by sl desc limit 20
    </select>

    <select id="zyjrytjsc" resultType="java.util.Map">
        select yj_rysfzh, count(1) as sl from tb_yjxx
        where xt_sjzt = '1' and yj_lx = '1' and xt_scbz= '0'
        and (yj_nr like '%2020年以来扒窃及盗窃电动车人员（刑侦）%' or yj_nr like '%遂宁籍飞车抢夺前科人员（刑侦）%'
        or yj_nr like '%盗窃非机动车前科人员专业库（刑侦）%')
        <if test="dto.kssj != null and dto.kssj != ''">
            and yj_sj >= #{dto.kssj}
        </if>
        <if test="dto.jssj != null and dto.jssj != ''">
            and yj_sj &lt;= #{dto.jssj}
        </if>
        <if test="dto.ssbmdm != null and dto.ssbmdm != ''">
            and ssbmdm like concat(#{dto.ssbmdm,jdbcType=VARCHAR},'%')
        </if>
<!--        <if test="dto.ssbmid != null and dto.ssbmid != ''">-->
<!--            and ssbmid = #{dto.ssbmid}-->
<!--        </if>-->
<!--        ${useSql}-->
        group by yj_rysfzh order by sl desc limit 20
    </select>

    <select id="zbyjbfylb" resultType="java.util.Map">
        select * from mosty_yjzl.tb_yjxx
        where xt_sjzt='1' and xt_scbz='0' and yj_lx = '1'
        <if test="dto.rysfzh != null and dto.rysfzh != ''">
            and yj_rysfzh like concat('%',#{dto.rysfzh},'%')
        </if>
        <if test="dto.yjlx != null and dto.yjlx == 1">
            and yj_lx = '1'
        </if>
        <if test="dto.yjlx != null and dto.yjlx == 2">
            and yj_lx = '2'
        </if>
        <if test="dto.yjlx != null and dto.yjlx == 3">
            and yjbq = '8'
        </if>
        <if test="dto.kssj != null and dto.kssj != ''">
            and yj_sj >= #{kssj}
        </if>
        <if test="dto.jssj != null and dto.jssj != ''">
            and yj_sj &lt;= #{dto.jssj}
        </if>
        <if test="dto.ssbmdm != null and dto.ssbmdm != ''">
            and ssbmdm like concat(#{dto.ssbmdm,jdbcType=VARCHAR},'%')
        </if>
<!--        ${useSql}-->
        order by yj_sj desc
    </select>

    <select id="zbyjtj" resultType="java.util.Map">
        select a.sl as ryyj,b.sl as clyj,c.sl as swsl from
        (
        select count(1) as sl from mosty_yjzl.tb_yjxx
        where xt_sjzt='1' and xt_scbz='0' and yj_lx = '1'
        <if test="dto.kssj != null and dto.kssj != ''">
            and yj_sj >= #{dto.kssj}
        </if>
        <if test="dto.jssj != null and dto.jssj != ''">
            and yj_sj &lt;= #{dto.jssj}
        </if>
        <if test="dto.ssbmdm != null and dto.ssbmdm != ''">
            and ssbmdm like concat(#{dto.ssbmdm,jdbcType=VARCHAR},'%')
        </if>
<!--        ${useSql}-->
        ) a,
        (
        select count(1) as sl from mosty_yjzl.tb_yjxx
        where xt_sjzt='1' and xt_scbz='0' and yj_lx = '2'
        <if test="dto.kssj != null and dto.kssj != ''">
            and yj_sj >= #{dto.kssj}
        </if>
        <if test="dto.jssj != null and dto.jssj != ''">
            and yj_sj &lt;= #{dto.jssj}
        </if>
        <if test="dto.ssbmdm != null and dto.ssbmdm != ''">
            and ssbmdm like concat(#{dto.ssbmdm,jdbcType=VARCHAR},'%')
        </if>
<!--        ${useSql}-->
        ) b,
        (
        select count(1) as sl from mosty_yjzl.tb_yjxx
        where xt_sjzt='1' and xt_scbz='0' and yj_lx = '1'
        and yjbq = '8'
        <if test="dto.kssj != null and dto.kssj != ''">
            and yj_sj >= #{dto.kssj}
        </if>
        <if test="dto.jssj != null and dto.jssj != ''">
            and yj_sj &lt;= #{dto.jssj}
        </if>
        <if test="dto.ssbmdm != null and dto.ssbmdm != ''">
            and ssbmdm like concat(#{dto.ssbmdm,jdbcType=VARCHAR},'%')
        </if>
<!--        ${useSql}-->
        ) c
    </select>

    <select id="gzyyjpm" resultType="java.util.Map">
        select count(1) total ,yj_gzymc from tb_yjxx
        where yj_gzymc is not null and yj_gzymc != '未知'
        <if test="dto.kssj != null and dto.kssj != '' and dto.jssj != null and dto.jssj != ''">
            and yj_fsrq between #{dto.kssj} and #{dto.jssj}
        </if>
        and xt_scbz = '0' and xt_sjzt = '1'
        <if test="dto.ssbmdm != null and dto.ssbmdm != ''">
            and  ssbmdm like concat(#{dto.ssbmdm,jdbcType=VARCHAR},'%')
        </if>
<!--        ${useSql}-->
        GROUP BY yj_gzymc order by count(1) DESC LIMIT 0,10
    </select>

    <select id="pcsyjpm" resultType="java.util.Map">
        select count(1) total ,ssbmdm,ssbm from tb_yjxx where ssbm is not null and ssbmdm is not null
        <if test="dto.kssj != null and dto.kssj != '' and dto.jssj != null and dto.jssj != ''">
            and yj_fsrq between #{dto.kssj} and #{dto.jssj}
        </if>
        and xt_scbz = '0' and xt_sjzt = '1'
        <if test="dto.ssbmdm != null and dto.ssbmdm != ''">
            and ssbmdm like concat(#{dto.ssbmdm,jdbcType=VARCHAR},'%')
        </if>
<!--        ${useSql}-->
        GROUP BY ssbmdm,ssbm order by count(1) DESC LIMIT 0,10
    </select>

    <select id="ryyjpm" resultType="java.util.Map">
        select yj_rysfzh,yj_ryxm,count(1) total from tb_yjxx
        where yj_rysfzh is not null and xt_scbz = '0' and xt_sjzt = '1'
        <if test="dto.kssj != null and dto.kssj != '' and dto.jssj != null and dto.jssj != ''">
            and yj_fsrq between #{dto.kssj} and #{dto.jssj}
        </if>
        <if test="dto.ssbmdm != null and dto.ssbmdm != ''">
            and ssbmdm like concat(#{dto.ssbmdm,jdbcType=VARCHAR},'%')
        </if>
<!--        ${useSql}-->
        GROUP BY yj_rysfzh,yj_ryxm order by count(1) DESC LIMIT 0,20
    </select>

    <select id="ycyjtj" resultType="java.util.Map">
        SELECT
        IFNULL( sum( quantity ), 0 ) total,
        "total" type
        FROM
        ( SELECT count( 1 ) quantity, yj_lx FROM tb_yjxx WHERE
        xt_scbz = '0' and xt_sjzt = '1'
        <if test="dto.startDate!=null and dto.startDate!=''">
            and yj_fssj >= #{dto.startDate}
        </if>
        <if test="dto.endDate!=null and dto.endDate!=''">
            and yj_fssj &lt;= #{dto.endDate}
        </if>
        <if test="dto.ssbmdm != null and dto.ssbmdm != ''">
            and  ssbmdm like concat(#{dto.ssbmdm,jdbcType=VARCHAR},'%')
        </if>
<!--        ${useSql}-->
        GROUP BY yj_lx ) s
        union
        SELECT
        IFNULL( sum( quantity ), 0 ) total,
        "personnel" type
        FROM
        ( SELECT count( 1 ) quantity, yj_lx FROM tb_yjxx WHERE xt_scbz = '0' and xt_sjzt = '1'
        <if test="dto.startDate!=null and dto.startDate!=''">
            and yj_fssj >= #{dto.startDate}
        </if>
        <if test="dto.endDate!=null and dto.endDate!=''">
            and yj_fssj &lt;= #{dto.endDate}
        </if>
        <if test="dto.ssbmdm != null and dto.ssbmdm != ''">
            and  ssbmdm like concat(#{dto.ssbmdm,jdbcType=VARCHAR},'%')
        </if>
<!--        ${useSql}-->
        GROUP BY yj_lx ) s
        WHERE
        yj_lx IN ( '1', '3', '4' )
        union
        SELECT
        IFNULL( sum( quantity ), 0 ) total,
        "car" type
        FROM
        ( SELECT count( 1 ) quantity, yj_lx FROM tb_yjxx WHERE xt_scbz = '0' and xt_sjzt = '1'
        <if test="dto.startDate!=null and dto.startDate!=''">
            and yj_fssj >= #{dto.startDate}
        </if>
        <if test="dto.endDate!=null and dto.endDate!=''">
            and yj_fssj &lt;= #{dto.endDate}
        </if>
        <if test="dto.ssbmdm != null and dto.ssbmdm != ''">
            and  ssbmdm like concat(#{dto.ssbmdm,jdbcType=VARCHAR},'%')
        </if>
<!--        ${useSql}-->
        GROUP BY yj_lx ) s
        WHERE
        yj_lx IN ( '2', '4' )
        union
        SELECT
        IFNULL( sum( quantity ), 0 ) total,
        "event" type
        FROM
        ( SELECT count( 1 ) quantity, yj_lx FROM tb_yjxx WHERE xt_scbz = '0' and xt_sjzt = '1'
        <if test="dto.startDate!=null and dto.startDate!=''">
            and yj_fssj >= #{dto.startDate}
        </if>
        <if test="dto.endDate!=null and dto.endDate!=''">
            and yj_fssj &lt;= #{dto.endDate}
        </if>
        <if test="dto.ssbmdm != null and dto.ssbmdm != ''">
            and  ssbmdm like concat(#{dto.ssbmdm,jdbcType=VARCHAR},'%')
        </if>
<!--        ${useSql}-->
        GROUP BY yj_lx ) s
        WHERE
        yj_lx = '5'
    </select>

    <select id="yjtj" resultType="java.util.Map">
        SELECT IFNULL(sum(quantity), 0) total,
        "today" date,
        "personnel" type
        FROM
        ( SELECT count( 1 ) quantity, yj_lx FROM tb_yjxx WHERE TO_DAYS( yj_fsrq ) = TO_DAYS( now()) and
        xt_scbz = '0' and xt_sjzt = '1'



        <if test="ssbmdm != null and ssbmdm != ''">
            and ssbmdm like concat(#{ssbmdm,jdbcType=VARCHAR},'%')
        </if>


        GROUP BY yj_lx ) s
        WHERE
        yj_lx IN ( '1'
        , '3'
        , '4' )
        UNION
        SELECT IFNULL(sum(quantity), 0) total,
        "yesterday" date,
        "personnel" type
        FROM
        (
        SELECT
        count( 1 ) quantity,
        yj_lx
        FROM
        tb_yjxx
        WHERE
        TO_DAYS( yj_fsrq ) = TO_DAYS(
        date_sub( now(), INTERVAL 1 DAY ))
        and xt_scbz = '0' and xt_sjzt = '1'
        <!--                        ${useSql}-->
        <if test="ssbmdm != null and ssbmdm != ''">
            and ssbmdm like concat(#{ssbmdm,jdbcType=VARCHAR},'%')
        </if>
        GROUP BY
        yj_lx
        ) s
        WHERE
        yj_lx IN ( '1'
        , '3'
        , '4' )
        UNION
        SELECT IFNULL(sum(quantity), 0) total,
        "today" date,
        "car" type
        FROM
        ( SELECT count( 1 ) quantity, yj_lx FROM tb_yjxx WHERE TO_DAYS( yj_fsrq ) = TO_DAYS( now())
        and xt_scbz = '0' and xt_sjzt = '1'
        <if test="ssbmdm != null and ssbmdm != ''">
            and ssbmdm like concat(#{ssbmdm,jdbcType=VARCHAR},'%')
        </if>
        GROUP BY yj_lx ) s
        WHERE
        yj_lx IN ( '2'
        , '4' )
        UNION
        SELECT IFNULL(sum(quantity), 0) total,
        "yesterday" date,
        "car" type
        FROM
        (
        SELECT
        count( 1 ) quantity,
        yj_lx
        FROM
        tb_yjxx
        WHERE
        TO_DAYS( yj_fsrq ) = TO_DAYS(
        date_sub( now(), INTERVAL 1 DAY ))
        and xt_scbz = '0' and xt_sjzt = '1'
        <!--                        ${useSql}-->
        <if test="ssbmdm != null and ssbmdm != ''">
            and ssbmdm like concat(#{ssbmdm,jdbcType=VARCHAR},'%')
        </if>
        GROUP BY
        yj_lx
        ) s
        WHERE
        yj_lx IN ( '2'
        , '4' )
        UNION
        SELECT IFNULL(sum(quantity), 0) total,
        "today" date,
        "event" type
        FROM
        ( SELECT count( 1 ) quantity, yj_lx FROM tb_yjxx WHERE TO_DAYS( yj_fsrq ) = TO_DAYS( now())
        and xt_scbz = '0' and xt_sjzt = '1'
        <if test="ssbmdm != null and ssbmdm != ''">
            and ssbmdm like concat(#{ssbmdm,jdbcType=VARCHAR},'%')
        </if>

        GROUP BY yj_lx ) s
        WHERE
        yj_lx = '5'
        UNION
        SELECT IFNULL(sum(quantity), 0) total,
        "yesterday" date,
        "event" type
        FROM
        (
        SELECT
        count( 1 ) quantity,
        yj_lx
        FROM
        tb_yjxx
        WHERE
        TO_DAYS( yj_fsrq ) = TO_DAYS(
        date_sub( now(), INTERVAL 1 DAY ))
        and xt_scbz = '0' and xt_sjzt = '1'
        <!--                        ${useSql}-->
        <if test="ssbmdm != null and ssbmdm != ''">
            and ssbmdm like concat(#{ssbmdm,jdbcType=VARCHAR},'%')
        </if>
        GROUP BY
        yj_lx
        ) s
        WHERE
        yj_lx = '5'
        UNION
        SELECT IFNULL(sum(quantity), 0) total,
        "today" date,
        "total" type
        FROM
        ( SELECT count( 1 ) quantity, yj_lx FROM tb_yjxx WHERE TO_DAYS( yj_fsrq ) = TO_DAYS( now())
        and xt_scbz = '0' and xt_sjzt = '1'
        <if test="ssbmdm != null and ssbmdm != ''">
            and ssbmdm like concat(#{ssbmdm,jdbcType=VARCHAR},'%')
        </if>
        GROUP BY yj_lx ) s
        UNION
        SELECT IFNULL(sum(quantity), 0) total,
        "yesterday" date,
        "total" type
        FROM
        (
        SELECT
        count( 1 ) quantity,
        yj_lx
        FROM
        tb_yjxx
        WHERE
        TO_DAYS( yj_fsrq ) = TO_DAYS(
        date_sub( now(), INTERVAL 1 DAY ))
        and xt_scbz = '0' and xt_sjzt = '1'
        <!--                        ${useSql}-->
        <if test="ssbmdm != null and ssbmdm != ''">
            and ssbmdm like concat(#{ssbmdm,jdbcType=VARCHAR},'%')
        </if>
        GROUP BY
        yj_lx
        ) s
    </select>

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

    <select id="getZls" resultType="java.util.Map">
        select count(1) count,ssxgaj,ssxgajid from tb_zlxx where xt_sjzt = '1' and xt_scbz = '0'
        group by ssxgaj,ssxgajid
    </select>

    <select id="getZxs" resultType="java.util.Map">
        select count(1) count,ssxgaj,ssxgajid from tb_zlxx where zlfqrq &lt;= #{jssj} and zlfqrq >= #{kssj}
        and xt_sjzt = '1' and xt_scbz = '0'
        and zlwjzt = '92' or zlwjzt = '93'
        group by ssxgaj,ssxgajid
    </select>

    <select id="getJqTj" resultType="java.util.Map">
        select count(1) count,jqfsksxs time from mosty_sjzx.tb_jq where xt_sjzt = '1' and xt_scbz = '0'
        and bjxl in ("01110200", "01110300", "01120300", "01120400", "01120700", "01120800", "01121000","01130100",
                     "01140100", "01149900", "02030200", "02030300", "02030400", "02030500", "02040100", "02050100",
                     "02050400","02121700", "02130000")
        and date_format(bjrq,'%Y-%m-%d') = #{kssj}
        group by jqfsksxs order by jqfsksxs
    </select>

<!-- =================================================================================================================================-->
    <select id="getYjsl1" resultType="java.util.Map">
        select count(1) count,date_format(yj_fssj,'%H') time from tb_yjxx where yj_fssj = #{kssj}
        and xt_sjzt = '1' and xt_scbz = '0'
        group by date_format(yj_fssj,'%H') order by date_format(yj_fssj,'%H')
    </select>

    <select id="getZls1" resultType="java.util.Map">
        select count(1) count,date_format(zlfqsj,'%H') time from tb_zlxx where xt_sjzt = '1' and xt_scbz = '0'
        and zlfqsj = #{kssj}
        group by date_format(zlfqsj,'%H') order by date_format(zlfqsj,'%H')
    </select>

    <select id="getZxs1" resultType="java.util.Map">
        select count(1) count,date_format(zlfqsj,'%H') time from tb_zlxx where zlfqsj = #{kssj}
        and xt_sjzt = '1' and xt_scbz = '0'
        and zlwjzt = '92' or zlwjzt = '93'
        group by date_format(zlfqsj,'%H') order by date_format(zlfqsj,'%H')
    </select>

    <select id="getJqTjByTime" resultType="java.util.Map">
        select count(1) count,bjrq time from mosty_sjzx.tb_jq  where xt_sjzt = '1' and xt_scbz = '0'
        and bjxl in ("01110200", "01110300", "01120300", "01120400", "01120700", "01120800", "01121000","01130100",
                     "01140100", "01149900", "02030200", "02030300", "02030400", "02030500", "02040100", "02050100",
                     "02050400","02121700", "02130000")
        and date_format(bjrq,'%Y-%m-%d') >= #{kssj} and date_format(bjrq,'%Y-%m-%d') &lt;= #{jssj}
        group by bjrq order by bjrq
    </select>

    <select id="getYjslByTime" resultType="java.util.Map">
        select count(1) count,yj_fsrq time from tb_yjxx where date_format(yj_fsrq,'%Y-%m-%d') >= #{kssj} and date_format(yj_fsrq,'%Y-%m-%d') &lt;= #{jssj}
        and xt_sjzt = '1' and xt_scbz = '0'
        group by yj_fsrq order by yj_fsrq
    </select>

    <select id="getZlsByTime" resultType="java.util.Map">
        select count(1) count,zlfqrq time from tb_zlxx where date_format(zlfqrq,'%Y-%m-%d') >= #{kssj} and date_format(zlfqrq,'%Y-%m-%d') &lt;= #{jssj}
        and xt_sjzt = '1' and xt_scbz = '0'
        group by zlfqrq order by zlfqrq
    </select>

    <select id="getZxsByTime" resultType="java.util.Map">
        select count(1) count,zlfqrq time from tb_zlxx where date_format(zlfqrq,'%Y-%m-%d') >= #{kssj} and date_format(zlfqrq,'%Y-%m-%d') &lt;= #{jssj}
        and xt_sjzt = '1' and xt_scbz = '0'
        and zlwjzt = '92' or zlwjzt = '93'
        group by zlfqrq order by zlfqrq
    </select>

</mapper>