|
|
|
@@ -26,7 +26,10 @@ |
|
|
|
where 1 = 1 |
|
|
|
<if test=" null != id "> |
|
|
|
and `id` = #{id} |
|
|
|
</if> |
|
|
|
</if> |
|
|
|
<if test=" null != tenantId "> |
|
|
|
and `tenant_id` = #{tenantId} |
|
|
|
</if> |
|
|
|
<if test=" null != orderId "> |
|
|
|
and `order_id` = #{orderId} |
|
|
|
</if> |
|
|
|
@@ -119,70 +122,76 @@ |
|
|
|
<result column="unit" jdbcType="INTEGER" property="unit" /> |
|
|
|
<result column="remark" jdbcType="VARCHAR" property="remark" /> |
|
|
|
<result column="name" jdbcType="VARCHAR" property="merchantName" /> |
|
|
|
|
|
|
|
<result column="nick_name" jdbcType="VARCHAR" property="nickName" /> |
|
|
|
<result column="phone" jdbcType="VARCHAR" property="phone" /> |
|
|
|
</resultMap> |
|
|
|
|
|
|
|
<sql id="allVoColumns"> |
|
|
|
ms.`id`,ms.`order_id`,ms.`order_type`,ms.`merchant_id`,ms.`coupon_order_id`,ms.`coupon_type`, |
|
|
|
ms.`id`,ms.`tenant_id`,ms.`order_id`,ms.`order_type`,ms.`merchant_id`,ms.`coupon_order_id`,ms.`coupon_type`, |
|
|
|
ms.`order_payment`,ms.`receiver_payment`,ms.`real_payment`, |
|
|
|
ms.`subsidy`,ms.`real_subsidy`,ms.`status`,ms.`create_date`,ms.`update_date`, |
|
|
|
c.`title`,c.`sub_title`,c.`unit`,m.`name` |
|
|
|
c.`title`,c.`sub_title`,c.`unit`,m.`name`, |
|
|
|
cu.`nick_name`, cu.`phone` |
|
|
|
</sql> |
|
|
|
|
|
|
|
<sql id="dynamicVoWhereConditions"> |
|
|
|
where 1 = 1 |
|
|
|
<if test=" null != id "> |
|
|
|
and ms.`id` = #{id} |
|
|
|
and t.`id` = #{id} |
|
|
|
</if> |
|
|
|
<if test=" null != tenantId "> |
|
|
|
and t.`tenant_id` = #{tenantId} |
|
|
|
</if> |
|
|
|
<if test=" null != orderId "> |
|
|
|
and ms.`order_id` = #{orderId} |
|
|
|
and t.`order_id` = #{orderId} |
|
|
|
</if> |
|
|
|
<if test=" null != orderType "> |
|
|
|
and ms.`order_type` = #{orderType} |
|
|
|
and t.`order_type` = #{orderType} |
|
|
|
</if> |
|
|
|
<if test=" null != merchantId "> |
|
|
|
and ms.`merchant_id` = #{merchantId} |
|
|
|
and t.`merchant_id` = #{merchantId} |
|
|
|
</if> |
|
|
|
<if test=" null != couponOrderId "> |
|
|
|
and ms.`coupon_order_id` = #{couponOrderId} |
|
|
|
and t.`coupon_order_id` = #{couponOrderId} |
|
|
|
</if> |
|
|
|
<if test=" null != couponType "> |
|
|
|
and ms.`coupon_type` = #{couponType} |
|
|
|
and t.`coupon_type` = #{couponType} |
|
|
|
</if> |
|
|
|
<if test=" null != orderPayment "> |
|
|
|
and ms.`order_payment` = #{orderPayment} |
|
|
|
and t.`order_payment` = #{orderPayment} |
|
|
|
</if> |
|
|
|
<if test=" null != receiverPayment "> |
|
|
|
and ms.`receiver_payment` = #{receiverPayment} |
|
|
|
and t.`receiver_payment` = #{receiverPayment} |
|
|
|
</if> |
|
|
|
<if test=" null != realPayment "> |
|
|
|
and ms.`real_payment` = #{realPayment} |
|
|
|
and t.`real_payment` = #{realPayment} |
|
|
|
</if> |
|
|
|
<if test=" null != subsidy "> |
|
|
|
and ms.`subsidy` = #{subsidy} |
|
|
|
and t.`subsidy` = #{subsidy} |
|
|
|
</if> |
|
|
|
<if test=" null != realSubsidy "> |
|
|
|
and ms.`real_subsidy` = #{realSubsidy} |
|
|
|
and t.`real_subsidy` = #{realSubsidy} |
|
|
|
</if> |
|
|
|
<if test=" null != status "> |
|
|
|
and ms.`status` = #{status} |
|
|
|
and t.`status` = #{status} |
|
|
|
</if> |
|
|
|
<if test=" null != createDate "> |
|
|
|
and ms.`create_date` = #{createDate} |
|
|
|
and t.`create_date` = #{createDate} |
|
|
|
</if> |
|
|
|
<if test=" null != updateDate "> |
|
|
|
and ms.`update_date` = #{updateDate} |
|
|
|
and t.`update_date` = #{updateDate} |
|
|
|
</if> |
|
|
|
<if test=" null != startdate and null!=enddate"> |
|
|
|
and ms.`create_date` between #{startdate} and #{enddate} |
|
|
|
and t.`create_date` between #{startdate} and #{enddate} |
|
|
|
</if> |
|
|
|
<if test=" null != statusS "> |
|
|
|
and ms.`status` in |
|
|
|
and t.`status` in |
|
|
|
<foreach collection="statusS" index="index" item="sItem" open="(" separator="," close=")"> |
|
|
|
#{sItem} |
|
|
|
</foreach> |
|
|
|
</if> |
|
|
|
<if test=" null != ids "> |
|
|
|
and ms.`id` in |
|
|
|
and t.`id` in |
|
|
|
<foreach collection="ids" index="index" item="idItem" open="(" separator="," close=")"> |
|
|
|
#{idItem} |
|
|
|
</foreach> |
|
|
|
@@ -191,20 +200,36 @@ |
|
|
|
</sql> |
|
|
|
|
|
|
|
<select id="findVoList" parameterType="com.iformall.domain.po.WxMerchantSubsidy" resultMap="VoBaseResultMap"> |
|
|
|
select <include refid="allVoColumns" /> |
|
|
|
from wx_merchant_subsidy ms |
|
|
|
left join wx_coupon_order co on co.id = ms.coupon_order_id |
|
|
|
left join wx_coupon c on c.id = co.coupon_id |
|
|
|
left join wx_merchant m on m.id = ms.merchant_id |
|
|
|
select * from |
|
|
|
( |
|
|
|
select <include refid="allVoColumns" /> |
|
|
|
from wx_merchant_subsidy ms |
|
|
|
left join wx_coupon_order co on co.id = ms.coupon_order_id |
|
|
|
left join wx_coupon c on c.id = co.coupon_id |
|
|
|
left join wx_merchant m on m.id = ms.merchant_id |
|
|
|
left join wx_card_spend cs on cs.order_id = ms.order_id |
|
|
|
left join wx_c_user cu on cu.id = cs.owner_id |
|
|
|
where ms.order_type = 3 |
|
|
|
union |
|
|
|
select <include refid="allVoColumns" /> |
|
|
|
from wx_merchant_subsidy ms |
|
|
|
left join wx_coupon_order co on co.id = ms.coupon_order_id |
|
|
|
left join wx_coupon c on c.id = co.coupon_id |
|
|
|
left join wx_merchant m on m.id = ms.merchant_id |
|
|
|
left join wx_order o on o.id = ms.order_id |
|
|
|
left join wx_c_user cu on cu.id = o.c_user_id |
|
|
|
where ms.order_type = 0 |
|
|
|
) t |
|
|
|
where 1=1 |
|
|
|
<include refid="dynamicVoWhereConditions" /> |
|
|
|
</select> |
|
|
|
|
|
|
|
<select id="sumVoList" parameterType="com.iformall.domain.po.WxMerchantSubsidy" resultType="hashmap"> |
|
|
|
select ms.`merchant_id`, m.`name` as merchant_name, |
|
|
|
IFNULL(sum(ms.`order_payment`),0) as sum_order_payment, |
|
|
|
IFNULL(sum(ms.`receiver_payment`),0) as sum_receiver_payment, |
|
|
|
IFNULL(sum(ms.`subsidy`),0) as sum_subsidy, |
|
|
|
IFNULL(sum(ms.`real_subsidy`),0) as sum_real_subsidy |
|
|
|
select ms.`merchant_id` merchantId, m.`name` as merchantName, |
|
|
|
IFNULL(sum(ms.`order_payment`),0) as sumOrderPayment, |
|
|
|
IFNULL(sum(ms.`receiver_payment`),0) as sumReceiverPayment, |
|
|
|
IFNULL(sum(ms.`subsidy`),0) as sumSubsidy, |
|
|
|
IFNULL(sum(ms.`real_subsidy`),0) as sumRealSubsidy |
|
|
|
from wx_merchant_subsidy ms |
|
|
|
left join wx_coupon_order co on co.id = ms.coupon_order_id |
|
|
|
left join wx_coupon c on c.id = co.coupon_id |
|
|
|
|