Przeglądaj źródła

[储值卡消费记录人工分账][修改]

release_toaliyun_real
Stormeye Wu 7 lat temu
rodzic
commit
ff3c9b51ac
7 zmienionych plików z 247 dodań i 232 usunięć
  1. +2
    -2
      mallinkAdmin/src/main/java/com/iformall/controller/WxCardPayController.java
  2. +8
    -0
      mallinkService/src/main/java/com/iformall/domain/po/WxCardSpend.java
  3. +0
    -7
      mallinkService/src/main/java/com/iformall/domain/vo/WxCardSpendVo.java
  4. +1
    -1
      mallinkService/src/main/java/com/iformall/mapper/WxCardSpendMapper.java
  5. +1
    -1
      mallinkService/src/main/java/com/iformall/service/WxCardSpendService.java
  6. +2
    -3
      mallinkService/src/main/java/com/iformall/service/impl/WxCardSpendServiceImpl.java
  7. +233
    -218
      mallinkService/src/main/resources/mapper/WxCardSpendMapper.xml

+ 2
- 2
mallinkAdmin/src/main/java/com/iformall/controller/WxCardPayController.java Wyświetl plik

@@ -148,8 +148,8 @@ public class WxCardPayController extends BaseController {
}
MallUserInfo user = getUser();
wxCardSpend.setTenantId(user.getTenantId());
int num = wxCardSpendService.update(wxCardSpend);
return new ResultData(num);
wxCardSpendService.update(wxCardSpend);
return new ResultData();
}

@ApiOperation("卡完结")


+ 8
- 0
mallinkService/src/main/java/com/iformall/domain/po/WxCardSpend.java Wyświetl plik

