<?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.ruoyi.system.mapper.PromotionCouponBatchMapper">

    <resultMap type="PromotionCouponBatch" id="PromotionCouponBatchResult">
        <result property="id"    column="id"    />
        <result property="storeId"    column="store_id"    />
        <result property="name"    column="name"    />
        <result property="couponType"    column="coupon_type"    />
        <result property="totalCount"    column="total_count"    />
        <result property="remainCount"    column="remain_count"    />
        <result property="receivedCount"    column="received_count"    />
        <result property="status"    column="status"    />
        <result property="startTime"    column="start_time"    />
        <result property="endTime"    column="end_time"    />
        <result property="validDays"    column="valid_days"    />
        <result property="createTime"    column="create_time"    />
        <result property="updateTime"    column="update_time"    />
    </resultMap>

    <select id="selectActiveByStoreId" parameterType="Long" resultMap="PromotionCouponBatchResult">
        select id, store_id, name, coupon_type, total_count, remain_count, received_count, status, start_time, end_time, valid_days, create_time, update_time
        from promotion_coupon_batch
        where store_id = #{storeId} and status = 1 and remain_count &gt; 0
        order by id asc
    </select>

</mapper>
