<?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.RsPsamXfmxbMapper">

    <select id="getXfyckList" parameterType="com.zjrs.zwnw.psam.dto.PsamXfycDTO" resultType="map">
        SELECT b.psambh "psambh",
               (SELECT detail FROM s_sg_dict t WHERE t.kind_code='RS_PSAM_KZT' AND CODE=b.kzt) "kzt",
               e.aab004 "dwmc",e.AAE006 "dwdz",COUNT(1) "cnt" FROM rs_psam_xfmxb a,rs_psam_rkxxb b,rs_psam_ywxx_sqb c,ab01 e
        WHERE a.psambh=b.psambh AND c.rs_psam_ywxx_sqb_lsh=b.rs_psam_ywxx_sqb_lsh AND c.ztid=e.ztid
        AND (a.jylat!=a.azlat OR a.jylng!=a.azlng)
        <if test="dto.xzqh != null and dto.xzqh != ''">
            and e.aab078 = #{ dto.xzqh }
        </if>
        GROUP BY b.psambh,b.kzt,e.aab004,e.AAE006
        ORDER BY b.psambh DESC
    </select>
</mapper>
