From f7241da8ed50014c81a5ff2849d6424a9f5bef4b Mon Sep 17 00:00:00 2001 From: Jack <46790855@qq.com> Date: Tue, 18 Mar 2025 10:20:24 +0800 Subject: [PATCH] =?UTF-8?q?=E5=A2=9E=E5=8A=A0=E4=BA=86app=20=E7=89=88?= =?UTF-8?q?=E6=9C=AC=E6=9B=B4=E6=96=B0=E6=8E=A5=E5=8F=A3,=20=E5=BA=97?= =?UTF-8?q?=E9=93=BA=E5=88=86=E7=B1=BB=E6=8E=A5=E5=8F=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../modules/store/ShopStoreBizCategory.java | 71 +++++++++++++++++ .../store/dto/ShopStoreBizCategoryDTO.java | 34 ++++++++ .../admin/ShopStoreBizCategoryController.java | 54 +++++++++++++ .../ShopStoreBizCategoryController.java | 44 +++++++++++ .../mapper/ShopStoreBizCategoryMapper.java | 29 +++++++ .../service/ShopStoreBizCategoryService.java | 27 +++++++ .../impl/ShopStoreBizCategoryServiceImpl.java | 38 +++++++++ .../store/ShopStoreBizCategoryMapper.xml | 79 +++++++++++++++++++ 8 files changed, 376 insertions(+) create mode 100644 mall-common/src/main/java/com/suisung/mall/common/modules/store/ShopStoreBizCategory.java create mode 100644 mall-common/src/main/java/com/suisung/mall/common/modules/store/dto/ShopStoreBizCategoryDTO.java create mode 100644 mall-shop/src/main/java/com/suisung/mall/shop/store/controller/admin/ShopStoreBizCategoryController.java create mode 100644 mall-shop/src/main/java/com/suisung/mall/shop/store/controller/mobile/ShopStoreBizCategoryController.java create mode 100644 mall-shop/src/main/java/com/suisung/mall/shop/store/mapper/ShopStoreBizCategoryMapper.java create mode 100644 mall-shop/src/main/java/com/suisung/mall/shop/store/service/ShopStoreBizCategoryService.java create mode 100644 mall-shop/src/main/java/com/suisung/mall/shop/store/service/impl/ShopStoreBizCategoryServiceImpl.java create mode 100644 mall-shop/src/main/resources/mapper/store/ShopStoreBizCategoryMapper.xml diff --git a/mall-common/src/main/java/com/suisung/mall/common/modules/store/ShopStoreBizCategory.java b/mall-common/src/main/java/com/suisung/mall/common/modules/store/ShopStoreBizCategory.java new file mode 100644 index 00000000..3a6a00bc --- /dev/null +++ b/mall-common/src/main/java/com/suisung/mall/common/modules/store/ShopStoreBizCategory.java @@ -0,0 +1,71 @@ +package com.suisung.mall.common.modules.store; + +import com.baomidou.mybatisplus.annotation.IdType; +import com.baomidou.mybatisplus.annotation.TableId; +import com.baomidou.mybatisplus.annotation.TableName; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; +import lombok.EqualsAndHashCode; +import lombok.experimental.Accessors; + +import java.io.Serializable; +import java.math.BigDecimal; +import java.util.Date; + +/** + *

+ * 店铺营业分类表,用于存储超市商品的分类信息,支持二级分类,会影响分成比例 + *

+ * + * @author Xinze + * @since 2021-07-02 + */ +@Data +@EqualsAndHashCode(callSuper = false) +@Accessors(chain = true) +@TableName("shop_store_biz_category") +@ApiModel(value = "ShopStoreBizCategory对象", description = "店铺营业分类表") +public class ShopStoreBizCategory implements Serializable { + + private static final long serialVersionUID = 1L; + + @ApiModelProperty(value = "自增ID") + @TableId(value = "id", type = IdType.INPUT) + private Long id; + + @ApiModelProperty(value = "分类编号") + private String category_code; + + @ApiModelProperty(value = "分类名称,记录分类的名称") + private String category_name; + + @ApiModelProperty(value = "父分类编号,用于关联上级分类,0表示顶级分类") + private String parent_category_code; + + @ApiModelProperty(value = "分类描述,对分类的详细说明") + private String description; + + @ApiModelProperty(value = "分成比例,范围是1.00-100.00") + private BigDecimal split_ratio; + + @ApiModelProperty(value = "排序,用于确定分类的显示顺序") + private Integer seq; + + @ApiModelProperty(value = "状态,如 1-有效,2-无效;") + private Integer status; + + @ApiModelProperty(value = "创建用户") + private String created_by; + + @ApiModelProperty(value = "最后修改用户") + private String updated_by; + + @ApiModelProperty(value = "创建时间") + private Date created_at; + + @ApiModelProperty(value = "更新时间") + private Date updated_at; + + +} diff --git a/mall-common/src/main/java/com/suisung/mall/common/modules/store/dto/ShopStoreBizCategoryDTO.java b/mall-common/src/main/java/com/suisung/mall/common/modules/store/dto/ShopStoreBizCategoryDTO.java new file mode 100644 index 00000000..d8db949d --- /dev/null +++ b/mall-common/src/main/java/com/suisung/mall/common/modules/store/dto/ShopStoreBizCategoryDTO.java @@ -0,0 +1,34 @@ +/* + * Copyright (c) 2025. Lorem ipsum dolor sit amet, consectetur adipiscing elit. + * Morbi non lorem porttitor neque feugiat blandit. Ut vitae ipsum eget quam lacinia accumsan. + * Etiam sed turpis ac ipsum condimentum fringilla. Maecenas magna. + * Proin dapibus sapien vel ante. Aliquam erat volutpat. Pellentesque sagittis ligula eget metus. + * Vestibulum commodo. Ut rhoncus gravida arcu. + */ + +package com.suisung.mall.common.modules.store.dto; + +import com.suisung.mall.common.modules.store.ShopStoreBizCategory; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.AllArgsConstructor; +import lombok.Data; +import lombok.EqualsAndHashCode; +import lombok.NoArgsConstructor; +import lombok.experimental.Accessors; + +import java.io.Serializable; +import java.util.List; + +@Data +@NoArgsConstructor +@AllArgsConstructor +@EqualsAndHashCode(callSuper = false) +@Accessors(chain = true) +@ApiModel(value = "ShopStoreBizCategoryDTO对象", description = "店铺营业分类表") +public class ShopStoreBizCategoryDTO extends ShopStoreBizCategory implements Serializable { + private static final long serialVersionUID = 1L; + + @ApiModelProperty(value = "子类集合") + private List children; +} diff --git a/mall-shop/src/main/java/com/suisung/mall/shop/store/controller/admin/ShopStoreBizCategoryController.java b/mall-shop/src/main/java/com/suisung/mall/shop/store/controller/admin/ShopStoreBizCategoryController.java new file mode 100644 index 00000000..e334fe40 --- /dev/null +++ b/mall-shop/src/main/java/com/suisung/mall/shop/store/controller/admin/ShopStoreBizCategoryController.java @@ -0,0 +1,54 @@ +/* + * Copyright (c) 2025. Lorem ipsum dolor sit amet, consectetur adipiscing elit. + * Morbi non lorem porttitor neque feugiat blandit. Ut vitae ipsum eget quam lacinia accumsan. + * Etiam sed turpis ac ipsum condimentum fringilla. Maecenas magna. + * Proin dapibus sapien vel ante. Aliquam erat volutpat. Pellentesque sagittis ligula eget metus. + * Vestibulum commodo. Ut rhoncus gravida arcu. + */ + +package com.suisung.mall.shop.store.controller.admin; + + +import cn.hutool.core.util.StrUtil; +import cn.hutool.json.JSONObject; +import com.suisung.mall.common.api.CommonResult; +import com.suisung.mall.common.service.impl.BaseControllerImpl; +import com.suisung.mall.shop.store.service.ShopStoreBizCategoryService; +import io.swagger.annotations.Api; +import io.swagger.annotations.ApiOperation; +import org.springframework.web.bind.annotation.RequestBody; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RequestMethod; +import org.springframework.web.bind.annotation.RestController; + +import javax.annotation.Resource; + +@Api(tags = "店铺分类(类目),此类决定商家分成比例") +@RestController +@RequestMapping("/admin/shop/store/biz-category") +public class ShopStoreBizCategoryController extends BaseControllerImpl { + + @Resource + private ShopStoreBizCategoryService shopStoreBizCategoryService; + + @ApiOperation(value = "搜索店铺分类(类目)", notes = "搜索店铺分类(类目)") + @RequestMapping(value = "/search", method = RequestMethod.POST) + public CommonResult shopStoreBizCategorySearchList(@RequestBody(required = false) JSONObject params) { + String keyword = ""; + if (params != null && StrUtil.isNotBlank(params.getStr("keyword"))) { + keyword = params.getStr("keyword"); + } + return CommonResult.success(shopStoreBizCategoryService.selectParentListWithChildren(keyword)); + } + + @ApiOperation(value = "新增店铺分类(类目)", notes = "新增店铺分类(类目)") + @RequestMapping(value = "/add/new", method = RequestMethod.POST) + public CommonResult shopStoreBusinessCategoryList(@RequestBody(required = false) JSONObject params) { + String keyword = ""; + if (params != null && StrUtil.isNotBlank(params.getStr("keyword"))) { + keyword = params.getStr("keyword"); + } + return CommonResult.success(shopStoreBizCategoryService.selectParentListWithChildren(keyword)); + } + +} diff --git a/mall-shop/src/main/java/com/suisung/mall/shop/store/controller/mobile/ShopStoreBizCategoryController.java b/mall-shop/src/main/java/com/suisung/mall/shop/store/controller/mobile/ShopStoreBizCategoryController.java new file mode 100644 index 00000000..cdbaa5f8 --- /dev/null +++ b/mall-shop/src/main/java/com/suisung/mall/shop/store/controller/mobile/ShopStoreBizCategoryController.java @@ -0,0 +1,44 @@ +/* + * Copyright (c) 2025. Lorem ipsum dolor sit amet, consectetur adipiscing elit. + * Morbi non lorem porttitor neque feugiat blandit. Ut vitae ipsum eget quam lacinia accumsan. + * Etiam sed turpis ac ipsum condimentum fringilla. Maecenas magna. + * Proin dapibus sapien vel ante. Aliquam erat volutpat. Pellentesque sagittis ligula eget metus. + * Vestibulum commodo. Ut rhoncus gravida arcu. + */ + +package com.suisung.mall.shop.store.controller.mobile; + + +import cn.hutool.core.util.StrUtil; +import cn.hutool.json.JSONObject; +import com.suisung.mall.common.api.CommonResult; +import com.suisung.mall.common.service.impl.BaseControllerImpl; +import com.suisung.mall.shop.store.service.ShopStoreBizCategoryService; +import io.swagger.annotations.Api; +import io.swagger.annotations.ApiOperation; +import org.springframework.web.bind.annotation.RequestBody; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RequestMethod; +import org.springframework.web.bind.annotation.RestController; + +import javax.annotation.Resource; + +@Api(tags = "店铺分类(类目),此类决定商家分成比例") +@RestController +@RequestMapping("/mobile/shop/store/biz-category") +public class ShopStoreBizCategoryController extends BaseControllerImpl { + + @Resource + private ShopStoreBizCategoryService shopStoreBizCategoryService; + + @ApiOperation(value = "店铺分类(类目)", notes = "店铺分类(类目)") + @RequestMapping(value = "/list", method = RequestMethod.POST) + public CommonResult shopStoreBusinessCategoryList(@RequestBody(required = false) JSONObject params) { + String keyword = ""; + if (params != null && StrUtil.isNotBlank(params.getStr("keyword"))) { + keyword = params.getStr("keyword"); + } + return CommonResult.success(shopStoreBizCategoryService.selectParentListWithChildren(keyword)); + } + +} diff --git a/mall-shop/src/main/java/com/suisung/mall/shop/store/mapper/ShopStoreBizCategoryMapper.java b/mall-shop/src/main/java/com/suisung/mall/shop/store/mapper/ShopStoreBizCategoryMapper.java new file mode 100644 index 00000000..9586a7ba --- /dev/null +++ b/mall-shop/src/main/java/com/suisung/mall/shop/store/mapper/ShopStoreBizCategoryMapper.java @@ -0,0 +1,29 @@ +package com.suisung.mall.shop.store.mapper; + +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import com.suisung.mall.common.modules.store.ShopStoreBizCategory; +import com.suisung.mall.common.modules.store.dto.ShopStoreBizCategoryDTO; +import org.apache.ibatis.annotations.Param; +import org.springframework.stereotype.Repository; + +import java.util.List; + +/** + *

+ * 店铺营业分类表,用于存储超市商品的分类信息,支持二级分类 Mapper 接口 + *

+ * + * @author panjunjie + * @since 2025-03-17 + */ +@Repository +public interface ShopStoreBizCategoryMapper extends BaseMapper { + + /** + * 根据关键字查询店铺一级营业分类信息 + * + * @param keyword + * @return + */ + List selectParentListWithChildren(@Param("keyword") String keyword); +} diff --git a/mall-shop/src/main/java/com/suisung/mall/shop/store/service/ShopStoreBizCategoryService.java b/mall-shop/src/main/java/com/suisung/mall/shop/store/service/ShopStoreBizCategoryService.java new file mode 100644 index 00000000..3a362753 --- /dev/null +++ b/mall-shop/src/main/java/com/suisung/mall/shop/store/service/ShopStoreBizCategoryService.java @@ -0,0 +1,27 @@ +package com.suisung.mall.shop.store.service; + +import com.suisung.mall.common.modules.store.ShopStoreBizCategory; +import com.suisung.mall.common.modules.store.dto.ShopStoreBizCategoryDTO; +import com.suisung.mall.core.web.service.IBaseService; + +import java.util.List; + + +/** + *

+ * 店铺营业分类表,用于存储超市商品的分类信息,支持二级分类,会影响分成比例 服务类 + *

+ * + * @author panjunjie + * @since 2025-03-17 + */ +public interface ShopStoreBizCategoryService extends IBaseService { + + /** + * 根据关键字查询店铺一级营业分类信息 + * + * @param keyword + * @return + */ + List selectParentListWithChildren(String keyword); +} diff --git a/mall-shop/src/main/java/com/suisung/mall/shop/store/service/impl/ShopStoreBizCategoryServiceImpl.java b/mall-shop/src/main/java/com/suisung/mall/shop/store/service/impl/ShopStoreBizCategoryServiceImpl.java new file mode 100644 index 00000000..761a53c6 --- /dev/null +++ b/mall-shop/src/main/java/com/suisung/mall/shop/store/service/impl/ShopStoreBizCategoryServiceImpl.java @@ -0,0 +1,38 @@ +package com.suisung.mall.shop.store.service.impl; + +import com.suisung.mall.common.modules.store.ShopStoreBizCategory; +import com.suisung.mall.common.modules.store.dto.ShopStoreBizCategoryDTO; +import com.suisung.mall.core.web.service.impl.BaseServiceImpl; +import com.suisung.mall.shop.store.mapper.ShopStoreBizCategoryMapper; +import com.suisung.mall.shop.store.service.ShopStoreBizCategoryService; +import org.springframework.stereotype.Service; + +import javax.annotation.Resource; +import java.util.List; + + +/** + *

+ * 店铺营业分类表,用于存储超市商品的分类信息,支持二级分类,会影响分成比例 服务实现类 + *

+ * + * @author panjunjie + * @since 2025-03-17 + */ +@Service +public class ShopStoreBizCategoryServiceImpl extends BaseServiceImpl implements ShopStoreBizCategoryService { + + @Resource + private ShopStoreBizCategoryMapper shopStoreBizCategoryMapper; + + /** + * 根据关键字查询店铺一级营业分类信息 + * + * @param keyword + * @return + */ + @Override + public List selectParentListWithChildren(String keyword) { + return shopStoreBizCategoryMapper.selectParentListWithChildren(keyword); + } +} diff --git a/mall-shop/src/main/resources/mapper/store/ShopStoreBizCategoryMapper.xml b/mall-shop/src/main/resources/mapper/store/ShopStoreBizCategoryMapper.xml new file mode 100644 index 00000000..eb382d07 --- /dev/null +++ b/mall-shop/src/main/resources/mapper/store/ShopStoreBizCategoryMapper.xml @@ -0,0 +1,79 @@ + + + + + + id + , category_code, category_name, parent_category_code, description,split_ratio,seq,status,created_by,updated_by,created_at,updated_at + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +