CreditCommitmentInfoMapper.xml 20 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.CreditCommitmentInfoMapper">

    <resultMap type="com.credit.cy.business.domain.CreditCommitmentInfo" id="CreditCommitmentInfoResult">
        <result property="id"    column="id"    />
        <result property="counterpartName"    column="counterpart_name"    />
        <result property="counterpartType"    column="counterpart_type"    />
        <result property="creditCode"    column="credit_code"    />
        <result property="commitmentType"    column="commitment_type"    />
        <result property="commitmentCause"    column="commitment_cause"    />
        <result property="content"    column="content"    />
        <result property="documentNum"    column="document_num"    />
        <result property="pubType"    column="pub_type"    />
        <result property="duty"    column="duty"    />
        <result property="startTime"    column="start_time"    />
        <result property="endTime"    column="end_time"    />
        <result property="execStatus"    column="exec_status"    />
        <result property="violateLevel"    column="violate_level"    />
        <result property="violateContent"    column="violate_content"    />
        <result property="violateTraceContent"    column="violate_trace_content"    />
        <result property="decisionTime"    column="decision_time"    />
        <result property="decisionOrg"    column="decision_org"    />
        <result property="decisionOrgCode"    column="decision_org_code"    />
        <result property="execOrg"    column="exec_org"    />
        <result property="execOrgCode"    column="exec_org_code"    />
        <result property="remark"    column="remark"    />
        <result property="fileKey"    column="file_key"    />
        <result property="createTime"    column="create_time"    />
        <result property="updateTime"    column="update_time"    />
        <result property="createBy"    column="create_by"    />
        <result property="updateBy"    column="update_by"    />
        <result property="reportDept" column="report_dept"/>
        <result property="reportDate" column="report_date"/>
        <result property="itemId" column="item_id"/>
        <result property="commitmentEntity" column="commitment_entity"/>
        <result property="fulfillDate" column="fulfill_date"/>
    </resultMap>

    <sql id="selectCreditCommitmentInfoVo">
        select id, counterpart_name, counterpart_type, credit_code, commitment_type, document_num,commitment_cause, content,
               pub_type, duty, start_time, end_time, exec_status, violate_level, violate_content, violate_trace_content,
               decision_time, decision_org, decision_org_code, exec_org, exec_org_code, remark, file_key,
               create_time, update_time, create_by, update_by,report_dept,report_date,item_id,commitment_entity,fulfill_date from credit_commitment_info
    </sql>

    <select id="selectCommitmentInfoList" parameterType="com.credit.cy.business.domain.CreditCommitmentInfo" resultMap="CreditCommitmentInfoResult">
        <include refid="selectCreditCommitmentInfoVo"/>
        <where>
            <if test="counterpartName != null  and counterpartName != ''"> and counterpart_name like concat('%', #{counterpartName}, '%')</if>
            <if test="itemId != null "> and item_id = #{itemId}</if>
            <if test="counterpartType != null  and counterpartType != ''"> and counterpart_type = #{counterpartType}</if>
            <if test="creditCode != null  and creditCode != ''"> and credit_code = #{creditCode}</if>
            <if test="commitmentType != null  and commitmentType != ''"> and commitment_type = #{commitmentType}</if>
            <if test="documentNum != null  and documentNum != ''"> and document_num = #{documentNum}</if>
            <if test="pubType != null  and pubType != ''"> and pub_type = #{pubType}</if>
            <if test="startTime != null "> and start_time = #{startTime}</if>
            <if test="endTime != null "> and end_time = #{endTime}</if>
            <if test="execStatus != null  and execStatus != ''"> and exec_status = #{execStatus}</if>
            <if test="violateLevel != null  and violateLevel != ''"> and violate_level = #{violateLevel}</if>
            <if test="violateContent != null  and violateContent != ''"> and violate_content = #{violateContent}</if>
            <if test="violateTraceContent != null  and violateTraceContent != ''"> and violate_trace_content = #{violateTraceContent}</if>
            <if test="decisionTime != null "> and decision_time = #{decisionTime}</if>
            <if test="decisionOrg != null  and decisionOrg != ''"> and decision_org = #{decisionOrg}</if>
            <if test="decisionOrgCode != null  and decisionOrgCode != ''"> and decision_org_code = #{decisionOrgCode}</if>
            <if test="execOrg != null  and execOrg != ''"> and exec_org = #{execOrg}</if>
            <if test="execOrgCode != null  and execOrgCode != ''"> and exec_org_code = #{execOrgCode}</if>
            <if test="fileKey != null  and fileKey != ''"> and file_key = #{fileKey}</if>
        </where>
    </select>

    <select id="selectCommitmentInfoById" parameterType="Long" resultMap="CreditCommitmentInfoResult">
        <include refid="selectCreditCommitmentInfoVo"/>
        where id = #{id}
    </select>

    <select id="queryList" parameterType="com.credit.cy.business.model.query.CreditCommitmentInfoQuery" resultMap="CreditCommitmentInfoResult">
        <include refid="selectCreditCommitmentInfoVo"/>
        <where>
            <if test="null!=createTimeBegin">
                AND create_time >= #{createTimeBegin}
            </if>
            <if test="null!=createTimeEnd">
                AND create_time <![CDATA[<=]]> #{createTimeEnd}
            </if>
            <if test="counterpartName != null  and counterpartName != ''">and counterpart_name like concat('%',
                #{counterpartName}, '%')
            </if>
            <if test="itemId != null ">and item_id = #{itemId}</if>
            <if test="reportDept != null ">and report_dept = #{reportDept}</if>
            <if test="counterpartType != null  and counterpartType != ''">and counterpart_type = #{counterpartType}</if>
            <if test="creditCode != null  and creditCode != ''">and credit_code = #{creditCode}</if>
            <if test="commitmentType != null  and commitmentType != ''">and commitment_type = #{commitmentType}</if>
            <if test="documentNum != null  and documentNum != ''">and document_num = #{documentNum}</if>
        </where>
    </select>

    <insert id="insertCommitmentInfo" parameterType="com.credit.cy.business.domain.CreditCommitmentInfo" useGeneratedKeys="true" keyProperty="id">
        insert into credit_commitment_info
        <trim prefix="(" suffix=")" suffixOverrides=",">
            <if test="counterpartName != null and counterpartName != ''">counterpart_name,</if>
            <if test="counterpartType != null and counterpartType != ''">counterpart_type,</if>
            <if test="creditCode != null and creditCode != ''">credit_code,</if>
            <if test="commitmentType != null and commitmentType != ''">commitment_type,</if>
            <if test="commitmentCause != null">commitment_cause,</if>
            <if test="content != null">content,</if>
            <if test="documentNum != null and documentNum != ''">document_num,</if>
            <if test="pubType != null and pubType != ''">pub_type,</if>
            <if test="duty != null">duty,</if>
            <if test="startTime != null">start_time,</if>
            <if test="endTime != null">end_time,</if>
            <if test="execStatus != null and execStatus != ''">exec_status,</if>
            <if test="violateLevel != null">violate_level,</if>
            <if test="violateContent != null">violate_content,</if>
            <if test="violateTraceContent != null">violate_trace_content,</if>
            <if test="decisionTime != null">decision_time,</if>
            <if test="decisionOrg != null">decision_org,</if>
            <if test="decisionOrgCode != null">decision_org_code,</if>
            <if test="execOrg != null">exec_org,</if>
            <if test="execOrgCode != null">exec_org_code,</if>
            <if test="remark != null">remark,</if>
            <if test="fileKey != null">file_key,</if>
            <if test="createTime != null">create_time,</if>
            <if test="updateTime != null">update_time,</if>
            <if test="createBy != null">create_by,</if>
            <if test="updateBy != null">update_by,</if>
            <if test="reportDept !=null ">report_dept,</if>
            <if test="reportDate !=null  ">report_date,</if>
            <if test="itemId !=null ">item_id,</if>
            <if test="commitmentEntity !=null and commitmentEntity != '' ">commitment_entity,</if>
        </trim>
        <trim prefix="values (" suffix=")" suffixOverrides=",">
            <if test="counterpartName != null and counterpartName != ''">#{counterpartName},</if>
            <if test="counterpartType != null and counterpartType != ''">#{counterpartType},</if>
            <if test="creditCode != null and creditCode != ''">#{creditCode},</if>
            <if test="commitmentType != null and commitmentType != ''">#{commitmentType},</if>
            <if test="commitmentCause != null">#{commitmentCause},</if>
            <if test="content != null">#{content},</if>
            <if test="documentNum != null and documentNum != ''">#{documentNum},</if>
            <if test="pubType != null and pubType != ''">#{pubType},</if>
            <if test="duty != null">#{duty},</if>
            <if test="startTime != null">#{startTime},</if>
            <if test="endTime != null">#{endTime},</if>
            <if test="execStatus != null and execStatus != ''">#{execStatus},</if>
            <if test="violateLevel != null">#{violateLevel},</if>
            <if test="violateContent != null">#{violateContent},</if>
            <if test="violateTraceContent != null">#{violateTraceContent},</if>
            <if test="decisionTime != null">#{decisionTime},</if>
            <if test="decisionOrg != null">#{decisionOrg},</if>
            <if test="decisionOrgCode != null">#{decisionOrgCode},</if>
            <if test="execOrg != null">#{execOrg},</if>
            <if test="execOrgCode != null">#{execOrgCode},</if>
            <if test="remark != null">#{remark},</if>
            <if test="fileKey != null">#{fileKey},</if>
            <if test="createTime != null">#{createTime},</if>
            <if test="updateTime != null">#{updateTime},</if>
            <if test="createBy != null">#{createBy},</if>
            <if test="updateBy != null">#{updateBy},</if>
            <if test="reportDept != null">#{reportDept},</if>
            <if test="reportDate != null">#{reportDate},</if>
            <if test="itemId !=null ">#{itemId},</if>
            <if test="commitmentEntity !=null and commitmentEntity != '' ">#{commitmentEntity},</if>
        </trim>
    </insert>

    <insert id="batchSave" parameterType="java.util.List" useGeneratedKeys="true" keyProperty="id">
        insert into credit_commitment_info
        <foreach collection="list" item="item" separator=",">
        <trim prefix="(" suffix=")" suffixOverrides=",">
            <if test="counterpartName != null and counterpartName != ''">counterpart_name,</if>
            <if test="counterpartType != null and counterpartType != ''">counterpart_type,</if>
            <if test="creditCode != null and creditCode != ''">credit_code,</if>
            <if test="commitmentType != null and commitmentType != ''">commitment_type,</if>
            <if test="commitmentCause != null">commitment_cause,</if>
            <if test="content != null">content,</if>
            <if test="documentNum != null and documentNum != ''">document_num,</if>
            <if test="pubType != null and pubType != ''">pub_type,</if>
            <if test="duty != null">duty,</if>
            <if test="startTime != null">start_time,</if>
            <if test="endTime != null">end_time,</if>
            <if test="execStatus != null and execStatus != ''">exec_status,</if>
            <if test="violateLevel != null">violate_level,</if>
            <if test="violateContent != null">violate_content,</if>
            <if test="violateTraceContent != null">violate_trace_content,</if>
            <if test="decisionTime != null">decision_time,</if>
            <if test="decisionOrg != null">decision_org,</if>
            <if test="decisionOrgCode != null">decision_org_code,</if>
            <if test="execOrg != null">exec_org,</if>
            <if test="execOrgCode != null">exec_org_code,</if>
            <if test="remark != null">remark,</if>
            <if test="fileKey != null">file_key,</if>
            <if test="createTime != null">create_time,</if>
            <if test="updateTime != null">update_time,</if>
            <if test="createBy != null">create_by,</if>
            <if test="updateBy != null">update_by,</if>
            <if test="reportDept !=null ">report_dept,</if>
            <if test="reportDate !=null  ">report_date,</if>
            <if test="itemId !=null ">item_id,</if>
            <if test="commitmentEntity !=null and commitmentEntity != '' ">commitment_entity,</if>
        </trim>
        <trim prefix="values (" suffix=")" suffixOverrides=",">
            <if test="counterpartName != null and counterpartName != ''">#{counterpartName},</if>
            <if test="counterpartType != null and counterpartType != ''">#{counterpartType},</if>
            <if test="creditCode != null and creditCode != ''">#{creditCode},</if>
            <if test="commitmentType != null and commitmentType != ''">#{commitmentType},</if>
            <if test="commitmentCause != null">#{commitmentCause},</if>
            <if test="content != null">#{content},</if>
            <if test="documentNum != null and documentNum != ''">#{documentNum},</if>
            <if test="pubType != null and pubType != ''">#{pubType},</if>
            <if test="duty != null">#{duty},</if>
            <if test="startTime != null">#{startTime},</if>
            <if test="endTime != null">#{endTime},</if>
            <if test="execStatus != null and execStatus != ''">#{execStatus},</if>
            <if test="violateLevel != null">#{violateLevel},</if>
            <if test="violateContent != null">#{violateContent},</if>
            <if test="violateTraceContent != null">#{violateTraceContent},</if>
            <if test="decisionTime != null">#{decisionTime},</if>
            <if test="decisionOrg != null">#{decisionOrg},</if>
            <if test="decisionOrgCode != null">#{decisionOrgCode},</if>
            <if test="execOrg != null">#{execOrg},</if>
            <if test="execOrgCode != null">#{execOrgCode},</if>
            <if test="remark != null">#{remark},</if>
            <if test="fileKey != null">#{fileKey},</if>
            <if test="createTime != null">#{createTime},</if>
            <if test="updateTime != null">#{updateTime},</if>
            <if test="createBy != null">#{createBy},</if>
            <if test="updateBy != null">#{updateBy},</if>
            <if test="reportDept != null">#{reportDept},</if>
            <if test="reportDate != null">#{reportDate},</if>
            <if test="itemId !=null ">#{itemId},</if>
            <if test="commitmentEntity !=null and commitmentEntity != '' ">#{commitmentEntity},</if>
        </trim>
        </foreach>
    </insert>

    <update id="updateCommitmentInfo" parameterType="com.credit.cy.business.domain.CreditCommitmentInfo">
        update credit_commitment_info
        <trim prefix="SET" suffixOverrides=",">
            <if test="counterpartName != null and counterpartName != ''">counterpart_name = #{counterpartName},</if>
            <if test="counterpartType != null and counterpartType != ''">counterpart_type = #{counterpartType},</if>
            <if test="creditCode != null and creditCode != ''">credit_code = #{creditCode},</if>
            <if test="commitmentType != null and commitmentType != ''">commitment_type = #{commitmentType},</if>
            <if test="commitmentCause != null">commitment_cause = #{commitmentCause},</if>
            <if test="content != null">content = #{content},</if>
            <if test="documentNum != null and documentNum != ''">document_num = #{documentNum},</if>
            <if test="pubType != null and pubType != ''">pub_type = #{pubType},</if>
            <if test="duty != null and duty != ''">duty = #{duty},</if>
            <if test="startTime != null">start_time = #{startTime},</if>
            <if test="endTime != null">end_time = #{endTime},</if>
            <if test="execStatus != null and execStatus != ''">exec_status = #{execStatus},</if>
            <if test="violateLevel != null">violate_level = #{violateLevel},</if>
            <if test="violateContent != null">violate_content = #{violateContent},</if>
            <if test="violateTraceContent != null">violate_trace_content = #{violateTraceContent},</if>
            <if test="decisionTime != null">decision_time = #{decisionTime},</if>
            <if test="decisionOrg != null">decision_org = #{decisionOrg},</if>
            <if test="decisionOrgCode != null">decision_org_code = #{decisionOrgCode},</if>
            <if test="execOrg != null">exec_org = #{execOrg},</if>
            <if test="execOrgCode != null">exec_org_code = #{execOrgCode},</if>
            <if test="remark != null">remark = #{remark},</if>
            <if test="fileKey != null">file_key = #{fileKey},</if>
            <if test="createTime != null">create_time = #{createTime},</if>
            <if test="updateTime != null">update_time = #{updateTime},</if>
            <if test="createBy != null">create_by = #{createBy},</if>
            <if test="updateBy != null">update_by = #{updateBy},</if>
            <if test="reportDept != null">report_dept=#{reportDept},</if>
            <if test="reportDate != null">report_date=#{reportDate},</if>
            <if test="commitmentEntity !=null and commitmentEntity != '' ">#{commitmentEntity},</if>
            <if test="fulfillDate != null">fulfill_date=#{fulfillDate},</if>
        </trim>
        where id = #{id}
    </update>

    <delete id="deleteCommitmentInfoById" parameterType="Long">
        delete from credit_commitment_info where id = #{id}
    </delete>

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

    <select id="selectCount" parameterType="com.credit.cy.business.model.query.WorkCountQuery" resultType="java.lang.Long">
        select count(1) from credit_commitment_info
        <where>
            <if test="reportDept != null  and reportDept != ''"> and report_dept = #{reportDept}</if>
            <if test="null!=reportStartDate"> and report_date >= #{reportStartDate}</if>
            <if test="null!=reportEndDate"> AND report_date <![CDATA[<=]]> #{reportEndDate}</if>
        </where>
    </select>

    <select id="selectDeptCount" parameterType="com.credit.cy.business.model.query.WorkCountQuery" resultType="java.lang.Long">
        select count(distinct report_dept) from credit_commitment_info
        <where>
            <if test="reportDept != null  and reportDept != ''"> and report_dept = #{reportDept}</if>
            <if test="null!=reportStartDate"> and report_date >= #{reportStartDate}</if>
            <if test="null!=reportEndDate"> AND report_date <![CDATA[<=]]> #{reportEndDate}</if>
        </where>
    </select>

    <select id="selectGroupCount" parameterType="com.credit.cy.business.model.query.WorkCountQuery" resultType="com.credit.cy.business.model.GroupNumResult">
        select report_dept as dept,count(1) as total from credit_commitment_info
        <where>
            <if test="reportDept != null  and reportDept != ''"> and report_dept = #{reportDept}</if>
            <if test="null!=reportStartDate"> and report_date >= #{reportStartDate}</if>
            <if test="null!=reportEndDate"> AND report_date <![CDATA[<=]]> #{reportEndDate}</if>
        </where>
        group by report_dept
    </select>
</mapper>