<?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.zjrs.zwnw.psam.entity.RsPsamYwxxSqbMapper">

    <select id="getRqListBySqrq" parameterType="com.zjrs.zwnw.psam.dto.PsamKglDTO"
            resultType="com.zjrs.zwnw.psam.dto.PsamTjDTO">
        SELECT SUBSTR(cjsj,0,10) rq,COUNT(1) cnt FROM (
        SELECT cjsj FROM rs_psam_ffxxb a where 1=1
        <if test="dto.sqrqBegin != null and dto.sqrqBegin != ''">
            and substr(a.cjsj,0,10) &gt;=#{ dto.sqrqBegin }
        </if>
        <if test="dto.sqrqEnd != null and dto.sqrqEnd != ''">
            and substr(a.cjsj,0,10) &lt;=#{ dto.sqrqEnd }
        </if>
        ) GROUP BY SUBSTR(cjsj,0,10) ORDER BY SUBSTR(cjsj,0,10)
    </select>
    <select id="getRqListByFfrq" parameterType="com.zjrs.zwnw.psam.dto.PsamKglDTO"
            resultType="com.zjrs.zwnw.psam.dto.PsamTjDTO">
        SELECT SUBSTR(bjsj,0,10) rq,COUNT(1) cnt FROM (
        SELECT cjsj bjsj FROM rs_psam_ffxxb a where 1=1
        <if test="dto.ffrqBegin != null and dto.ffrqBegin != ''">
            and substr(a.cjsj,0,10) &gt;=#{ dto.ffrqBegin }
        </if>
        <if test="dto.ffrqEnd != null and dto.ffrqEnd != ''">
            and substr(a.cjsj,0,10) &lt;=#{ dto.ffrqEnd }
        </if>
        ) GROUP BY SUBSTR(bjsj,0,10) ORDER BY SUBSTR(bjsj,0,10)
    </select>
    <select id="exportRqListBySqrq" parameterType="com.zjrs.zwnw.psam.dto.PsamKglDTO"
            resultType="com.zjrs.zwnw.psam.dto.PsamTjDTO">
        select rownum rn,aa.* from(
        SELECT SUBSTR(cjsj,0,10) rq,COUNT(1) cnt FROM (
        SELECT cjsj FROM rs_psam_ffxxb a where 1=1
        <if test="dto.sqrqBegin != null and dto.sqrqBegin != ''">
            and substr(a.cjsj,0,10) &gt;=#{ dto.sqrqBegin }
        </if>
        <if test="dto.sqrqEnd != null and dto.sqrqEnd != ''">
            and substr(a.cjsj,0,10) &lt;=#{ dto.sqrqEnd }
        </if>
        ) GROUP BY SUBSTR(cjsj,0,10) ORDER BY SUBSTR(cjsj,0,10))aa
    </select>
    <select id="exportRqListByFfrq" parameterType="com.zjrs.zwnw.psam.dto.PsamKglDTO"
            resultType="com.zjrs.zwnw.psam.dto.PsamTjDTO">
        select rownum rn,aa.* from(SELECT SUBSTR(bjsj,0,10) rq,COUNT(1) cnt FROM (
        SELECT cjsj bjsj FROM rs_psam_ffxxb a where 1=1
        <if test="dto.ffrqBegin != null and dto.ffrqBegin != ''">
            and substr(a.cjsj,0,10) &gt;=#{ dto.ffrqBegin }
        </if>
        <if test="dto.ffrqEnd != null and dto.ffrqEnd != ''">
            and substr(a.cjsj,0,10) &lt;=#{ dto.ffrqEnd }
        </if>
        ) GROUP BY SUBSTR(bjsj,0,10) ORDER BY SUBSTR(bjsj,0,10)) aa
    </select>
</mapper>
