refactor: 迁移类目模块到商品模块下

This commit is contained in:
2026-08-18 17:43:36 +08:00
parent fd7a3b1273
commit 24ef58a217
14 changed files with 51 additions and 48 deletions
@@ -9,8 +9,8 @@ import top.xyquan.ecomdmbbackend.modules.ec.shop.monthlytarget.mapper.ShopMonthl
import top.xyquan.ecomdmbbackend.modules.ec.shop.monthlytarget.model.po.ShopMonthlyTargetPO;
import top.xyquan.ecomdmbbackend.modules.bi.overview.model.vo.CompanyOverviewVO;
import top.xyquan.ecomdmbbackend.modules.bi.overview.service.CompanyOverviewService;
import top.xyquan.ecomdmbbackend.modules.ec.category.model.po.CategoryPO;
import top.xyquan.ecomdmbbackend.modules.ec.category.service.CategoryService;
import top.xyquan.ecomdmbbackend.modules.ec.product.category.model.po.CategoryPO;
import top.xyquan.ecomdmbbackend.modules.ec.product.category.service.CategoryService;
import top.xyquan.ecomdmbbackend.modules.ec.product.mapper.ProductMapper;
import top.xyquan.ecomdmbbackend.modules.ec.product.model.po.ProductPO;
@@ -3,14 +3,14 @@ package top.xyquan.ecomdmbbackend.modules.bi.workbench.service.impl;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import org.springframework.stereotype.Service;
import top.xyquan.ecomdmbbackend.common.exception.BusinessException;
import top.xyquan.ecomdmbbackend.modules.ec.category.model.po.CategoryPO;
import top.xyquan.ecomdmbbackend.modules.ec.category.service.CategoryService;
import top.xyquan.ecomdmbbackend.modules.bi.overview.model.agg.OverviewAggRows;
import top.xyquan.ecomdmbbackend.modules.ec.order.status.support.OrderStatusStatResolver;
import top.xyquan.ecomdmbbackend.modules.ec.order.status.support.OrderStatusStatSets;
import top.xyquan.ecomdmbbackend.modules.bi.overview.model.vo.CompanyOverviewVO;
import top.xyquan.ecomdmbbackend.modules.bi.overview.service.CompanyOverviewService;
import top.xyquan.ecomdmbbackend.modules.ec.platform.model.enums.PlatformCode;
import top.xyquan.ecomdmbbackend.modules.ec.product.category.model.po.CategoryPO;
import top.xyquan.ecomdmbbackend.modules.ec.product.category.service.CategoryService;
import top.xyquan.ecomdmbbackend.modules.ec.product.mapper.ProductMapper;
import top.xyquan.ecomdmbbackend.modules.ec.product.model.po.ProductPO;
import top.xyquan.ecomdmbbackend.modules.ec.shop.model.po.ShopPO;
@@ -14,8 +14,8 @@ import top.xyquan.ecomdmbbackend.modules.channel.pdd.order.sync.model.PddOrderSy
import top.xyquan.ecomdmbbackend.modules.channel.pdd.order.sync.service.PddOrderSyncContextResolver;
import top.xyquan.ecomdmbbackend.modules.channel.pdd.goods.service.PddGoodsService;
import top.xyquan.ecomdmbbackend.modules.channel.pdd.pop.goods.PddGoodsPopApiClient;
import top.xyquan.ecomdmbbackend.modules.ec.category.model.po.CategoryPO;
import top.xyquan.ecomdmbbackend.modules.ec.category.service.CategoryService;
import top.xyquan.ecomdmbbackend.modules.ec.product.category.model.po.CategoryPO;
import top.xyquan.ecomdmbbackend.modules.ec.product.category.service.CategoryService;
import top.xyquan.ecomdmbbackend.modules.ec.product.model.po.ProductPO;
import top.xyquan.ecomdmbbackend.modules.ec.product.model.po.ProductSkuPO;
import top.xyquan.ecomdmbbackend.modules.ec.product.service.ProductService;
@@ -1,4 +1,4 @@
package top.xyquan.ecomdmbbackend.modules.ec.category.controller;
package top.xyquan.ecomdmbbackend.modules.ec.product.category.controller;
import jakarta.validation.Valid;
import org.springframework.web.bind.annotation.*;
@@ -6,11 +6,11 @@ import top.xyquan.ecomdmbbackend.common.annotation.RequirePermission;
import top.xyquan.ecomdmbbackend.common.model.dto.PageQueryDTO;
import top.xyquan.ecomdmbbackend.common.model.vo.PageResultVO;
import top.xyquan.ecomdmbbackend.common.response.ApiResponse;
import top.xyquan.ecomdmbbackend.modules.ec.category.model.dto.CategoryFilterDTO;
import top.xyquan.ecomdmbbackend.modules.ec.category.model.dto.CreateCategoryDTO;
import top.xyquan.ecomdmbbackend.modules.ec.category.model.dto.UpdateCategoryDTO;
import top.xyquan.ecomdmbbackend.modules.ec.category.model.vo.CategoryVO;
import top.xyquan.ecomdmbbackend.modules.ec.category.service.CategoryService;
import top.xyquan.ecomdmbbackend.modules.ec.product.category.model.dto.CategoryFilterDTO;
import top.xyquan.ecomdmbbackend.modules.ec.product.category.model.dto.CreateCategoryDTO;
import top.xyquan.ecomdmbbackend.modules.ec.product.category.model.dto.UpdateCategoryDTO;
import top.xyquan.ecomdmbbackend.modules.ec.product.category.model.vo.CategoryVO;
import top.xyquan.ecomdmbbackend.modules.ec.product.category.service.CategoryService;
import java.util.List;
@@ -18,7 +18,7 @@ import java.util.List;
* 商品类目管理控制器
*/
@RestController
@RequestMapping("/api/ec/category")
@RequestMapping("/api/ec/product/category")
public class CategoryController {
private final CategoryService categoryService;
@@ -28,14 +28,14 @@ public class CategoryController {
}
@PostMapping("/create")
@RequirePermission(value = "ec:category:manage", description = "创建类目", allowSuper = true)
@RequirePermission(value = "ec:product:category:manage", description = "创建类目", allowSuper = true)
public ApiResponse<CategoryVO> createCategory(@Valid @RequestBody CreateCategoryDTO createCategoryDTO) {
CategoryVO categoryVO = categoryService.createCategory(createCategoryDTO);
return ApiResponse.success("类目创建成功", categoryVO);
}
@PutMapping("/update/{id}")
@RequirePermission(value = "ec:category:manage", description = "更新类目", allowSuper = true)
@RequirePermission(value = "ec:product:category:manage", description = "更新类目", allowSuper = true)
public ApiResponse<CategoryVO> updateCategory(@Valid @RequestBody UpdateCategoryDTO updateCategoryDTO,
@PathVariable Long id) {
CategoryVO categoryVO = categoryService.updateCategory(updateCategoryDTO, id);
@@ -43,7 +43,7 @@ public class CategoryController {
}
@DeleteMapping("/delete/{id}")
@RequirePermission(value = "ec:category:manage", description = "删除类目", allowSuper = true)
@RequirePermission(value = "ec:product:category:manage", description = "删除类目", allowSuper = true)
public ApiResponse<Void> deleteCategory(
@PathVariable Long id) {
categoryService.deleteCategory(id);
@@ -51,7 +51,7 @@ public class CategoryController {
}
@PostMapping("/list")
@RequirePermission(value = "ec:category:read", description = "查询类目列表", allowSuper = true)
@RequirePermission(value = "ec:product:category:read", description = "查询类目列表", allowSuper = true)
public ApiResponse<PageResultVO<CategoryVO>> getCategoryPage(
@Valid @RequestBody PageQueryDTO<CategoryFilterDTO> pageQueryDTO) {
PageResultVO<CategoryVO> result = categoryService.getCategoryPage(pageQueryDTO);
@@ -59,14 +59,14 @@ public class CategoryController {
}
@GetMapping("/tree")
@RequirePermission(value = "ec:category:read", description = "查询类目树", allowSuper = true)
@RequirePermission(value = "ec:product:category:read", description = "查询类目树", allowSuper = true)
public ApiResponse<List<CategoryVO>> getCategoryTree() {
List<CategoryVO> tree = categoryService.getCategoryTree();
return ApiResponse.success("获取类目树成功", tree);
}
@GetMapping("/list")
@RequirePermission(value = "ec:category:read", description = "查询类目列表", allowSuper = true)
@RequirePermission(value = "ec:product:category:read", description = "查询类目列表", allowSuper = true)
public ApiResponse<List<CategoryVO>> getCategoryList() {
List<CategoryVO> list = categoryService.getCategoryList();
return ApiResponse.success("获取类目列表成功", list);
@@ -1,7 +1,9 @@
package top.xyquan.ecomdmbbackend.modules.ec.category.mapper;
package top.xyquan.ecomdmbbackend.modules.ec.product.category.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import top.xyquan.ecomdmbbackend.modules.ec.category.model.po.CategoryPO;
import top.xyquan.ecomdmbbackend.modules.ec.product.category.model.po.CategoryPO;
import org.apache.ibatis.annotations.Mapper;
/**
@@ -1,4 +1,4 @@
package top.xyquan.ecomdmbbackend.modules.ec.category.model.dto;
package top.xyquan.ecomdmbbackend.modules.ec.product.category.model.dto;
import lombok.Data;
@@ -1,4 +1,4 @@
package top.xyquan.ecomdmbbackend.modules.ec.category.model.dto;
package top.xyquan.ecomdmbbackend.modules.ec.product.category.model.dto;
import jakarta.validation.constraints.NotBlank;
import lombok.Data;
@@ -1,4 +1,4 @@
package top.xyquan.ecomdmbbackend.modules.ec.category.model.dto;
package top.xyquan.ecomdmbbackend.modules.ec.product.category.model.dto;
import jakarta.validation.constraints.NotBlank;
import lombok.Data;
@@ -1,4 +1,4 @@
package top.xyquan.ecomdmbbackend.modules.ec.category.model.po;
package top.xyquan.ecomdmbbackend.modules.ec.product.category.model.po;
import com.baomidou.mybatisplus.annotation.*;
import lombok.Data;
@@ -1,4 +1,4 @@
package top.xyquan.ecomdmbbackend.modules.ec.category.model.vo;
package top.xyquan.ecomdmbbackend.modules.ec.product.category.model.vo;
import lombok.Data;
@@ -1,13 +1,13 @@
package top.xyquan.ecomdmbbackend.modules.ec.category.service;
package top.xyquan.ecomdmbbackend.modules.ec.product.category.service;
import com.baomidou.mybatisplus.extension.service.IService;
import top.xyquan.ecomdmbbackend.common.model.dto.PageQueryDTO;
import top.xyquan.ecomdmbbackend.common.model.vo.PageResultVO;
import top.xyquan.ecomdmbbackend.modules.ec.category.model.dto.CategoryFilterDTO;
import top.xyquan.ecomdmbbackend.modules.ec.category.model.dto.CreateCategoryDTO;
import top.xyquan.ecomdmbbackend.modules.ec.category.model.dto.UpdateCategoryDTO;
import top.xyquan.ecomdmbbackend.modules.ec.category.model.po.CategoryPO;
import top.xyquan.ecomdmbbackend.modules.ec.category.model.vo.CategoryVO;
import top.xyquan.ecomdmbbackend.modules.ec.product.category.model.dto.CategoryFilterDTO;
import top.xyquan.ecomdmbbackend.modules.ec.product.category.model.dto.CreateCategoryDTO;
import top.xyquan.ecomdmbbackend.modules.ec.product.category.model.dto.UpdateCategoryDTO;
import top.xyquan.ecomdmbbackend.modules.ec.product.category.model.po.CategoryPO;
import top.xyquan.ecomdmbbackend.modules.ec.product.category.model.vo.CategoryVO;
import java.util.List;
@@ -1,6 +1,14 @@
package top.xyquan.ecomdmbbackend.modules.ec.category.service.impl;
package top.xyquan.ecomdmbbackend.modules.ec.product.category.service.impl;
import top.xyquan.ecomdmbbackend.common.utils.BeanCopyUtils;
import top.xyquan.ecomdmbbackend.modules.ec.product.category.mapper.CategoryMapper;
import top.xyquan.ecomdmbbackend.modules.ec.product.category.model.dto.CategoryFilterDTO;
import top.xyquan.ecomdmbbackend.modules.ec.product.category.model.dto.CreateCategoryDTO;
import top.xyquan.ecomdmbbackend.modules.ec.product.category.model.dto.UpdateCategoryDTO;
import top.xyquan.ecomdmbbackend.modules.ec.product.category.model.po.CategoryPO;
import top.xyquan.ecomdmbbackend.modules.ec.product.category.model.vo.CategoryVO;
import top.xyquan.ecomdmbbackend.modules.ec.product.category.service.CategoryService;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
@@ -10,13 +18,6 @@ import org.springframework.transaction.annotation.Transactional;
import top.xyquan.ecomdmbbackend.common.exception.BusinessException;
import top.xyquan.ecomdmbbackend.common.model.dto.PageQueryDTO;
import top.xyquan.ecomdmbbackend.common.model.vo.PageResultVO;
import top.xyquan.ecomdmbbackend.modules.ec.category.mapper.CategoryMapper;
import top.xyquan.ecomdmbbackend.modules.ec.category.model.dto.CategoryFilterDTO;
import top.xyquan.ecomdmbbackend.modules.ec.category.model.dto.CreateCategoryDTO;
import top.xyquan.ecomdmbbackend.modules.ec.category.model.dto.UpdateCategoryDTO;
import top.xyquan.ecomdmbbackend.modules.ec.category.model.po.CategoryPO;
import top.xyquan.ecomdmbbackend.modules.ec.category.model.vo.CategoryVO;
import top.xyquan.ecomdmbbackend.modules.ec.category.service.CategoryService;
import top.xyquan.ecomdmbbackend.utils.CurrentUserContext;
import java.util.ArrayList;
@@ -11,6 +11,7 @@ import org.springframework.transaction.annotation.Transactional;
import top.xyquan.ecomdmbbackend.common.exception.BusinessException;
import top.xyquan.ecomdmbbackend.common.model.dto.PageQueryDTO;
import top.xyquan.ecomdmbbackend.common.model.vo.PageResultVO;
import top.xyquan.ecomdmbbackend.modules.ec.product.category.service.CategoryService;
import top.xyquan.ecomdmbbackend.modules.ec.product.mapper.ProductMapper;
import top.xyquan.ecomdmbbackend.modules.ec.product.model.dto.CreateProductDTO;
import top.xyquan.ecomdmbbackend.modules.ec.product.model.dto.CreateProductResultDTO;
@@ -26,7 +27,6 @@ import top.xyquan.ecomdmbbackend.modules.ec.product.model.vo.ProductSkuVO;
import top.xyquan.ecomdmbbackend.modules.ec.order.service.OrderService;
import top.xyquan.ecomdmbbackend.modules.ec.product.service.ProductService;
import top.xyquan.ecomdmbbackend.modules.ec.product.service.ProductSkuService;
import top.xyquan.ecomdmbbackend.modules.ec.category.service.CategoryService;
import top.xyquan.ecomdmbbackend.modules.sys.file.mapper.SysFileMapper;
import top.xyquan.ecomdmbbackend.modules.sys.file.model.po.SysFilePO;
import top.xyquan.ecomdmbbackend.utils.CurrentUserContext;
@@ -580,7 +580,7 @@ public class ProductServiceImpl extends ServiceImpl<ProductMapper, ProductPO> im
// 查询类目名称
if (product.getCategoryId() != null) {
top.xyquan.ecomdmbbackend.modules.ec.category.model.po.CategoryPO category =
top.xyquan.ecomdmbbackend.modules.ec.product.category.model.po.CategoryPO category =
categoryService.getById(product.getCategoryId());
if (category != null) {
productVO.setCategoryName(category.getName());