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

    <resultMap type="com.ssm.manage.entity.RechargeTurnCourse" id="RechargeTurnCourseMap">
        <result property="id" column="id" jdbcType="BIGINT"/>
        <result property="docNum" column="doc_num" jdbcType="VARCHAR"/>
        <result property="docDate" column="doc_date" jdbcType="TIMESTAMP"/>
        <result property="storeId" column="store_id" jdbcType="BIGINT"/>
        <result property="storeName" column="store_name" jdbcType="VARCHAR"/>
        <result property="memberId" column="member_id" jdbcType="BIGINT"/>
        <result property="memberName" column="member_name" jdbcType="VARCHAR"/>
        <result property="memberIdentityCard" column="member_identity_card" jdbcType="VARCHAR"/>
        <result property="mobilePhone" column="mobile_phone" jdbcType="VARCHAR"/>
        <result property="rechargeInMoney" column="recharge_in_money" jdbcType="NUMERIC"/>
        <result property="courseOutMoney" column="course_out_money" jdbcType="NUMERIC"/>
        <result property="state" column="state" jdbcType="INTEGER"/>
        <result property="rechargeBeforeMoney" column="recharge_before_money" jdbcType="NUMERIC"/>
        <result property="rechargeAfterMoney" column="recharge_after_money" jdbcType="NUMERIC"/>
        <result property="inputId" column="input_id" jdbcType="BIGINT"/>
        <result property="inputBy" column="input_by" jdbcType="VARCHAR"/>
        <result property="rechargeAccountId" column="recharge_account_id" jdbcType="BIGINT"/>
        <result property="inputDate" column="input_date" jdbcType="TIMESTAMP"/>
        <result property="updateId" column="update_id" jdbcType="BIGINT"/>
        <result property="updateBy" column="update_by" jdbcType="VARCHAR"/>
        <result property="updateDate" column="update_date" jdbcType="TIMESTAMP"/>
        <result property="brandNumberOne" column="brand_number_one" jdbcType="VARCHAR"/>
        <result property="saleOneStaffId" column="sale_one_staff_id" jdbcType="BIGINT"/>
        <result property="saleOneStaffName" column="sale_one_staff_name" jdbcType="VARCHAR"/>
        <result property="saleOneRatio" column="sale_one_ratio" jdbcType="NUMERIC"/>
        <result property="saleOneAchievementAmount" column="sale_one_achievement_amount" jdbcType="NUMERIC"/>
        <result property="saleOneCommissionAmount" column="sale_one_commission_amount" jdbcType="NUMERIC"/>
        <result property="saleOneIdentityCard" column="sale_one_identity_card" jdbcType="VARCHAR"/>
        <result property="saleTwoStaffId" column="sale_two_staff_id" jdbcType="BIGINT"/>
        <result property="saleTwoStaffName" column="sale_two_staff_name" jdbcType="VARCHAR"/>
        <result property="saleTwoIdentityCard" column="sale_two_identity_card" jdbcType="VARCHAR"/>
        <result property="saleTwoRatio" column="sale_two_ratio" jdbcType="NUMERIC"/>
        <result property="saleTwoAchievementAmount" column="sale_two_achievement_amount" jdbcType="NUMERIC"/>
        <result property="saleTwoCommissionAmount" column="sale_two_commission_amount" jdbcType="NUMERIC"/>
        <result property="saleThreeStaffId" column="sale_three_staff_id" jdbcType="BIGINT"/>
        <result property="saleThreeStaffName" column="sale_three_staff_name" jdbcType="VARCHAR"/>
        <result property="saleThreeIdentityCard" column="sale_three_identity_card" jdbcType="VARCHAR"/>
        <result property="saleThreeRatio" column="sale_three_ratio" jdbcType="NUMERIC"/>
        <result property="saleThreeAchievementAmount" column="sale_three_achievement_amount" jdbcType="NUMERIC"/>
        <result property="saleThreeCommissionAmount" column="sale_three_commission_amount" jdbcType="NUMERIC"/>
        <result property="brandNumberTwo" column="brand_number_two" jdbcType="VARCHAR"/>
        <result property="brandNumberThree" column="brand_number_three" jdbcType="VARCHAR"/>
        <result property="saleFourStaffId" column="sale_four_staff_id" jdbcType="BIGINT"/>
        <result property="saleFourStaffName" column="sale_four_staff_name" jdbcType="VARCHAR"/>
        <result property="brandNumberFour" column="brand_number_four" jdbcType="VARCHAR"/>
        <result property="saleFourIdentityCard" column="sale_four_identity_card" jdbcType="VARCHAR"/>
        <result property="saleFourRatio" column="sale_four_ratio" jdbcType="NUMERIC"/>
        <result property="saleFourAchievementAmount" column="sale_four_achievement_amount" jdbcType="NUMERIC"/>
        <result property="saleFourCommissionAmount" column="sale_four_commission_amount" jdbcType="NUMERIC"/>
        <result property="typeRatio" column="type_ratio" jdbcType="NUMERIC"/>
        <result column="member_num" jdbcType="VARCHAR" property="memberNum" />
        <result column="recharge_type_num" jdbcType="VARCHAR" property="rechargeTypeNum" />
        <result column="recharge_type_id" jdbcType="BIGINT" property="rechargeTypeId" />
        <result column="recharge_type_name" jdbcType="VARCHAR" property="rechargeTypeName" />
        <result column="is_addition" jdbcType="INTEGER" property="isAddition" />
        <result column="discount" jdbcType="INTEGER" property="discount" />
        <result column="courser_out_time" jdbcType="INTEGER" property="courserOutTime" />
    </resultMap>

    <select id="selectFKJ" resultMap="RechargeTurnCourseMap" parameterType="com.ssm.manage.entity.RechargeTurnCourse">
        select * from recharge_turn_course
        <where>
            store_id = #{storeId, jdbcType = BIGINT} and state=0
            and DATE_FORMAT(doc_date, '%Y-%m-%d' ) = DATE_FORMAT(#{docDate} , '%Y-%m-%d' );
        </where>
    </select>
    <select id="selectFKJByDate"  resultMap="RechargeTurnCourseMap" parameterType="com.ssm.manage.entity.RechargeTurnCourse">
        select * from recharge_turn_course
        <where>
            state=0 <if test="storeId!=null">and store_id = #{storeId, jdbcType = BIGINT} </if>
            and doc_date between #{startTime} and #{endTime}
        </where>
    </select>


</mapper>

