<?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.ssm.manage.mapper.CardChangeInProjectMapper">
  <resultMap id="BaseResultMap" type="com.ssm.manage.entity.CardChangeInProject">
    <!--
      WARNING - @mbg.generated
    -->
    <id column="id" jdbcType="BIGINT" property="id" />
    <result column="doc_num" jdbcType="VARCHAR" property="docNum" />
    <result column="doc_date" jdbcType="TIMESTAMP" property="docDate" />
    <result column="member_id" jdbcType="BIGINT" property="memberId" />
    <result column="member_name" jdbcType="VARCHAR" property="memberName" />
    <result column="card" jdbcType="VARCHAR" property="card" />
    <result column="mobile_phone" jdbcType="VARCHAR" property="mobilePhone" />
    <result column="store_id" jdbcType="BIGINT" property="storeId" />
    <result column="store_name" jdbcType="VARCHAR" property="storeName" />
    <result column="project_id" jdbcType="BIGINT" property="projectId" />
    <result column="project_name" jdbcType="VARCHAR" property="projectName" />
    <result column="account_id" jdbcType="BIGINT" property="accountId" />
    <result column="course_rest_count" jdbcType="INTEGER" property="courseRestCount" />
    <result column="course_consume_count" jdbcType="INTEGER" property="courseConsumeCount" />
    <result column="minumum_times" jdbcType="INTEGER" property="minumumTimes" />
    <result column="price" jdbcType="DECIMAL" property="price" />
    <result column="minumum_price" jdbcType="DECIMAL" property="minumumPrice" />
    <result column="price_member" jdbcType="DECIMAL" property="priceMember" />
    <result column="minumum_price_member" jdbcType="DECIMAL" property="minumumPriceMember" />
    <result column="sales_achievement" jdbcType="DECIMAL" property="salesAchievement" />
    <result column="sales_commission" jdbcType="DECIMAL" property="salesCommission" />
    <result column="card_sales_achievement" jdbcType="DECIMAL" property="cardSalesAchievement" />
    <result column="card_sales_commission" jdbcType="DECIMAL" property="cardSalesCommission" />
    <result column="valid_time" jdbcType="INTEGER" property="validTime" />
    <result column="change_in_time" jdbcType="INTEGER" property="changeInTime" />
    <result column="change_in_money" jdbcType="DECIMAL" property="changeInMoney" />
    <result column="change_in_case_time" jdbcType="INTEGER" property="changeInCaseTime" />
    <result column="debt_money" jdbcType="DECIMAL" property="debtMoney" />
    <result column="refund_money" jdbcType="DECIMAL" property="refundMoney" />
    <result column="transaction_money" jdbcType="DECIMAL" property="transactionMoney" />
    <result column="achievement_amount" jdbcType="DECIMAL" property="achievementAmount" />
    <result column="commission_amount" jdbcType="DECIMAL" property="commissionAmount" />
    <result column="card_achievement_amount" jdbcType="DECIMAL" property="cardAchievementAmount" />
    <result column="card_commission_amount" jdbcType="DECIMAL" property="cardCommissionAmount" />
    <result column="sale_one_number" jdbcType="VARCHAR" property="saleOneNumber" />
    <result column="sale_two_number" jdbcType="VARCHAR" property="saleTwoNumber" />
    <result column="sale_three_number" jdbcType="VARCHAR" property="saleThreeNumber" />
    <result column="sale_four_number" jdbcType="VARCHAR" property="saleFourNumber" />
    <result column="sale_one_staff_id" jdbcType="BIGINT" property="saleOneStaffId" />
    <result column="sale_two_staff_id" jdbcType="BIGINT" property="saleTwoStaffId" />
    <result column="sale_three_staff_id" jdbcType="BIGINT" property="saleThreeStaffId" />
    <result column="sale_four_staff_id" jdbcType="BIGINT" property="saleFourStaffId" />
    <result column="sale_one_staff_name" jdbcType="VARCHAR" property="saleOneStaffName" />
    <result column="sale_two_staff_name" jdbcType="VARCHAR" property="saleTwoStaffName" />
    <result column="sale_three_staff_name" jdbcType="VARCHAR" property="saleThreeStaffName" />
    <result column="sale_four_staff_name" jdbcType="VARCHAR" property="saleFourStaffName" />
    <result column="sale_one_identity" jdbcType="VARCHAR" property="saleOneIdentity" />
    <result column="sale_two_identity" jdbcType="VARCHAR" property="saleTwoIdentity" />
    <result column="sale_three_identity" jdbcType="VARCHAR" property="saleThreeIdentity" />
    <result column="sale_four_identity" jdbcType="VARCHAR" property="saleFourIdentity" />
    <result column="sale_one_ratio" jdbcType="DECIMAL" property="saleOneRatio" />
    <result column="sale_two_ratio" jdbcType="DECIMAL" property="saleTwoRatio" />
    <result column="sale_three_ratio" jdbcType="DECIMAL" property="saleThreeRatio" />
    <result column="sale_four_ratio" jdbcType="DECIMAL" property="saleFourRatio" />
    <result column="manage_staff_id" jdbcType="BIGINT" property="manageStaffId" />
    <result column="manage_staff_name" jdbcType="VARCHAR" property="manageStaffName" />
    <result column="manage_identity" jdbcType="VARCHAR" property="manageIdentity" />
    <result column="manage_number" jdbcType="VARCHAR" property="manageNumber" />
    <result property="beforePrice" column="before_rice" jdbcType="NUMERIC"/>
    <result property="beforeRestMoney" column="before_rest_money" jdbcType="NUMERIC"/>
    <result property="beforeConsumeMoney" column="before_consume_money" jdbcType="NUMERIC"/>
    <result property="beforeGiftRestMoney" column="before_gift_rest_money" jdbcType="NUMERIC"/>
    <result property="beforeGiftConsumeMoney" column="before_gift_consume_money" jdbcType="NUMERIC"/>
    <result property="beforeRestCount" column="before_rest_count" jdbcType="INTEGER"/>
    <result property="beforeConsumeCount" column="before_consume_count" jdbcType="INTEGER"/>

    <result property="backPrice" column="back_rice" jdbcType="NUMERIC"/>
    <result property="backRestMoney" column="back_rest_money" jdbcType="NUMERIC"/>
    <result property="backConsumeMoney" column="back_consume_money" jdbcType="NUMERIC"/>
    <result property="backGiftRestMoney" column="back_gift_rest_money" jdbcType="NUMERIC"/>
    <result property="backGiftConsumeMoney" column="back_gift_consume_money" jdbcType="NUMERIC"/>
    <result property="backRestCount" column="back_rest_count" jdbcType="INTEGER"/>
    <result property="backConsumeCount" column="back_consume_count" jdbcType="INTEGER"/>
  </resultMap>


  <update id="updateStaff" parameterType="com.ssm.manage.entity.CardChangeInProject" >
    update card_change_in_project
    <set>
      <!--<if test="saleOneNumber != null">-->
      sale_one_number = #{saleOneNumber, jdbcType = VARCHAR},
      <!--</if>
      <if test="saleTwoNumber != null">-->
      sale_two_number = #{saleTwoNumber, jdbcType = VARCHAR},
      <!--</if>
      <if test="saleThreeNumber != null">-->
      sale_three_number = #{saleThreeNumber, jdbcType = VARCHAR},
      <!--</if>
      <if test="saleFourNumber != null">-->
      sale_four_number = #{saleFourNumber, jdbcType = VARCHAR},
      <!--</if>
      <if test="saleOneStaffId != null">-->
      sale_one_staff_id = #{saleOneStaffId, jdbcType = BIGINT},
      <!--</if>
      <if test="saleTwoStaffId != null">-->
      sale_two_staff_id = #{saleTwoStaffId, jdbcType = BIGINT},
      <!--</if>
      <if test="saleThreeStaffId != null">-->
      sale_three_staff_id = #{saleThreeStaffId, jdbcType = BIGINT},
      <!--</if>
      <if test="saleFourStaffId != null">-->
      sale_four_staff_id = #{saleFourStaffId, jdbcType = BIGINT},
      <!--</if>
      <if test="saleOneStaffName != null">-->
      sale_one_staff_name = #{saleOneStaffName, jdbcType = VARCHAR},
      <!--</if>
      <if test="saleTwoStaffName != null">-->
      sale_two_staff_name = #{saleTwoStaffName, jdbcType = VARCHAR},
      <!--</if>
      <if test="saleThreeStaffName != null">-->
      sale_three_staff_name = #{saleThreeStaffName, jdbcType = VARCHAR},
      <!--</if>
      <if test="saleFourStaffName != null">-->
      sale_four_staff_name = #{saleFourStaffName, jdbcType = VARCHAR},
      <!--</if>
      <if test="saleOneIdentity != null">-->
      sale_one_identity = #{saleOneIdentity, jdbcType = VARCHAR},
      <!--</if>
      <if test="saleTwoIdentity != null">-->
      sale_two_identity = #{saleTwoIdentity, jdbcType = VARCHAR},
      <!--</if>
      <if test="saleThreeIdentity != null">-->
      sale_three_identity = #{saleThreeIdentity, jdbcType = VARCHAR},
      <!--</if>
      <if test="saleFourIdentity != null">-->
      sale_four_identity = #{saleFourIdentity, jdbcType = VARCHAR},
      <!--</if>
      <if test="saleOneRatio != null">-->
      sale_one_ratio = #{saleOneRatio, jdbcType = DECIMAL},
      <!--</if>
      <if test="saleTwoRatio != null">-->
      sale_two_ratio = #{saleTwoRatio, jdbcType = DECIMAL},
      <!--</if>
      <if test="saleThreeRatio != null">-->
      sale_three_ratio = #{saleThreeRatio, jdbcType = DECIMAL},
      <!--</if>
      <if test="saleFourRatio != null"> </if>-->
      sale_four_ratio = #{saleFourRatio, jdbcType = DECIMAL},


      sale_five_number = #{saleFiveNumber, jdbcType = VARCHAR},
      <!--</if>
      <if test="saleTwoNumber != null">-->
      sale_six_number = #{saleSixNumber, jdbcType = VARCHAR},
      <!--</if>
      <if test="saleThreeNumber != null">-->
      sale_seven_number = #{saleSevenNumber, jdbcType = VARCHAR},
      <!--</if>
      <if test="saleFourNumber != null">-->
      sale_eight_number = #{saleEightNumber, jdbcType = VARCHAR},
      <!--</if>
      <if test="saleOneStaffId != null">-->
      sale_five_staff_id = #{saleFiveStaffId, jdbcType = BIGINT},
      <!--</if>
      <if test="saleTwoStaffId != null">-->
      sale_six_staff_id = #{saleSixStaffId, jdbcType = BIGINT},
      <!--</if>
      <if test="saleThreeStaffId != null">-->
      sale_seven_staff_id = #{saleSevenStaffId, jdbcType = BIGINT},
      <!--</if>
      <if test="saleFourStaffId != null">-->
      sale_eight_staff_id = #{saleEightStaffId, jdbcType = BIGINT},
      <!--</if>
      <if test="saleOneStaffName != null">-->
      sale_five_staff_name = #{saleFiveStaffName, jdbcType = VARCHAR},
      <!--</if>
      <if test="saleTwoStaffName != null">-->
      sale_six_staff_name = #{saleSixStaffName, jdbcType = VARCHAR},
      <!--</if>
      <if test="saleThreeStaffName != null">-->
      sale_seven_staff_name = #{saleSevenStaffName, jdbcType = VARCHAR},
      <!--</if>
      <if test="saleFourStaffName != null">-->
      sale_eight_staff_name = #{saleEightStaffName, jdbcType = VARCHAR},
      <!--</if>
      <if test="saleOneIdentity != null">-->
      sale_five_identity = #{saleFiveIdentity, jdbcType = VARCHAR},
      <!--</if>
      <if test="saleTwoIdentity != null">-->
      sale_six_identity = #{saleSixIdentity, jdbcType = VARCHAR},
      <!--</if>
      <if test="saleThreeIdentity != null">-->
      sale_seven_identity = #{saleSevenIdentity, jdbcType = VARCHAR},
      <!--</if>
      <if test="saleFourIdentity != null">-->
      sale_eight_identity = #{saleEightIdentity, jdbcType = VARCHAR},
      <!--</if>
      <if test="saleOneRatio != null">-->
      sale_five_ratio = #{saleFiveRatio, jdbcType = DECIMAL},
      <!--</if>
      <if test="saleTwoRatio != null">-->
      sale_six_ratio = #{saleSixRatio, jdbcType = DECIMAL},
      <!--</if>
      <if test="saleThreeRatio != null">-->
      sale_seven_ratio = #{saleSevenRatio, jdbcType = DECIMAL},
      <!--</if>
      <if test="saleFourRatio != null"> </if>-->
      sale_eight_ratio = #{saleEightRatio, jdbcType = DECIMAL}

    </set>
    <where>
      id = #{id, jdbcType = BIGINT}
    </where>
  </update>
    <select id="selectNew" resultMap="BaseResultMap" >
      select * from card_change_in_project where SUBSTR(doc_date,1,7) = #{strDate} and store_id in <foreach
            collection="storeIds" open="(" close=")" separator="," item="item">
      #{item}
    </foreach>
     </select>
</mapper>