| @@ -48,11 +48,11 @@ | |||||
| </resultMap> | </resultMap> | ||||
| <sql id="allColumns"> | <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"> | <sql id="dynamicWhereConditions"> | ||||
| where 1 = 1 | where 1 = 1 | ||||
| @@ -204,6 +204,7 @@ | |||||
| <sql id="dynamicWhereConditionsForCoupon"> | <sql id="dynamicWhereConditionsForCoupon"> | ||||
| where 1 = 1 | |||||
| <if test=" null != id "> | <if test=" null != id "> | ||||
| and `id` = #{id} | and `id` = #{id} | ||||
| @@ -214,7 +215,7 @@ | |||||
| </if> | </if> | ||||
| <if test=" null == type "> | <if test=" null == type "> | ||||
| and `type` < 7 | |||||
| and `type` < 7 | |||||
| </if> | </if> | ||||
| <if test=" null != type "> | <if test=" null != type "> | ||||
| @@ -402,31 +403,31 @@ | |||||
| <update id="reduceInventory"> | <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 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 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 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 | 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> | ||||
| <select id="findPaymentByDate" parameterType="com.iformall.domain.po.WxCoupon" resultType="com.iformall.domain.po.WxCoupon"> | <select id="findPaymentByDate" parameterType="com.iformall.domain.po.WxCoupon" resultType="com.iformall.domain.po.WxCoupon"> | ||||
| @@ -440,11 +441,11 @@ | |||||
| <select id="findSaleCardCount" parameterType="com.iformall.domain.po.WxCoupon" resultType="Long"> | <select id="findSaleCardCount" parameterType="com.iformall.domain.po.WxCoupon" resultType="Long"> | ||||
| select count(co.id) | 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> | ||||
| <select id="findTranCardCount" parameterType="com.iformall.domain.po.WxCoupon" resultType="Long"> | <select id="findTranCardCount" parameterType="com.iformall.domain.po.WxCoupon" resultType="Long"> | ||||
| @@ -487,8 +488,8 @@ | |||||
| where wc.id = c.id) as sum_subsidy | where wc.id = c.id) as sum_subsidy | ||||
| from wx_coupon c where c.type = 100 | from wx_coupon c where c.type = 100 | ||||
| <if test="title != null"> | |||||
| and c.title = concat('%', #{title},'%') | |||||
| <if test="title != null and title !=''"> | |||||
| and c.title like concat('%', #{title},'%') | |||||
| </if> | </if> | ||||
| <if test="id != null"> | <if test="id != null"> | ||||
| and c.id = #{id} | and c.id = #{id} | ||||
| @@ -513,8 +514,8 @@ | |||||
| <if test=" 2 == type "> | <if test=" 2 == type "> | ||||
| and c.sale_price = 0 | and c.sale_price = 0 | ||||
| </if> | </if> | ||||
| <if test="title != null"> | |||||
| and c.title = concat('%', #{title},'%') | |||||
| <if test="title != null and title != ''"> | |||||
| and c.title like concat('%', #{title},'%') | |||||
| </if> | </if> | ||||
| <if test="id != null"> | <if test="id != null"> | ||||
| and c.id = #{id} | and c.id = #{id} | ||||
| @@ -554,8 +555,8 @@ | |||||
| <if test="id != null"> | <if test="id != null"> | ||||
| and c.id = #{id} | and c.id = #{id} | ||||
| </if> | </if> | ||||
| <if test="title != null"> | |||||
| and c.title = concat('%', #{title},'%') | |||||
| <if test="title != null and title != ''"> | |||||
| and c.title like concat('%', #{title},'%') | |||||
| </if> | </if> | ||||
| order by c.status asc,c.create_date desc | order by c.status asc,c.create_date desc | ||||
| </select> | </select> | ||||