<?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.MemberInitStaffMapper">
  <resultMap id="BaseResultMap" type="com.ssm.manage.entity.MemberInitStaff">
    <!--
      WARNING - @mbg.generated
    -->
    <id column="id" jdbcType="BIGINT" property="id" />
    <result column="doc_num" jdbcType="VARCHAR" property="docNum"/>
    <result column="brand_number" jdbcType="VARCHAR" property="brandNumber"/>
    <result column="staff_name" jdbcType="VARCHAR" property="staffName"/>
    <result column="ratio" jdbcType="DECIMAL" property="ratio"/>
    <result column="staff_id" jdbcType="BIGINT" property="staffId"/>
    <result column="project_id" jdbcType="BIGINT" property="projectId"/>
    <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="doc_date" jdbcType="TIMESTAMP" property="docDate"/>
    <result column="state" jdbcType="INTEGER" property="state"/>
    <result column="money" jdbcType="DECIMAL" property="money"/>
    <result column="store_id" jdbcType="BIGINT" property="storeId"/>
    <result column="is_cooperation" jdbcType="INTEGER" property="isCooperation"/>
    <result column="brokerage" jdbcType="DECIMAL" property="brokerage"/>
  </resultMap>
  <update id="updateByDocNum">
    update member_init_staff set state = 0,doc_date = now() where doc_num = #{docNum}
  </update>
  <select id="selectStaff" resultMap="BaseResultMap">
    select * from member_init_staff where store_id in (
    <foreach collection="storeIds" separator="," item="item">
      #{item}
    </foreach>
        )and state = 0 and doc_date between #{startTime} and
    #{endTime}
  </select>

</mapper>