From 86f2368f146af23c9e16507f790752e79858a29f Mon Sep 17 00:00:00 2001
From: Hentua <wangdoubleone@gmail.com>
Date: Thu, 22 Feb 2024 22:34:31 +0800
Subject: [PATCH] fix
---
src/main/java/cc/mrbird/febs/mall/service/impl/AdminMallGoodsService.java | 300 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++---
1 files changed, 285 insertions(+), 15 deletions(-)
diff --git a/src/main/java/cc/mrbird/febs/mall/service/impl/AdminMallGoodsService.java b/src/main/java/cc/mrbird/febs/mall/service/impl/AdminMallGoodsService.java
index 9a89674..8f4e174 100644
--- a/src/main/java/cc/mrbird/febs/mall/service/impl/AdminMallGoodsService.java
+++ b/src/main/java/cc/mrbird/febs/mall/service/impl/AdminMallGoodsService.java
@@ -2,6 +2,7 @@
import cc.mrbird.febs.common.entity.FebsResponse;
import cc.mrbird.febs.common.entity.QueryRequest;
+import cc.mrbird.febs.common.utils.AppContants;
import cc.mrbird.febs.mall.conversion.MallGoodsConversion;
import cc.mrbird.febs.mall.dto.*;
import cc.mrbird.febs.mall.entity.*;
@@ -42,6 +43,8 @@
private final MallShoppingCartMapper mallShoppingCartMapper;
private final MallCarriageRuleMapper mallCarriageRuleMapper;
private final MallCarriageRuleInfoMapper mallCarriageRuleInfoMapper;
+ private final MallGoodsCouponMapper mallGoodsCouponMapper;
+ private final CouponGoodsMapper couponGoodsMapper;
@Override
public IPage<AdminMallGoodsVo> getCategoryListInPage(MallGoods mallGoods, QueryRequest request) {
@@ -70,16 +73,18 @@
return new FebsResponse().fail().message("商品编号不能重复");
}
Integer carriageType = addMallGoodsDto.getCarriageType();
- if(1 == carriageType){
- if(ObjectUtil.isEmpty(addMallGoodsDto.getCarriageAmount())
- || BigDecimal.ZERO.compareTo(addMallGoodsDto.getCarriageAmount()) >= 0){
- return new FebsResponse().fail().message("固定邮费不能小于零");
- }
- }else{
- Long carriageRuleId = addMallGoodsDto.getCarriageRuleId();
- MallCarriageRule mallCarriageRule = mallCarriageRuleMapper.selectById(carriageRuleId);
- if(ObjectUtil.isEmpty(mallCarriageRule)){
- return new FebsResponse().fail().message("邮费模板不能为空");
+ if (addMallGoodsDto.getGoodsType() == 1) {
+ if (1 == carriageType) {
+ if (ObjectUtil.isEmpty(addMallGoodsDto.getCarriageAmount())
+ || BigDecimal.ZERO.compareTo(addMallGoodsDto.getCarriageAmount()) > 0) {
+ return new FebsResponse().fail().message("固定邮费不能小于零");
+ }
+ } else {
+ Long carriageRuleId = addMallGoodsDto.getCarriageRuleId();
+ MallCarriageRule mallCarriageRule = mallCarriageRuleMapper.selectById(carriageRuleId);
+ if (ObjectUtil.isEmpty(mallCarriageRule)) {
+ return new FebsResponse().fail().message("邮费模板不能为空");
+ }
}
}
@@ -121,6 +126,11 @@
if (StrUtil.isEmpty(presentPrice)) {
return new FebsResponse().fail().message("商品规格现价不能为空");
}
+ if (StrUtil.isEmpty(addSku.getLevelOnePrice())
+ || StrUtil.isEmpty(addSku.getLevelTwoPrice())
+ || StrUtil.isEmpty(addSku.getLevelThreePrice())) {
+ return new FebsResponse().fail().message("商品规格级别价格不能为空");
+ }
BigDecimal goodsWeight = addSku.getGoodsWeight();
if(BigDecimal.ZERO.compareTo(goodsWeight) > 0){
return new FebsResponse().fail().message("重量不能小于零");
@@ -153,6 +163,25 @@
}
}
+ Long goodsId = mallGoods.getId();
+ QueryWrapper<CouponGoods> objectQueryWrapper = new QueryWrapper<>();
+ objectQueryWrapper.eq("goods_id",goodsId);
+ List<CouponGoods> mallGoodsCoupons = couponGoodsMapper.selectList(objectQueryWrapper);
+ if(CollUtil.isNotEmpty(mallGoodsCoupons)){
+ for(CouponGoods couponGoods : mallGoodsCoupons){
+ couponGoodsMapper.deleteById(couponGoods);
+ }
+ }
+ if(CollUtil.isNotEmpty(addMallGoodsDto.getCouponIds())){
+ List<Long> couponIds = addMallGoodsDto.getCouponIds();
+ for(Long couponId : couponIds){
+ CouponGoods couponGoods = new CouponGoods();
+ couponGoods.setGoodsId(goodsId);
+ couponGoods.setCouponId(couponId);
+ couponGoodsMapper.insert(couponGoods);
+ }
+ }
+
if (addMallGoodsDto.getGoodsType() == 2) {
return new FebsResponse().success().message("添加成功");
}
@@ -171,6 +200,9 @@
sku.setCostPrice(mallGoods.getCostPrice());
sku.setPresentPrice(new BigDecimal(mallGoods.getPresentPrice()));
sku.setOriginalPrice(new BigDecimal(mallGoods.getOriginalPrice()));
+ sku.setLevelOnePrice(mallGoods.getLevelOnePrice());
+ sku.setLevelTwoPrice(mallGoods.getLevelTwoPrice());
+ sku.setLevelThreePrice(mallGoods.getLevelThreePrice());
sku.setSkuVolume(mallGoods.getVolume());
sku.setStock(mallGoods.getStock());
sku.setStyleId(style.getId());
@@ -207,11 +239,17 @@
mallGoodsSku.setStock(addMallGoodsSkuDto.getStock() == null ? 0 : addMallGoodsSkuDto.getStock());
mallGoodsSku.setSkuVolume(addMallGoodsSkuDto.getSkuVolume() == null ? 0 : addMallGoodsSkuDto.getSkuVolume());
mallGoodsSku.setOriginalPrice(new BigDecimal(addMallGoodsSkuDto.getOriginalPrice()));
- mallGoodsSku.setPresentPrice(new BigDecimal(addMallGoodsSkuDto.getPresentPrice()));
+// mallGoodsSku.setPresentPrice(new BigDecimal(addMallGoodsSkuDto.getPresentPrice()));
+ mallGoodsSku.setPresentPrice(new BigDecimal(addMallGoodsSkuDto.getOriginalPrice()));
+
+ mallGoodsSku.setLevelOnePrice(new BigDecimal(addMallGoodsSkuDto.getLevelOnePrice()));
+ mallGoodsSku.setLevelTwoPrice(new BigDecimal(addMallGoodsSkuDto.getLevelTwoPrice()));
+ mallGoodsSku.setLevelThreePrice(new BigDecimal(addMallGoodsSkuDto.getLevelThreePrice()));
mallGoodsSku.setStyleId(mallGoodsStyleSku.getId());
mallGoodsSku.setCostPrice(addMallGoodsSkuDto.getCostPrice());
mallGoodsSku.setGoodsId(mallGoods.getId());
mallGoodsSku.setGoodsWeight(addMallGoodsSkuDto.getGoodsWeight());
+ mallGoodsSku.setSample(addMallGoodsSkuDto.getSample());
mallGoodsSkuMapper.insert(mallGoodsSku);
}
}
@@ -289,8 +327,10 @@
List<MallGoodsSku> skus = mallGoodsSkuMapper.selectSkuByGoodsId(mallGoods.getId());
List<String> thumbs = mallGoodsImagesMapper.selectByGoodId(mallGoods.getId());
+ List<Long> couponIds = couponGoodsMapper.selectByGoodId(mallGoods.getId());
mallGoods.setImages(thumbs);
mallGoods.setSkus(skus);
+ mallGoods.setCouponIds(couponIds);
return mallGoods;
}
@@ -388,6 +428,12 @@
mallGoodsMapper.updateById(mallGoods);
+ if( 1 == mallGoods.getCarriageType()){
+ mallGoodsMapper.updateCarriageRuleId(mallGoods.getId());
+ }else{
+ mallGoodsMapper.updateCarriageAmount(mallGoods.getId());
+ }
+
mallGoodsImagesMapper.deleteByGoodsId(mallGoodsUpdateDto.getId());
String thumbs = mallGoodsUpdateDto.getThumbs();
if (StrUtil.isNotEmpty(thumbs)) {
@@ -402,6 +448,25 @@
mallGoodsImagesMapper.insert(mallGoodsImages);
i++;
}
+ }
+ }
+
+ Long goodsId = mallGoodsUpdateDto.getId();
+ QueryWrapper<CouponGoods> objectQueryWrapper = new QueryWrapper<>();
+ objectQueryWrapper.eq("goods_id",goodsId);
+ List<CouponGoods> mallGoodsCoupons = couponGoodsMapper.selectList(objectQueryWrapper);
+ if(CollUtil.isNotEmpty(mallGoodsCoupons)){
+ for(CouponGoods couponGoods : mallGoodsCoupons){
+ couponGoodsMapper.deleteById(couponGoods);
+ }
+ }
+ if(CollUtil.isNotEmpty(mallGoodsUpdateDto.getCouponIds())){
+ List<Long> couponIds = mallGoodsUpdateDto.getCouponIds();
+ for(Long couponId : couponIds){
+ CouponGoods couponGoods = new CouponGoods();
+ couponGoods.setGoodsId(goodsId);
+ couponGoods.setCouponId(couponId);
+ couponGoodsMapper.insert(couponGoods);
}
}
@@ -423,6 +488,9 @@
sku.setCostPrice(mallGoods.getCostPrice());
sku.setPresentPrice(new BigDecimal(mallGoods.getPresentPrice()));
sku.setOriginalPrice(new BigDecimal(mallGoods.getOriginalPrice()));
+ sku.setLevelOnePrice(mallGoods.getLevelOnePrice());
+ sku.setLevelTwoPrice(mallGoods.getLevelTwoPrice());
+ sku.setLevelThreePrice(mallGoods.getLevelThreePrice());
sku.setSkuVolume(mallGoods.getVolume());
sku.setStock(mallGoods.getStock());
sku.setStyleId(style.getId());
@@ -430,8 +498,6 @@
mallGoodsSkuMapper.insert(sku);
return new FebsResponse().success().message("添加成功");
}
-
-
// 删除已存在sku
List<Long> delSkuIds = mallGoodsUpdateDto.getDelSkuId();
@@ -461,6 +527,10 @@
if (ObjectUtil.isEmpty(mallGoodsStyleSku)) {
styles.add(addStyleDto.getStyleName());
}
+ }else{
+ MallGoodsStyle mallGoodsStyle = mallGoodsStyleMapper.selectById(addStyleDto.getStyleId());
+ mallGoodsStyle.setName(addStyleDto.getStyleName());
+ mallGoodsStyleMapper.updateById(mallGoodsStyle);
}
}
}
@@ -484,11 +554,16 @@
mallGoodsSku.setStock(addMallGoodsSkuDto.getStock() == null ? 0 : addMallGoodsSkuDto.getStock());
mallGoodsSku.setSkuVolume(addMallGoodsSkuDto.getSkuVolume() == null ? 0 : addMallGoodsSkuDto.getSkuVolume());
mallGoodsSku.setOriginalPrice(addMallGoodsSkuDto.getOriginalPrice());
- mallGoodsSku.setPresentPrice(addMallGoodsSkuDto.getPresentPrice());
+// mallGoodsSku.setPresentPrice(addMallGoodsSkuDto.getPresentPrice());
+ mallGoodsSku.setPresentPrice(addMallGoodsSkuDto.getOriginalPrice());
+ mallGoodsSku.setLevelOnePrice(addMallGoodsSkuDto.getLevelOnePrice());
+ mallGoodsSku.setLevelTwoPrice(addMallGoodsSkuDto.getLevelTwoPrice());
+ mallGoodsSku.setLevelThreePrice(addMallGoodsSkuDto.getLevelThreePrice());
mallGoodsSku.setStyleId(addMallGoodsSkuDto.getStyleId());
mallGoodsSku.setGoodsId(mallGoods.getId());
mallGoodsSku.setCostPrice(addMallGoodsSkuDto.getCostPrice());
mallGoodsSku.setGoodsWeight(addMallGoodsSkuDto.getGoodsWeight());
+ mallGoodsSku.setSample(addMallGoodsSkuDto.getSample());
mallGoodsSkuMapper.updateById(mallGoodsSku);
} else {
//新增商品规格
@@ -499,11 +574,16 @@
mallGoodsSku.setStock(addMallGoodsSkuDto.getStock() == null ? 0 : addMallGoodsSkuDto.getStock());
mallGoodsSku.setSkuVolume(addMallGoodsSkuDto.getSkuVolume() == null ? 0 : addMallGoodsSkuDto.getSkuVolume());
mallGoodsSku.setOriginalPrice(addMallGoodsSkuDto.getOriginalPrice());
- mallGoodsSku.setPresentPrice(addMallGoodsSkuDto.getPresentPrice());
+// mallGoodsSku.setPresentPrice(addMallGoodsSkuDto.getPresentPrice());
+ mallGoodsSku.setPresentPrice(addMallGoodsSkuDto.getOriginalPrice());
+ mallGoodsSku.setLevelOnePrice(addMallGoodsSkuDto.getLevelOnePrice());
+ mallGoodsSku.setLevelTwoPrice(addMallGoodsSkuDto.getLevelTwoPrice());
+ mallGoodsSku.setLevelThreePrice(addMallGoodsSkuDto.getLevelThreePrice());
mallGoodsSku.setStyleId(mallGoodsStyleSku.getId());
mallGoodsSku.setCostPrice(addMallGoodsSkuDto.getCostPrice());
mallGoodsSku.setGoodsId(mallGoods.getId());
mallGoodsSku.setGoodsWeight(addMallGoodsSkuDto.getGoodsWeight());
+ mallGoodsSku.setSample(addMallGoodsSkuDto.getSample());
mallGoodsSkuMapper.insert(mallGoodsSku);
}
}
@@ -663,6 +743,7 @@
List<MallCarriageRuleInfo> mallCarriageRuleInfos = mallCarriageRuleInfoMapper.selectMallCarriageRuleInfoByRuleIdAndAreaAddress(id,null);
if(CollUtil.isNotEmpty(mallCarriageRuleInfos)){
+ StringBuffer areaAddressStr = new StringBuffer();
List<AdminMallCarriageRuleInfoVo> adminCarriageRuleInfoVos = new ArrayList<>();
for(MallCarriageRuleInfo mallCarriageRuleInfo : mallCarriageRuleInfos){
if(StrUtil.isNotEmpty(mallCarriageRuleInfo.getAreaAddress())){
@@ -674,6 +755,8 @@
adminMallCarriageRuleInfoVo.setMoreCnt(mallCarriageRuleInfo.getMoreCnt());
adminMallCarriageRuleInfoVo.setMorePrice(mallCarriageRuleInfo.getMorePrice());
adminCarriageRuleInfoVos.add(adminMallCarriageRuleInfoVo);
+
+ areaAddressStr.append(mallCarriageRuleInfo.getAreaAddress());
}else{
//默认规则
adminMallCarriageRuleVo.setBasicCntDefault(mallCarriageRuleInfo.getBasicCnt());
@@ -684,6 +767,7 @@
}
}
adminMallCarriageRuleVo.setAdminCarriageRuleInfoVos(adminCarriageRuleInfoVos);
+ adminMallCarriageRuleVo.setAreaAddressStr(areaAddressStr.toString());
}
return adminMallCarriageRuleVo;
}
@@ -706,6 +790,9 @@
}
return new FebsResponse().fail().message(goodsNameBuffer+"正在使用当前模板,请先下架商品");
}
+
+ mallCarriageRule.setName(adminCarriageRuleUpdateDto.getRuleName());
+ mallCarriageRuleMapper.updateById(mallCarriageRule);
//删除现有的所有运费模板子表数据
List<MallCarriageRuleInfo> mallCarriageRuleInfos = mallCarriageRuleInfoMapper.selectMallCarriageRuleInfoByRuleIdAndAreaAddress(id, null);
if(CollUtil.isNotEmpty(mallCarriageRuleInfos)){
@@ -757,4 +844,187 @@
List<MallCarriageRule> mallCarriageRules = mallCarriageRuleMapper.selectList(new QueryWrapper<>());
return mallCarriageRules;
}
+
+ @Override
+ public IPage<MallGoodsCoupon> getMallGoodsCouponListInPage(MallGoodsCoupon mallGoodsCoupon, QueryRequest request) {
+ Page<MallGoodsCoupon> page = new Page<>(request.getPageNum(), request.getPageSize());
+ IPage<MallGoodsCoupon> mallGoodsCouponIPage = mallGoodsCouponMapper.selectMallGoodsCouponListInPage(page, mallGoodsCoupon);
+ return mallGoodsCouponIPage;
+ }
+
+ @Override
+ public FebsResponse couponRuleAdd(CouponRuleAddDto couponRuleAddDto) {
+ String name = couponRuleAddDto.getName();
+ QueryWrapper<MallGoodsCoupon> objectQueryWrapper = new QueryWrapper<>();
+ objectQueryWrapper.eq("name",name);
+ List<MallGoodsCoupon> mallGoodsCoupons = mallGoodsCouponMapper.selectList(objectQueryWrapper);
+ if(CollUtil.isNotEmpty(mallGoodsCoupons)){
+ return new FebsResponse().fail().message("名称不能重复");
+ }
+
+ MallGoodsCoupon mallGoodsCoupon = new MallGoodsCoupon();
+ mallGoodsCoupon.setName(name);
+ mallGoodsCoupon.setExpireDay(couponRuleAddDto.getExpireDay());
+ mallGoodsCoupon.setCostAmount(couponRuleAddDto.getCostAmount());
+ mallGoodsCoupon.setType(couponRuleAddDto.getType());
+ mallGoodsCoupon.setRealAmount(couponRuleAddDto.getRealAmount());
+ mallGoodsCouponMapper.insert(mallGoodsCoupon);
+
+ Long couponId = mallGoodsCoupon.getId();
+ QueryWrapper<CouponGoods> objectQueryWrapperCoupon = new QueryWrapper<>();
+ objectQueryWrapperCoupon.eq("coupon_id",couponId);
+ List<CouponGoods> couponGoodsList = couponGoodsMapper.selectList(objectQueryWrapperCoupon);
+ if(CollUtil.isNotEmpty(couponGoodsList)){
+ for(CouponGoods couponGoods : couponGoodsList){
+ couponGoodsMapper.deleteById(couponGoods);
+ }
+ }
+ if(CollUtil.isNotEmpty(couponRuleAddDto.getGoodsIds())){
+ List<Long> goodsIds = couponRuleAddDto.getGoodsIds();
+ for(Long goodsId : goodsIds){
+ CouponGoods couponGoods = new CouponGoods();
+ couponGoods.setGoodsId(goodsId);
+ couponGoods.setCouponId(couponId);
+ couponGoodsMapper.insert(couponGoods);
+ }
+ }
+ return new FebsResponse().success().message("操作成功");
+ }
+
+ @Override
+ public FebsResponse couponRuleDel(Long id) {
+ MallGoodsCoupon mallGoodsCoupon = mallGoodsCouponMapper.selectById(id);
+ if (ObjectUtil.isEmpty(mallGoodsCoupon)) {
+ return new FebsResponse().fail().message("优惠卷不存在,请刷新当前页面");
+ }
+ Integer state = mallGoodsCoupon.getState();
+ if(2 == state){
+ return new FebsResponse().fail().message("请先下架优惠卷");
+ }
+ mallGoodsCouponMapper.deleteById(id);
+ return new FebsResponse().success();
+ }
+
+ @Override
+ public FebsResponse upCoupon(Long id) {
+ MallGoodsCoupon mallGoodsCoupon = mallGoodsCouponMapper.selectById(id);
+ if (ObjectUtil.isEmpty(mallGoodsCoupon)) {
+ return new FebsResponse().fail().message("优惠卷不存在,请刷新当前页面");
+ }
+ mallGoodsCoupon.setState(2);
+ mallGoodsCouponMapper.updateById(mallGoodsCoupon);
+ return new FebsResponse().success();
+ }
+
+ @Override
+ public FebsResponse downCoupon(Long id) {
+ MallGoodsCoupon mallGoodsCoupon = mallGoodsCouponMapper.selectById(id);
+ if (ObjectUtil.isEmpty(mallGoodsCoupon)) {
+ return new FebsResponse().fail().message("优惠卷不存在,请刷新当前页面");
+ }
+ mallGoodsCoupon.setState(1);
+ mallGoodsCouponMapper.updateById(mallGoodsCoupon);
+ return new FebsResponse().success().message("操作成功");
+ }
+
+ @Override
+ public AdminMallGoodsCouponVo selectGoodsCouponById(long id) {
+ List<Long> goodsIds = couponGoodsMapper.selectByCouponId(id);
+ AdminMallGoodsCouponVo adminMallGoodsCouponVo = mallGoodsCouponMapper.selectGoodsCouponById(id);
+ adminMallGoodsCouponVo.setGoodsIds(goodsIds);
+ return adminMallGoodsCouponVo;
+ }
+
+ @Override
+ public FebsResponse couponUpdate(AdminMallGoodsCouponVo adminMallGoodsCouponVo) {
+ Long id = adminMallGoodsCouponVo.getId();
+ MallGoodsCoupon mallGoodsCoupon = mallGoodsCouponMapper.selectById(id);
+ if (ObjectUtil.isEmpty(mallGoodsCoupon)) {
+ return new FebsResponse().fail().message("优惠卷不存在,请刷新当前页面");
+ }
+ Integer state = mallGoodsCoupon.getState();
+ if(2 == state){
+ return new FebsResponse().fail().message("请先下架优惠卷");
+ }
+ mallGoodsCoupon.setName(adminMallGoodsCouponVo.getName());
+ mallGoodsCoupon.setExpireDay(adminMallGoodsCouponVo.getExpireDay());
+ mallGoodsCoupon.setCostAmount(adminMallGoodsCouponVo.getCostAmount());
+ mallGoodsCoupon.setType(adminMallGoodsCouponVo.getType());
+ mallGoodsCoupon.setRealAmount(adminMallGoodsCouponVo.getRealAmount());
+ mallGoodsCouponMapper.updateById(mallGoodsCoupon);
+
+ Long couponId = mallGoodsCoupon.getId();
+ QueryWrapper<CouponGoods> objectQueryWrapperCoupon = new QueryWrapper<>();
+ objectQueryWrapperCoupon.eq("coupon_id",couponId);
+ List<CouponGoods> couponGoodsList = couponGoodsMapper.selectList(objectQueryWrapperCoupon);
+ if(CollUtil.isNotEmpty(couponGoodsList)){
+ for(CouponGoods couponGoods : couponGoodsList){
+ couponGoodsMapper.deleteById(couponGoods);
+ }
+ }
+ if(CollUtil.isNotEmpty(adminMallGoodsCouponVo.getGoodsIds())){
+ List<Long> goodsIds = adminMallGoodsCouponVo.getGoodsIds();
+ for(Long goodsId : goodsIds){
+ CouponGoods couponGoods = new CouponGoods();
+ couponGoods.setGoodsId(goodsId);
+ couponGoods.setCouponId(couponId);
+ couponGoodsMapper.insert(couponGoods);
+ }
+ }
+ return new FebsResponse().success().message("操作成功");
+ }
+
+ @Override
+ public List<AdminMallGoodsCouponTreeVo> findAdminMallGoodsCouponVoTree() {
+ QueryWrapper<MallGoodsCoupon> objectQueryWrapper = new QueryWrapper<>();
+ objectQueryWrapper.eq("state",2);
+ List<MallGoodsCoupon> mallGoodsCoupons = mallGoodsCouponMapper.selectList(objectQueryWrapper);
+
+ List<AdminMallGoodsCouponTreeVo> objects = new ArrayList<>();
+ if(CollUtil.isNotEmpty(mallGoodsCoupons)){
+ for(MallGoodsCoupon mallGoodsCoupon : mallGoodsCoupons){
+ AdminMallGoodsCouponTreeVo adminMallGoodsCouponTreeVo = new AdminMallGoodsCouponTreeVo();
+ adminMallGoodsCouponTreeVo.setCouponId(mallGoodsCoupon.getId());
+ adminMallGoodsCouponTreeVo.setCouponName(mallGoodsCoupon.getName());
+ objects.add(adminMallGoodsCouponTreeVo);
+ }
+ }
+ return objects;
+ }
+
+ @Override
+ public List<AdminMallGoodsCouponTreeListVo> findAdminMallGoodsCouponVoTreeList() {
+ QueryWrapper<MallGoodsCoupon> objectQueryWrapper = new QueryWrapper<>();
+ objectQueryWrapper.eq("state",2);
+ List<MallGoodsCoupon> mallGoodsCoupons = mallGoodsCouponMapper.selectList(objectQueryWrapper);
+
+ List<AdminMallGoodsCouponTreeListVo> objects = new ArrayList<>();
+ if(CollUtil.isNotEmpty(mallGoodsCoupons)){
+ for(MallGoodsCoupon mallGoodsCoupon : mallGoodsCoupons){
+ AdminMallGoodsCouponTreeListVo adminMallGoodsCouponTreeListVo = new AdminMallGoodsCouponTreeListVo();
+ adminMallGoodsCouponTreeListVo.setId(mallGoodsCoupon.getId());
+ adminMallGoodsCouponTreeListVo.setName(mallGoodsCoupon.getName());
+ objects.add(adminMallGoodsCouponTreeListVo);
+ }
+ }
+ return objects;
+ }
+
+ @Override
+ public List<AdminMallGoodsCouponTreeListVo> findAdminMallGoodsVoTreeList() {
+ QueryWrapper<MallGoods> objectQueryWrapper = new QueryWrapper<>();
+ objectQueryWrapper.eq("is_sale",1);
+ List<MallGoods> mallGoodsList = mallGoodsMapper.selectList(objectQueryWrapper);
+
+ List<AdminMallGoodsCouponTreeListVo> objects = new ArrayList<>();
+ if(CollUtil.isNotEmpty(mallGoodsList)){
+ for(MallGoods mallGoods : mallGoodsList){
+ AdminMallGoodsCouponTreeListVo adminMallGoodsCouponTreeListVo = new AdminMallGoodsCouponTreeListVo();
+ adminMallGoodsCouponTreeListVo.setId(mallGoods.getId());
+ adminMallGoodsCouponTreeListVo.setName(mallGoods.getGoodsName());
+ objects.add(adminMallGoodsCouponTreeListVo);
+ }
+ }
+ return objects;
+ }
}
--
Gitblit v1.9.1