Просмотр исходного кода

fix couponOrder export

release_toaliyun_real
winter 4 лет назад
Родитель
Сommit
7a984d0de1
18 измененных файлов: 292 добавлений и 108 удалений
  1. +3
    -0
      mallinkService/src/main/java/com/iformall/domain/po/WxMerchantBUser.java
  2. +5
    -0
      mallinkService/src/main/java/com/iformall/domain/po/WxMerchantShop.java
  3. +7
    -1
      mallinkService/src/main/java/com/iformall/domain/vo/WxCouponOrderBVo.java
  4. +31
    -0
      mallinkService/src/main/java/com/iformall/domain/vo/WxMerchantProductVo.java
  5. +1
    -0
      mallinkService/src/main/java/com/iformall/mapper/WxCouponMapper.java
  6. +3
    -0
      mallinkService/src/main/java/com/iformall/mapper/WxCouponMerchantMapper.java
  7. +1
    -0
      mallinkService/src/main/java/com/iformall/mapper/WxMerchantBUserMapper.java
  8. +2
    -0
      mallinkService/src/main/java/com/iformall/mapper/WxMerchantMapper.java
  9. +2
    -0
      mallinkService/src/main/java/com/iformall/mapper/WxMerchantShopMapper.java
  10. +2
    -0
      mallinkService/src/main/java/com/iformall/mapper/WxShopMapper.java
  11. +133
    -0
      mallinkService/src/main/java/com/iformall/service/impl/WxCouponOrderServiceImpl.java
  12. +6
    -0
      mallinkService/src/main/resources/mapper/WxCouponMapper.xml
  13. +38
    -1
      mallinkService/src/main/resources/mapper/WxCouponMerchantMapper.xml
  14. +20
    -105
      mallinkService/src/main/resources/mapper/WxCouponOrderMapper.xml
  15. +12
    -0
      mallinkService/src/main/resources/mapper/WxMerchantBUserMapper.xml
  16. +6
    -0
      mallinkService/src/main/resources/mapper/WxMerchantMapper.xml
  17. +14
    -1
      mallinkService/src/main/resources/mapper/WxMerchantShopMapper.xml
  18. +6
    -0
      mallinkService/src/main/resources/mapper/WxShopMapper.xml

+ 3
- 0
mallinkService/src/main/java/com/iformall/domain/po/WxMerchantBUser.java Просмотреть файл

@@ -9,6 +9,7 @@ import lombok.EqualsAndHashCode;


import java.util.Date;
import java.util.List;
import java.util.UUID;

