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

    <select id="getList" parameterType="com.zjrs.zwnw.psam.dto.PsamAzjgDTO"
            resultType="com.zjrs.zwnw.psam.po.RsPsamAzjgxxPO">
        SELECT a.rs_psam_azjgxx_lsh "rsPsamAzjgxxLsh",jgmc "jgmc",jgdz "jgdz",corp_code "corpCode",
               (SELECT t.user_name FROM s_sg_user t WHERE t.id=a.zhxgr)  "zhxgr" FROM rs_psam_azjgxx a where TS_SCBS=0
        <if test="dto.corpCode != null and dto.corpCode != ''">
            and CORP_CODE = #{ dto.corpCode }
        </if>
        <if test="dto.jgmc != null and dto.jgmc != ''">
            and JGMC like '%${ dto.jgmc }%'
        </if>
        ORDER BY a.ZHXGSJ DESC
    </select>
    <select id="getInfo" parameterType="com.zjrs.zwnw.psam.dto.PsamQueryFjDTO"
            resultType="com.zjrs.zwnw.psam.po.RsPsamAzjgxxPO">
        SELECT t.RS_PSAM_AZJGXX_LSH rsPsamAzjgxxLsh,t.jgdz,t.jgmc,t.corp_code corpCode,
               (SELECT t.user_name FROM s_sg_user t WHERE t.id=t.cjr) cjr,t.cjsj,
               (SELECT t.user_name FROM s_sg_user t WHERE t.id=t.zhxgr) zhxgr,t.zhxgsj FROM rs_psam_azjgxx t
            where t.rs_psam_azjgxx_lsh=#{ dto.id }
    </select>
</mapper>
