DgArchivesMapper.xml 5.61 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.archive.mapper.DgArchivesMapper">

    <!-- 通用查询映射结果 -->
    <resultMap id="BaseResultMap" type="com.pashanhoo.archive.entity.DgArchivesDO">
        <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_ARCHIVES, AJBT, ZTC, FLH, MLH, AJH, ND, JS, YS, BGQX, QSRQ, ZZRQ, MJ, HH, CFWZ, CJR, CJRQ, HCR, BZ, SMZT, DAZT, CDJGBM, DALY
    </sql>
    <update id="updateArchivesInfoByReceiveIdList">
        update DG_ARCHIVES a set a.dazt=#{dazt,jdbcType=VARCHAR} where exists (
         select 1 from dg_receive_relation b where  a.BSM_ARCHIVES=b.BSM_ARCHIVES
         and b.bms_receive in
        <foreach collection="idList" index="index" item="item"
                 separator="," open="(" close=")">
            #{item,jdbcType=VARCHAR}
        </foreach>
        )
    </update>

    <select id="searchArchive" resultType="com.pashanhoo.archive.entity.vo.SearchArchiveVO">
        select rownum as xh,
        DA.BSM_ARCHIVES,
        DA.DAZT,
        DA.DALY,
        DA.AJH,
        DA.CFWZ,
        DA.HH,
        D.BDCQZH,
        D.QLR,
        D.YWR,
        DB.YWH,
        D.BDCDYH,
        DB.QLLX
        from DG_ARCHIVES DA
        join DG_BUSINESS DB on DA.BSM_ARCHIVES = DB.BSM_ARCHIVES
        join DG_BDCDY D on DA.BSM_ARCHIVES = D.BSM_ARCHIVES
        <where>
            <if test="request.ajh != null and request.ajh != ''">
                AJH = #{request.ajh,jdbcType=VARCHAR}
            </if>
            <if test="request.mlh != null and request.mlh != ''">
                and MLH = #{request.mlh,jdbcType=VARCHAR}
            </if>
            <if test="request.hh != null and request.hh != ''">
                and HH = #{request.hh,jdbcType=VARCHAR}
            </if>
            <if test="request.dazt != null and request.dazt != ''">
                and DAZT = #{request.dazt,jdbcType=VARCHAR}
            </if>
            <if test="request.ywh != null and request.ywh != ''">
                and YWH = #{request.ywh,jdbcType=VARCHAR}
            </if>
            <if test="request.bdcqzh != null and request.bdcqzh != ''">
                and BDCQZH = #{request.bdcqzh,jdbcType=VARCHAR}
            </if>
            <if test="request.bdcdyh != null and request.bdcdyh != ''">
                and BDCDYH = #{request.bdcdyh,jdbcType=VARCHAR}
            </if>
            <if test="request.qllx != null and request.qllx != ''">
                and QLLX = #{request.qllx,jdbcType=VARCHAR}
            </if>
            <if test="request.qlr != null and request.qlr != ''">
                and QLR = #{request.qlr,jdbcType=VARCHAR}
            </if>
        </where>
    </select>


    <resultMap id="CatalogWithFile" type="com.pashanhoo.catalog.entity.vo.DgArchivesCatalogWithFileVO">
        <result column="bsm_catalog" property="bsmCatalog"/>
        <result column="bsm_archives" property="bsmArchives"/>
        <result column="xh" property="xh"/>
        <result column="wjbm" property="wjbm"/>
        <result column="wjmc" property="wjmc"/>
        <result column="cllxbm" property="cllxbm"/>
        <result column="cllxmc" property="cllxmc"/>
        <result column="ys" property="ys"/>
        <result column="yh" property="yh"/>
        <result column="fs" property="fs"/>
        <result column="wh" property="wh"/>
        <result column="bz" property="bz"/>
        <collection property="dgFileDOS" ofType="com.pashanhoo.file.entity.DgFileDO">
            <result column="BSM_FILE" property="bsmFile"/>
            <result column="DF_BSM_CATALOG" property="bsmCatalog"/>
            <result column="KZM" property="kzm"/>
            <result column="SCRQ" property="scrq"/>
            <result column="SCR" property="scr"/>
            <result column="FJURL" property="fjurl"/>
            <result column="FJSIZE" property="fjsize"/>
        </collection>
    </resultMap>

    <select id="selectCatalogWithFile" resultMap="CatalogWithFile">
        select DAC.*, DF.BSM_FILE as BSM_FILE, DF.BSM_CATALOG as DF_BSM_CATALOG, DF.KZM as KZM,DF.SCRQ as SCRQ,DF.SCR as SCR,DF.FJURL as FJURL,DF.FJSIZE as FJSIZE
        from DG_FILE DF
        left join DG_ARCHIVES_CATALOG DAC on DAC.BSM_CATALOG =
        DF.BSM_CATALOG
        <where>
            <if test="request.bsmArchives != null and request.bsmArchives != ''">
                BSM_ARCHIVES = #{request.bsmArchives,jdbcType=VARCHAR}
            </if>
        </where>
        order by XH
    </select>
</mapper>