@@ -77,6 +77,14 @@ public class WxCardSpend implements Serializable {
@Transient
protected String payStatusStr;

@Transient
@io.swagger.annotations.ApiModelProperty(value="开始时间",name="startdate")
private Date startdate;

@Transient
@io.swagger.annotations.ApiModelProperty(value="结束时间",name="enddate")
private Date enddate;

public static enum Field
{
Id_ASC("`id` ASC"),Id_DESC("`id` DESC")


+ 0
- 7
mallinkService/src/main/java/com/iformall/domain/vo/WxCardSpendVo.java Wyświetl plik

@@ -40,11 +40,4 @@ public class WxCardSpendVo extends WxCardSpend {
@io.swagger.annotations.ApiModelProperty(value="持有人绑定的手机号",name="ouPhone")
private String ouPhone;

@Transient
@io.swagger.annotations.ApiModelProperty(value="开始时间",name="startdate")
private Date startdate;

@Transient
@io.swagger.annotations.ApiModelProperty(value="结束时间",name="enddate")
private Date enddate;
}

+ 1
- 1
mallinkService/src/main/java/com/iformall/mapper/WxCardSpendMapper.java Wyświetl plik

@@ -9,7 +9,7 @@ public interface WxCardSpendMapper extends CommonMapper<WxCardSpend, Long> {

List<WxCardSpend> findList(WxCardSpend wxCardSpend);

int updateByCond(WxCardSpend wxCardSpend);
void updateByCond(WxCardSpend wxCardSpend);

List<WxCardSpendVo> findCardSpendVoList(WxCardSpend wxCardSpend);



+ 1
- 1
mallinkService/src/main/java/com/iformall/service/WxCardSpendService.java Wyświetl plik

@@ -73,7 +73,7 @@ public interface WxCardSpendService {
*
* @param record
*/
int update(WxCardSpend record);
void update(WxCardSpend record);

/**
* 卡完结


+ 2
- 3
mallinkService/src/main/java/com/iformall/service/impl/WxCardSpendServiceImpl.java Wyświetl plik

@@ -275,7 +275,7 @@ public class WxCardSpendServiceImpl implements WxCardSpendService {
}

@Override
public int update(WxCardSpend record) {
public void update(WxCardSpend record) {
// 1. 检查符合条件的卡消费记录是否已支付
List<WxCardSpend> cardSpends = wxCardSpendMapper.findList(record);
if (cardSpends.stream().anyMatch((cs->(!cs.getPayStatus().equals(EnumCardSpendStatus.NOT_PAY.getCode()))))){
@@ -284,8 +284,7 @@ public class WxCardSpendServiceImpl implements WxCardSpendService {
// 2. 更新支付状态
record.setPayStatus(EnumCardSpendStatus.MANUAL_PAY.getCode());
record.setUpdateDate(new Date());
int num = wxCardSpendMapper.updateByCond(record);
return num;
wxCardSpendMapper.updateByCond(record);
}

@Override


+ 233
- 218
mallinkService/src/main/resources/mapper/WxCardSpendMapper.xml Wyświetl plik

@@ -1,136 +1,151 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.iformall.mapper.WxCardSpendMapper">
<resultMap id="BaseResultMap" type="com.iformall.domain.po.WxCardSpend">
<id column="id" jdbcType="BIGINT" property="id" />
<result column="tenant_id" jdbcType="VARCHAR" property="tenantId" />
<result column="card_id" jdbcType="BIGINT" property="cardId" />
<result column="owner_id" jdbcType="BIGINT" property="ownerId" />
<result column="merchant_id" jdbcType="BIGINT" property="merchantId" />
<result column="order_id" jdbcType="BIGINT" property="orderId" />
<result column="deduction_amount" jdbcType="INTEGER" property="deductionAmount" />
<result column="payment" jdbcType="INTEGER" property="payment" />
<result column="real_payment" jdbcType="INTEGER" property="realPayment" />
<result column="card_remain_amount" jdbcType="INTEGER" property="cardRemainAmount" />
<result column="card_before_amount" jdbcType="INTEGER" property="cardBeforeAmount" />
<result column="card_remain_real_amount" jdbcType="INTEGER" property="cardRemainRealAmount" />
<result column="card_before_real_amount" jdbcType="INTEGER" property="cardBeforeRealAmount" />
<result column="create_date" jdbcType="TIMESTAMP" property="createDate" />
<result column="update_date" jdbcType="TIMESTAMP" property="updateDate" />
<result column="pay_status" jdbcType="INTEGER" property="payStatus" />
</resultMap>
<sql id="allColumns">
<resultMap id="BaseResultMap" type="com.iformall.domain.po.WxCardSpend">
<id column="id" jdbcType="BIGINT" property="id"/>
<result column="tenant_id" jdbcType="VARCHAR" property="tenantId"/>
<result column="card_id" jdbcType="BIGINT" property="cardId"/>
<result column="owner_id" jdbcType="BIGINT" property="ownerId"/>
<result column="merchant_id" jdbcType="BIGINT" property="merchantId"/>
<result column="order_id" jdbcType="BIGINT" property="orderId"/>
<result column="deduction_amount" jdbcType="INTEGER" property="deductionAmount"/>
<result column="payment" jdbcType="INTEGER" property="payment"/>
<result column="real_payment" jdbcType="INTEGER" property="realPayment"/>
<result column="card_remain_amount" jdbcType="INTEGER" property="cardRemainAmount"/>
<result column="card_before_amount" jdbcType="INTEGER" property="cardBeforeAmount"/>
<result column="card_remain_real_amount" jdbcType="INTEGER" property="cardRemainRealAmount"/>
<result column="card_before_real_amount" jdbcType="INTEGER" property="cardBeforeRealAmount"/>
<result column="create_date" jdbcType="TIMESTAMP" property="createDate"/>
<result column="update_date" jdbcType="TIMESTAMP" property="updateDate"/>
<result column="pay_status" jdbcType="INTEGER" property="payStatus"/>
</resultMap>
<sql id="allColumns">
`id`,`tenant_id`,`card_id`,`owner_id`,`merchant_id`,`order_id`,`deduction_amount`,`payment`,`real_payment`,
`card_remain_amount`,`card_before_amount`,`card_remain_real_amount`,`card_before_real_amount`,
`create_date`,`update_date`, `pay_status`
</sql>

<sql id="dynamicWhereConditions">
where 1 = 1
<if test=" null != id ">
and `id` = #{id}
</if>
<if test=" null != tenantId ">
and `tenant_id` = #{tenantId}
</if>
<if test=" null != cardId ">
and `card_id` = #{cardId}
</if>
<if test=" null != ownerId ">
and `owner_id` = #{ownerId}
</if>
<if test=" null != merchantId ">
and `merchant_id` = #{merchantId}
</if>
<if test=" null != orderId ">
and `order_id` = #{orderId}
</if>
<sql id="dynamicWhereConditions">
where 1 = 1
<if test=" null != id ">
and `id` = #{id}
</if>
<if test=" null != tenantId ">
and `tenant_id` = #{tenantId}
</if>
<if test=" null != cardId ">
and `card_id` = #{cardId}
</if>
<if test=" null != ownerId ">
and `owner_id` = #{ownerId}
</if>
<if test=" null != merchantId ">
and `merchant_id` = #{merchantId}
</if>
<if test=" null != orderId ">
and `order_id` = #{orderId}
</if>
<if test=" null != deductionAmount ">
and `deduction_amount` = #{deductionAmount}
</if>
<if test=" null != payment ">
and `payment` = #{payment}
</if>
<if test=" null != realPayment ">
and `real_payment` = #{realPayment}
</if>
<if test=" null != cardRemainAmount ">
and `card_remain_amount` = #{cardRemainAmount}
</if>
<if test=" null != cardBeforeAmount ">
and `card_before_amount` = #{cardBeforeAmount}
</if>
<if test=" null != realPayment ">
and `real_payment` = #{realPayment}
</if>
<if test=" null != cardRemainAmount ">
and `card_remain_amount` = #{cardRemainAmount}
</if>
<if test=" null != cardBeforeAmount ">
and `card_before_amount` = #{cardBeforeAmount}
</if>
<if test=" null != cardRemainRealAmount ">
and `card_remain_real_amount` = #{cardRemainRealAmount}
</if>
<if test=" null != cardBeforeRealAmount ">
and `card_before_real_amount` = #{cardBeforeRealAmount}
</if>
<if test=" null != createDate ">
and `create_date` = #{createDate}
</if>
<if test=" null != updateDate ">
and `update_date` = #{updateDate}
</if>
<if test=" null != payStatus ">
and `pay_status` = #{payStatus}
</if>
<if test=" null != startdate and null!=enddate">
and `create_date` between #{startdate} and #{enddate}
</if>
<if test=" null != ids ">
and id in
<foreach collection="ids" index="index" item="idItem" open="(" separator="," close=")">
#{idItem}
</foreach>
</if>
<if test=" null != sortColumns"> order by ${sortColumns} </if>
</sql>
<select id="findList" parameterType="com.iformall.domain.po.WxCardSpend" resultMap="BaseResultMap">
select <include refid="allColumns" /> from wx_card_spend
<include refid="dynamicWhereConditions" />
</select>
<if test=" null != createDate ">
and `create_date` = #{createDate}
</if>
<if test=" null != updateDate ">
and `update_date` = #{updateDate}
</if>
<if test=" null != payStatus ">
and `pay_status` = #{payStatus}
</if>
<if test=" null != startdate and null!=enddate">
and `create_date` between #{startdate} and #{enddate}
</if>
<if test=" null != ids ">
and id in
<foreach collection="ids" index="index" item="idItem" open="(" separator="," close=")">
#{idItem}
</foreach>
</if>
<if test=" null != sortColumns">order by ${sortColumns}</if>
</sql>

<select id="findList" parameterType="com.iformall.domain.po.WxCardSpend" resultMap="BaseResultMap">
select
<include refid="allColumns"/>
from wx_card_spend
<include refid="dynamicWhereConditions"/>
</select>

<select id="updateByCond" parameterType="com.iformall.domain.po.WxCardSpend" resultMap="BaseResultMap">
update wx_card_spend
set `pay_status` = #{payStatus}
<include refid="dynamicWhereConditions" />
</select>
<select id="updateByCond" parameterType="com.iformall.domain.po.WxCardSpend">
update wx_card_spend
set `pay_status` = #{payStatus}, `update_date` = #{updateDate}
<where>
<if test=" null != tenantId ">
and `tenant_id` = #{tenantId}
</if>
<if test=" null != startdate and null!=enddate">
and `create_date` between #{startdate} and #{enddate}
</if>
<if test=" null != ids ">
and id in
<foreach collection="ids" index="index" item="idItem" open="(" separator="," close=")">
#{idItem}
</foreach>
</if>
</where>
</select>


<resultMap id="VoResultMap" type="com.iformall.domain.vo.WxCardSpendVo">
<id column="id" jdbcType="BIGINT" property="id" />
<result column="tenant_id" jdbcType="VARCHAR" property="tenantId" />
<result column="card_id" jdbcType="BIGINT" property="cardId" />
<result column="owner_id" jdbcType="BIGINT" property="ownerId" />
<result column="merchant_id" jdbcType="BIGINT" property="merchantId" />
<result column="order_id" jdbcType="BIGINT" property="orderId" />
<result column="deduction_amount" jdbcType="INTEGER" property="deductionAmount" />
<result column="payment" jdbcType="INTEGER" property="payment" />
<result column="real_payment" jdbcType="INTEGER" property="realPayment" />
<result column="card_remain_amount" jdbcType="INTEGER" property="cardRemainAmount" />
<result column="card_before_amount" jdbcType="INTEGER" property="cardBeforeAmount" />
<result column="card_remain_real_amount" jdbcType="INTEGER" property="cardRemainRealAmount" />
<result column="card_before_real_amount" jdbcType="INTEGER" property="cardBeforeRealAmount" />
<result column="create_date" jdbcType="TIMESTAMP" property="createDate" />
<result column="update_date" jdbcType="TIMESTAMP" property="updateDate" />
<result column="pay_status" jdbcType="INTEGER" property="payStatus" />
<resultMap id="VoResultMap" type="com.iformall.domain.vo.WxCardSpendVo">
<id column="id" jdbcType="BIGINT" property="id"/>
<result column="tenant_id" jdbcType="VARCHAR" property="tenantId"/>
<result column="card_id" jdbcType="BIGINT" property="cardId"/>
<result column="owner_id" jdbcType="BIGINT" property="ownerId"/>
<result column="merchant_id" jdbcType="BIGINT" property="merchantId"/>
<result column="order_id" jdbcType="BIGINT" property="orderId"/>
<result column="deduction_amount" jdbcType="INTEGER" property="deductionAmount"/>
<result column="payment" jdbcType="INTEGER" property="payment"/>
<result column="real_payment" jdbcType="INTEGER" property="realPayment"/>
<result column="card_remain_amount" jdbcType="INTEGER" property="cardRemainAmount"/>
<result column="card_before_amount" jdbcType="INTEGER" property="cardBeforeAmount"/>
<result column="card_remain_real_amount" jdbcType="INTEGER" property="cardRemainRealAmount"/>
<result column="card_before_real_amount" jdbcType="INTEGER" property="cardBeforeRealAmount"/>
<result column="create_date" jdbcType="TIMESTAMP" property="createDate"/>
<result column="update_date" jdbcType="TIMESTAMP" property="updateDate"/>
<result column="pay_status" jdbcType="INTEGER" property="payStatus"/>

<result column="title" jdbcType="VARCHAR" property="title"/>

<result column="name" jdbcType="VARCHAR" property="merchantName"/>
<result column="name" jdbcType="VARCHAR" property="merchantName"/>

<result column="subsidy" jdbcType="INTEGER" property="subsidy" />
<result column="real_subsidy" jdbcType="INTEGER" property="realSubsidy" />
<result column="status" jdbcType="INTEGER" property="status" />
<result column="subsidy" jdbcType="INTEGER" property="subsidy"/>
<result column="real_subsidy" jdbcType="INTEGER" property="realSubsidy"/>
<result column="status" jdbcType="INTEGER" property="status"/>

<result column="onick_name" jdbcType="VARCHAR" property="onickName"/>
<result column="ou_phone" jdbcType="VARCHAR" property="ouPhone"/>
</resultMap>
<result column="onick_name" jdbcType="VARCHAR" property="onickName"/>
<result column="ou_phone" jdbcType="VARCHAR" property="ouPhone"/>
</resultMap>

<sql id="allVoColumns">
<sql id="allVoColumns">
cs.`id`,cs.`tenant_id`,cs.`card_id`,cs.`owner_id`,cs.`merchant_id`,cs.`order_id`,cs.`deduction_amount`,cs.`payment`,cs.`real_payment`,
cs.`card_remain_amount`,cs.`card_before_amount`,cs.`card_remain_real_amount`,cs.`card_before_real_amount`,
cs.`create_date`,cs.`update_date`, cs.`pay_status`,
@@ -139,125 +154,125 @@
ou.`nick_name` as onick_name, ou.`phone` as ou_phone
</sql>

<sql id="dynamicVoWhereConditions">
where 1 = 1
<if test=" null != id ">
and cs.`id` = #{id}
</if>
<if test=" null != tenantId ">
and cs.`tenant_id` = #{tenantId}
</if>
<if test=" null != cardId ">
and cs.`card_id` = #{cardId}
</if>
<if test=" null != ownerId ">
and cs.`owner_id` = #{ownerId}
</if>
<if test=" null != merchantId ">
and cs.`merchant_id` = #{merchantId}
</if>
<if test=" null != orderId ">
and cs.`order_id` = #{orderId}
</if>
<if test=" null != deductionAmount ">
and cs.`deduction_amount` = #{deductionAmount}
</if>
<if test=" null != payment ">
and cs.`payment` = #{payment}
</if>
<if test=" null != realPayment ">
and cs.`real_payment` = #{realPayment}
</if>
<if test=" null != cardRemainAmount ">
and cs.`card_remain_amount` = #{cardRemainAmount}
</if>
<if test=" null != cardBeforeAmount ">
and cs.`card_before_amount` = #{cardBeforeAmount}
</if>
<if test=" null != cardRemainRealAmount ">
and cs.`card_remain_real_amount` = #{cardRemainRealAmount}
</if>
<if test=" null != cardBeforeRealAmount ">
and cs.`card_before_real_amount` = #{cardBeforeRealAmount}
</if>
<if test=" null != createDate ">
and cs.`create_date` = #{createDate}
</if>
<if test=" null != updateDate ">
and cs.`update_date` = #{updateDate}
</if>
<if test=" null != payStatus ">
and cs.`pay_status` = #{payStatus}
</if>
<if test=" null != status ">
and ms.`status` = #{status}
</if>
<if test=" null != ouPhone ">
and ou.`phone` = #{ouPhone}
</if>
<if test=" null != startdate and null!=enddate">
and cs.`create_date` between #{startdate} and #{enddate}
</if>
<if test=" null != payStatusS ">
and cs.`pay_status` in
<foreach collection="payStatusS" index="index" item="sItem" open="(" separator="," close=")">
#{sItem}
</foreach>
</if>
<if test=" null != ids ">
and cs.id in
<foreach collection="ids" index="index" item="idItem" open="(" separator="," close=")">
#{idItem}
</foreach>
</if>
</sql>
<sql id="dynamicVoWhereConditions">
where 1 = 1
<if test=" null != id ">
and cs.`id` = #{id}
</if>
<if test=" null != tenantId ">
and cs.`tenant_id` = #{tenantId}
</if>
<if test=" null != cardId ">
and cs.`card_id` = #{cardId}
</if>
<if test=" null != ownerId ">
and cs.`owner_id` = #{ownerId}
</if>
<if test=" null != merchantId ">
and cs.`merchant_id` = #{merchantId}
</if>
<if test=" null != orderId ">
and cs.`order_id` = #{orderId}
</if>
<if test=" null != deductionAmount ">
and cs.`deduction_amount` = #{deductionAmount}
</if>
<if test=" null != payment ">
and cs.`payment` = #{payment}
</if>
<if test=" null != realPayment ">
and cs.`real_payment` = #{realPayment}
</if>
<if test=" null != cardRemainAmount ">
and cs.`card_remain_amount` = #{cardRemainAmount}
</if>
<if test=" null != cardBeforeAmount ">
and cs.`card_before_amount` = #{cardBeforeAmount}
</if>
<if test=" null != cardRemainRealAmount ">
and cs.`card_remain_real_amount` = #{cardRemainRealAmount}
</if>
<if test=" null != cardBeforeRealAmount ">
and cs.`card_before_real_amount` = #{cardBeforeRealAmount}
</if>
<if test=" null != createDate ">
and cs.`create_date` = #{createDate}
</if>
<if test=" null != updateDate ">
and cs.`update_date` = #{updateDate}
</if>
<if test=" null != payStatus ">
and cs.`pay_status` = #{payStatus}
</if>
<if test=" null != status ">
and ms.`status` = #{status}
</if>
<if test=" null != ouPhone ">
and ou.`phone` = #{ouPhone}
</if>
<if test=" null != startdate and null!=enddate">
and cs.`create_date` between #{startdate} and #{enddate}
</if>
<if test=" null != payStatusS ">
and cs.`pay_status` in
<foreach collection="payStatusS" index="index" item="sItem" open="(" separator="," close=")">
#{sItem}
</foreach>
</if>
<if test=" null != ids ">
and cs.id in
<foreach collection="ids" index="index" item="idItem" open="(" separator="," close=")">
#{idItem}
</foreach>
</if>
</sql>

<select id="findCardSpendVoList" parameterType="com.iformall.domain.vo.WxCardSpendVo" resultMap="VoResultMap">
select
<include refid="allVoColumns"/>
from wx_card_spend cs
<select id="findCardSpendVoList" parameterType="com.iformall.domain.vo.WxCardSpendVo" resultMap="VoResultMap">
select
<include refid="allVoColumns"/>
from wx_card_spend cs
left join wx_coupon_order co on co.id = cs.card_id
left join wx_coupon c on c.id = co.coupon_id
left join wx_merchant m on m.id = cs.merchant_id
left join wx_merchant m on m.id = cs.merchant_id
left join wx_merchant_subsidy ms on ms.order_id = cs.order_id
left join wx_c_user ou on ou.id = co.owner_id
<include refid="dynamicVoWhereConditions" />
left join wx_c_user ou on ou.id = co.owner_id
<include refid="dynamicVoWhereConditions"/>
order by cs.create_date DESC
</select>
</select>

<select id="sumCardSpendVoForMerchant" parameterType="com.iformall.domain.vo.WxCardSpendVo" resultType="hashmap">
select cs.merchant_id, m.name as merchantName,
IFNULL(SUM(cs.`deduction_amount`),0) as sum_deduction_amount,
IFNULL(SUM(cs.`payment`),0) as sum_payment,
IFNULL(SUM(cs.`real_payment`),0) as sum_real_payment,
IFNULL(SUM(ms.`subsidy`), 0) as sum_subsidy,
IFNULL(SUM(ms.`real_subsidy`), 0) as sum_real_subsidy
from wx_card_spend cs
left join wx_coupon_order co on co.id = cs.card_id
left join wx_coupon c on c.id = co.coupon_id
left join wx_merchant m on m.id = cs.merchant_id
left join wx_merchant_subsidy ms on ms.order_id = cs.order_id
left join wx_c_user ou on ou.id = co.owner_id
<include refid="dynamicVoWhereConditions"/>
group by cs.merchant_id
</select>

<select id="sumCardSpendVoForOwner" parameterType="com.iformall.domain.vo.WxCardSpendVo" resultType="hashmap">
select cs.owner_id,
IFNULL(SUM(cs.`deduction_amount`),0) as sum_deduction_amount,
IFNULL(SUM(cs.`payment`),0) as sum_payment,
IFNULL(SUM(cs.`real_payment`),0) as sum_real_payment,
IFNULL(SUM(ms.`subsidy`), 0) as sum_subsidy,
IFNULL(SUM(ms.`real_subsidy`), 0) as sum_real_subsidy
from wx_card_spend cs
left join wx_coupon_order co on co.id = cs.card_id
left join wx_coupon c on c.id = co.coupon_id
left join wx_merchant m on m.id = cs.merchant_id
left join wx_merchant_subsidy ms on ms.order_id = cs.order_id
left join wx_c_user ou on ou.id = co.owner_id
<include refid="dynamicVoWhereConditions"/>
group by cs.owner_id
</select>

<select id="sumCardSpendVoForMerchant" parameterType="com.iformall.domain.vo.WxCardSpendVo" resultType="hashmap">
select cs.merchant_id, m.name as merchantName,
IFNULL(SUM(cs.`deduction_amount`),0) as sum_deduction_amount,
IFNULL(SUM(cs.`payment`),0) as sum_payment,
IFNULL(SUM(cs.`real_payment`),0) as sum_real_payment,
IFNULL(SUM(ms.`subsidy`), 0) as sum_subsidy,
IFNULL(SUM(ms.`real_subsidy`), 0) as sum_real_subsidy
from wx_card_spend cs
left join wx_coupon_order co on co.id = cs.card_id
left join wx_coupon c on c.id = co.coupon_id
left join wx_merchant m on m.id = cs.merchant_id
left join wx_merchant_subsidy ms on ms.order_id = cs.order_id
left join wx_c_user ou on ou.id = co.owner_id
<include refid="dynamicVoWhereConditions" />
group by cs.merchant_id
</select>

<select id="sumCardSpendVoForOwner" parameterType="com.iformall.domain.vo.WxCardSpendVo" resultType="hashmap">
select cs.owner_id,
IFNULL(SUM(cs.`deduction_amount`),0) as sum_deduction_amount,
IFNULL(SUM(cs.`payment`),0) as sum_payment,
IFNULL(SUM(cs.`real_payment`),0) as sum_real_payment,
IFNULL(SUM(ms.`subsidy`), 0) as sum_subsidy,
IFNULL(SUM(ms.`real_subsidy`), 0) as sum_real_subsidy
from wx_card_spend cs
left join wx_coupon_order co on co.id = cs.card_id
left join wx_coupon c on c.id = co.coupon_id
left join wx_merchant m on m.id = cs.merchant_id
left join wx_merchant_subsidy ms on ms.order_id = cs.order_id
left join wx_c_user ou on ou.id = co.owner_id
<include refid="dynamicVoWhereConditions" />
group by cs.owner_id
</select>
</mapper>

Ładowanie…
Anuluj
Zapisz