diff --git a/pom.xml b/pom.xml index 302654cc..2b519bc3 100644 --- a/pom.xml +++ b/pom.xml @@ -33,7 +33,7 @@ 1.5.4 4.3.9 1.1.0 - 3.1.0 + 3.5.3.1 3.12.5 2.12.1 2.17.2 diff --git a/yami-shop-admin/src/main/java/com/yami/shop/admin/controller/AreaController.java b/yami-shop-admin/src/main/java/com/yami/shop/admin/controller/AreaController.java index ac46c7d1..b09651d3 100644 --- a/yami-shop-admin/src/main/java/com/yami/shop/admin/controller/AreaController.java +++ b/yami-shop-admin/src/main/java/com/yami/shop/admin/controller/AreaController.java @@ -124,7 +124,7 @@ public ServerResponseEntity delete(@PathVariable Long id) { } private void hasSameName(Area area) { - int count = areaService.count(new LambdaQueryWrapper() + long count = areaService.count(new LambdaQueryWrapper() .eq(Area::getParentId, area.getParentId()) .eq(Area::getAreaName, area.getAreaName()) .ne(Objects.nonNull(area.getAreaId()) && !Objects.equals(area.getAreaId(), 0L), Area::getAreaId, area.getAreaId()) diff --git a/yami-shop-admin/src/main/java/com/yami/shop/admin/controller/BrandController.java b/yami-shop-admin/src/main/java/com/yami/shop/admin/controller/BrandController.java index de08d25e..b84bce88 100644 --- a/yami-shop-admin/src/main/java/com/yami/shop/admin/controller/BrandController.java +++ b/yami-shop-admin/src/main/java/com/yami/shop/admin/controller/BrandController.java @@ -44,10 +44,9 @@ public class BrandController { @GetMapping("/page") @PreAuthorize("@pms.hasPermission('admin:brand:page')") public ServerResponseEntity> page(Brand brand,PageParam page) { - page.setAsc("first_char"); IPage brands = brandService.page(page, new LambdaQueryWrapper() - .like(StrUtil.isNotBlank(brand.getBrandName()), Brand::getBrandName, brand.getBrandName())); + .like(StrUtil.isNotBlank(brand.getBrandName()), Brand::getBrandName, brand.getBrandName()).orderByAsc(Brand::getFirstChar)); return ServerResponseEntity.success(brands); } diff --git a/yami-shop-api/src/main/java/com/yami/shop/api/controller/AddrController.java b/yami-shop-api/src/main/java/com/yami/shop/api/controller/AddrController.java index c882a1d9..e79bbf43 100644 --- a/yami-shop-api/src/main/java/com/yami/shop/api/controller/AddrController.java +++ b/yami-shop-api/src/main/java/com/yami/shop/api/controller/AddrController.java @@ -63,7 +63,7 @@ public ServerResponseEntity addAddr(@Valid @RequestBody AddrParam addrPa if (addrParam.getAddrId() != null && addrParam.getAddrId() != 0) { return ServerResponseEntity.showFailMsg("该地址已存在"); } - int addrCount = userAddrService.count(new LambdaQueryWrapper().eq(UserAddr::getUserId, userId)); + long addrCount = userAddrService.count(new LambdaQueryWrapper().eq(UserAddr::getUserId, userId)); UserAddr userAddr = mapperFacade.map(addrParam, UserAddr.class); if (addrCount == 0) { diff --git a/yami-shop-api/src/main/java/com/yami/shop/api/controller/UserCollectionController.java b/yami-shop-api/src/main/java/com/yami/shop/api/controller/UserCollectionController.java index e6b2affa..9022d2d3 100644 --- a/yami-shop-api/src/main/java/com/yami/shop/api/controller/UserCollectionController.java +++ b/yami-shop-api/src/main/java/com/yami/shop/api/controller/UserCollectionController.java @@ -91,9 +91,9 @@ public ServerResponseEntity addOrCancel(@RequestBody Long prodId) { */ @GetMapping("count") @Operation(summary = "查询用户收藏商品数量" , description = "查询用户收藏商品数量") - public int findUserCollectionCount() { + public ServerResponseEntity findUserCollectionCount() { String userId = SecurityUtils.getUser().getUserId(); - return userCollectionService.count(new LambdaQueryWrapper().eq(UserCollection::getUserId, userId)); + return ServerResponseEntity.success(userCollectionService.count(new LambdaQueryWrapper().eq(UserCollection::getUserId, userId))); } @GetMapping("/prods") diff --git a/yami-shop-common/src/main/java/com/yami/shop/common/config/MybatisPlusConfig.java b/yami-shop-common/src/main/java/com/yami/shop/common/config/MybatisPlusConfig.java index 6aad0fdc..d8ba4f39 100644 --- a/yami-shop-common/src/main/java/com/yami/shop/common/config/MybatisPlusConfig.java +++ b/yami-shop-common/src/main/java/com/yami/shop/common/config/MybatisPlusConfig.java @@ -10,10 +10,12 @@ package com.yami.shop.common.config; +import com.baomidou.mybatisplus.annotation.DbType; +import com.baomidou.mybatisplus.core.injector.DefaultSqlInjector; import com.baomidou.mybatisplus.core.injector.ISqlInjector; -import com.baomidou.mybatisplus.extension.injector.LogicSqlInjector; -import com.baomidou.mybatisplus.extension.plugins.OptimisticLockerInterceptor; -import com.baomidou.mybatisplus.extension.plugins.PaginationInterceptor; +import com.baomidou.mybatisplus.extension.plugins.MybatisPlusInterceptor; +import com.baomidou.mybatisplus.extension.plugins.inner.OptimisticLockerInnerInterceptor; +import com.baomidou.mybatisplus.extension.plugins.inner.PaginationInnerInterceptor; import org.mybatis.spring.annotation.MapperScan; import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean; import org.springframework.context.annotation.Bean; @@ -26,32 +28,24 @@ @MapperScan({"com.yami.shop.**.dao"}) public class MybatisPlusConfig { - /** - * 分页插件 - * @return PaginationInterceptor - */ - @Bean - @ConditionalOnMissingBean - public PaginationInterceptor paginationInterceptor() { - return new PaginationInterceptor(); - } /** * 逻辑删除插件 - * * @return LogicSqlInjector */ @Bean @ConditionalOnMissingBean public ISqlInjector sqlInjector() { - return new LogicSqlInjector(); + return new DefaultSqlInjector(); } /** - * 乐观锁插件 - * @return + * mybatis-plus插件 */ @Bean - public OptimisticLockerInterceptor optimisticLockerInterceptor() { - return new OptimisticLockerInterceptor(); + public MybatisPlusInterceptor optimisticLockerInterceptor() { + MybatisPlusInterceptor mybatisPlusInterceptor = new MybatisPlusInterceptor(); + mybatisPlusInterceptor.addInnerInterceptor(new PaginationInnerInterceptor(DbType.MYSQL)); + mybatisPlusInterceptor.addInnerInterceptor(new OptimisticLockerInnerInterceptor()); + return mybatisPlusInterceptor; } } diff --git a/yami-shop-common/src/main/java/com/yami/shop/common/util/PageParam.java b/yami-shop-common/src/main/java/com/yami/shop/common/util/PageParam.java index 02b497cb..88d1b7bc 100644 --- a/yami-shop-common/src/main/java/com/yami/shop/common/util/PageParam.java +++ b/yami-shop-common/src/main/java/com/yami/shop/common/util/PageParam.java @@ -92,14 +92,6 @@ public boolean getSearchCount() { return isSearchCount; } - @Override - public boolean isSearchCount() { - if (total < 0) { - return false; - } - return isSearchCount; - } - @Override public Page setSearchCount(boolean isSearchCount) { this.isSearchCount = isSearchCount; @@ -132,24 +124,4 @@ public Page setCurrent(long current) { this.current = current; return this; } - - /** @deprecated */ - @Deprecated - public String getCountId() { - return this.countId; - } - - /** @deprecated */ - @Deprecated - public Long getMaxLimit() { - return this.maxLimit; - } - - - /** @deprecated */ - @Deprecated - public boolean isOptimizeCountSql() { - return this.optimizeCountSql; - } - } diff --git a/yami-shop-service/src/main/java/com/yami/shop/service/impl/SmsLogServiceImpl.java b/yami-shop-service/src/main/java/com/yami/shop/service/impl/SmsLogServiceImpl.java index 76ff1523..a3b8f7a1 100644 --- a/yami-shop-service/src/main/java/com/yami/shop/service/impl/SmsLogServiceImpl.java +++ b/yami-shop-service/src/main/java/com/yami/shop/service/impl/SmsLogServiceImpl.java @@ -87,7 +87,7 @@ public void sendSms(SmsType smsType, String userId, String mobile, Map() + long todaySendSmsNumber = smsLogMapper.selectCount(new LambdaQueryWrapper() .gt(SmsLog::getRecDate, DateUtil.beginOfDay(new Date())) .lt(SmsLog::getRecDate, DateUtil.endOfDay(new Date())) .eq(SmsLog::getUserId, userId)