From 80e679a7511fadb323f41ea322285e7c385c6b97 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=B0=8F=E5=B0=8F=E5=BC=A0?= <1085577365@qq.com> Date: Tue, 16 May 2023 18:46:19 +0800 Subject: [PATCH] =?UTF-8?q?=E5=90=8E=E5=8F=B0--=E8=B0=83=E8=AF=95=E7=89=A9?= =?UTF-8?q?=E6=B5=81=E3=80=81=E8=A7=84=E6=A0=BC?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../express/ShippingTemplatesController.java | 7 ++++--- .../ShippingTemplatesNoDeliveryController.java | 2 +- .../express/vo/ShippingTemplatesFreeRespVO.java | 3 --- .../vo/ShippingTemplatesRegionRespVO.java | 4 ---- .../express/ShippingTemplatesFreeDO.java | 5 ----- .../express/ShippingTemplatesRegionDO.java | 10 ---------- .../ShippingTemplatesNoDeliveryService.java | 2 ++ .../express/ShippingTemplatesService.java | 5 +++-- .../impl/ShippingTemplatesFreeServiceImpl.java | 17 +++++++++++++---- .../ShippingTemplatesNoDeliveryServiceImpl.java | 14 ++++++++++++-- .../ShippingTemplatesRegionServiceImpl.java | 17 ++++++++++------- .../impl/ShippingTemplatesServiceImpl.java | 15 ++++++++++----- .../express/ShippingTemplatesFreeMapper.xml | 2 +- .../ShippingTemplatesNoDeliveryMapper.xml | 2 +- .../express/ShippingTemplatesRegionMapper.xml | 2 +- 15 files changed, 58 insertions(+), 49 deletions(-) diff --git a/yudao-module-mall/yudao-module-shop-biz/src/main/java/cn/iocoder/yudao/module/shop/controller/admin/express/ShippingTemplatesController.java b/yudao-module-mall/yudao-module-shop-biz/src/main/java/cn/iocoder/yudao/module/shop/controller/admin/express/ShippingTemplatesController.java index 537fc1e65..41d6eb02c 100644 --- a/yudao-module-mall/yudao-module-shop-biz/src/main/java/cn/iocoder/yudao/module/shop/controller/admin/express/ShippingTemplatesController.java +++ b/yudao-module-mall/yudao-module-shop-biz/src/main/java/cn/iocoder/yudao/module/shop/controller/admin/express/ShippingTemplatesController.java @@ -2,11 +2,12 @@ package cn.iocoder.yudao.module.shop.controller.admin.express; import cn.iocoder.yudao.framework.common.exception.enums.GlobalErrorCodeConstants; import cn.iocoder.yudao.framework.common.pojo.CommonResult; -import cn.iocoder.yudao.framework.common.pojo.PageResult; +import cn.iocoder.yudao.framework.common.pojo.PageParam; import cn.iocoder.yudao.module.shop.controller.admin.express.vo.ShippingTemplatesReqVO; import cn.iocoder.yudao.module.shop.controller.admin.express.vo.ShippingTemplatesSearchReqVO; import cn.iocoder.yudao.module.shop.dal.dataobject.express.ShippingTemplatesDO; import cn.iocoder.yudao.module.shop.service.express.ShippingTemplatesService; +import com.github.pagehelper.PageInfo; import io.swagger.v3.oas.annotations.Operation; import io.swagger.v3.oas.annotations.Parameter; import io.swagger.v3.oas.annotations.tags.Tag; @@ -46,8 +47,8 @@ public class ShippingTemplatesController { @PreAuthorize("@ss.hasPermission('admin:shipping:templates:list')") @Operation(summary = "分页列表") @GetMapping(value = "/list") - public CommonResult> getList(@Validated ShippingTemplatesSearchReqVO request){ - PageResult shippingTemplatesCommonPage = shippingTemplatesService.getList(request); + public CommonResult> getList(@Validated ShippingTemplatesSearchReqVO request, @Validated PageParam pageParamRequest){ + PageInfo shippingTemplatesCommonPage = shippingTemplatesService.getList(request, pageParamRequest); return CommonResult.success(shippingTemplatesCommonPage); } diff --git a/yudao-module-mall/yudao-module-shop-biz/src/main/java/cn/iocoder/yudao/module/shop/controller/admin/express/ShippingTemplatesNoDeliveryController.java b/yudao-module-mall/yudao-module-shop-biz/src/main/java/cn/iocoder/yudao/module/shop/controller/admin/express/ShippingTemplatesNoDeliveryController.java index 1f183c952..8af8816bc 100644 --- a/yudao-module-mall/yudao-module-shop-biz/src/main/java/cn/iocoder/yudao/module/shop/controller/admin/express/ShippingTemplatesNoDeliveryController.java +++ b/yudao-module-mall/yudao-module-shop-biz/src/main/java/cn/iocoder/yudao/module/shop/controller/admin/express/ShippingTemplatesNoDeliveryController.java @@ -30,7 +30,7 @@ import java.util.List; @Slf4j @RestController @RequestMapping("admin/express/shipping/no_delivery") -@Tag(name = "设置 -- 物流 -- 免费") +@Tag(name = "设置 -- 物流 -- 不送达") public class ShippingTemplatesNoDeliveryController { @Autowired diff --git a/yudao-module-mall/yudao-module-shop-biz/src/main/java/cn/iocoder/yudao/module/shop/controller/admin/express/vo/ShippingTemplatesFreeRespVO.java b/yudao-module-mall/yudao-module-shop-biz/src/main/java/cn/iocoder/yudao/module/shop/controller/admin/express/vo/ShippingTemplatesFreeRespVO.java index 3bb66a80d..5a037a619 100644 --- a/yudao-module-mall/yudao-module-shop-biz/src/main/java/cn/iocoder/yudao/module/shop/controller/admin/express/vo/ShippingTemplatesFreeRespVO.java +++ b/yudao-module-mall/yudao-module-shop-biz/src/main/java/cn/iocoder/yudao/module/shop/controller/admin/express/vo/ShippingTemplatesFreeRespVO.java @@ -39,9 +39,6 @@ public class ShippingTemplatesFreeRespVO implements Serializable { @Schema(description = "省ID, 多个逗号分割。 全国 all", required = true, example = "1,2,3,4") private String provinceId; - @Schema(description = "城市名称描述") - private String title; - @Schema(description = "包邮件数", required = true, example = "1") // @Min(value = 1, message = "请填写包邮件数") @DecimalMin(value = "0.1", message = "包邮不能低于0.1") diff --git a/yudao-module-mall/yudao-module-shop-biz/src/main/java/cn/iocoder/yudao/module/shop/controller/admin/express/vo/ShippingTemplatesRegionRespVO.java b/yudao-module-mall/yudao-module-shop-biz/src/main/java/cn/iocoder/yudao/module/shop/controller/admin/express/vo/ShippingTemplatesRegionRespVO.java index b27b87223..d02fb3fd7 100644 --- a/yudao-module-mall/yudao-module-shop-biz/src/main/java/cn/iocoder/yudao/module/shop/controller/admin/express/vo/ShippingTemplatesRegionRespVO.java +++ b/yudao-module-mall/yudao-module-shop-biz/src/main/java/cn/iocoder/yudao/module/shop/controller/admin/express/vo/ShippingTemplatesRegionRespVO.java @@ -38,8 +38,6 @@ public class ShippingTemplatesRegionRespVO implements Serializable { @Schema(description = "省ID, 多个逗号分割。 全国 all", required = true, example = "1,2,3,4") private String provinceId; - @Schema(description = "城市名称描述") - private String title; @Schema(description = "首件", required = true, example = "0.1") @DecimalMin(value = "0.1", message = "首件金额不能低于0.1") @@ -57,6 +55,4 @@ public class ShippingTemplatesRegionRespVO implements Serializable { @DecimalMin(value = "0.1", message = "续件运费金额不能低于0.1") private BigDecimal renewalPrice; - @Schema(description = "分组唯一值") - private String uniqid; } diff --git a/yudao-module-mall/yudao-module-shop-biz/src/main/java/cn/iocoder/yudao/module/shop/dal/dataobject/express/ShippingTemplatesFreeDO.java b/yudao-module-mall/yudao-module-shop-biz/src/main/java/cn/iocoder/yudao/module/shop/dal/dataobject/express/ShippingTemplatesFreeDO.java index 3b7023c87..05590bedf 100644 --- a/yudao-module-mall/yudao-module-shop-biz/src/main/java/cn/iocoder/yudao/module/shop/dal/dataobject/express/ShippingTemplatesFreeDO.java +++ b/yudao-module-mall/yudao-module-shop-biz/src/main/java/cn/iocoder/yudao/module/shop/dal/dataobject/express/ShippingTemplatesFreeDO.java @@ -45,11 +45,6 @@ public class ShippingTemplatesFreeDO implements Serializable { */ private Integer cityId; - /** - *描述 - */ - private String title; - /** *包邮件数 */ diff --git a/yudao-module-mall/yudao-module-shop-biz/src/main/java/cn/iocoder/yudao/module/shop/dal/dataobject/express/ShippingTemplatesRegionDO.java b/yudao-module-mall/yudao-module-shop-biz/src/main/java/cn/iocoder/yudao/module/shop/dal/dataobject/express/ShippingTemplatesRegionDO.java index 7ea1a2c4b..91d6e49a7 100644 --- a/yudao-module-mall/yudao-module-shop-biz/src/main/java/cn/iocoder/yudao/module/shop/dal/dataobject/express/ShippingTemplatesRegionDO.java +++ b/yudao-module-mall/yudao-module-shop-biz/src/main/java/cn/iocoder/yudao/module/shop/dal/dataobject/express/ShippingTemplatesRegionDO.java @@ -46,11 +46,6 @@ public class ShippingTemplatesRegionDO implements Serializable { private Integer provinceId; - /** - *描述 - */ - private String title; - /** *首件 */ @@ -76,11 +71,6 @@ public class ShippingTemplatesRegionDO implements Serializable { */ private Integer type; - /** - *分组唯一值 - */ - private String uniqid; - /** *是否无效 */ diff --git a/yudao-module-mall/yudao-module-shop-biz/src/main/java/cn/iocoder/yudao/module/shop/service/express/ShippingTemplatesNoDeliveryService.java b/yudao-module-mall/yudao-module-shop-biz/src/main/java/cn/iocoder/yudao/module/shop/service/express/ShippingTemplatesNoDeliveryService.java index 065c63298..ba98b4d93 100644 --- a/yudao-module-mall/yudao-module-shop-biz/src/main/java/cn/iocoder/yudao/module/shop/service/express/ShippingTemplatesNoDeliveryService.java +++ b/yudao-module-mall/yudao-module-shop-biz/src/main/java/cn/iocoder/yudao/module/shop/service/express/ShippingTemplatesNoDeliveryService.java @@ -36,4 +36,6 @@ public interface ShippingTemplatesNoDeliveryService extends IService { - PageResult getList(ShippingTemplatesSearchReqVO request); + PageInfo getList(ShippingTemplatesSearchReqVO request, PageParam pageParamRequest); /** * 新增运费模板 diff --git a/yudao-module-mall/yudao-module-shop-biz/src/main/java/cn/iocoder/yudao/module/shop/service/express/impl/ShippingTemplatesFreeServiceImpl.java b/yudao-module-mall/yudao-module-shop-biz/src/main/java/cn/iocoder/yudao/module/shop/service/express/impl/ShippingTemplatesFreeServiceImpl.java index 83d64db5d..42cd393dd 100644 --- a/yudao-module-mall/yudao-module-shop-biz/src/main/java/cn/iocoder/yudao/module/shop/service/express/impl/ShippingTemplatesFreeServiceImpl.java +++ b/yudao-module-mall/yudao-module-shop-biz/src/main/java/cn/iocoder/yudao/module/shop/service/express/impl/ShippingTemplatesFreeServiceImpl.java @@ -18,7 +18,6 @@ import org.springframework.stereotype.Service; import javax.annotation.Resource; import java.util.ArrayList; import java.util.List; -import java.util.stream.Collectors; /** * ShippingTemplatesFreeServiceImpl 接口实现 @@ -68,7 +67,7 @@ public class ShippingTemplatesFreeServiceImpl extends ServiceImpl lambdaQueryWrapper = new LambdaQueryWrapper<>(); + lambdaQueryWrapper.eq(ShippingTemplatesFreeDO::getTempId, tempId); + return dao.delete(lambdaQueryWrapper) > 0; + } + + /** + * 删除模板下的无效数据 + * @param tempId Integer 运费模板id + */ + public Boolean deleteStatusFalse(Integer tempId) { LambdaQueryWrapper lambdaQueryWrapper = new LambdaQueryWrapper<>(); lambdaQueryWrapper.eq(ShippingTemplatesFreeDO::getTempId, tempId); lambdaQueryWrapper.eq(ShippingTemplatesFreeDO::getStatus, false); diff --git a/yudao-module-mall/yudao-module-shop-biz/src/main/java/cn/iocoder/yudao/module/shop/service/express/impl/ShippingTemplatesNoDeliveryServiceImpl.java b/yudao-module-mall/yudao-module-shop-biz/src/main/java/cn/iocoder/yudao/module/shop/service/express/impl/ShippingTemplatesNoDeliveryServiceImpl.java index 9e36be37d..726d42337 100644 --- a/yudao-module-mall/yudao-module-shop-biz/src/main/java/cn/iocoder/yudao/module/shop/service/express/impl/ShippingTemplatesNoDeliveryServiceImpl.java +++ b/yudao-module-mall/yudao-module-shop-biz/src/main/java/cn/iocoder/yudao/module/shop/service/express/impl/ShippingTemplatesNoDeliveryServiceImpl.java @@ -11,14 +11,12 @@ import cn.iocoder.yudao.module.shop.dal.mysql.express.ShippingTemplatesNoDeliver import cn.iocoder.yudao.module.shop.service.express.ShippingTemplatesNoDeliveryService; import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; -import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import org.springframework.validation.annotation.Validated; import javax.annotation.Resource; import java.util.ArrayList; import java.util.List; -import java.util.stream.Collectors; @Service @Validated @@ -41,6 +39,7 @@ public class ShippingTemplatesNoDeliveryServiceImpl extends ServiceImpl shippingTemplatesNoDeliveryRespVOS, Integer tempId) { ArrayList shippingTemplatesNoDeliveryDOS = new ArrayList<>(); + delete(tempId); for (ShippingTemplatesNoDeliveryRespVO shippingTemplatesNoDeliveryRespVO : shippingTemplatesNoDeliveryRespVOS) { if(shippingTemplatesNoDeliveryRespVO.getCityId().equals("all") || shippingTemplatesNoDeliveryRespVO.getCityId().equals("0")){ cityIdList = getCityIdList(); @@ -58,6 +57,17 @@ public class ShippingTemplatesNoDeliveryServiceImpl extends ServiceImpl lambdaQueryWrapper = new LambdaQueryWrapper<>(); + lambdaQueryWrapper.eq(ShippingTemplatesNoDeliveryDO::getTempId, tempId); + return shippingTemplatesNoDeliveryMapper.delete(lambdaQueryWrapper) > 0; + } + /** * 获取所有城市cityId * @author Mr.Zhang diff --git a/yudao-module-mall/yudao-module-shop-biz/src/main/java/cn/iocoder/yudao/module/shop/service/express/impl/ShippingTemplatesRegionServiceImpl.java b/yudao-module-mall/yudao-module-shop-biz/src/main/java/cn/iocoder/yudao/module/shop/service/express/impl/ShippingTemplatesRegionServiceImpl.java index 558d11a62..27bbcdd99 100644 --- a/yudao-module-mall/yudao-module-shop-biz/src/main/java/cn/iocoder/yudao/module/shop/service/express/impl/ShippingTemplatesRegionServiceImpl.java +++ b/yudao-module-mall/yudao-module-shop-biz/src/main/java/cn/iocoder/yudao/module/shop/service/express/impl/ShippingTemplatesRegionServiceImpl.java @@ -20,7 +20,6 @@ import java.io.Serializable; import java.util.ArrayList; import java.util.Collection; import java.util.List; -import java.util.stream.Collectors; /** * ShippingTemplatesRegionServiceImpl 接口实现 @@ -79,8 +78,7 @@ public class ShippingTemplatesRegionServiceImpl extends ServiceImpl lambdaQueryWrapper = new LambdaQueryWrapper<>(); lambdaQueryWrapper.eq(ShippingTemplatesRegionDO::getTempId, tempId); lambdaQueryWrapper.eq(ShippingTemplatesRegionDO::getStatus, false); @@ -152,7 +149,6 @@ public class ShippingTemplatesRegionServiceImpl extends ServiceImpl lambdaQueryWrapper = new LambdaQueryWrapper<>(); lambdaQueryWrapper.eq(ShippingTemplatesRegionDO::getTempId, tempId); lambdaQueryWrapper.eq(ShippingTemplatesRegionDO::getCityId, cityId); - lambdaQueryWrapper.eq(ShippingTemplatesRegionDO::getStatus, true); lambdaQueryWrapper.orderByDesc(ShippingTemplatesRegionDO::getId); lambdaQueryWrapper.last(" limit 1"); return dao.selectOne(lambdaQueryWrapper); @@ -167,5 +163,12 @@ public class ShippingTemplatesRegionServiceImpl extends ServiceImpl getListGroup(Integer tempId) { return dao.getListGroup(tempId); } + + @Override + public Boolean delete(Integer tempId) { + LambdaQueryWrapper lambdaQueryWrapper = new LambdaQueryWrapper<>(); + lambdaQueryWrapper.eq(ShippingTemplatesRegionDO::getTempId, tempId); + return dao.delete(lambdaQueryWrapper) > 0; + } } diff --git a/yudao-module-mall/yudao-module-shop-biz/src/main/java/cn/iocoder/yudao/module/shop/service/express/impl/ShippingTemplatesServiceImpl.java b/yudao-module-mall/yudao-module-shop-biz/src/main/java/cn/iocoder/yudao/module/shop/service/express/impl/ShippingTemplatesServiceImpl.java index a68ebab56..b1c05e887 100644 --- a/yudao-module-mall/yudao-module-shop-biz/src/main/java/cn/iocoder/yudao/module/shop/service/express/impl/ShippingTemplatesServiceImpl.java +++ b/yudao-module-mall/yudao-module-shop-biz/src/main/java/cn/iocoder/yudao/module/shop/service/express/impl/ShippingTemplatesServiceImpl.java @@ -3,7 +3,7 @@ package cn.iocoder.yudao.module.shop.service.express.impl; import cn.hutool.core.collection.CollUtil; import cn.hutool.core.util.ObjectUtil; import cn.iocoder.yudao.framework.common.exception.ServiceException; -import cn.iocoder.yudao.framework.common.pojo.PageResult; +import cn.iocoder.yudao.framework.common.pojo.PageParam; import cn.iocoder.yudao.module.shop.controller.admin.express.vo.*; import cn.iocoder.yudao.module.shop.dal.dataobject.express.ShippingTemplatesDO; import cn.iocoder.yudao.module.shop.dal.mysql.express.ShippingTemplatesMapper; @@ -13,6 +13,8 @@ import cn.iocoder.yudao.module.shop.service.express.ShippingTemplatesRegionServi import cn.iocoder.yudao.module.shop.service.express.ShippingTemplatesService; import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import com.github.pagehelper.PageHelper; +import com.github.pagehelper.PageInfo; import org.apache.commons.lang3.StringUtils; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; @@ -59,15 +61,16 @@ public class ShippingTemplatesServiceImpl extends ServiceImpl */ @Override - public PageResult getList(ShippingTemplatesSearchReqVO request) { + public PageInfo getList(ShippingTemplatesSearchReqVO request, PageParam pageParamRequest) { + PageHelper.startPage(pageParamRequest.getPageNo(), pageParamRequest.getPageSize()); LambdaQueryWrapper lambdaQueryWrapper = new LambdaQueryWrapper<>(); if(!StringUtils.isBlank(request.getKeywords())){ lambdaQueryWrapper.like(ShippingTemplatesDO::getName, request.getKeywords()); } - lambdaQueryWrapper.orderByDesc(ShippingTemplatesDO::getSort).orderByDesc(ShippingTemplatesDO::getId); - return dao.selectPage(request, lambdaQueryWrapper); + lambdaQueryWrapper.orderByDesc(ShippingTemplatesDO::getSort).orderByDesc(ShippingTemplatesDO::getId); + return new PageInfo<>(dao.selectList(lambdaQueryWrapper)); } /** @@ -92,6 +95,7 @@ public class ShippingTemplatesServiceImpl extends ServiceImpl { shippingTemplatesRegionService.delete(id); shippingTemplatesFreeService.delete(id); - removeById(id); + shippingTemplatesNoDeliveryService.delete(id); + dao.deleteById(id); return Boolean.TRUE; }); } diff --git a/yudao-module-mall/yudao-module-shop-biz/src/main/resources/mapper/express/ShippingTemplatesFreeMapper.xml b/yudao-module-mall/yudao-module-shop-biz/src/main/resources/mapper/express/ShippingTemplatesFreeMapper.xml index 518028905..d27a6d8f0 100644 --- a/yudao-module-mall/yudao-module-shop-biz/src/main/resources/mapper/express/ShippingTemplatesFreeMapper.xml +++ b/yudao-module-mall/yudao-module-shop-biz/src/main/resources/mapper/express/ShippingTemplatesFreeMapper.xml @@ -3,6 +3,6 @@ diff --git a/yudao-module-mall/yudao-module-shop-biz/src/main/resources/mapper/express/ShippingTemplatesNoDeliveryMapper.xml b/yudao-module-mall/yudao-module-shop-biz/src/main/resources/mapper/express/ShippingTemplatesNoDeliveryMapper.xml index f403c4d62..06da0e77c 100644 --- a/yudao-module-mall/yudao-module-shop-biz/src/main/resources/mapper/express/ShippingTemplatesNoDeliveryMapper.xml +++ b/yudao-module-mall/yudao-module-shop-biz/src/main/resources/mapper/express/ShippingTemplatesNoDeliveryMapper.xml @@ -3,6 +3,6 @@ diff --git a/yudao-module-mall/yudao-module-shop-biz/src/main/resources/mapper/express/ShippingTemplatesRegionMapper.xml b/yudao-module-mall/yudao-module-shop-biz/src/main/resources/mapper/express/ShippingTemplatesRegionMapper.xml index 3e174bafb..d31a41ad7 100644 --- a/yudao-module-mall/yudao-module-shop-biz/src/main/resources/mapper/express/ShippingTemplatesRegionMapper.xml +++ b/yudao-module-mall/yudao-module-shop-biz/src/main/resources/mapper/express/ShippingTemplatesRegionMapper.xml @@ -3,6 +3,6 @@