DgArchivesDestructionMapper.xml 5.5 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.destroy.mapper.DgArchivesDestructionMapper">
    <!-- 通用查询映射结果 -->
    <resultMap id="BaseResultMap" type="com.pashanhoo.destroy.entity.DgArchivesDestructionDO">
        <id column="BSM_DESTRUCTION" property="bsmDestruction"/>
        <result column="XHQCBH" property="xhqcbh"/>
        <result column="FQR" property="fqr"/>
        <result column="FQRQ" property="fqrq"/>
        <result column="XHYY" property="xhyy"/>
        <result column="SHRY" property="shry"/>
        <result column="SHYJ" property="shyj"/>
        <result column="XHR" property="xhr"/>
        <result column="XHRQ" property="xhrq"/>
    </resultMap>
    <!-- 销毁页面记录查询 -->
    <resultMap id="ShowDestructionResultMap" type="com.pashanhoo.destroy.entity.vo.DgArchivesDestructionListVO">
        <id column="BSM_DESTRUCTION" property="bsmDestruction" />
        <result column="XHQCBH" property="xhqcbh" />
        <result column="FQR" property="fqr" />
        <result column="FQRQ" property="fqrq" />
        <result column="XHYY" property="xhyy" />
        <result column="SHRY" property="shry" />
        <result column="SHYJ" property="shyj" />
        <result column="XHR" property="xhr" />
        <result column="XHRQ" property="xhrq" />
        <result column="AJ_NUM" property="ajNum" />
    </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>
    <!-- 通用查询结果列 -->
    <sql id="Base_Column_List">
        BSM_DESTRUCTION,
        XHQCBH,
        FQR,
        FQRQ,
        XHYY,
        SHRY,
        SHYJ,
        XHR,
        XHRQ
    </sql>
    <update id="updateArchivesStatus" parameterType="java.lang.String">
        update dg_archives b
        set b.dazt = #{dazt,jdbcType=VARCHAR}
        where exists (select 1
                      from DG_DESTRUCTION_CATALOG a
                      where a.bsm_destruction = #{bsm_destruction,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>
    <update id="updateDestructionArchivesStatus">
        update DG_DESTRUCTION b
        set b.dazt = #{dazt,jdbcType=VARCHAR}
        where bsm_destruction=#{bsm_destruction,jdbcType=VARCHAR}
    </update>
    <select id="selectXhResult" resultMap="ShowDestructionResultMap">
        select a.BSM_DESTRUCTION,
               a.XHQCBH,
               a.FQR,
               a.FQRQ,
               a.XHYY,
               a.SHRY,
               a.SHYJ,
               a.XHR,
               a.XHRQ,
               count(1) over(partition by b.bsm_destruction, b.bsm_archives) aj_num
        from dg_archives_destruction a, dg_destruction_catalog b
        where a.bsm_destruction = b.bsm_destruction
          and exists
            (select 1 from dg_archives c where c.bsm_archives = b.bsm_archives
            <if test="ajh!=null and ajh!='' ">
                and c.ajh=#{ajh,jdbcType=VARCHAR}
            </if>
              )
        <if test="xhqcbh!=null and xhqcbh!='' ">
            and a.xhqcbh=#{xhqcbh,jdbcType=VARCHAR}
        </if>
        <if test="xhrq!=null and xhrq!='' ">
            and a.XHRQ=#{xhrq,jdbcType=TIMESTAMP}
        </if>
        order by a.XHRQ desc
    </select>
    <select id="queryArchivesInfo" resultMap="ShowArchivesInfoResultMap">
        select * from  dg_archives b
        where exists (select 1
                      from DG_DESTRUCTION_CATALOG a
                      where a.BSM_LEND = #{bsm_destruction,jdbcType=VARCHAR}
                        and b.bsm_archives = a.bsm_archives)
    </select>

    <select id="getDestroyLeftMenu" resultType="com.pashanhoo.archive.entity.DgArchivesDO">
        select DA.*
        from DG_ARCHIVES DA
                     join DG_DESTRUCTION_CATALOG DDC on DA.BSM_ARCHIVES = DDC.BSM_ARCHIVES
                     join DG_ARCHIVES_DESTRUCTION DAD on DDC.BSM_DESTRUCTION = DAD.BSM_DESTRUCTION
        where DAD.XHQCBH = #{xhqcbh,jdbcType=VARCHAR}
    </select>
</mapper>