From 0719d7a23b535a7d577d4f414cf7c99ae2c1644d Mon Sep 17 00:00:00 2001 From: liujiang <569804566@qq.com> Date: Fri, 15 Aug 2025 13:29:41 +0800 Subject: [PATCH] =?UTF-8?q?master=EF=BC=9Aapp=E6=9F=A5=E8=AF=A2=E6=97=B6?= =?UTF-8?q?=E5=88=86=E7=B1=BB=E6=8E=A5=E5=8F=A3=E8=B0=83=E6=95=B4=EF=BC=9B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../system/SysProductCategoryController.java | 6 ++++ .../xkt/vo/storeProd/StoreProdVO.java | 4 +-- sql/ry_20240629.sql | 6 ++-- .../service/ISysProductCategoryService.java | 8 +++++ .../impl/SysProductCategoryServiceImpl.java | 29 +++++++++++++++++++ 5 files changed, 48 insertions(+), 5 deletions(-) diff --git a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/SysProductCategoryController.java b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/SysProductCategoryController.java index 60588162b..a46d47451 100644 --- a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/SysProductCategoryController.java +++ b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/SysProductCategoryController.java @@ -79,6 +79,12 @@ public class SysProductCategoryController extends XktBaseController { return R.ok(BeanUtil.copyToList(prodCateService.selectList(BeanUtil.toBean(listVO, ProdCateListDTO.class)), ProdCateListResVO.class)); } + @ApiOperation(value = "获取商品分类列表", httpMethod = "POST", response = R.class) + @PostMapping("/app/list") + public R> appList(@RequestBody ProdCateListVO listVO) { + return R.ok(BeanUtil.copyToList(prodCateService.selectAppList(BeanUtil.toBean(listVO, ProdCateListDTO.class)), ProdCateListResVO.class)); + } + @ApiOperation(value = "根据1级分类获取二级分类列表", httpMethod = "GET", response = R.class) @GetMapping("/sub/{parCateId}") public R> getSubListByParCateId(@PathVariable Long parCateId) { diff --git a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/xkt/vo/storeProd/StoreProdVO.java b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/xkt/vo/storeProd/StoreProdVO.java index 429c5450e..80fe17fd6 100644 --- a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/xkt/vo/storeProd/StoreProdVO.java +++ b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/xkt/vo/storeProd/StoreProdVO.java @@ -39,10 +39,10 @@ public class StoreProdVO { @NotBlank(message = "商品分类名称不能为空!") private String prodCateName; @ApiModelProperty(value = "工厂货号") - @Size(min = 0, max = 15, message = "工厂货号不能超过60个字!") + @Size(min = 0, max = 20, message = "工厂货号不能超过20个字!") private String factoryArtNum; @ApiModelProperty(value = "商品货号", required = true) - @Size(min = 0, max = 15, message = "商品货号不能超过60个字!") + @Size(min = 0, max = 20, message = "商品货号不能超过20个字!") @NotBlank(message = "商品货号不能为空!") private String prodArtNum; @ApiModelProperty(value = "商品标题", required = true) diff --git a/sql/ry_20240629.sql b/sql/ry_20240629.sql index 62b1f0925..f1a3e2944 100644 --- a/sql/ry_20240629.sql +++ b/sql/ry_20240629.sql @@ -3399,8 +3399,8 @@ CREATE TABLE `store_product` `id` bigint UNSIGNED NOT NULL AUTO_INCREMENT COMMENT '档口商品ID', `store_id` bigint UNSIGNED NOT NULL COMMENT '档口ID', `prod_cate_id` bigint UNSIGNED NULL DEFAULT NULL COMMENT '商品分类ID', - `factory_art_num` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '工厂货号', - `prod_art_num` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '商品货号', + `factory_art_num` varchar(100) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '工厂货号', + `prod_art_num` varchar(100) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '商品货号', `prod_title` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '商品标题', `prod_weight` decimal(10, 2) NULL DEFAULT NULL COMMENT '商品重量', `produce_price` int UNSIGNED NULL DEFAULT NULL COMMENT '生产价格', @@ -3651,7 +3651,7 @@ CREATE TABLE `store_product_detail` ( `id` bigint UNSIGNED NOT NULL AUTO_INCREMENT COMMENT '商品详情ID', `store_prod_id` bigint UNSIGNED NOT NULL COMMENT '档口商品ID', - `detail` blob NOT NULL COMMENT '详情内容', + `detail` mediumblob NOT NULL COMMENT '详情内容', `version` bigint UNSIGNED NOT NULL COMMENT '版本号', `del_flag` char(1) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '删除标志(0代表存在 2代表删除)', `create_by` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT '' COMMENT '创建者', diff --git a/xkt/src/main/java/com/ruoyi/xkt/service/ISysProductCategoryService.java b/xkt/src/main/java/com/ruoyi/xkt/service/ISysProductCategoryService.java index bf9abf6f1..a5b4da473 100644 --- a/xkt/src/main/java/com/ruoyi/xkt/service/ISysProductCategoryService.java +++ b/xkt/src/main/java/com/ruoyi/xkt/service/ISysProductCategoryService.java @@ -54,6 +54,14 @@ public interface ISysProductCategoryService { */ List selectList(ProdCateListDTO listDTO); + /** + * 获取商品分类列表 + * + * @param listDTO 查询入参 + * @return List + */ + List selectAppList(ProdCateListDTO listDTO); + /** * 获取APP首页商品分类 * diff --git a/xkt/src/main/java/com/ruoyi/xkt/service/impl/SysProductCategoryServiceImpl.java b/xkt/src/main/java/com/ruoyi/xkt/service/impl/SysProductCategoryServiceImpl.java index bd1765f6e..f969522b2 100644 --- a/xkt/src/main/java/com/ruoyi/xkt/service/impl/SysProductCategoryServiceImpl.java +++ b/xkt/src/main/java/com/ruoyi/xkt/service/impl/SysProductCategoryServiceImpl.java @@ -143,6 +143,35 @@ public class SysProductCategoryServiceImpl implements ISysProductCategoryService return this.buildCateTree(resList); } + /** + * 获取商品分类列表 + * + * @param listDTO 查询入参 + * @return List + */ + @Override + @Transactional(readOnly = true) + public List selectAppList(ProdCateListDTO listDTO) { + LambdaQueryWrapper queryWrapper = new LambdaQueryWrapper() + .eq(SysProductCategory::getDelFlag, Constants.UNDELETED) + // 排除最顶层的父级分类 + .ne(SysProductCategory::getParentId, 0) + .orderByAsc(Arrays.asList(SysProductCategory::getOrderNum, SysProductCategory::getId)); + if (StringUtils.isNotBlank(listDTO.getName())) { + queryWrapper.like(SysProductCategory::getName, listDTO.getName()); + } + if (StringUtils.isNotBlank(listDTO.getStatus())) { + queryWrapper.eq(SysProductCategory::getStatus, listDTO.getStatus()); + } + List prodCateList = this.prodCateMapper.selectList(queryWrapper); + if (CollectionUtils.isEmpty(prodCateList)) { + return new ArrayList<>(); + } + List resList = prodCateList.stream() + .map(x -> BeanUtil.toBean(x, ProdCateListResDTO.class).setProdCateId(x.getId())).collect(Collectors.toList()); + return this.buildCateTree(resList); + } + /** * 管理员获取商品分类树 *