@TableName(value = "wx_merchant_b_user")
@@ -24,6 +25,8 @@ public class WxMerchantBUser extends TenantEntity {
private String userPwd;
@io.swagger.annotations.ApiModelProperty(value = "商户id", name = "merchantId")
private Long merchantId;
@TableField(exist = false)
private List<Long> merchantIds;
@io.swagger.annotations.ApiModelProperty(value = "创建时间", name = "createDate")
private Date createDate;
@io.swagger.annotations.ApiModelProperty(value = "更新时间", name = "updateDate")


+ 5
- 0
mallinkService/src/main/java/com/iformall/domain/po/WxMerchantShop.java Просмотреть файл

@@ -1,11 +1,13 @@
package com.iformall.domain.po;

import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableName;
import com.iformall.domain.po.base.TenantEntity;
import lombok.Data;
import lombok.EqualsAndHashCode;

import java.util.Date;
import java.util.List;

@TableName(value = "wx_merchant_shop")
@Data
@@ -18,6 +20,9 @@ public class WxMerchantShop extends TenantEntity {
private Long merchantId;
@io.swagger.annotations.ApiModelProperty(value="商铺ID",name="shopId")
private Long shopId;
@TableField(exist = false)
private List<Long> shopIdList;
@io.swagger.annotations.ApiModelProperty(value="创建时间",name="createDate")
private Date createDate;
@io.swagger.annotations.ApiModelProperty(value="更新时间",name="updateDate")


+ 7
- 1
mallinkService/src/main/java/com/iformall/domain/vo/WxCouponOrderBVo.java Просмотреть файл

@@ -55,6 +55,9 @@ public class WxCouponOrderBVo extends WxCouponOrder {
@Excel(name = "会员手机号", width = 20, orderNum = "13")
@io.swagger.annotations.ApiModelProperty(value="c用户绑定的手机号",name="cUserPhone")
private String cUserPhone;
@io.swagger.annotations.ApiModelProperty(value="c用户编号",name="cUserId")
@TableField(exist = false)
private Long cUserId;

@Excel(name = "微信昵称", width = 20, orderNum = "14")
@io.swagger.annotations.ApiModelProperty(value="微信昵称",name="userNickName")
@@ -141,7 +144,8 @@ public class WxCouponOrderBVo extends WxCouponOrder {
@Excel(name = "所属商户", width = 50, orderNum = "3")
@io.swagger.annotations.ApiModelProperty(value="使用券商户名",name="merchantName")
private String merchantName;
@TableField(exist = false)
private List<Long> bUserIdList;

@Excel(name = "发券商户(商户注券)", width = 50, orderNum = "3")
@io.swagger.annotations.ApiModelProperty(value="发券商户(商户注券)",name="sendMerchantName")
@@ -192,6 +196,8 @@ public class WxCouponOrderBVo extends WxCouponOrder {

@TableField(exist = false)
private Long couponId;
@TableField(exist = false)
private List<Long> couponIds;

@Excel(name = "类型", width = 50, orderNum = "16", replace = {"满减券_1", "代金券_2", "团购券_3", "礼品券_4", "停车券_5", "通用券_6", "砍价券_8", "团购券_9", "预购商品_10", "可配送商品_11", "券礼包_12", "积分券_50", "积分停车券_51", "消费卡_100"})
@TableField(exist = false)


+ 31
- 0
mallinkService/src/main/java/com/iformall/domain/vo/WxMerchantProductVo.java Просмотреть файл

@@ -0,0 +1,31 @@
package com.iformall.domain.vo;

import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
import com.iformall.domain.po.base.TenantEntity;
import lombok.Data;
import lombok.EqualsAndHashCode;

import java.util.Date;
import java.util.List;

@JsonIgnoreProperties(value = {"handler"})
@Data
@EqualsAndHashCode(callSuper = true)
public class WxMerchantProductVo extends TenantEntity {

/**
*
*/
private static final long serialVersionUID = -367003237067255221L;


@io.swagger.annotations.ApiModelProperty(value = "券编码", name = "productId")
private Long productId;

@io.swagger.annotations.ApiModelProperty(value = "商户编码", name = "merchantId")
private Long merchantId;
@io.swagger.annotations.ApiModelProperty(value = "商户数", name = "merchantId")
private Integer mc;
}

+ 1
- 0
mallinkService/src/main/java/com/iformall/mapper/WxCouponMapper.java Просмотреть файл

@@ -15,6 +15,7 @@ public interface WxCouponMapper extends CommonMapper<WxCoupon, Long> {
List<WxCouponStatisVo> findCountData(@Param("tenantEntitys")List<TenantEntity> tenantEntitys, @Param("wxCoupon")WxCoupon wxCoupon);

List<WxCoupon> findList(WxCoupon wxCoupon);
List<Long> findIdList(WxCoupon wxCoupon);
List<WxCoupon> findCouponList(WxCoupon wxCoupon);

WxCoupon selectById(@Param("id")Long id,@Param("tenantId")String tenantId);


+ 3
- 0
mallinkService/src/main/java/com/iformall/mapper/WxCouponMerchantMapper.java Просмотреть файл

@@ -3,6 +3,7 @@ package com.iformall.mapper;

import com.iformall.common.CommonMapper;
import com.iformall.domain.po.WxCouponMerchant;
import com.iformall.domain.vo.WxMerchantProductVo;
import com.iformall.domain.vo.WxMerchantVo;

import java.util.List;
@@ -16,4 +17,6 @@ public interface WxCouponMerchantMapper extends CommonMapper<WxCouponMerchant, L
List<WxMerchantVo> findMerchantVoList(@Param("productId")Long productId,@Param("tenantId")String tenantId);
List<WxMerchantVo> findMerchantNameList(@Param("productId")Long productId,@Param("tenantId")String tenantId);
List<WxMerchantVo> findMerchantBaseList(@Param("productId")Long productId,@Param("tenantId")String tenantId);
List<WxMerchantProductVo> findMerchantProduct(@Param("tenantId")String tenantId,@Param("merchantIdList")List<Long> merchantIdList);
List<Long> findMerchantProductIds(@Param("tenantId")String tenantId,@Param("merchantIdList")List<Long> merchantIdList);
}

+ 1
- 0
mallinkService/src/main/java/com/iformall/mapper/WxMerchantBUserMapper.java Просмотреть файл

@@ -8,6 +8,7 @@ import com.iformall.domain.vo.WxMerchantBuInfoVo;
public interface WxMerchantBUserMapper extends CommonMapper<WxMerchantBUser, Long> {

List<WxMerchantBUser> findList(WxMerchantBUser wxMerchantBUser);
List<Long> findIdList(WxMerchantBUser wxMerchantBUser);

List<WxMerchantBuInfoVo> findSelMerchantList(WxMerchantBUser wxMerchantBUser);



+ 2
- 0
mallinkService/src/main/java/com/iformall/mapper/WxMerchantMapper.java Просмотреть файл

@@ -16,6 +16,8 @@ import java.util.Map;
public interface WxMerchantMapper extends CommonMapper<WxMerchant, Long> {

List<WxMerchant> findList(WxMerchant wxMerchant);
List<Long> findIdList(WxMerchant wxMerchant);
List<WxMerchant> findIdNameList(WxMerchant wxMerchant);


+ 2
- 0
mallinkService/src/main/java/com/iformall/mapper/WxMerchantShopMapper.java Просмотреть файл

@@ -11,6 +11,8 @@ public interface WxMerchantShopMapper extends CommonMapper<WxMerchantShop, Strin

List<WxMerchantShop> findList(WxMerchantShop wxMerchantShop);
List<Long> findMerchantIdList(WxMerchantShop wxMerchantShop);
List<Long> findShopIds(@Param("merchantId") Long merchantId);

void delShops(@Param("merchantId") Long merchantId,@Param("shopList") List<Long> shopIds);


+ 2
- 0
mallinkService/src/main/java/com/iformall/mapper/WxShopMapper.java Просмотреть файл

@@ -16,6 +16,8 @@ import java.util.Map;
public interface WxShopMapper extends CommonMapper<WxShop, String> {

List<WxShop> findList(WxShop wxShop);
List<Long> findIdList(WxShop wxShop);

List<Map<String,Object>> findListMap(WxShop record);



+ 133
- 0
mallinkService/src/main/java/com/iformall/service/impl/WxCouponOrderServiceImpl.java Просмотреть файл

@@ -171,6 +171,11 @@ public class WxCouponOrderServiceImpl implements WxCouponOrderService {
SysConfigService sysConfigService;
@Autowired
WxMerchantBUserService wxMerchantBUserService;
@Autowired
WxShopMapper wxShopMapper;
@Autowired
WxMerchantShopMapper wxMerchantShopMapper;

private final SimpleDateFormat mydateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");

@@ -335,6 +340,7 @@ public class WxCouponOrderServiceImpl implements WxCouponOrderService {

@Override
public ResultData listAdminAsPage(WxCouponOrderBVo wxCouponOrderBVo, Integer pageIndex, Integer pageSize) {
handleWxCouponOrderBVoQueryParam(wxCouponOrderBVo);
PageInfo<WxCouponOrderBVo> pageInfo = PageHelper.startPage(pageIndex, pageSize).doSelectPageInfo(() -> wxCouponOrderMapper.findListOfAdmin(wxCouponOrderBVo));
return new ResultData(pageInfo);
}
@@ -348,6 +354,131 @@ public class WxCouponOrderServiceImpl implements WxCouponOrderService {
return new ResultData(wxCouponOrderBVo);
}

private List<Long> getMerchantIdsQueryParam(WxCouponOrderBVo wxCouponOrder) {
List<Long> retMerchantIdList = new ArrayList<Long>();
boolean isConditiondQquery = false;
//根据名称查询商户
String merchantName = StringUtils.trimToNull(wxCouponOrder.getMerchantName());
if (null != merchantName) {
WxMerchant merchantQ1 = new WxMerchant();
merchantQ1.updateTenantInfo(wxCouponOrder);
merchantQ1.setName(merchantName);
List<Long> merchantIdList = wxMerchantMapper.findIdList(merchantQ1);
if (null == merchantIdList || merchantIdList.size() <= 0) {
throw new MallinkException(ErrorCode.USER_IS_EMPTY.getCode(),"商户名称查询不到商户。");
}
retMerchantIdList.addAll(merchantIdList);
isConditiondQquery = true;
}
//楼层楼座查询商户
if (null != wxCouponOrder.getBuilding() || null != wxCouponOrder.getFloor()) {
WxShop shopQ = new WxShop();
shopQ.updateTenantInfo(wxCouponOrder);
shopQ.setBuilding(Long.parseLong(String.valueOf(wxCouponOrder.getBuilding())));
shopQ.setFloor(Long.parseLong(String.valueOf(wxCouponOrder.getFloor())));
List<Long> shopIds = wxShopMapper.findIdList(shopQ);
if (null == shopIds || shopIds.size() <= 0 ){
throw new MallinkException(ErrorCode.USER_IS_EMPTY.getCode(),"楼座楼层提交查询不到店铺信息.");
}
WxMerchantShop wxMerchantShopQ = new WxMerchantShop();
wxMerchantShopQ.updateTenantInfo(wxCouponOrder);
wxMerchantShopQ.setShopIdList(shopIds);
wxMerchantShopQ.setIsDel(0);
List<Long> buildMerchantIdList = wxMerchantShopMapper.findMerchantIdList(wxMerchantShopQ);
if (null == buildMerchantIdList || buildMerchantIdList.size() <= 0 ){
throw new MallinkException(ErrorCode.USER_IS_EMPTY.getCode(),"楼座楼层对应店铺无商户绑定记录.");
}
retMerchantIdList.retainAll(buildMerchantIdList);
isConditiondQquery = true;
}
if (isConditiondQquery) {
if (null == retMerchantIdList || retMerchantIdList.size() <= 0 ) {
throw new MallinkException(ErrorCode.USER_IS_EMPTY.getCode(),"根据条件交集未查询到商户记录.");
}else {
return retMerchantIdList;
}
}else {
return null;
}
}
private void handleWxCouponOrderBVoQueryParam(WxCouponOrderBVo wxCouponOrder) {
String cuserPhone = StringUtils.trimToNull(wxCouponOrder.getcuserPhone());
if (null != cuserPhone) {
WxCUserBasicInfo basicInfo = wxCUserBasicInfoService.findInfoByPhone(wxCouponOrder, cuserPhone);
if (null != basicInfo) {
wxCouponOrder.setCUserId(basicInfo.getId());
}else {
throw new MallinkException(ErrorCode.USER_IS_EMPTY.getCode(),"手机号查询不到会员信息。");
}
}
List<Long> merchantIdListQueryParam = getMerchantIdsQueryParam(wxCouponOrder);
List<Long> merchantProductIds = null;
if (null != merchantIdListQueryParam) {
//查询商户券
merchantProductIds = wxCouponMerchantMapper.findMerchantProductIds(wxCouponOrder.getTenantId(), merchantIdListQueryParam);
if (null == merchantProductIds || merchantProductIds.size() <= 0) {
throw new MallinkException(ErrorCode.USER_IS_EMPTY.getCode(),"商户下查询不到券信息。");
}
}
List<Long> couponIds = null;
String title = StringUtils.trimToNull(wxCouponOrder.getTitle());
if (null != title || null != wxCouponOrder.getType() || null != wxCouponOrder.getBusiness() || null != wxCouponOrder.getSourceType()) {
WxCoupon wxCouponQuery = new WxCoupon();
wxCouponQuery.updateTenantInfo(wxCouponOrder);
wxCouponQuery.setTitle(title);
wxCouponQuery.setType(wxCouponOrder.getType());
wxCouponQuery.setBusiness(wxCouponOrder.getBusiness());
wxCouponQuery.setSourceType(wxCouponOrder.getSourceType());
couponIds = wxCouponMapper.findIdList(wxCouponQuery);
if (null == couponIds || couponIds.size() <= 0) {
throw new MallinkException(ErrorCode.USER_IS_EMPTY.getCode(),"根据券条件搜索不到券信息。");
}
}
//merchantProducts 和 couponIds 取交集
if (null != merchantProductIds) {
if (null != couponIds) {
//取交集
merchantProductIds.retainAll(couponIds);
}
wxCouponOrder.setCouponIds(merchantProductIds);
}else {
if (null != couponIds) {
wxCouponOrder.setCouponIds(couponIds);
}
}
//核销商户
String verifyMerchantName = StringUtils.trimToNull(wxCouponOrder.getVerifyMerchantName());
if (null != verifyMerchantName) {
WxMerchant merchantQ2 = new WxMerchant();
merchantQ2.updateTenantInfo(wxCouponOrder);
merchantQ2.setName(verifyMerchantName);
List<Long> merchantIds = wxMerchantMapper.findIdList(merchantQ2);
if (null == merchantIds || merchantIds.size() <= 0 ){
throw new MallinkException(ErrorCode.USER_IS_EMPTY.getCode(),"核销商户名称查询不到商户记录.");
}
WxMerchantBUser merchantBUserQ = new WxMerchantBUser();
merchantBUserQ.setMerchantIds(merchantIds);
List<Long> bUserIdList = wxMerchantBUserMapper.findIdList(merchantBUserQ);
if (null == bUserIdList || bUserIdList.size() <= 0 ){
throw new MallinkException(ErrorCode.USER_IS_EMPTY.getCode(),"核销商户下查询不到员工信息.");
}
wxCouponOrder.setBUserIdList(bUserIdList);
}
}
@Override
public void exportData(WxCouponOrderBVo wxCouponOrder, HttpServletRequest request, HttpServletResponse response) {
String filename = "券订单";
@@ -364,6 +495,8 @@ public class WxCouponOrderServiceImpl implements WxCouponOrderService {
});
}
handleWxCouponOrderBVoQueryParam(wxCouponOrder);
List<WxCouponOrderBVo> list = wxCouponOrderMapper.findListOfAdmin(wxCouponOrder);
list.parallelStream().forEach(c -> {
if (c.getCouponOrderStatus().equals(EnumCouponOrderStatus.COUPON_ORDER_USE_WAIT.getCode())) {


+ 6
- 0
mallinkService/src/main/resources/mapper/WxCouponMapper.xml Просмотреть файл

@@ -323,6 +323,12 @@
from wx_coupon c
<include refid="dynamicWhereConditions"/>
</select>
<select id="findIdList" parameterType="com.iformall.domain.po.WxCoupon" resultType="Long">
select id
from wx_coupon c
<include refid="dynamicWhereConditions"/>
</select>

<update id="updateStockAndValidDate" parameterType="com.iformall.domain.po.WxCoupon">
update wx_coupon


+ 38
- 1
mallinkService/src/main/resources/mapper/WxCouponMerchantMapper.xml Просмотреть файл

@@ -133,6 +133,43 @@
where cm.status = 0
and cm.product_id = #{productId} and cm.tenant_id = #{tenantId}
</select>

<resultMap id="MerchantProductVoResultMap" type="com.iformall.domain.vo.WxMerchantProductVo">
<result column="product_id" jdbcType="BIGINT" property="productId"/>
<result column="merchant_id" jdbcType="BIGINT" property="merchantId"/>
<result column="mc" jdbcType="Integer" property="mc"/>
</resultMap>
<select id = "findMerchantProduct" parameterType="java.util.Map" resultMap="MerchantProductVoResultMap">
SELECT wcm.product_id,wcm.merchant_id,COUNT(1) AS mc
FROM wx_coupon_merchant wcm
WHERE STATUS = 0
<if test=" null != tenantId and '' != tenantId">
and wcm.`tenant_id` = #{tenantId}
</if>
<if test=" null != merchantIdList">
and wcm.merchant_id in
<foreach collection="merchantIdList" index="index" item="merchantIdItem" open="(" separator="," close=")">
#{merchantIdItem}
</foreach>
</if>
GROUP BY product_id
</select>
<select id = "findMerchantProductIds" parameterType="java.util.Map" resultType="Long">
SELECT distinct wcm.product_id
FROM wx_coupon_merchant wcm
WHERE STATUS = 0
<if test=" null != tenantId and '' != tenantId">
and wcm.`tenant_id` = #{tenantId}
</if>
<if test=" null != merchantIdList">
and wcm.merchant_id in
<foreach collection="merchantIdList" index="index" item="merchantIdItem" open="(" separator="," close=")">
#{merchantIdItem}
</foreach>
</if>
</select>

</mapper>

+ 20
- 105
mallinkService/src/main/resources/mapper/WxCouponOrderMapper.xml Просмотреть файл

@@ -872,34 +872,6 @@
<result column="send_merchant_id" jdbcType="INTEGER" property="sendMerchantId" />
</resultMap>

<sql id="allAdminCouponOrderListColumns">
<!--
co.id,co.tenant_id,co.parent_tenant_id,co.coupon_id,co.coupon_type,co.expired_time,co.coupon_order_status,co.create_date,co.update_date,co.coupon_price,
c.title,c.sale_price,c.use_price,c.price,c.unit,c.auto_refund,c.business,c.subsidy_type,ms.subsidy subsidy_num,

(case when com.mc=1 then
(select m.name from wx_merchant m, wx_coupon_merchant cm
where m.id = cm.merchant_id and cm.product_id=co.coupon_id and cm.status = 0) else '[多商户通用]' end) as merchant_name,
(case when com.mc = 1 then (select m.id from wx_merchant m,
wx_coupon_merchant cm where m.id = cm.merchant_id and cm.product_id = co.coupon_id
and cm.status = 0) else 0 end) as merchant_id,
cu.phone,bu.verify_merchant_name,cal.channel_type

(case when couc.mc = 1 then m1.name else '[多商户通用]' end) as merchant_name,
(case when couc.mc = 1 then m1.id else 0 end) as merchant_id,
cu.phone,m2.name as verify_merchant_name,cal.channel_type
-->

co.id,co.tenant_id,co.parent_tenant_id,co.coupon_id,co.coupon_type,co.expired_time,co.coupon_order_status,co.order_id,
co.create_date,co.update_date,co.coupon_price, co.verify_type, co.verify_remark,co.pay_vendor,
co.`freight_price`,co.`shipping_type`,co.`shipping_address`,co.`shipping_status`,co.`delivery_info`,
c.title,c.sale_price,c.use_price,c.price,
co.send_merchant_id,c.unit,c.auto_refund,c.business,c.subsidy_type,c.source_type,ms.subsidy subsidy_num,
(CASE WHEN couc.mc = 1 THEN m1.name ELSE '[多商户通用]' END) AS merchant_name,
(CASE WHEN couc.mc = 1 THEN m1.id ELSE 0 END) AS merchant_id,
cu.phone,cu.nick_name,m2.name AS verify_merchant_name,cal.channel_type
</sql>

<sql id="allAdminCouponOrderDetailColumns">
co.id,co.tenant_id,co.parent_tenant_id,co.coupon_id,co.coupon_type,co.c_user_id,co.owner_id,co.b_user_id,
co.order_id,co.expired_time,co.coupon_order_status,co.create_date,co.update_date,co.coupon_price,co.verify_type,co.verify_remark, co.pay_vendor,
@@ -911,23 +883,10 @@
</sql>

<select id="findListOfAdmin" parameterType="com.iformall.domain.vo.WxCouponOrderBVo" resultMap="AdminBVoResultMap">
select <include refid="allAdminCouponOrderListColumns" />

FROM (
SELECT wcm.product_id,wcm.merchant_id,COUNT(1) AS mc
FROM wx_coupon_merchant wcm
WHERE STATUS = 0
<if test=" null != tenantId and '' != tenantId">
and wcm.`tenant_id` = #{tenantId}
</if>
<if test=" null != parentTenantId and '' != parentTenantId">
and wcm.`parent_tenant_id` = #{parentTenantId}
</if>
GROUP BY product_id) couc
RIGHT JOIN (
SELECT co.id,co.tenant_id,co.parent_tenant_id,co.coupon_id,co.c_user_id,co.b_user_id,co.order_id,co.coupon_type,
co.expired_time,co.coupon_order_status,co.create_date,co.update_date,co.coupon_price,co.auto_refund,co.verify_type,co.verify_remark,co.pay_vendor
,co.send_merchant_id,co.`freight_price`,co.`shipping_type`,co.`shipping_address`,co.`shipping_status`,co.`delivery_info`
select co.id,co.tenant_id,co.parent_tenant_id,co.coupon_id,co.coupon_type,co.expired_time,co.coupon_order_status,co.order_id,
co.create_date,co.update_date,co.coupon_price, co.verify_type, co.verify_remark,co.pay_vendor,
co.`freight_price`,co.`shipping_type`,co.`shipping_address`,co.`shipping_status`,co.`delivery_info`,
co.coupon_id
FROM wx_coupon_order co WHERE 1=1
<if test=" null != tenantId and '' != tenantId">
and co.`tenant_id` = #{tenantId}
@@ -935,15 +894,6 @@
<if test=" null != parentTenantId and '' != parentTenantId">
and co.`parent_tenant_id` = #{parentTenantId}
</if>
) co
ON co.coupon_id = couc.product_id
LEFT JOIN wx_c_user_basic_info cu ON cu.id=co.c_user_id
LEFT JOIN wx_coupon c ON c.id = co.coupon_id
LEFT JOIN wx_merchant m1 ON m1.id = couc.merchant_id
LEFT JOIN wx_merchant_subsidy ms ON co.id = ms.coupon_order_id AND ms.type = 1
LEFT JOIN wx_merchant_b_user mbu ON mbu.id = co.b_user_id LEFT JOIN wx_merchant m2 ON m2.id = mbu.merchant_id
LEFT JOIN wx_coupon_action_log cal ON cal.coupon_order_id = co.id AND cal.coupon_id = co.coupon_id
where 1=1
<choose>
<when test=" null != couponType">
and co.coupon_type = #{couponType}
@@ -962,10 +912,6 @@
<if test=" null != parentTenantId and '' != parentTenantId">
and co.`parent_tenant_id` = #{parentTenantId}
</if>
<if test=" null != cUserPhone and '' != cUserPhone">
and cu.`phone` = #{cUserPhone}
</if>

<if test=" null != couponOrderStatus ">
and co.coupon_order_status = #{couponOrderStatus}
</if>
@@ -977,20 +923,6 @@
<if test=" null != shippingStatus ">
and co.`shipping_status` = #{shippingStatus}
</if>
<if test=" null != merchantName and merchantName!=''">

and (case when couc.mc=1
then
m1.name
<!--(select m.name from wx_merchant m, wx_coupon_merchant cm
where m.id = cm.merchant_id
and cm.product_id=co.coupon_id
and cm.status = 0)-->
else'[多商户通用]' end)
like concat('%', #{merchantName},'%')
</if>

<if test="startDate != null">
AND co.create_date &gt; #{startDate,jdbcType=TIMESTAMP}
</if>
@@ -1006,7 +938,6 @@
<if test="verifyEndDate != null">
AND co.update_date &lt; #{verifyEndDate,jdbcType=TIMESTAMP}
</if>
<if test=" null != id ">
and co.id = #{id}
</if>
@@ -1014,46 +945,30 @@
and co.order_id = #{orderId}
</if>
<if test=" null != couponId ">
and c.id = #{couponId}
</if>
<if test=" null != title ">
and c.title like concat('%', #{title},'%')
</if>
<if test=" null != type ">
and c.`type` = #{type}
</if>
<if test=" null != business ">
and c.business = #{business}
and co.coupon_id = #{couponId}
</if>
<if test=" null != sourceType ">
and c.`source_type` = #{sourceType}
<if test=" null != cUserId and '' != cUserId">
and co.c_user_id = #{cUserId}
</if>
<if test=" null != verifyMerchantName and ''!= verifyMerchantName ">
and bu.verify_merchant_name = #{verifyMerchantName}
<if test=" null != couponIds">
and co.coupon_id in
<foreach collection="couponIds" index="index" item="couponIdItem" open="(" separator="," close=")">
#{couponIdItem}
</foreach>
</if>
<if test="null!=building">
and co.coupon_id in(
select cm.product_id from wx_merchant_shop ms left join wx_merchant m on ms.merchant_id=m.id
left join wx_shop s on ms.shop_id=s.id
left join wx_coupon_merchant cm on ms.merchant_id=cm.merchant_id
where ms.is_del=0 and s.building=#{building}
<if test=" null != tenantId and '' != tenantId">
and ms.`tenant_id` = #{tenantId}
</if>
<if test=" null != parentTenantId and '' != parentTenantId">
and ms.`parent_tenant_id` = #{parentTenantId}
</if>
<if test="null!=floor">
and s.floor=#{floor}
</if>
)
<if test=" null != bUserIdList">
and co.b_user_id in
<foreach collection="bUserIdList" index="index" item="bUserIdItem" open="(" separator="," close=")">
#{bUserIdItem}
</foreach>
</if>
<if test=" null != sortColumns"> order by ${sortColumns} </if>
<if test=" null == sortColumns">order by co.create_date desc,co.id desc</if>
<if test=" null == sortColumns">order by co.create_date desc,co.id desc</if>
</select>


<select id="findGoodsList" parameterType="com.iformall.domain.vo.WxCouponOrderBVo" resultMap="AdminBVoResultMap">
select
co.id,co.tenant_id,co.parent_tenant_id,co.coupon_id,co.coupon_type,co.c_user_id,co.owner_id,co.b_user_id,


+ 12
- 0
mallinkService/src/main/resources/mapper/WxMerchantBUserMapper.xml Просмотреть файл

@@ -78,6 +78,12 @@
#{idItem}
</foreach>
</if>
<if test=" null != merchantIds ">
and merchant_id in
<foreach collection="merchantIds" index="index" item="merchantIdItem" open="(" separator="," close=")">
#{merchantIdItem}
</foreach>
</if>
<if test=" null != sortColumns">order by ${sortColumns}</if>

</sql>
@@ -88,6 +94,12 @@
from wx_merchant_b_user
<include refid="dynamicWhereConditions"/>
</select>
<select id="findIdList" parameterType="com.iformall.domain.po.WxMerchantBUser" resultType="Long">
select id
from wx_merchant_b_user
<include refid="dynamicWhereConditions"/>
</select>

<select id="findSelMerchantList" parameterType="com.iformall.domain.po.WxMerchantBUser" resultType="com.iformall.domain.vo.WxMerchantBuInfoVo">
select


+ 6
- 0
mallinkService/src/main/resources/mapper/WxMerchantMapper.xml Просмотреть файл

@@ -207,6 +207,12 @@
from wx_merchant m
<include refid="dynamicWhereConditions"/>
</select>
<select id="findIdList" parameterType="com.iformall.domain.po.WxMerchant" resultType="Long">
select id
from wx_merchant m
<include refid="dynamicWhereConditions"/>
</select>

<select id="findFollowList" parameterType="com.iformall.domain.po.WxMerchant" resultMap="BaseResultMap">
select


+ 14
- 1
mallinkService/src/main/resources/mapper/WxMerchantShopMapper.xml Просмотреть файл

@@ -60,7 +60,14 @@
<foreach collection="ids" index="index" item="idItem" open="(" separator="," close=")">
#{idItem}
</foreach>
</if>
</if>
<if test=" null != shopIdList ">
and shop_id in
<foreach collection="shopIdList" index="index" item="shopIdItem" open="(" separator="," close=")">
#{idItem}
</foreach>
</if>
<if test=" null != sortColumns"> order by ${sortColumns} </if>
</sql>
@@ -71,6 +78,12 @@
<include refid="dynamicWhereConditions" />
</select>
<select id="findMerchantIdList" parameterType="com.iformall.domain.po.WxMerchantShop" resultType="Long">
select distinct merchant_id
from wx_merchant_shop
<include refid="dynamicWhereConditions" />
</select>
<select id="findShopIds" parameterType="Long" resultType="Long">
select shop_id from wx_merchant_shop where `merchant_id` = #{merchantId} and is_del = 0
</select>


+ 6
- 0
mallinkService/src/main/resources/mapper/WxShopMapper.xml Просмотреть файл

@@ -145,6 +145,12 @@
from wx_shop
<include refid="dynamicWhereConditions"/>
</select>
<select id="findIdList" parameterType="com.iformall.domain.po.WxShop" resultType="Long">
select id
from wx_shop
<include refid="dynamicWhereConditions"/>
</select>

<select id="selectBatchByIds" resultMap="BaseResultMap">
select


Загрузка…
Отмена
Сохранить