CreditCatalogShareMapper.xml 14.6 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.credit.cy.business.mapper.CreditCatalogShareMapper">
    
    <resultMap type="CreditCatalogShare" id="CreditCatalogShareResult">
        <result property="id"    column="id"    />
        <result property="catalogId"    column="catalog_id"    />
        <result property="sharePurpose"    column="share_purpose"    />
        <result property="shareMemo"    column="share_memo"    />
        <result property="startDate"    column="start_date"    />
        <result property="endDate"    column="end_date"    />
        <result property="applyUser"    column="apply_user"    />
        <result property="applyContact"    column="apply_contact"    />
        <result property="applyDate"    column="apply_date"    />
        <result property="applyDept"    column="apply_dept"    />
        <result property="applyFile"    column="apply_file"    />
        <result property="auditStatus"    column="audit_status"    />
        <result property="auditMemo"    column="audit_memo"    />
        <result property="auditUser"    column="audit_user"    />
        <result property="auditDept"    column="audit_dept"    />
        <result property="auditDate"    column="audit_date"    />
        <result property="shareResult"    column="share_result"    />
        <result property="delFlag"    column="del_flag"    />
        <result property="createBy"    column="create_by"    />
        <result property="createTime"    column="create_time"    />
        <result property="updateBy"    column="update_by"    />
        <result property="updateTime"    column="update_time"    />
    </resultMap>

    <resultMap type="com.credit.cy.business.model.CatalogShareInfo" id="CatalogShareInfoResult">
        <result property="id"    column="id"    />
        <result property="catalogId"    column="catalog_id"    />
        <result property="catalogName"    column="catalog_name"    />
        <result property="catalogType"    column="catalog_type"    />
        <result property="deptId"    column="dept_id"    />
        <result property="deptName"    column="dept_name"    />
        <result property="counterpartType"    column="counterpart_type"    />
        <result property="sharePurpose"    column="share_purpose"    />
        <result property="applyUser"    column="apply_user"    />
        <result property="applyDate"    column="apply_date"    />
        <result property="applyDept"    column="apply_dept"    />
        <result property="applyFile"    column="apply_file"    />
        <result property="auditStatus"    column="audit_status"    />
        <result property="auditMemo"    column="audit_memo"    />
        <result property="auditDept"    column="audit_dept"    />
        <result property="auditDate"    column="audit_date"    />
        <result property="shareResult"    column="share_result"    />
    </resultMap>



    <sql id="selectCreditCatalogShareVo">
        select id, catalog_id, share_purpose, share_memo, start_date, end_date, apply_user, apply_contact, apply_date, apply_dept, apply_file, audit_status, audit_memo, audit_user, audit_dept, audit_date, share_result, del_flag, create_by, create_time, update_by, update_time from credit_catalog_share
    </sql>


    <sql id="selectCatalogShareInfoVo">
        select ccs.id, ccs.catalog_id, ccs.share_purpose, ccs.apply_user, ccs.apply_contact, ccs.apply_date, ccs.apply_dept, ccs.apply_file, ccs.audit_status, ccs.audit_memo, ccs.audit_user, ccs.audit_dept, ccs.audit_date, ccs.share_result,
                cc.catalog_name, cc.large_type, cc.catalog_type, cc.dept_id, cc.dept_name, cc.counterpart_type
               from credit_catalog_share ccs
                        left join credit_catalog cc on ccs.catalog_id = cc.id
    </sql>

    <select id="selectCreditCatalogShareList" parameterType="CreditCatalogShare" resultMap="CreditCatalogShareResult">
        <include refid="selectCreditCatalogShareVo"/>
        <where>  
            <if test="catalogId != null "> and catalog_id = #{catalogId}</if>
            <if test="sharePurpose != null  and sharePurpose != ''"> and share_purpose = #{sharePurpose}</if>
            <if test="shareMemo != null  and shareMemo != ''"> and share_memo = #{shareMemo}</if>
            <if test="startDate != null "> and start_date = #{startDate}</if>
            <if test="endDate != null "> and end_date = #{endDate}</if>
            <if test="applyUser != null "> and apply_user = #{applyUser}</if>
            <if test="applyContact != null  and applyContact != ''"> and apply_contact = #{applyContact}</if>
            <if test="applyDate != null "> and apply_date = #{applyDate}</if>
            <if test="applyDept != null "> and apply_dept = #{applyDept}</if>
            <if test="applyFile != null  and applyFile != ''"> and apply_file = #{applyFile}</if>
            <if test="auditStatus != null "> and audit_status = #{auditStatus}</if>
            <if test="auditUser != null "> and audit_user = #{auditUser}</if>
            <if test="auditDept != null "> and audit_dept = #{auditDept}</if>
            <if test="auditDate != null "> and audit_date = #{auditDate}</if>
            <if test="shareResult != null "> and share_result = #{shareResult}</if>
        </where>
    </select>
    
    <select id="selectCreditCatalogShareById" parameterType="Long" resultMap="CreditCatalogShareResult">
        <include refid="selectCreditCatalogShareVo"/>
        where id = #{id}
    </select>
        
    <insert id="insertCreditCatalogShare" parameterType="CreditCatalogShare" useGeneratedKeys="true" keyProperty="id">
        insert into credit_catalog_share
        <trim prefix="(" suffix=")" suffixOverrides=",">
            <if test="catalogId != null">catalog_id,</if>
            <if test="sharePurpose != null and sharePurpose != ''">share_purpose,</if>
            <if test="shareMemo != null">share_memo,</if>
            <if test="startDate != null">start_date,</if>
            <if test="endDate != null">end_date,</if>
            <if test="applyUser != null">apply_user,</if>
            <if test="applyContact != null">apply_contact,</if>
            <if test="applyDate != null">apply_date,</if>
            <if test="applyDept != null">apply_dept,</if>
            <if test="applyFile != null">apply_file,</if>
            <if test="auditStatus != null">audit_status,</if>
            <if test="auditMemo != null">audit_memo,</if>
            <if test="auditUser != null">audit_user,</if>
            <if test="auditDept != null">audit_dept,</if>
            <if test="auditDate != null">audit_date,</if>
            <if test="shareResult != null">share_result,</if>
            <if test="delFlag != null">del_flag,</if>
            <if test="createBy != null">create_by,</if>
            <if test="createTime != null">create_time,</if>
            <if test="updateBy != null">update_by,</if>
            <if test="updateTime != null">update_time,</if>
         </trim>
        <trim prefix="values (" suffix=")" suffixOverrides=",">
            <if test="catalogId != null">#{catalogId},</if>
            <if test="sharePurpose != null and sharePurpose != ''">#{sharePurpose},</if>
            <if test="shareMemo != null">#{shareMemo},</if>
            <if test="startDate != null">#{startDate},</if>
            <if test="endDate != null">#{endDate},</if>
            <if test="applyUser != null">#{applyUser},</if>
            <if test="applyContact != null">#{applyContact},</if>
            <if test="applyDate != null">#{applyDate},</if>
            <if test="applyDept != null">#{applyDept},</if>
            <if test="applyFile != null">#{applyFile},</if>
            <if test="auditStatus != null">#{auditStatus},</if>
            <if test="auditMemo != null">#{auditMemo},</if>
            <if test="auditUser != null">#{auditUser},</if>
            <if test="auditDept != null">#{auditDept},</if>
            <if test="auditDate != null">#{auditDate},</if>
            <if test="shareResult != null">#{shareResult},</if>
            <if test="delFlag != null">#{delFlag},</if>
            <if test="createBy != null">#{createBy},</if>
            <if test="createTime != null">#{createTime},</if>
            <if test="updateBy != null">#{updateBy},</if>
            <if test="updateTime != null">#{updateTime},</if>
         </trim>
    </insert>

    <update id="updateCreditCatalogShare" parameterType="CreditCatalogShare">
        update credit_catalog_share
        <trim prefix="SET" suffixOverrides=",">
            <if test="sharePurpose != null and sharePurpose != ''">share_purpose = #{sharePurpose},</if>
            <if test="shareMemo != null">share_memo = #{shareMemo},</if>
            <if test="startDate != null">start_date = #{startDate},</if>
            <if test="endDate != null">end_date = #{endDate},</if>
            <if test="applyUser != null">apply_user = #{applyUser},</if>
            <if test="applyContact != null">apply_contact = #{applyContact},</if>
            <if test="applyDate != null">apply_date = #{applyDate},</if>
            <if test="applyDept != null">apply_dept = #{applyDept},</if>
            <if test="applyFile != null">apply_file = #{applyFile},</if>
            <if test="updateBy != null">update_by = #{updateBy},</if>
            <if test="updateTime != null">update_time = #{updateTime},</if>
        </trim>
        where id = #{id}
    </update>

    <update id="auditCreditCatalogShare" parameterType="CreditCatalogShare">
        update credit_catalog_share
        <trim prefix="SET" suffixOverrides=",">
            <if test="auditStatus != null">audit_status = #{auditStatus},</if>
            <if test="auditMemo != null">audit_memo = #{auditMemo},</if>
            <if test="auditUser != null">audit_user = #{auditUser},</if>
            <if test="auditDept != null">audit_dept = #{auditDept},</if>
            <if test="auditDate != null">audit_date = #{auditDate},</if>
            <if test="shareResult != null">share_result = #{shareResult},</if>
            <if test="updateBy != null">update_by = #{updateBy},</if>
            <if test="updateTime != null">update_time = #{updateTime},</if>
        </trim>
        where id = #{id}
    </update>

    <delete id="deleteCreditCatalogShareById" parameterType="Long">
        delete from credit_catalog_share where id = #{id}
    </delete>

    <delete id="deleteCreditCatalogShareByIds" parameterType="String">
        delete from credit_catalog_share where id in 
        <foreach item="id" collection="array" open="(" separator="," close=")">
            #{id}
        </foreach>
    </delete>

    <select id="searchCreditCatalogShareList" parameterType="com.credit.cy.business.model.CreditCatalogShareQuery" resultMap="CreditCatalogShareResult">
        <include refid="selectCreditCatalogShareVo"/>
        <where>
            <if test="id != null "> and id = #{id}</if>
            <if test="catalogId != null "> and catalog_id = #{catalogId}</if>

            <if test="applyStartDate != null "> and apply_date &gt;= #{applyStartDate}</if>
            <if test="applyEndDate != null "> and apply_date &lt;= #{applyEndDate}</if>
            <if test="applyDept != null "> and apply_dept = #{applyDept}</if>

            <if test="auditStatusList != null and auditStatusList.length > 0"> and audit_status in
                <foreach item="auditStatus" collection="auditStatusList" open="(" separator="," close=")">
                    #{auditStatus}
                </foreach>
            </if>
            <if test="auditDept != null "> and audit_dept = #{auditDept}</if>
            <if test="shareResultList != null and shareResultList.length > 0"> and share_result in
                <foreach item="shareResult" collection="shareResultList" open="(" separator="," close=")">
                    #{shareResult}
                </foreach>
            </if>
        </where>
    </select>

    <select id="searchAuditCatalogShareList" parameterType="com.credit.cy.business.model.CreditCatalogShareQuery" resultMap="CatalogShareInfoResult">
        <include refid="selectCatalogShareInfoVo"/>
        <where>
            <if test="id != null "> and ccs.id = #{id}</if>
            <if test="catalogId != null "> and ccs.catalog_id = #{catalogId}</if>
            <if test="catalogName != null  and catalogName != ''"> and cc.catalog_name like concat('%',#{catalogName}, '%')</if>
            <if test="counterpartType != null  and counterpartType != ''"> and cc.counterpart_type = #{counterpartType}</if>
            <if test="largeType != null  and largeType != ''"> and cc.large_type = #{largeType}</if>
            <if test="openType != null  and openType != ''"> and open_type = #{openType}</if>
            <if test="catalogTypeList != null and catalogTypeList.length > 0"> and cc.counterpart_type in
                <foreach item="counterpartType" collection="catalogTypeList" open="(" separator="," close=")">
                    #{counterpartType}
                </foreach>
            </if>
            <if test="deptId != null "> and cc.dept_id = #{deptId}</if>

            <if test="applyStartDate != null "> and ccs.apply_date &gt;= #{applyStartDate}</if>
            <if test="applyEndDate != null "> and ccs.apply_date &lt;= #{applyEndDate}</if>
            <if test="applyDept != null "> and ccs.apply_dept = #{applyDept}</if>
            <if test="auditStatusList != null and auditStatusList.length > 0"> and ccs.audit_status in
                <foreach item="auditStatus" collection="auditStatusList" open="(" separator="," close=")">
                    #{auditStatus}
                </foreach>
            </if>
            <if test="auditDept != null "> and ccs.audit_dept = #{auditDept}</if>
            <if test="shareResultList != null and shareResultList.length > 0"> and ccs.share_result in
                <foreach item="shareResult" collection="shareResultList" open="(" separator="," close=")">
                    #{shareResult}
                </foreach>
            </if>
        </where>
    </select>

    <select id="selectCount" parameterType="com.credit.cy.business.model.query.WorkCountQuery" resultType="java.lang.Long">
        select count(1) from credit_catalog_share
        <where>
            <if test="reportDept != null  and reportDept != ''"> and apply_dept = #{reportDept}</if>
            <if test="auditDept != null  and auditDept != ''"> and audit_dept = #{auditDept}</if>
            <if test="null!=reportStartDate"> and apply_date >= #{reportStartDate}</if>
            <if test="null!=reportEndDate"> AND apply_date <![CDATA[<=]]> #{reportEndDate}</if>
            <if test="null!=auditStartDate"> and audit_date >= #{auditStartDate}</if>
            <if test="null!=auditEndDate"> and audit_date <![CDATA[<=]]> #{auditEndDate}</if>
        </where>
    </select>
</mapper>