<?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.RefundCashMapper">
  <resultMap id="BaseResultMap" type="com.ssm.manage.entity.RefundCash">
    <!--
      WARNING - @mbg.generated
    -->
    <id column="id" jdbcType="BIGINT" property="id" />
    <result column="refund_num" jdbcType="VARCHAR" property="refundNum" />
    <result column="refund_date" jdbcType="TIMESTAMP" property="refundDate" />
    <result column="store_id" jdbcType="BIGINT" property="storeId" />
    <result column="store_name" jdbcType="VARCHAR" property="storeName" />
    <result column="member_id" jdbcType="BIGINT" property="memberId" />
    <result column="member_name" jdbcType="VARCHAR" property="memberName" />
    <result column="member_identity_card" jdbcType="VARCHAR" property="memberIdentityCard" />
    <result column="mobile_phone" jdbcType="VARCHAR" property="mobilePhone" />
    <result column="cash_id" jdbcType="BIGINT" property="cashId" />
    <result column="cash_date" jdbcType="TIMESTAMP" property="cashDate" />
    <result column="project_id" jdbcType="BIGINT" property="projectId" />
    <result column="project_name" jdbcType="VARCHAR" property="projectName" />
    <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="transaction_price" jdbcType="DECIMAL" property="transactionPrice" />
    <result column="number_times" jdbcType="INTEGER" property="numberTimes" />
    <result column="cash_refund_money" jdbcType="DECIMAL" property="cashRefundMoney" />
    <result column="cash_compensation" jdbcType="DECIMAL" property="cashCompensation" />
    <result column="achievement_large" jdbcType="DECIMAL" property="achievementLarge" />
    <result column="achievement_zhonggong" jdbcType="DECIMAL" property="achievementZhonggong" />
    <result column="achievement_technician" jdbcType="DECIMAL" property="achievementTechnician" />
    <result column="achievement_small" jdbcType="DECIMAL" property="achievementSmall" />
    <result column="commission_large" jdbcType="DECIMAL" property="commissionLarge" />
    <result column="commission_zhonggong" jdbcType="DECIMAL" property="commissionZhonggong" />
    <result column="commission_technician" jdbcType="DECIMAL" property="commissionTechnician" />
    <result column="commission_small" jdbcType="DECIMAL" property="commissionSmall" />
    <result column="card_achievement_large" jdbcType="DECIMAL" property="cardAchievementLarge" />
    <result column="card_achievement_zhonggong" jdbcType="DECIMAL" property="cardAchievementZhonggong" />
    <result column="card_achievement_technician" jdbcType="DECIMAL" property="cardAchievementTechnician" />
    <result column="card_achievement_small" jdbcType="DECIMAL" property="cardAchievementSmall" />
    <result column="card_commission_large" jdbcType="DECIMAL" property="cardCommissionLarge" />
    <result column="card_commission_zhonggong" jdbcType="DECIMAL" property="cardCommissionZhonggong" />
    <result column="card_commission_technician" jdbcType="DECIMAL" property="cardCommissionTechnician" />
    <result column="card_commission_small" jdbcType="DECIMAL" property="cardCommissionSmall" />
    <result column="large_one_number" jdbcType="VARCHAR" property="largeOneNumber" />
    <result column="service_large_one_staff_id" jdbcType="BIGINT" property="serviceLargeOneStaffId" />
    <result column="service_large_one_staff_name" jdbcType="VARCHAR" property="serviceLargeOneStaffName" />
    <result column="service_large_one_identity_card" jdbcType="VARCHAR" property="serviceLargeOneIdentityCard" />
    <result column="service_large_one_achievement_amount" jdbcType="DECIMAL" property="serviceLargeOneAchievementAmount" />
    <result column="service_large_one_commission_amount" jdbcType="DECIMAL" property="serviceLargeOneCommissionAmount" />
    <result column="service_large_one_ratio" jdbcType="DECIMAL" property="serviceLargeOneRatio" />
    <result column="large_two_number" jdbcType="VARCHAR" property="largeTwoNumber" />
    <result column="service_large_two_staff_id" jdbcType="BIGINT" property="serviceLargeTwoStaffId" />
    <result column="service_large_two_staff_name" jdbcType="VARCHAR" property="serviceLargeTwoStaffName" />
    <result column="service_large_two_identity_card" jdbcType="VARCHAR" property="serviceLargeTwoIdentityCard" />
    <result column="service_large_two_achievement_amount" jdbcType="DECIMAL" property="serviceLargeTwoAchievementAmount" />
    <result column="service_large_two_commission_amount" jdbcType="DECIMAL" property="serviceLargeTwoCommissionAmount" />
    <result column="service_large_two_ratio" jdbcType="DECIMAL" property="serviceLargeTwoRatio" />
    <result column="large_three_number" jdbcType="VARCHAR" property="largeThreeNumber" />
    <result column="service_large_three_staff_id" jdbcType="BIGINT" property="serviceLargeThreeStaffId" />
    <result column="service_large_three_staff_name" jdbcType="VARCHAR" property="serviceLargeThreeStaffName" />
    <result column="service_large_three_identity_card" jdbcType="VARCHAR" property="serviceLargeThreeIdentityCard" />
    <result column="service_large_three_achievement_amount" jdbcType="DECIMAL" property="serviceLargeThreeAchievementAmount" />
    <result column="service_large_three_commission_amount" jdbcType="DECIMAL" property="serviceLargeThreeCommissionAmount" />
    <result column="service_large_three_ratio" jdbcType="DECIMAL" property="serviceLargeThreeRatio" />
    <result column="zhonggong_one_number" jdbcType="VARCHAR" property="zhonggongOneNumber" />
    <result column="service_zhonggong_one_staff_id" jdbcType="BIGINT" property="serviceZhonggongOneStaffId" />
    <result column="service_zhonggong_one_staff_name" jdbcType="VARCHAR" property="serviceZhonggongOneStaffName" />
    <result column="service_zhonggong_one_identity_card" jdbcType="VARCHAR" property="serviceZhonggongOneIdentityCard" />
    <result column="service_zhonggong_one_achievement_amount" jdbcType="DECIMAL" property="serviceZhonggongOneAchievementAmount" />
    <result column="service_zhonggong_one_commission_amount" jdbcType="DECIMAL" property="serviceZhonggongOneCommissionAmount" />
    <result column="service_zhonggong_one_ratio" jdbcType="DECIMAL" property="serviceZhonggongOneRatio" />
    <result column="zhonggong_two_number" jdbcType="VARCHAR" property="zhonggongTwoNumber" />
    <result column="service_zhonggong_two_staff_id" jdbcType="BIGINT" property="serviceZhonggongTwoStaffId" />
    <result column="service_zhonggong_two_staff_name" jdbcType="VARCHAR" property="serviceZhonggongTwoStaffName" />
    <result column="service_zhonggong_two_identity_card" jdbcType="VARCHAR" property="serviceZhonggongTwoIdentityCard" />
    <result column="service_zhonggong_two_achievement_amount" jdbcType="DECIMAL" property="serviceZhonggongTwoAchievementAmount" />
    <result column="service_zhonggong_two_commission_amount" jdbcType="DECIMAL" property="serviceZhonggongTwoCommissionAmount" />
    <result column="service_zhonggong_two_ratio" jdbcType="DECIMAL" property="serviceZhonggongTwoRatio" />
    <result column="zhonggong_three_number" jdbcType="VARCHAR" property="zhonggongThreeNumber" />
    <result column="service_zhonggong_three_staff_id" jdbcType="BIGINT" property="serviceZhonggongThreeStaffId" />
    <result column="service_zhonggong_three_staff_name" jdbcType="VARCHAR" property="serviceZhonggongThreeStaffName" />
    <result column="service_zhonggong_three_identity_card" jdbcType="VARCHAR" property="serviceZhonggongThreeIdentityCard" />
    <result column="service_zhonggong_three_achievement_amount" jdbcType="DECIMAL" property="serviceZhonggongThreeAchievementAmount" />
    <result column="service_zhonggong_three_commission_amount" jdbcType="DECIMAL" property="serviceZhonggongThreeCommissionAmount" />
    <result column="service_zhonggong_three_ratio" jdbcType="DECIMAL" property="serviceZhonggongThreeRatio" />
    <result column="technician_one_number" jdbcType="VARCHAR" property="technicianOneNumber" />
    <result column="service_technician_one_staff_id" jdbcType="BIGINT" property="serviceTechnicianOneStaffId" />
    <result column="service_technician_one_staff_name" jdbcType="VARCHAR" property="serviceTechnicianOneStaffName" />
    <result column="service_technician_one_identity_card" jdbcType="VARCHAR" property="serviceTechnicianOneIdentityCard" />
    <result column="service_technician_one_achievement_amount" jdbcType="DECIMAL" property="serviceTechnicianOneAchievementAmount" />
    <result column="service_technician_one_commission_amount" jdbcType="DECIMAL" property="serviceTechnicianOneCommissionAmount" />
    <result column="service_technician_one_ratio" jdbcType="DECIMAL" property="serviceTechnicianOneRatio" />
    <result column="technician_two_number" jdbcType="VARCHAR" property="technicianTwoNumber" />
    <result column="service_technician_two_staff_id" jdbcType="BIGINT" property="serviceTechnicianTwoStaffId" />
    <result column="service_technician_two_staff_name" jdbcType="VARCHAR" property="serviceTechnicianTwoStaffName" />
    <result column="service_technician_two_identity_card" jdbcType="VARCHAR" property="serviceTechnicianTwoIdentityCard" />
    <result column="service_technician_two_achievement_amount" jdbcType="DECIMAL" property="serviceTechnicianTwoAchievementAmount" />
    <result column="service_technician_two_commission_amount" jdbcType="DECIMAL" property="serviceTechnicianTwoCommissionAmount" />
    <result column="service_technician_two_ratio" jdbcType="DECIMAL" property="serviceTechnicianTwoRatio" />
    <result column="technician_three_number" jdbcType="VARCHAR" property="technicianThreeNumber" />
    <result column="service_technician_three_staff_id" jdbcType="BIGINT" property="serviceTechnicianThreeStaffId" />
    <result column="service_technician_three_staff_name" jdbcType="VARCHAR" property="serviceTechnicianThreeStaffName" />
    <result column="service_technician_three_identity_card" jdbcType="VARCHAR" property="serviceTechnicianThreeIdentityCard" />
    <result column="service_technician_three_achievement_amount" jdbcType="DECIMAL" property="serviceTechnicianThreeAchievementAmount" />
    <result column="service_technician_three_commission_amount" jdbcType="DECIMAL" property="serviceTechnicianThreeCommissionAmount" />
    <result column="service_technician_three_ratio" jdbcType="DECIMAL" property="serviceTechnicianThreeRatio" />
    <result column="small_one_number" jdbcType="VARCHAR" property="smallOneNumber" />
    <result column="service_small_one_staff_id" jdbcType="BIGINT" property="serviceSmallOneStaffId" />
    <result column="service_small_one_staff_name" jdbcType="VARCHAR" property="serviceSmallOneStaffName" />
    <result column="service_small_one_identity_card" jdbcType="VARCHAR" property="serviceSmallOneIdentityCard" />
    <result column="service_small_one_achievement_amount" jdbcType="DECIMAL" property="serviceSmallOneAchievementAmount" />
    <result column="service_small_one_commission_amount" jdbcType="DECIMAL" property="serviceSmallOneCommissionAmount" />
    <result column="service_small_one_ratio" jdbcType="DECIMAL" property="serviceSmallOneRatio" />
    <result column="small_two_number" jdbcType="VARCHAR" property="smallTwoNumber" />
    <result column="service_small_two_staff_id" jdbcType="BIGINT" property="serviceSmallTwoStaffId" />
    <result column="service_small_two_staff_name" jdbcType="VARCHAR" property="serviceSmallTwoStaffName" />
    <result column="service_small_two_identity_card" jdbcType="VARCHAR" property="serviceSmallTwoIdentityCard" />
    <result column="service_small_two_achievement_amount" jdbcType="DECIMAL" property="serviceSmallTwoAchievementAmount" />
    <result column="service_small_two_commission_amount" jdbcType="DECIMAL" property="serviceSmallTwoCommissionAmount" />
    <result column="service_small_two_ratio" jdbcType="DECIMAL" property="serviceSmallTwoRatio" />
    <result column="small_three_number" jdbcType="VARCHAR" property="smallThreeNumber" />
    <result column="service_small_three_staff_id" jdbcType="BIGINT" property="serviceSmallThreeStaffId" />
    <result column="service_small_three_staff_name" jdbcType="VARCHAR" property="serviceSmallThreeStaffName" />
    <result column="service_small_three_identity_card" jdbcType="VARCHAR" property="serviceSmallThreeIdentityCard" />
    <result column="service_small_three_achievement_amount" jdbcType="DECIMAL" property="serviceSmallThreeAchievementAmount" />
    <result column="service_small_three_commission_amount" jdbcType="DECIMAL" property="serviceSmallThreeCommissionAmount" />
    <result column="service_small_three_ratio" jdbcType="DECIMAL" property="serviceSmallThreeRatio" />
    <result column="manage_staff_id" jdbcType="BIGINT" property="manageStaffId" />
    <result column="manage_staff_name" jdbcType="VARCHAR" property="manageStaffName" />
    <result column="manage_identity_card" jdbcType="VARCHAR" property="manageIdentityCard" />
    <result column="manage_number" jdbcType="VARCHAR" property="manageNumber" />
    <result column="large_achievement_amount" jdbcType="DECIMAL" property="largeAchievementAmount" />
    <result column="zhonggong_achievement_amount" jdbcType="DECIMAL" property="zhonggongAchievementAmount" />
    <result column="technician_achievement_amount" jdbcType="DECIMAL" property="technicianAchievementAmount" />
    <result column="small_achievement_amount" jdbcType="DECIMAL" property="smallAchievementAmount" />
    <result column="large_commission_amount" jdbcType="DECIMAL" property="largeCommissionAmount" />
    <result column="zhonggong_commission_amount" jdbcType="DECIMAL" property="zhonggongCommissionAmount" />
    <result column="technician_commission_amount" jdbcType="DECIMAL" property="technicianCommissionAmount" />
    <result column="small_commission_amount" jdbcType="DECIMAL" property="smallCommissionAmount" />
    <result column="card_large_achievement_amount" jdbcType="DECIMAL" property="cardLargeAchievementAmount" />
    <result column="card_zhonggong_achievement_amount" jdbcType="DECIMAL" property="cardZhonggongAchievementAmount" />
    <result column="card_technician_achievement_amount" jdbcType="DECIMAL" property="cardTechnicianAchievementAmount" />
    <result column="card_small_achievement_amount" jdbcType="DECIMAL" property="cardSmallAchievementAmount" />
    <result column="card_large_commission_amount" jdbcType="DECIMAL" property="cardLargeCommissionAmount" />
    <result column="card_zhonggong_commission_amount" jdbcType="DECIMAL" property="cardZhonggongCommissionAmount" />
    <result column="card_technician_commission_amount" jdbcType="DECIMAL" property="cardTechnicianCommissionAmount" />
    <result column="card_small_commission_amount" jdbcType="DECIMAL" property="cardSmallCommissionAmount" />
    <result column="audit_date" jdbcType="TIMESTAMP" property="auditDate"/>
  </resultMap>

  <select id="selectList" parameterType="com.ssm.manage.query.RefundOrderResquest" resultMap="BaseResultMap">
    select b.*,a.audit_date from refund_order_list a, refund_cash b
    where b.store_id = #{storeId, jdbcType = BIGINT}
    and a.refund_num = b.refund_num
    and a.state = #{state, jdbcType = INTEGER}
    <if test="dateStr != null">
      and a.audit_date like concat( #{dateStr, jdbcType = VARCHAR}, '%')
    </if>
    <if test="startTime != null">
      and a.audit_date between #{startTime} and #{endTime}
    </if>
  </select>

  <select id="selectLists" parameterType="com.ssm.manage.query.RefundOrderResquest" resultMap="BaseResultMap">
    select b.* from refund_order_list a, refund_cash b
    where b.store_id = #{storeId, jdbcType = BIGINT}
    and a.refund_num = b.refund_num
    and a.state = #{state, jdbcType = INTEGER}
    <if test="dateStr != null">
      and a.refund_date between #{startTime, jdbcType = TIMESTAMP} and #{endTime, jdbcType = TIMESTAMP}
    </if>
  </select>

  <select id="selectListschia" parameterType="com.ssm.manage.query.RefundOrderResquest" resultMap="BaseResultMap">
    select b.* from refund_order_list a, refund_cash b
    where b.store_id = #{storeId, jdbcType = BIGINT}
    and a.refund_num = b.refund_num
      and a.refund_date between #{startTime, jdbcType = TIMESTAMP} and #{endTime, jdbcType = TIMESTAMP}
  </select>
    <select id="selectNew" resultMap="BaseResultMap">
      select * from refund_cash where SUBSTR(refund_date,1,7) = #{strDate}
                                  and  store_id in <foreach collection="storeIds" item="item" separator="," close=")" open="(">
      #{item}
    </foreach>
    </select>
    <select id="selectFKJByRefundCashGifMoney" resultMap="BaseResultMap" parameterType="com.ssm.manage.query.StoreDailyRequest">
      select cash.* from refund_cash cash left join refund_order_list refund on cash.refund_num = refund.refund_num
        where refund.store_id = #{storeId} and refund.state = 3 and refund.type = 2 and refund.audit_date between #{startTime} and #{endTime}
    </select>
</mapper>