<?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.hzya.frame.seeyon.cbs8.dao.impl.AgentPaymentDetailDaoImpl">
    <resultMap id="get-AgentPaymentDetailEntity-result" type="com.hzya.frame.seeyon.cbs8.entity.AgentPaymentDetailEntity">
        <result property="id" column="id" />
        <result property="formmainId" column="formmainId" />
        <result property="tabName" column="tabName" />
        <result property="dtlSeqNum" column="dtlSeqNum" />
        <result property="dtlAmount" column="dtlAmount" />
        <result property="dtlRevAccount" column="dtlRevAccount" />
        <result property="dtlCnapsCode" column="dtlCnapsCode" />
        <result property="dtlRevName" column="dtlRevName" />
        <result property="dtlRevBankName" column="dtlRevBankName" />
        <result property="payResult" column="payResult" />
        <result property="payDate" column="payDate" />
    </resultMap>

    <sql id="AgentPaymentDetailEntity_Base_Column_List">
        id,
        formmainId,
        tabName,
        dtlSeqNum,
        dtlAmount,
        dtlRevAccount,
        dtlCnapsCode,
        dtlRevName,
        dtlRevBankName,
        payResult,
        payDate
    </sql>


    <!-- 采用==查询 -->
    <select id="entity_list_base" resultMap="get-AgentPaymentDetailEntity-result" parameterType="com.hzya.frame.seeyon.cbs8.entity.AgentPaymentDetailEntity">
        select
        <include refid="AgentPaymentDetailEntity_Base_Column_List"/>
        from (
        SELECT
        formson_0225.id,
        formson_0225.formmain_id AS formmainId,
        'formson_0225' AS tabName,
        formson_0225.field0001 AS dtlSeqNum,
        formson_0225.field0019 AS dtlAmount,
        formson_0225.field0036 AS dtlRevAccount,
        formson_0225.field0035 AS dtlCnapsCode,
        formson_0225.field0037 AS dtlRevName,
        formson_0225.field0034 AS dtlRevBankName,
        formson_0225.field0044 AS payResult,
        formson_0225.field0045 AS payDate
        FROM
        formson_0225
        )formson_0225
        <trim prefix="where" prefixOverrides="and">
            <if test="id != null and id !='' "> formson_0225.id = #{id} </if>
            <if test="formmainId != null and formmainId !='' "> and formson_0225.formmainId = #{formmainId} </if>
            <if test="tabName != null and tabName !='' "> and formson_0225.tabName = #{tabName} </if>
            <if test="dtlSeqNum != null and dtlSeqNum !='' "> and formson_0225.dtlSeqNum = #{dtlSeqNum} </if>
            <if test="dtlAmount != null and dtlAmount !='' "> and formson_0225.dtlAmount = #{dtlAmount} </if>
            <if test="dtlRevAccount != null and dtlRevAccount !='' "> and formson_0225.dtlRevAccount = #{dtlRevAccount} </if>
            <if test="dtlCnapsCode != null and dtlCnapsCode !='' "> and formson_0225.dtlCnapsCode = #{dtlCnapsCode} </if>
            <if test="dtlRevName != null and dtlRevName !='' "> and formson_0225.dtlRevName = #{dtlRevName} </if>
            <if test="dtlRevBankName != null and dtlRevBankName !='' "> and formson_0225.dtlRevBankName = #{dtlRevBankName} </if>
        </trim>
    </select>

    <update id="entity_update" parameterType="com.hzya.frame.seeyon.cbs8.entity.AgentPaymentDetailEntity">
        update formson_0225 set
        <trim suffix="" suffixOverrides=",">
            <if test="payDate != null and payDate !='' ">field0045 =#{payDate},</if>
            <if test="payResult != null and payResult !='' ">field0044 =#{payResult}</if>
        </trim>
        where id = #{id}
    </update>

    <!-- 更新支付结果 -->
    <update id="entity_update_result" parameterType="com.hzya.frame.seeyon.cbs8.entity.AgentPaymentDetailEntity">
        update formson_0225 set
        <trim suffix="" suffixOverrides=",">
            <if test="payDate != null and payDate !='' ">field0045 =#{payDate},</if>
            <if test="payResult != null and payResult !='' ">field0044 =#{payResult}</if>
        </trim>
        where field0001=#{dtlSeqNum} and field0019=#{dtlAmount} and field0035=#{dtlCnapsCode} and field0037=#{dtlRevName}
    </update>
</mapper>
