<?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.ElccouMapper">

    <resultMap id="BaseResultMap" type="com.brilliance.isc.bo.Elccou">
        <result property="id" column="id" jdbcType="BIGINT"/>
        <result property="coudat" column="coudat" jdbcType="DATE"/>
        <result property="counam" column="counam" jdbcType="VARCHAR"/>
        <result property="coustp" column="coustp" jdbcType="INTEGER"/>
        <result property="couval" column="couval" jdbcType="BIGINT"/>
    </resultMap>

    <sql id="Base_Column_List">
        id,coudat,counam,coustp,couval
    </sql>

    <select id="selectByPrimaryKey" resultMap="BaseResultMap">
        select
            <include refid="Base_Column_List" />
        from elccou
        where id = #{id,jdbcType=BIGINT}
    </select>

    <select id="selectForUpdate" resultMap="BaseResultMap">
        select id,coustp,couval
        from elccou
        where coudat = #{coudat,jdbcType=DATE}
        and counam = #{counam,jdbcType=VARCHAR}
        limit 1 for update
    </select>

    <select id="selectByCoudatAndCounam" resultMap="BaseResultMap">
        select id,coustp
        from elccou
        where coudat = #{coudat,jdbcType=DATE}
        and counam = #{counam,jdbcType=VARCHAR}
        limit 1
    </select>


    <insert id="insert">
        insert into elccou (coudat,counam,coustp,couval)
        <trim prefix="values (" suffix=")" suffixOverrides=",">
            #{coudat,jdbcType=DATE},
            #{counam,jdbcType=VARCHAR},
            #{coustp,jdbcType=INTEGER},
            #{couval,jdbcType=BIGINT},
        </trim>
    </insert>

    <update id="update">
        update elccou
        set couval = #{couval}
        where id = #{id,jdbcType=BIGINT}
    </update>

</mapper>