| | |
| | | <result property="tag" column="tag"/> |
| | | <result property="isUsing" column="is_using"/> |
| | | <result property="kind" column="kind"/> |
| | | <result property="companyId" column="company_id"/> |
| | | </resultMap> |
| | | |
| | | <select id="selectUsableCouponByProductInfo" resultMap="WxShopCouponMap"> |
| | |
| | | select * |
| | | from shop_coupon |
| | | where |
| | | kind=2 and now() >= begin_time and end_time >= now() |
| | | company_id=#{companyId} |
| | | and kind=2 and now() >= begin_time and end_time >= now() |
| | | and is_open = 1 |
| | | and (is_all = 1 or |
| | | ( |
| | |
| | | ifnull(scr.is_using, 0) is_using |
| | | from shop_coupon sc left join shop_coupon_record scr |
| | | on sc.id = scr.c_id and user_id = #{userId} |
| | | where sc.shop_id=#{shopId} and sc.kind=1 and now() >= begin_time and end_time >= now() and is_open = 1 |
| | | where sc.company_id=#{companyId} and sc.kind=1 and now() >= begin_time and end_time >= now() and is_open = 1 |
| | | <!--<if test="!isNewPeople">--> |
| | | <!--and get_limit = 1--> |
| | | <!--</if>--> |