优惠卷列表 添加 店铺名称
This commit is contained in:
@@ -33,7 +33,7 @@ public interface TbActivateInRecordMapper {
|
||||
List<TbActivateInRecord> queryAll(TbActivateInRecord tbActivateInRecord);
|
||||
|
||||
List<TbProduct> queryByVipIdAndShopId(@Param("vipUserId") Integer vipUserId, @Param("shopId") Integer shopId);
|
||||
List<UserCouponVo> queryVipPro(@Param("vipUserId") Integer vipUserId, @Param("shopId") Integer shopId);
|
||||
List<UserCouponVo> queryVipPro(@Param("vipUserId") Integer vipUserId, @Param("shopId") Integer shopId,@Param("shopName")String shopName);
|
||||
int queryByVipIdAndShopIdAndProId(@Param("vipUserId") Integer vipUserId, @Param("shopId") Integer shopId,@Param("productId") Integer productId);
|
||||
List<TbActivateInRecord> queryAllByVipIdAndShopIdAndProId(@Param("vipUserId") Integer vipUserId, @Param("shopId") Integer shopId,@Param("productId") Integer productId);
|
||||
|
||||
|
||||
@@ -30,7 +30,7 @@ public interface TbActivateOutRecordMapper {
|
||||
*/
|
||||
List<TbActivateOutRecord> queryAll(TbActivateOutRecord tbActivateOutRecord);
|
||||
|
||||
List<UserCouponVo> queryVipPro(@Param("vipUserId") Integer vipUserId, @Param("shopId") Integer shopId);
|
||||
List<UserCouponVo> queryVipPro(@Param("vipUserId") Integer vipUserId, @Param("shopId") Integer shopId, @Param("shopName") String shopName);
|
||||
|
||||
|
||||
/**
|
||||
|
||||
@@ -14,6 +14,7 @@ public class UserCouponVo {
|
||||
* 卷描述
|
||||
*/
|
||||
private String detail;
|
||||
private String shopName;
|
||||
/**
|
||||
* 优惠金额
|
||||
*/
|
||||
|
||||
@@ -1,9 +1,7 @@
|
||||
package com.chaozhanggui.system.cashierservice.service.impl;
|
||||
|
||||
import com.chaozhanggui.system.cashierservice.dao.TbActivateInRecordMapper;
|
||||
import com.chaozhanggui.system.cashierservice.dao.TbActivateOutRecordMapper;
|
||||
import com.chaozhanggui.system.cashierservice.dao.TbShopUserMapper;
|
||||
import com.chaozhanggui.system.cashierservice.dao.TbUserCouponsMapper;
|
||||
import com.chaozhanggui.system.cashierservice.dao.*;
|
||||
import com.chaozhanggui.system.cashierservice.entity.TbShopInfo;
|
||||
import com.chaozhanggui.system.cashierservice.entity.dto.UserCouponDto;
|
||||
import com.chaozhanggui.system.cashierservice.entity.vo.ShopUserListVo;
|
||||
import com.chaozhanggui.system.cashierservice.entity.vo.UserCouponVo;
|
||||
@@ -36,6 +34,8 @@ public class TbUserCouponsServiceImpl implements TbUserCouponsService {
|
||||
private TbActivateOutRecordMapper outRecordMapper;
|
||||
@Autowired
|
||||
private TbShopUserMapper tbShopUserMapper;
|
||||
@Autowired
|
||||
private TbShopInfoMapper tbShopInfoMapper;
|
||||
|
||||
|
||||
/**
|
||||
@@ -52,12 +52,13 @@ public class TbUserCouponsServiceImpl implements TbUserCouponsService {
|
||||
List<ShopUserListVo> tbShopUsers = tbShopUserMapper.selectByUserId(couponDto.getUserId().toString(), couponDto.getShopId()==null?null:couponDto.getShopId().toString());
|
||||
if (!CollectionUtils.isEmpty(tbShopUsers)) {
|
||||
tbShopUsers.forEach(s -> {
|
||||
TbShopInfo shopInfo = tbShopInfoMapper.selectByPrimaryKey(s.getShopId().intValue());
|
||||
if (couponDto.getStatus()==null || (couponDto.getStatus() != null && couponDto.getStatus() == 0)) {
|
||||
List<UserCouponVo> unuseCoupon = inRecordMapper.queryVipPro(s.getMemberId().intValue(), s.getShopId().intValue());
|
||||
List<UserCouponVo> unuseCoupon = inRecordMapper.queryVipPro(s.getMemberId().intValue(), s.getShopId().intValue(),shopInfo.getShopName());
|
||||
result.addAll(unuseCoupon);
|
||||
}
|
||||
if (couponDto.getStatus()==null || (couponDto.getStatus() != null && couponDto.getStatus() == 1)) {
|
||||
List<UserCouponVo> useCoupon = outRecordMapper.queryVipPro(s.getMemberId().intValue(), s.getShopId().intValue());
|
||||
List<UserCouponVo> useCoupon = outRecordMapper.queryVipPro(s.getMemberId().intValue(), s.getShopId().intValue(),shopInfo.getShopName());
|
||||
result.addAll(useCoupon);
|
||||
}
|
||||
});
|
||||
|
||||
@@ -40,15 +40,19 @@
|
||||
</select>
|
||||
|
||||
<select id="queryVipPro" resultType="com.chaozhanggui.system.cashierservice.entity.vo.UserCouponVo">
|
||||
SELECT tb_product.name as detail,
|
||||
0 as status,
|
||||
sum(tb_activate_in_record.over_num) as num,
|
||||
2 as type
|
||||
SELECT tb_product.name as detail,
|
||||
0 as status,
|
||||
sum(tb_activate_in_record.over_num) as num,
|
||||
<choose>
|
||||
<when test="shopName != null and shopName != ''">#{shopName}</when>
|
||||
<otherwise>''</otherwise>
|
||||
</choose> AS shopName,
|
||||
2 as type
|
||||
FROM tb_activate_in_record
|
||||
LEFT JOIN tb_product ON tb_activate_in_record.pro_id = tb_product.id
|
||||
LEFT JOIN tb_product ON tb_activate_in_record.pro_id = tb_product.id
|
||||
WHERE vip_user_id = #{vipUserId}
|
||||
and tb_activate_in_record.shop_id = #{shopId}
|
||||
and num!=0
|
||||
and tb_activate_in_record.shop_id = #{shopId}
|
||||
and num!=0
|
||||
group by tb_activate_in_record.pro_id
|
||||
</select>
|
||||
|
||||
|
||||
@@ -29,10 +29,15 @@
|
||||
|
||||
|
||||
<select id="queryVipPro" resultType="com.chaozhanggui.system.cashierservice.entity.vo.UserCouponVo">
|
||||
SELECT tb_product.NAME AS detail,
|
||||
1 AS status,
|
||||
tb_activate_out_record.use_num AS num,
|
||||
2 AS type
|
||||
SELECT tb_product.NAME AS detail,
|
||||
1 AS status,
|
||||
tb_activate_out_record.use_num AS num,
|
||||
<choose>
|
||||
<when test="shopName != null and shopName != ''">#{shopName}</when>
|
||||
<otherwise>''</otherwise>
|
||||
</choose>
|
||||
AS shopName,
|
||||
2 AS type
|
||||
FROM tb_activate_out_record
|
||||
LEFT JOIN tb_product ON tb_activate_out_record.pro_id = tb_product.id
|
||||
LEFT JOIN tb_activate_in_record ON tb_activate_in_record.id = tb_activate_out_record.give_id
|
||||
|
||||
Reference in New Issue
Block a user