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

    <resultMap type="com.ssm.manage.entity.BaseGrouponCard" id="BaseGrouponCardMap">
        <result property="id" column="id" jdbcType="INTEGER"/>
        <result property="state" column="state" jdbcType="INTEGER"/>
        <result property="docNum" column="doc_num" jdbcType="VARCHAR"/>
        <result property="docDate" column="doc_date" jdbcType="TIMESTAMP"/>
        <result property="rechargeTypeId" column="recharge_type_id" jdbcType="INTEGER"/>
        <result property="rechargeTypeNum" column="recharge_type_num" jdbcType="VARCHAR"/>
        <result property="rechargeTypeName" column="recharge_type_name" jdbcType="VARCHAR"/>
        <result property="storeId" column="store_id" jdbcType="INTEGER"/>
        <result property="storeName" column="store_name" jdbcType="VARCHAR"/>
        <result property="expireDate" column="expire_date" jdbcType="TIMESTAMP"/>
        <result property="discount" column="discount" jdbcType="NUMERIC"/>
        <result property="rechargeMoney" column="recharge_money" jdbcType="NUMERIC"/>
        <result property="quantity" column="quantity" jdbcType="INTEGER"/>
        <result property="inputBy" column="input_by" jdbcType="VARCHAR"/>
        <result property="inputDate" column="input_date" jdbcType="TIMESTAMP"/>
        <result property="updateBy" column="update_by" jdbcType="VARCHAR"/>
        <result property="updateDate" column="update_date" jdbcType="TIMESTAMP"/>
        <result property="auditBy" column="audit_by" jdbcType="VARCHAR"/>
        <result property="auditDate" column="audit_date" jdbcType="TIMESTAMP"/>
        <result property="remark" column="remark" jdbcType="VARCHAR"/>
        <result property="typeRatio" column="type_ratio" jdbcType="DECIMAL"/>
    </resultMap>

    <select id="selectFKJ" resultMap="BaseGrouponCardMap" parameterType="com.ssm.manage.entity.BaseGrouponCard">
        select * from base_groupon_card
        <where>
            store_id = #{storeId, jdbcType = BIGINT} and state=3
            and DATE_FORMAT(doc_date, '%Y-%m-%d' ) = DATE_FORMAT(#{docDate} , '%Y-%m-%d' );
        </where>
    </select>
    <select id="selectFKJByDate" resultMap="BaseGrouponCardMap" parameterType="com.ssm.manage.entity.BaseGrouponCard">
        select * from base_groupon_card
        <where>
            store_id = #{storeId, jdbcType = BIGINT} and state=3
            and doc_date between #{startTime} and #{endTime}
        </where>
    </select>
    <select id="selectNew" resultMap="BaseGrouponCardMap" >
        select * from base_groupon_card
        where store_id in <foreach collection="storeIds" open="(" close=")" separator="," item="item">
        #{item}
    </foreach>
    </select>
</mapper>

