<?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.brilliance.isc.mda.dao.PtycrmMapper">

    <resultMap id="BaseResultMap" type="com.brilliance.isc.bo.Ptycrm">
        <result property="ptyinr" column="ptyinr" jdbcType="VARCHAR"/>
        <result property="creditSort" column="creditSort" jdbcType="VARCHAR"/>
        <result property="crmSta" column="crmSta" jdbcType="VARCHAR"/>
        <result property="business" column="business" jdbcType="VARCHAR"/>
        <result property="refremitMaxBal" column="refremitMaxBal" jdbcType="DECIMAL"/>
        <result property="gootradeMaxBal" column="gootradeMaxBal" jdbcType="DECIMAL"/>
        <result property="sertradeMaxBal" column="sertradeMaxBal" jdbcType="DECIMAL"/>
    </resultMap>

    <sql id="Base_Column_List">
        ptyinr,creditSort,crmSta,business,refremitMaxBal,gootradeMaxBal,sertradeMaxBal
    </sql>

    <select id="selectByPtyinr" resultMap="BaseResultMap">
        select
        <include refid="Base_Column_List"/>
        from ptycrm
        where ptyinr = #{ptyinr,jdbcType=VARCHAR}
    </select>

    <delete id="deleteByPtyinr">
        delete from ptycrm where ptyinr = #{ptyinr,jdbcType=VARCHAR}
    </delete>

    <insert id="insert">
        insert into ptycrm (<include refid="Base_Column_List"/>)
        <trim prefix="values (" suffix=")" suffixOverrides=",">
            #{ptyinr,jdbcType=VARCHAR},
            #{creditSort,jdbcType=VARCHAR},
            #{crmSta,jdbcType=VARCHAR},
            #{business,jdbcType=VARCHAR},
            #{refremitMaxBal,jdbcType=DECIMAL},
            #{gootradeMaxBal,jdbcType=DECIMAL},
            #{sertradeMaxBal,jdbcType=DECIMAL},
        </trim>
    </insert>

    <update id="updateByPtyinr">
        update ptycrm
        <set>
            <if test="ptyinr != null">ptyinr = #{ptyinr,jdbcType=VARCHAR},</if>
            <if test="creditSort != null">creditSort = #{creditSort,jdbcType=VARCHAR},</if>
            <if test="crmSta != null">crmSta = #{crmSta,jdbcType=VARCHAR},</if>
            <if test="business != null">business = #{business,jdbcType=VARCHAR},</if>
            <if test="refremitMaxBal != null">refremitMaxBal = #{refremitMaxBal,jdbcType=DECIMAL},</if>
            <if test="gootradeMaxBal != null">gootradeMaxBal = #{gootradeMaxBal,jdbcType=DECIMAL},</if>
            <if test="sertradeMaxBal != null">sertradeMaxBal = #{sertradeMaxBal,jdbcType=DECIMAL},</if>
        </set>
        where ptyinr = #{ptyinr,jdbcType=VARCHAR}
    </update>

    <delete id="deleteByPtyinr">
        delete from pty where ptyinr = #{ptyinr,jdbcType=VARCHAR}
    </delete>

</mapper>