<?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.bkzx.mapper.XdxxMapper">
    <select id="queryXdxxBYSzfhCount" resultType="int">
        select count(1) from tb_xdxx where xt_scbz = '0'
        and id in (
        select xd_id from tb_xdxx_ry where xt_scbz = '0'
        <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 = #{dto.sfzh}
        </if>
        <if test="dto.kssj != null and dto.kssj != ''">
            and xjcjsj >= #{dto.kssj}
        </if>
        <if test="dto.jssj != null and dto.jssj != ''">
            and xjcjsj &lt;= #{dto.jssj}
        </if>
        )
    </select>

    <select id="queryXdxxBYSzfh" resultType="java.util.Map">
        select * from tb_xdxx where xt_scbz = '0'
        and id in (
        select xd_id from tb_xdxx_ry where xt_scbz = '0'
        <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 = #{dto.sfzh}
        </if>
        <if test="dto.kssj != null and dto.kssj != ''">
            and xjcjsj >= #{dto.kssj}
        </if>
        <if test="dto.jssj != null and dto.jssj != ''">
            and xjcjsj &lt;= #{dto.jssj}
        </if>
        )
        order by xdlysj desc
        limit #{pageIndex},#{pageSize}
    </select>

    <select id="xdrylbCount" resultType="int">
        select count(1) from tb_xdxx_ry where xt_scbz = '0'
        <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 = #{dto.sfzh}
        </if>
        <if test="dto.xdbm != null and dto.xdbm != ''">
            and xdbm = #{dto.xdbm}
        </if>
        <if test="dto.xdId != null and dto.xdId != ''">
            and xd_id = #{dto.xdId}
        </if>
        <if test="dto.kssj != null and dto.kssj != ''">
            and xjcjsj >= #{dto.kssj}
        </if>
        <if test="jssj != null and jssj != ''">
            and xjcjsj &lt;= #{jssj}
        </if>
    </select>

    <select id="xdrylb" resultType="java.util.Map">
        select * from tb_xdxx_ry where xt_scbz = '0'
        <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 = #{dto.sfzh}
        </if>
        <if test="dto.xdbm != null and dto.xdbm != ''">
            and xdbm = #{dto.xdbm}
        </if>
        <if test="dto.xdId != null and dto.xdId != ''">
            and xd_id = #{dto.xdId}
        </if>
        <if test="dto.kssj != null and dto.kssj != ''">
            and xjcjsj >= #{dto.kssj}
        </if>
        <if test="jssj != null and jssj != ''">
            and xjcjsj &lt;= #{jssj}
        </if>
        order by xjcjsj desc
        limit #{pageIndex},#{pageSize}
    </select>

    <select id="xdrytj" resultType="java.util.Map">
        select count(1) as sl from tb_xdxx_ry where xt_scbz = '0'
        <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 = #{dto.sfzh}
        </if>
        <if test="dto.xdbm != null and dto.xdbm != ''">
            and xdbm = #{dto.xdbm}
        </if>
        <if test="dto.xdId != null and dto.xdId != ''">
            and xd_id = #{dto.xdId}
        </if>
        <if test="dto.kssj != null and dto.kssj != ''">
            and xjcjsj >= #{dto.kssj}
        </if>
        <if test="dto.jssj != null and dto.jssj != ''">
            and xjcjsj &lt;= #{dto.jssj}
        </if>
        order by xjcjsj desc
    </select>

    <select id="xdxxlbCount" resultType="int">
        select count(1) from tb_xdxx where xt_scbz = '0'
        <if test="dto.kssj != null and dto.kssj != ''">
            and xdlysj >= #{dto.kssj}
        </if>
        <if test="dto.jssj != null and dto.jssj != ''">
            and xdlysj &lt;= #{dto.jssj}
        </if>
        <if test="dto.xdid != null and dto.xdid != ''">
            and id in ( #{dto.xdid} )
        </if>
        order by xdlysj desc
    </select>

    <select id="xdxxlb" resultType="java.util.Map">
        select * from tb_xdxx where xt_scbz = '0'
        <if test="dto.kssj != null and dto.kssj != ''">
            and xdlysj >= #{dto.kssj}
        </if>
        <if test="dto.jssj != null and dto.jssj != ''">
            and xdlysj &lt;= #{dto.jssj}
        </if>
        <if test="dto.xdid != null and dto.xdid != ''">
            and id in ( #{dto.xdid} )
        </if>
        order by xdlysj desc
        limit #{pageIndex},#{pageSize}
    </select>

    <select id="xdxxtj" resultType="java.util.Map">
        select count(1) as sl from tb_xdxx where xt_scbz = '0'
        <if test="dto.kssj != null and dto.kssj != ''">
            and xdlysj >= #{dto.kssj}
        </if>
        <if test="dto.jssj != null and dto.jssj != ''">
            and xdlysj &lt;= #{dto.jssj}
        </if>
    </select>
</mapper>