| @@ -48,11 +48,11 @@ | |||
| </resultMap> | |||
| <sql id="allColumns"> | |||
| `id`,`tenant_id`,`type`,`cover_img`,`title`,`sub_title`,`sale_price`,`use_price`,`use_limit_quantity`,`send_type`, | |||
| `valid_type`,`valid_start_date`,`valid_end_date`,`valid_days`,`detail`,`price`,`unit`,`remain_inventory`,`inventory`, | |||
| `remark`,`status`,`create_date`,`update_date`,`business`,`support_transfer`,`subsidy_num`,`subsidy_type`, | |||
| `press_limit_num`, `press_limit_hours`, `auto_refund` | |||
| </sql> | |||
| `id`,`tenant_id`,`type`,`cover_img`,`title`,`sub_title`,`sale_price`,`use_price`,`use_limit_quantity`,`send_type`, | |||
| `valid_type`,`valid_start_date`,`valid_end_date`,`valid_days`,`detail`,`price`,`unit`,`remain_inventory`,`inventory`, | |||
| `remark`,`status`,`create_date`,`update_date`,`business`,`support_transfer`,`subsidy_num`,`subsidy_type`, | |||
| `press_limit_num`, `press_limit_hours`, `auto_refund` | |||
| </sql> | |||
| <sql id="dynamicWhereConditions"> | |||
| where 1 = 1 | |||
| @@ -402,31 +402,31 @@ | |||
| <update id="reduceInventory"> | |||
| update wx_coupon SET remain_inventory = remain_inventory - #{number} where id = #{id} and remain_inventory>= #{number} | |||
| </update> | |||
| update wx_coupon SET remain_inventory = remain_inventory - #{number} where id = #{id} and remain_inventory>= #{number} | |||
| </update> | |||
| <update id="offExpiriedCouponByValidDate"> | |||
| update wx_coupon SET status = 1, update_date = now() | |||
| where status = 0 and valid_type = 1 and valid_end_date < now() | |||
| </update> | |||
| update wx_coupon SET status = 1, update_date = now() | |||
| where status = 0 and valid_type = 1 and valid_end_date < now() | |||
| </update> | |||
| <update id="offExpiriedCouponByMerchantStatus"> | |||
| update wx_coupon c | |||
| SET c.status = 1, c.update_date = now() | |||
| where c.status = 0 and | |||
| (select count(*) from wx_coupon_merchant cm, wx_merchant m | |||
| where m.id = cm.merchant_id | |||
| and c.id = cm.product_id | |||
| and cm.status = 0 | |||
| and m.status = 1) = 0 | |||
| </update> | |||
| update wx_coupon c | |||
| SET c.status = 1, c.update_date = now() | |||
| where c.status = 0 and | |||
| (select count(*) from wx_coupon_merchant cm, wx_merchant m | |||
| where m.id = cm.merchant_id | |||
| and c.id = cm.product_id | |||
| and cm.status = 0 | |||
| and m.status = 1) = 0 | |||
| </update> | |||
| <select id="findSaleMoneyByDate" parameterType="com.iformall.domain.po.WxCoupon" resultType="com.iformall.domain.po.WxCoupon"> | |||
| select DATE_FORMAT(ci.create_date,'%Y-%m-%d') xtime,sum(round(ci.sale_amount/100,2)) xcount from wx_card_info ci | |||
| left join wx_coupon c on c.id = ci.coupon_id | |||
| where c.type = 100 | |||
| and ci.create_date between #{startdate} and #{enddate} | |||
| group by xtime | |||
| left join wx_coupon c on c.id = ci.coupon_id | |||
| where c.type = 100 | |||
| and ci.create_date between #{startdate} and #{enddate} | |||
| group by xtime | |||
| </select> | |||
| <select id="findPaymentByDate" parameterType="com.iformall.domain.po.WxCoupon" resultType="com.iformall.domain.po.WxCoupon"> | |||
| @@ -440,11 +440,11 @@ | |||
| <select id="findSaleCardCount" parameterType="com.iformall.domain.po.WxCoupon" resultType="Long"> | |||
| select count(co.id) | |||
| from wx_card_info ci | |||
| left join wx_coupon c on c.id = ci.coupon_id | |||
| left join wx_coupon_order co on co.id = ci.id | |||
| where c.type = 100 | |||
| and c.create_date between #{startdate} and #{enddate} | |||
| from wx_card_info ci | |||
| left join wx_coupon c on c.id = ci.coupon_id | |||
| left join wx_coupon_order co on co.id = ci.id | |||
| where c.type = 100 | |||
| and c.create_date between #{startdate} and #{enddate} | |||
| </select> | |||
| <select id="findTranCardCount" parameterType="com.iformall.domain.po.WxCoupon" resultType="Long"> | |||