DgLendMapper.xml 6.84 KB
<?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.pashanhoo.lend.mapper.DgLendMapper">

    <!-- 通用查询映射结果 -->
    <resultMap id="BaseResultMap" type="com.pashanhoo.lend.entity.vo.DgLendDetailVO">
        <id column="BSM_LEND" property="bsm_lend" />
        <result column="JYSX" property="jyr" />
        <result column="JYDH" property="jydw" />
        <result column="AJH" property="ajh" />
        <result column="JYFS" property="jyfs" />
        <result column="JYDW" property="jydw" />
        <result column="JYR" property="jyr" />
        <result column="QSSJ" property="qssj" />
        <result column="JZRQ" property="jzrq" />
        <result column="GHR" property="ghr" />
        <result column="GHSJ" property="ghsj" />
        <result column="JYZT" property="jyzt" />
        <result column="DA_NUM" property="da_num" />
    </resultMap>
    <!-- 档案列表记录查询 -->
    <resultMap id="ShowArchivesInfoResultMap" type="com.pashanhoo.archive.entity.vo.DgArchivesListVO">
        <id column="BSM_ARCHIVES" property="bsmArchives" />
        <result column="AJBT" property="ajbt" />
        <result column="ZTC" property="ztc" />
        <result column="FLH" property="flh" />
        <result column="MLH" property="mlh" />
        <result column="AJH" property="ajh" />
        <result column="ND" property="nd" />
        <result column="JS" property="js" />
        <result column="YS" property="ys" />
        <result column="BGQX" property="bgqx" />
        <result column="QSRQ" property="qsrq" />
        <result column="ZZRQ" property="zzrq" />
        <result column="MJ" property="mj" />
        <result column="HH" property="hh" />
        <result column="CFWZ" property="cfwz" />
        <result column="CJR" property="cjr" />
        <result column="CJRQ" property="cjrq" />
        <result column="HCR" property="hcr" />
        <result column="BZ" property="bz" />
        <result column="SMZT" property="smzt" />
        <result column="DAZT" property="dazt" />
        <result column="CDJGBM" property="cdjgbm" />
        <result column="DALY" property="daly" />
    </resultMap>
    <!-- 通用查询映射结果 -->
    <resultMap id="ArchiveLendInfoResultMap" type="com.pashanhoo.lend.entity.vo.ArchiveLendInfoRequestVO">
        <id column="BSM_ARCHIVES" property="bsm_archives" />
        <result column="DAZT" property="dazt" />
        <result column="AJH" property="ajh" />
        <result column="BDCDYH" property="bdcdyh" />
        <result column="QLLX" property="qllx" />
        <result column="DJLX" property="djlx" />
        <result column="QLR" property="qlr" />
        <result column="YWR" property="ywr" />
        <result column="ZJHM" property="zjhm" />
        <result column="BDCDY_NUM" property="bdcdy_num" />
    </resultMap>
    <!-- 通用查询结果列 -->
    <sql id="Base_Column_List">
        BSM_LEND, JYR, JYDW, LXDW, TXDZ, JYRQ, GHRQ, PZR, JYQX, JCLY, LYMD, BZ, PZSJ
    </sql>
    <update id="updateArchivesStatus">
        update dg_archives b
        set b.dazt = #{dazt,jdbcType=VARCHAR}
        where exists (select 1
                      from DG_LEND_CATALOG a
                      where a.BSM_LENDCATALOG = #{lendBsm,jdbcType=VARCHAR}
                        and b.bsm_archives = a.bsm_archives)

    </update>
    <update id="updateArchivesStatusBatch">
        update dg_archives b
        set b.dazt = #{dazt,jdbcType=VARCHAR} where bsm_archives in
        <foreach collection="idList" index="index" item="item"
                 separator="," open="(" close=")">
            #{item,jdbcType=VARCHAR}
        </foreach>
    </update>
    <select id="getDanganJyDetail" resultMap="BaseResultMap">
        select d.BSM_LEND,
        d.jysx,
        d.jydh,
        d.ajh,
        d.jyfs,
        d.jydw,
        d.jyr,
        d.qssj,
        d.jzrq,
        d.ghr,
        d.ghsj,
        d.jyzt,count(1) over(partition by d.BSM_LEND order by d.jysx asc, d.jzrq asc, d.jyzt asc) da_num
        from (select a.jy_bsm,
        case
        when a.jzrq &lt; sysdate and a.JYZT = '8' then
        '0'
        else
        '1'
        end as jysx,
        a.jydh,
        b.ajh,
        a.jyfs,
        a.jydw,
        a.jyr,
        a.qssj,
        a.jzrq,
        a.ghr,
        a.ghsj,
        a.jyzt
        from dg_lend a, dg_archives b,dg_lend_catalog c,dg_bdcdy e,dg_business f
        where b.BSM_ARCHIVES=c.BSM_ARCHIVES
        and a.BSM_LEND=c.BSM_LEND
        and e.BSM_ARCHIVES=b.BSM_ARCHIVES
        and f.BSM_ARCHIVES=b.BSM_ARCHIVES
        <if test="ajh != null and ajh!='' ">
            and b.ajh=#{ajh,jdbcType=VARCHAR}
        </if>
        <if test="bdcdyh != null and bdcdyh!='' ">
            and e.bdcdyh=#{bdcdyh,jdbcType=VARCHAR}
        </if>
        <if test="ywh != null and ywh!=''">
            and f.ywh=#{ywh,jdbcType=VARCHAR}
        </if>
        <if test="bdcqzh != null and bdcqzh !='' ">
            and e.zjhm=#{bdcqzh,jdbcType=VARCHAR}
        </if>
        <if test="jyr != null and jyr!='' ">
            and a.jyr=#{jyr,jdbcType=VARCHAR}
        </if>
        <if test="jyzt != null and jyzt != '' ">
            and a.jyzt=#{jyzt,jdbcType=VARCHAR}
        </if>

        ) d



    </select>
    <select id="queryArchivesInfo" resultMap="ShowArchivesInfoResultMap">
        select * from  dg_archives b
        where exists (select 1
                      from DG_LEND_CATALOG a
                      where a.BSM_LENDCATALOG = #{bsm_lend,jdbcType=VARCHAR}
                        and b.bsm_archives = a.bsm_archives)
    </select>
    <select id="getArchiveLendInfo" resultType="com.pashanhoo.lend.entity.vo.ArchiveLendInfoRequestVO">
        select a.bsm_archives,a.dazt,a.ajh,c.bdcdyh,b.qllx,b.djlx,c.qlr,c.ywr,c.zjhm,count(1) over (partition by a.bsm_archives) bdcdy_num
        from dg_archives a, dg_business b, dg_bdcdy c
        where a.bsm_archives = b.bsm_archives
          and   a.bsm_archives=c.bsm_archives
          and a.dazt='4'
        <if test="ajh != null and ajh != '' ">
            and a.ajh=#{ajh,jdbcType=VARCHAR}
        </if>
        <if test="ywh != null and ywh != '' ">
            and b.ywh=#{ywh,jdbcType=VARCHAR}
        </if>
        <if test="bdcdyh != null and bdcdyh != '' ">
            and c.bdcdyh=#{bdcdyh,jdbcType=VARCHAR}
        </if>
        <if test="zjhm != null and zjhm != '' ">
            and c.zjhm=#{zjhm,jdbcType=VARCHAR}
        </if>
        <if test="qlr != null and qlr != '' ">
            and c.qlr=#{qlr,jdbcType=VARCHAR}
        </if>
        <if test="ywr != null and ywr != '' ">
            and c.ywr=#{ywr,jdbcType=VARCHAR}
        </if>
        <if test="cfwh != null and cfwh != '' ">
            and c.zjhm=#{cfwh,jdbcType=VARCHAR}
        </if>
        <if test="qllx != null and qllx != '' ">
            and c.qllx=#{qllx,jdbcType=VARCHAR}
        </if>
    </select>
</mapper>