Sfoglia il codice sorgente

[卷][修改][修改编辑页面卷列表,过滤掉已下架]

# Conflicts:
#	mallinkService/src/main/resources/mapper/WxCouponMapper.xml
release_toaliyun_real
luozukai 7 anni fa
parent
commit
24697fbbac
1 ha cambiato i file con 77 aggiunte e 42 eliminazioni
  1. +77
    -42
      mallinkService/src/main/resources/mapper/WxCouponMapper.xml

+ 77
- 42
mallinkService/src/main/resources/mapper/WxCouponMapper.xml Vedi File

@@ -38,6 +38,10 @@
<result column="credit_price" jdbcType="INTEGER" property="creditPrice"/>
<result column="credit_refund" jdbcType="INTEGER" property="creditRefund"/>
<result column="is_del" property="isDel"/>
<result column="put_apply_status" property="putApplyStatus"/>
<result column="stock_apply_status" property="stockApplyStatus"/>
<result column="cancle_apply_status" property="cancleApplyStatus"/>
<result column="conditions" jdbcType="VARCHAR" property="conditions"/>

</resultMap>
<resultMap id="statisMap" type="com.iformall.domain.vo.WxCouponStatisVo">
@@ -91,7 +95,8 @@
`id`,`tenant_id`,`type`,`cover_img`,`cover_picture`,`detail_picture`,`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`,`sub_business`,`support_transfer`,`subsidy_num`,`subsidy_type`,
`press_limit_num`, `press_limit_hours`, `auto_refund`,`credit_price`,`credit_refund`
`press_limit_num`, `press_limit_hours`, `auto_refund`,`credit_price`,`credit_refund`,put_apply_status,stock_apply_status,cancle_apply_status
`press_limit_num`, `press_limit_hours`, `auto_refund`,`credit_price`,`credit_refund`,`conditions`
</sql>

<sql id="dynamicWhereConditions">
@@ -466,7 +471,7 @@
<result column="subsidy_num" jdbcType="INTEGER" property="subsidyNum"/>
<result column="press_limit_num" jdbcType="INTEGER" property="pressLimitNum"/>
<result column="press_limit_hours" jdbcType="INTEGER" property="pressLimitHours"/>
<result column="conditions" jdbcType="VARCHAR" property="conditions"/>

<collection column="{productId=id}" property="merchantVoList"
ofType="com.iformall.domain.vo.WxMerchantVo"
@@ -487,6 +492,10 @@
update wx_coupon SET remain_inventory = remain_inventory - #{number} where id = #{id} and remain_inventory>= #{number}
</update>

<update id="backInventory">
update wx_coupon SET remain_inventory = remain_inventory + #{number} where id = #{id} and remain_inventory>= #{remainInventory}
</update>

<update id="offExpiriedCouponByValidDate">
update wx_coupon SET status = 1, update_date = now()
where status = 0 and valid_type = 1 and valid_end_date &lt; now()
@@ -615,54 +624,79 @@
</select>

<select id="findPressData" parameterType="com.iformall.domain.po.WxCoupon" resultMap="statisMap">
select c.*,
IFNULL(round((select count(wo.id) from wx_coupon wc
left join wx_order wo on wo.product_id = wc.id
where wo.order_status = 1 and wc.id = c.id)/(select count(wop.id) from wx_coupon wc
left join wx_order wo on wo.product_id = wc.id
left join wx_order_press wop on wop.order_id = wo.id
where wop.first = 1 and wc.id = c.id)*100,2),0) change_rate

,(select count(wop.id) from wx_coupon wc
left join wx_order wo on wo.product_id = wc.id
left join wx_order_press wop on wop.order_id = wo.id
where wop.first = 1 and wc.id = c.id) as press_count,

(select count(wo.id) from wx_coupon wc
left join wx_order wo on wo.product_id = wc.id
where wo.order_status = 1 and wc.id = c.id) as press_succ_count,

(select count(wop.id) from wx_coupon wc
left join wx_order wo on wo.product_id = wc.id
left join wx_order_press wop on wop.order_id = wo.id
where wc.id = c.id) as join_count,

round(
(select count(wco.id) xcount from wx_coupon wc
left join wx_coupon_order wco on wco.coupon_id = wc.id
where wc.type = 8 and wco.coupon_order_status = 1
and wc.id = c.id)
/
(select count(wop.id) from wx_coupon wc
left join wx_order wo on wo.product_id = wc.id
left join wx_order_press wop on wop.order_id = wo.id
where wop.first = 1 and wc.id = c.id)
*100,2) as payment_rate

