<?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.fs.company.mapper.CompanyTcmConsumeMapper">

    <resultMap type="CompanyTcmConsume" id="CompanyTcmConsumeResult">
        <result property="id"    column="id"    />
        <result property="scheduleId"    column="schedule_id"    />
        <result property="companyId"    column="company_id"    />
        <result property="money"    column="money"    />
        <result property="cuCount"    column="cu_count"    />
        <result property="createUserId"    column="create_user_id"    />
        <result property="updateUserId"    column="update_user_id"    />
        <result property="createTime"    column="create_time"    />
        <result property="updateTime"    column="update_time"    />
    </resultMap>

    <sql id="selectCompanyTcmConsumeVo">
        select id, schedule_id, company_id, money,cu_count, create_user_id, update_user_id, create_time, update_time from company_tcm_consume
    </sql>

    <select id="selectCompanyTcmConsumeList" parameterType="CompanyTcmConsume" resultMap="CompanyTcmConsumeResult">
        <include refid="selectCompanyTcmConsumeVo"/>
        <where>
        </where>
    </select>

    <select id="selectCompanyTcmConsumeById" parameterType="Long" resultMap="CompanyTcmConsumeResult">
        <include refid="selectCompanyTcmConsumeVo"/>
        where id = #{id}
    </select>

    <insert id="insertCompanyTcmConsume" parameterType="CompanyTcmConsume" useGeneratedKeys="true" keyProperty="id">
        insert into company_tcm_consume
        <trim prefix="(" suffix=")" suffixOverrides=",">
            <if test="scheduleId != null">schedule_id,</if>
            <if test="companyId != null">company_id,</if>
            <if test="money != null">money,</if>
            <if test="cuCount != null">cu_count,</if>
            <if test="createUserId != null">create_user_id,</if>
            <if test="updateUserId != null">update_user_id,</if>
            <if test="createTime != null">create_time,</if>
            <if test="updateTime != null">update_time,</if>
         </trim>
        <trim prefix="values (" suffix=")" suffixOverrides=",">
            <if test="scheduleId != null">#{scheduleId},</if>
            <if test="companyId != null">#{companyId},</if>
            <if test="money != null">#{money},</if>
            <if test="cuCount != null">#{cuCount},</if>
            <if test="createUserId != null">#{createUserId},</if>
            <if test="updateUserId != null">#{updateUserId},</if>
            <if test="createTime != null">#{createTime},</if>
            <if test="updateTime != null">#{updateTime},</if>
         </trim>
    </insert>

    <update id="updateCompanyTcmConsume" parameterType="CompanyTcmConsume">
        update company_tcm_consume
        <trim prefix="SET" suffixOverrides=",">
            <if test="scheduleId != null">schedule_id = #{scheduleId},</if>
            <if test="companyId != null">company_id = #{companyId},</if>
            <if test="money != null">money = #{money},</if>
            <if test="cuCount != null">cu_count = #{cuCount},</if>
            <if test="createUserId != null">create_user_id = #{createUserId},</if>
            <if test="updateUserId != null">update_user_id = #{updateUserId},</if>
            <if test="createTime != null">create_time = #{createTime},</if>
            <if test="updateTime != null">update_time = #{updateTime},</if>
        </trim>
        where id = #{id}
    </update>

    <delete id="deleteCompanyTcmConsumeById" parameterType="Long">
        delete from company_tcm_consume where id = #{id}
    </delete>

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

</mapper>
