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

    <resultMap type="CompanyTcmReport" id="CompanyTcmReportResult">
        <result property="id"    column="id"    />
        <result property="scheduleId"    column="schedule_id"    />
        <result property="companyUserId"    column="company_user_id"    />
        <result property="companyId"    column="company_id"    />
        <result property="totalNum"    column="total_num"    />
        <result property="registerNum"    column="register_num"    />
        <result property="onlineNum"    column="online_num"    />
        <result property="finishNum"    column="finish_num"    />
        <result property="registerRate"    column="register_rate"    />
        <result property="onlineRate"    column="online_rate"    />
        <result property="finishRate"    column="finish_rate"    />
        <result property="totalMoney"    column="total_money"    />
        <result property="totalOrder"    column="total_order"    />
        <result property="targetMoney"    column="target_money"    />
        <result property="targetRate"    column="target_rate"    />
        <result property="round1Money"    column="round1_money"    />
        <result property="round1Order"    column="round1_order"    />
        <result property="round1Rate"    column="round1_rate"    />
        <result property="round1Unit"    column="round1_unit"    />
        <result property="round2Money"    column="round2_money"    />
        <result property="round2Order"    column="round2_order"    />
        <result property="round2Rate"    column="round2_rate"    />
        <result property="round2Unit"    column="round2_unit"    />
        <result property="round3Money"    column="round3_money"    />
        <result property="round3Order"    column="round3_order"    />
        <result property="round3Rate"    column="round3_rate"    />
        <result property="round3Unit"    column="round3_unit"    />
        <result property="round4Money"    column="round4_money"    />
        <result property="round4Order"    column="round4_order"    />
        <result property="round4Rate"    column="round4_rate"    />
        <result property="round4Unit"    column="round4_unit"    />
        <result property="round5Money"    column="round5_money"    />
        <result property="round5Order"    column="round5_order"    />
        <result property="round5Rate"    column="round5_rate"    />
        <result property="round5Unit"    column="round5_unit"    />
        <result property="round6Money"    column="round6_money"    />
        <result property="round6Order"    column="round6_order"    />
        <result property="round6Rate"    column="round6_rate"    />
        <result property="round6Unit"    column="round6_unit"    />
        <result property="round7Money"    column="round7_money"    />
        <result property="round7Order"    column="round7_order"    />
        <result property="round7Rate"    column="round7_rate"    />
        <result property="round7Unit"    column="round7_unit"    />
        <result property="round8Money"    column="round8_money"    />
        <result property="round8Order"    column="round8_order"    />
        <result property="round8Rate"    column="round8_rate"    />
        <result property="round8Unit"    column="round8_unit"    />
        <result property="round9Money"    column="round9_money"    />
        <result property="round9Order"    column="round9_order"    />
        <result property="round9Rate"    column="round9_rate"    />
        <result property="round9Unit"    column="round9_unit"    />

        <result property="createTime"    column="create_time"    />
        <result property="createUserId"    column="create_user_id"    />
        <result property="updateTime"    column="update_time"    />
        <result property="updateUserId"    column="update_user_id"    />
    </resultMap>

    <sql id="selectCompanyTcmReportVo">
        select id, schedule_id, company_user_id, company_id, total_num, register_num, online_num, finish_num, register_rate, online_rate, finish_rate, total_money, total_order, target_money, target_rate, round1_money, round1_order, round1_rate, round1_unit, round2_money, round2_order, round2_rate, round2_unit, round3_money, round3_order, round3_rate, round3_unit, round4_money, round4_order, round4_rate, round4_unit, round5_money, round5_order, round5_rate, round5_unit, round6_money, round6_order, round6_rate, round6_unit, round7_money, round7_order, round7_rate, round7_unit, round8_money, round8_order, round8_rate, round8_unit, round9_money, round9_order, round9_rate, round9_unit,create_time,create_user_id,update_time,update_user_id from company_tcm_report
    </sql>

    <select id="selectCompanyTcmReportList" parameterType="CompanyTcmReport" resultMap="CompanyTcmReportResult">
        <include refid="selectCompanyTcmReportVo"/>
        <where>
            <if test="scheduleId != null "> and schedule_id = #{scheduleId}</if>
            <if test="companyUserId != null "> and company_user_id = #{companyUserId}</if>
            <if test="companyId != null "> and company_id = #{companyId}</if>
            <if test="totalNum != null "> and total_num = #{totalNum}</if>
            <if test="registerNum != null "> and register_num = #{registerNum}</if>
            <if test="onlineNum != null "> and online_num = #{onlineNum}</if>
            <if test="finishNum != null "> and finish_num = #{finishNum}</if>
            <if test="registerRate != null "> and register_rate = #{registerRate}</if>
            <if test="onlineRate != null "> and online_rate = #{onlineRate}</if>
            <if test="finishRate != null "> and finish_rate = #{finishRate}</if>
            <if test="totalMoney != null "> and total_money = #{totalMoney}</if>
            <if test="totalOrder != null "> and total_order = #{totalOrder}</if>
            <if test="targetMoney != null "> and target_money = #{targetMoney}</if>
            <if test="targetRate != null "> and target_rate = #{targetRate}</if>
            <if test="round1Money != null "> and round1_money = #{round1Money}</if>
            <if test="round1Order != null "> and round1_order = #{round1Order}</if>
            <if test="round1Rate != null "> and round1_rate = #{round1Rate}</if>
            <if test="round1Unit != null "> and round1_unit = #{round1Unit}</if>
            <if test="round2Money != null "> and round2_money = #{round2Money}</if>
            <if test="round2Order != null "> and round2_order = #{round2Order}</if>
            <if test="round2Rate != null "> and round2_rate = #{round2Rate}</if>
            <if test="round2Unit != null "> and round2_unit = #{round2Unit}</if>
            <if test="round3Money != null "> and round3_money = #{round3Money}</if>
            <if test="round3Order != null "> and round3_order = #{round3Order}</if>
            <if test="round3Rate != null "> and round3_rate = #{round3Rate}</if>
            <if test="round3Unit != null "> and round3_unit = #{round3Unit}</if>
            <if test="round4Money != null "> and round4_money = #{round4Money}</if>
            <if test="round4Order != null "> and round4_order = #{round4Order}</if>
            <if test="round4Rate != null "> and round4_rate = #{round4Rate}</if>
            <if test="round4Unit != null "> and round4_unit = #{round4Unit}</if>
            <if test="round5Money != null "> and round5_money = #{round5Money}</if>
            <if test="round5Order != null "> and round5_order = #{round5Order}</if>
            <if test="round5Rate != null "> and round5_rate = #{round5Rate}</if>
            <if test="round5Unit != null "> and round5_unit = #{round5Unit}</if>
            <if test="round6Money != null "> and round6_money = #{round6Money}</if>
            <if test="round6Order != null "> and round6_order = #{round6Order}</if>
            <if test="round6Rate != null "> and round6_rate = #{round6Rate}</if>
            <if test="round6Unit != null "> and round6_unit = #{round6Unit}</if>
            <if test="round7Money != null "> and round7_money = #{round7Money}</if>
            <if test="round7Order != null "> and round7_order = #{round7Order}</if>
            <if test="round7Rate != null "> and round7_rate = #{round7Rate}</if>
            <if test="round7Unit != null "> and round7_unit = #{round7Unit}</if>
            <if test="round8Money != null "> and round8_money = #{round8Money}</if>
            <if test="round8Order != null "> and round8_order = #{round8Order}</if>
            <if test="round8Rate != null "> and round8_rate = #{round8Rate}</if>
            <if test="round8Unit != null "> and round8_unit = #{round8Unit}</if>
            <if test="round9Money != null "> and round9_money = #{round9Money}</if>
            <if test="round9Order != null "> and round9_order = #{round9Order}</if>
            <if test="round9Rate != null "> and round9_rate = #{round9Rate}</if>
            <if test="round9Unit != null "> and round9_unit = #{round9Unit}</if>
            <if test="createTime != null "> and create_time = #{createTime}</if>
            <if test="createUserId != null "> and create_user_id = #{createUserId}</if>
            <if test="updateTime != null "> and update_time = #{updateTime}</if>
            <if test="updateUserId != null "> and update_user_id = #{updateUserId}</if>
        </where>
    </select>

    <select id="selectCompanyTcmReportById" parameterType="Long" resultMap="CompanyTcmReportResult">
        <include refid="selectCompanyTcmReportVo"/>
        where id = #{id}
    </select>

    <insert id="insertCompanyTcmReport" parameterType="CompanyTcmReport" useGeneratedKeys="true" keyProperty="id">
        insert into company_tcm_report
        <trim prefix="(" suffix=")" suffixOverrides=",">
            <if test="scheduleId != null">schedule_id,</if>
            <if test="companyUserId != null">company_user_id,</if>
            <if test="companyId != null">company_id,</if>
            <if test="totalNum != null">total_num,</if>
            <if test="registerNum != null">register_num,</if>
            <if test="onlineNum != null">online_num,</if>
            <if test="finishNum != null">finish_num,</if>
            <if test="registerRate != null">register_rate,</if>
            <if test="onlineRate != null">online_rate,</if>
            <if test="finishRate != null">finish_rate,</if>
            <if test="totalMoney != null">total_money,</if>
            <if test="totalOrder != null">total_order,</if>
            <if test="targetMoney != null">target_money,</if>
            <if test="targetRate != null">target_rate,</if>
            <if test="round1Money != null">round1_money,</if>
            <if test="round1Order != null">round1_order,</if>
            <if test="round1Rate != null">round1_rate,</if>
            <if test="round1Unit != null">round1_unit,</if>
            <if test="round2Money != null">round2_money,</if>
            <if test="round2Order != null">round2_order,</if>
            <if test="round2Rate != null">round2_rate,</if>
            <if test="round2Unit != null">round2_unit,</if>
            <if test="round3Money != null">round3_money,</if>
            <if test="round3Order != null">round3_order,</if>
            <if test="round3Rate != null">round3_rate,</if>
            <if test="round3Unit != null">round3_unit,</if>
            <if test="round4Money != null">round4_money,</if>
            <if test="round4Order != null">round4_order,</if>
            <if test="round4Rate != null">round4_rate,</if>
            <if test="round4Unit != null">round4_unit,</if>
            <if test="round5Money != null">round5_money,</if>
            <if test="round5Order != null">round5_order,</if>
            <if test="round5Rate != null">round5_rate,</if>
            <if test="round5Unit != null">round5_unit,</if>
            <if test="round6Money != null">round6_money,</if>
            <if test="round6Order != null">round6_order,</if>
            <if test="round6Rate != null">round6_rate,</if>
            <if test="round6Unit != null">round6_unit,</if>
            <if test="round7Money != null">round7_money,</if>
            <if test="round7Order != null">round7_order,</if>
            <if test="round7Rate != null">round7_rate,</if>
            <if test="round7Unit != null">round7_unit,</if>
            <if test="round8Money != null">round8_money,</if>
            <if test="round8Order != null">round8_order,</if>
            <if test="round8Rate != null">round8_rate,</if>
            <if test="round8Unit != null">round8_unit,</if>
            <if test="round9Money != null">round9_money,</if>
            <if test="round9Order != null">round9_order,</if>
            <if test="round9Rate != null">round9_rate,</if>
            <if test="round9Unit != null">round9_unit,</if>
            <if test="createTime != null">create_time,</if>
            <if test="createUserId != null">create_user_id,</if>
            <if test="updateTime != null">update_time,</if>
            <if test="updateUserId != null">update_user_id,</if>
         </trim>
        <trim prefix="values (" suffix=")" suffixOverrides=",">
            <if test="scheduleId != null">#{scheduleId},</if>
            <if test="companyUserId != null">#{companyUserId},</if>
            <if test="companyId != null">#{companyId},</if>
            <if test="totalNum != null">#{totalNum},</if>
            <if test="registerNum != null">#{registerNum},</if>
            <if test="onlineNum != null">#{onlineNum},</if>
            <if test="finishNum != null">#{finishNum},</if>
            <if test="registerRate != null">#{registerRate},</if>
            <if test="onlineRate != null">#{onlineRate},</if>
            <if test="finishRate != null">#{finishRate},</if>
            <if test="totalMoney != null">#{totalMoney},</if>
            <if test="totalOrder != null">#{totalOrder},</if>
            <if test="targetMoney != null">#{targetMoney},</if>
            <if test="targetRate != null">#{targetRate},</if>
            <if test="round1Money != null">#{round1Money},</if>
            <if test="round1Order != null">#{round1Order},</if>
            <if test="round1Rate != null">#{round1Rate},</if>
            <if test="round1Unit != null">#{round1Unit},</if>
            <if test="round2Money != null">#{round2Money},</if>
            <if test="round2Order != null">#{round2Order},</if>
            <if test="round2Rate != null">#{round2Rate},</if>
            <if test="round2Unit != null">#{round2Unit},</if>
            <if test="round3Money != null">#{round3Money},</if>
            <if test="round3Order != null">#{round3Order},</if>
            <if test="round3Rate != null">#{round3Rate},</if>
            <if test="round3Unit != null">#{round3Unit},</if>
            <if test="round4Money != null">#{round4Money},</if>
            <if test="round4Order != null">#{round4Order},</if>
            <if test="round4Rate != null">#{round4Rate},</if>
            <if test="round4Unit != null">#{round4Unit},</if>
            <if test="round5Money != null">#{round5Money},</if>
            <if test="round5Order != null">#{round5Order},</if>
            <if test="round5Rate != null">#{round5Rate},</if>
            <if test="round5Unit != null">#{round5Unit},</if>
            <if test="round6Money != null">#{round6Money},</if>
            <if test="round6Order != null">#{round6Order},</if>
            <if test="round6Rate != null">#{round6Rate},</if>
            <if test="round6Unit != null">#{round6Unit},</if>
            <if test="round7Money != null">#{round7Money},</if>
            <if test="round7Order != null">#{round7Order},</if>
            <if test="round7Rate != null">#{round7Rate},</if>
            <if test="round7Unit != null">#{round7Unit},</if>
            <if test="round8Money != null">#{round8Money},</if>
            <if test="round8Order != null">#{round8Order},</if>
            <if test="round8Rate != null">#{round8Rate},</if>
            <if test="round8Unit != null">#{round8Unit},</if>
            <if test="round9Money != null">#{round9Money},</if>
            <if test="round9Order != null">#{round9Order},</if>
            <if test="round9Rate != null">#{round9Rate},</if>
            <if test="round9Unit != null">#{round9Unit},</if>
            <if test="createTime != null">#{createTime},</if>
            <if test="createUserId != null">#{createUserId},</if>
            <if test="updateTime != null">#{updateTime},</if>
            <if test="updateUserId != null">#{updateUserId},</if>
         </trim>
    </insert>

    <update id="updateCompanyTcmReport" parameterType="CompanyTcmReport">
        update company_tcm_report
        <trim prefix="SET" suffixOverrides=",">
            <if test="scheduleId != null">schedule_id = #{scheduleId},</if>
            <if test="companyUserId != null">company_user_id = #{companyUserId},</if>
            <if test="companyId != null">company_id = #{companyId},</if>
            <if test="totalNum != null">total_num = #{totalNum},</if>
            <if test="registerNum != null">register_num = #{registerNum},</if>
            <if test="onlineNum != null">online_num = #{onlineNum},</if>
            <if test="finishNum != null">finish_num = #{finishNum},</if>
            <if test="registerRate != null">register_rate = #{registerRate},</if>
            <if test="onlineRate != null">online_rate = #{onlineRate},</if>
            <if test="finishRate != null">finish_rate = #{finishRate},</if>
            <if test="totalMoney != null">total_money = #{totalMoney},</if>
            <if test="totalOrder != null">total_order = #{totalOrder},</if>
            <if test="targetMoney != null">target_money = #{targetMoney},</if>
            <if test="targetRate != null">target_rate = #{targetRate},</if>
            <if test="round1Money != null">round1_money = #{round1Money},</if>
            <if test="round1Order != null">round1_order = #{round1Order},</if>
            <if test="round1Rate != null">round1_rate = #{round1Rate},</if>
            <if test="round1Unit != null">round1_unit = #{round1Unit},</if>
            <if test="round2Money != null">round2_money = #{round2Money},</if>
            <if test="round2Order != null">round2_order = #{round2Order},</if>
            <if test="round2Rate != null">round2_rate = #{round2Rate},</if>
            <if test="round2Unit != null">round2_unit = #{round2Unit},</if>
            <if test="round3Money != null">round3_money = #{round3Money},</if>
            <if test="round3Order != null">round3_order = #{round3Order},</if>
            <if test="round3Rate != null">round3_rate = #{round3Rate},</if>
            <if test="round3Unit != null">round3_unit = #{round3Unit},</if>
            <if test="round4Money != null">round4_money = #{round4Money},</if>
            <if test="round4Order != null">round4_order = #{round4Order},</if>
            <if test="round4Rate != null">round4_rate = #{round4Rate},</if>
            <if test="round4Unit != null">round4_unit = #{round4Unit},</if>
            <if test="round5Money != null">round5_money = #{round5Money},</if>
            <if test="round5Order != null">round5_order = #{round5Order},</if>
            <if test="round5Rate != null">round5_rate = #{round5Rate},</if>
            <if test="round5Unit != null">round5_unit = #{round5Unit},</if>
            <if test="round6Money != null">round6_money = #{round6Money},</if>
            <if test="round6Order != null">round6_order = #{round6Order},</if>
            <if test="round6Rate != null">round6_rate = #{round6Rate},</if>
            <if test="round6Unit != null">round6_unit = #{round6Unit},</if>
            <if test="round7Money != null">round7_money = #{round7Money},</if>
            <if test="round7Order != null">round7_order = #{round7Order},</if>
            <if test="round7Rate != null">round7_rate = #{round7Rate},</if>
            <if test="round7Unit != null">round7_unit = #{round7Unit},</if>
            <if test="round8Money != null">round8_money = #{round8Money},</if>
            <if test="round8Order != null">round8_order = #{round8Order},</if>
            <if test="round8Rate != null">round8_rate = #{round8Rate},</if>
            <if test="round8Unit != null">round8_unit = #{round8Unit},</if>
            <if test="round9Money != null">round9_money = #{round9Money},</if>
            <if test="round9Order != null">round9_order = #{round9Order},</if>
            <if test="round9Rate != null">round9_rate = #{round9Rate},</if>
            <if test="round9Unit != null">round9_unit = #{round9Unit},</if>
            <if test="createTime != null">create_time = #{createTime},</if>
            <if test="createUserId != null">create_user_id = #{createUserId},</if>
            <if test="updateTime != null">update_time = #{updateTime},</if>
            <if test="updateUserId != null">update_user_id = #{updateUserId},</if>
        </trim>
        where id = #{id}
    </update>

    <delete id="deleteCompanyTcmReportById" parameterType="Long">
        delete from company_tcm_report where id = #{id}
    </delete>

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

</mapper>