from wx_coupon c where c.type = 8
<if test="tenantId != null">
and c.tenant_id=#{tenantId}
select cpd.id, cpd.`cover_img`,cpd.`title`,cpd.`sale_price`,cpd.`price`,
cpd.change_rate, cpd.press_count, cpd.press_succ_count, cpd.join_count, cpd.payment_rate
from wx_coupon_press_data cpd
left join wx_coupon c on c.id = cpd.id
<if test="id != null">
and cpd.tenant_id=#{tenantId}
</if>
<if test="id != null">
and c.id = #{id}
and cpd.id = #{id}
</if>
<if test="title != null and title != ''">
and c.title like concat('%', #{title},'%')
and cpd.title like concat('%', #{title},'%')
</if>
<if test=" null != sortColumns"> order by ${sortColumns} </if>
<if test=" null == sortColumns"> order by c.status asc,c.create_date desc </if>
</select>

<insert id="delPressData" parameterType="com.iformall.domain.po.WxCoupon" >
delete from `wx_coupon_press_data` where type = 8 and tenant_id = #{tenantId}
</insert>

<insert id="insertPressData" parameterType="com.iformall.domain.po.WxCoupon" >
insert into `wx_coupon_press_data`
(`id`, `tenant_id`, `cover_img`, `title`, `sale_price`, `price`)
select `id`, `tenant_id`, `cover_img`, `title`, `sale_price`, `price`
from wx_coupon where type = 8 and tenant_id = #{tenantId}
</insert>

<update id="updatePressData1" parameterType="com.iformall.domain.po.WxCoupon" >
update wx_coupon_press_data cpd set change_rate =
IFNULL(round((select count(o.id) from wx_order o
where o.tenant_id = #{tenantId} and o.order_status = 1 and o.product_id = cpd.id)/
(select count(wop.id) from wx_order o
left join wx_order_press wop on wop.order_id = o.id
where o.product_id = cpd.id and o.tenant_id = #{tenantId} and wop.first = 1)*100,2),0)
where cpd.tenant_id = #{tenantId}
</update>

<update id="updatePressData2" parameterType="com.iformall.domain.po.WxCoupon">
update wx_coupon_press_data cpd set press_count= (select count(wop.id) from wx_order o
left join wx_order_press wop on wop.order_id = o.id
where o.product_id = cpd.id and o.tenant_id = #{tenantId} and wop.first = 1)
where cpd.tenant_id=#{tenantId}
</update>

<update id="updatePressData3" parameterType="com.iformall.domain.po.WxCoupon">
update wx_coupon_press_data cpd set
press_succ_count =
(select count(o.id) from wx_order o
where o.product_id = cpd.id and o.tenant_id = #{tenantId} and o.order_status = 1)
where cpd.tenant_id=#{tenantId}
</update>

<update id="updatePressData4" parameterType="com.iformall.domain.po.WxCoupon" >
update wx_coupon_press_data cpd set join_count =
(select count(wop.id) from wx_order o
left join wx_order_press wop on wop.order_id = o.id
where o.tenant_id = #{tenantId} and o.product_id = cpd.id and o.payment_type = 0)
where cpd.tenant_id=#{tenantId}
</update>

<select id="updatePressData5" parameterType="com.iformall.domain.po.WxCoupon">
update wx_coupon_press_data cpd set payment_rate = round(
(select count(wco.id) xcount from wx_coupon_order wco
where wco.tenant_id = #{tenantId} and wco.coupon_id = cpd.id and wco.coupon_order_status = 1)
/
(select count(wop.id) from wx_order o
left join wx_order_press wop on wop.order_id = o.id
where o.tenant_id = #{tenantId} and o.product_id = cpd.id and wop.first = 1 )
*100,2)
where cpd.tenant_id=#{tenantId}
</select>

<select id="findCouponOrderCount" parameterType="com.iformall.domain.po.WxCoupon" resultType="com.iformall.domain.vo.WxCouponStatisVo">
select DATE_FORMAT(wco.create_date,'%Y-%m-%d') xtime,count(wco.id) xcount from wx_coupon c
left join wx_coupon_order wco on c.id = wco.coupon_id
@@ -791,10 +825,11 @@
wc.tenant_id,wc.`type`,wc.`cover_img`,wc.`cover_picture`,wc.`detail_picture`,wc.`title`,wc.`sub_title`,wc.`sale_price`,wc.`use_price`,wc.`use_limit_quantity`,wc.`send_type`,
wc.`valid_type`,wc.`valid_start_date`,wc.`valid_end_date`,wc.`valid_days`,wc.`detail`,wc.`price`,wc.`unit`,wc.`remain_inventory`,wc.`inventory`,
wc.`remark`,wc.`status`,wc.`create_date`,wc.`update_date`,wc.`business`,wc.`sub_business`,wc.`support_transfer`,wc.`subsidy_num`,wc.`subsidy_type`,
wc.`press_limit_num`, wc.`press_limit_hours`, wc.`auto_refund`,wc.`credit_price`,wc.`credit_refund`
wc.`press_limit_num`, wc.`press_limit_hours`, wc.`auto_refund`,wc.`credit_price`,wc.`credit_refund`,wc.`conditions`
,wc.title as couponName,wc.`cover_img` as couponPic,wc.`cover_picture` as couponPicture,wc.`detail_picture` as detailPicture,wc.id as couponId from wx_coupon_channel ct left join
wx_coupon wc on wc.id = ct.coupon_id
where ct.`sub_target_id` = #{id}
and ct.status = 0
</select>

</mapper>

Caricamento…
Annulla
Salva