From e4636b43d19c8f288962cd44c9d61ea89a9239fb Mon Sep 17 00:00:00 2001
From: DESKTOP-71BH0QO\L、ming <172680469@qq.com>
Date: 星期日, 25 四月 2021 18:44:37 +0800
Subject: [PATCH] Merge remote-tracking branch 'origin/master'
---
springcloud_k8s_panzhihuazhihuishequ/service_community/src/main/java/com/panzhihua/service_community/service/impl/ComShopStoreServiceImpl.java | 40 ++++++++++++++++++++++++++++------------
1 files changed, 28 insertions(+), 12 deletions(-)
diff --git a/springcloud_k8s_panzhihuazhihuishequ/service_community/src/main/java/com/panzhihua/service_community/service/impl/ComShopStoreServiceImpl.java b/springcloud_k8s_panzhihuazhihuishequ/service_community/src/main/java/com/panzhihua/service_community/service/impl/ComShopStoreServiceImpl.java
index bb925ad..9e6e1c0 100644
--- a/springcloud_k8s_panzhihuazhihuishequ/service_community/src/main/java/com/panzhihua/service_community/service/impl/ComShopStoreServiceImpl.java
+++ b/springcloud_k8s_panzhihuazhihuishequ/service_community/src/main/java/com/panzhihua/service_community/service/impl/ComShopStoreServiceImpl.java
@@ -54,7 +54,7 @@
@Override
public R pageStoreList(PageComShopStoreDTO pageComShopStoreDTO) {
Page page = new Page<>(pageComShopStoreDTO.getPageNum(), pageComShopStoreDTO.getPageSize());
- IPage<PageShopStoreVO> comShopStoreVOIPage = this.baseMapper.pageShopStoreByAdmin(page, pageComShopStoreDTO);
+ IPage<PageShopStoreVO> comShopStoreVOIPage = this.baseMapper.pageShopStore(page, pageComShopStoreDTO);
return R.ok(comShopStoreVOIPage);
}
@@ -162,23 +162,39 @@
@Override
public R editStore(Long id, ShopStoreVO storeVO) {
- if (storeVO == null) {
- return R.ok("500", "数据为空!");
+ ComShopStoreDO storeDO = this.baseMapper.selectById(id);
+ if(storeDO == null){
+ return R.fail("商家不存在");
}
- LambdaQueryWrapper<ComShopStoreDO> query = new LambdaQueryWrapper<ComShopStoreDO>().eq(ComShopStoreDO::getId, id);
- ComShopStoreDO storeDO = new ComShopStoreDO();
BeanUtils.copyProperties(storeVO, storeDO);
- int update = this.baseMapper.update(storeDO, query);
- return update > 0 ? R.ok() : R.fail();
+ if(this.baseMapper.updateById(storeDO) > 0){
+ return R.ok();
+ }else{
+ return R.fail();
+ }
}
@Override
public R deleteStore(Long[] id) {
LambdaQueryWrapper<ComShopStoreDO> query = new LambdaQueryWrapper<ComShopStoreDO>().in(ComShopStoreDO::getId, id);
List<ComShopStoreDO> comShopStoreDO = this.baseMapper.selectList(query);
- for (ComShopStoreDO shopStoreDO:comShopStoreDO) {
- shopStoreDO.setDeleteStatus(2);
- int update = this.baseMapper.updateById(shopStoreDO);
+ if(!comShopStoreDO.isEmpty()){
+ for (ComShopStoreDO shopStoreDO:comShopStoreDO) {
+ //判断店铺下是否拥有正常的商品
+ List<ComShopGoodsDO> shopGoodsList = shopGoodsDAO.selectList(new QueryWrapper<ComShopGoodsDO>()
+ .lambda().eq(ComShopGoodsDO::getStoreId,shopStoreDO.getId())
+ .eq(ComShopGoodsDO::getDeleteStatus,ComShopGoodsDO.deleteStatus.no)
+ .eq(ComShopGoodsDO::getStatus,ComShopGoodsDO.status.sell));
+
+ if(!shopGoodsList.isEmpty()){//如果有正常商品则提示无法删除
+ return R.fail("店铺下有商品正在出售,无法删除店铺");
+ }
+
+ shopStoreDO.setDeleteStatus(2);
+ this.baseMapper.updateById(shopStoreDO);
+ }
+ }else {
+ return R.fail("未查询到店铺");
}
return R.ok();
}
@@ -187,7 +203,7 @@
public R getOneInfo(Long id) {
ComShopStoreDO comShopStoreDO = this.baseMapper.selectById(id);
if (comShopStoreDO == null) {
- R.fail(500, "商铺不存在");
+ return R.fail(500, "商铺不存在");
}
ShopStoreVO shopStoreVO = new ShopStoreVO();
BeanUtils.copyProperties(comShopStoreDO, shopStoreVO);
@@ -198,7 +214,7 @@
public R getUserStoreInfo(Long userId) {
ComShopStoreDO comShopStoreDO = this.baseMapper.selectOne(new LambdaQueryWrapper<ComShopStoreDO>().eq(ComShopStoreDO::getDeleteStatus, 1).eq(ComShopStoreDO::getSysUserId, userId));
if (comShopStoreDO == null) {
- R.fail(500, "商铺不存在");
+ return R.fail(500, "商铺不存在");
}
ShopStoreVO shopStoreVO = new ShopStoreVO();
BeanUtils.copyProperties(comShopStoreDO, shopStoreVO);
--
Gitblit v1.7.1