From 4d14e33ea998854b7e3670cbb8972eb69ff7c29a Mon Sep 17 00:00:00 2001 From: sangelxiu1 <15781802@163.com> Date: Wed, 25 Jun 2025 16:29:40 +0800 Subject: [PATCH] =?UTF-8?q?##=20Feat=20-=20=E5=8C=BA=E5=9F=9F=E4=BD=93?= =?UTF-8?q?=E7=B3=BB=E5=88=86=E7=BB=84=E9=85=8D=E7=BD=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../api/ApiRegionVertexController.java | 19 ++++ .../manage/BdRegionVertexController.java | 61 ++++++++++ .../base/mapper/BdRegionVertexMapper.java | 17 +++ .../base/service/IBdRegionVertexService.java | 24 ++++ .../impl/BdRegionVertexServiceImpl.java | 106 ++++++++++++++++++ .../hzs/system/base/vo/BdRegionVertexVo.java | 8 ++ .../system/base/BdRegionVertexMapper.xml | 23 ++++ .../domain/system/base/BdRegionVertex.java | 38 +++++++ sql/2025年6月25日_区域体系分组配置.sql | 24 ++++ 9 files changed, 320 insertions(+) create mode 100644 bd-business/bd-business-system/src/main/java/com/hzs/system/base/controller/api/ApiRegionVertexController.java create mode 100644 bd-business/bd-business-system/src/main/java/com/hzs/system/base/controller/manage/BdRegionVertexController.java create mode 100644 bd-business/bd-business-system/src/main/java/com/hzs/system/base/mapper/BdRegionVertexMapper.java create mode 100644 bd-business/bd-business-system/src/main/java/com/hzs/system/base/service/IBdRegionVertexService.java create mode 100644 bd-business/bd-business-system/src/main/java/com/hzs/system/base/service/impl/BdRegionVertexServiceImpl.java create mode 100644 bd-business/bd-business-system/src/main/java/com/hzs/system/base/vo/BdRegionVertexVo.java create mode 100644 bd-business/bd-business-system/src/main/resources/mapper/system/base/BdRegionVertexMapper.xml create mode 100644 bd-common/bd-common-domain/src/main/java/com/hzs/common/domain/system/base/BdRegionVertex.java create mode 100644 sql/2025年6月25日_区域体系分组配置.sql diff --git a/bd-business/bd-business-system/src/main/java/com/hzs/system/base/controller/api/ApiRegionVertexController.java b/bd-business/bd-business-system/src/main/java/com/hzs/system/base/controller/api/ApiRegionVertexController.java new file mode 100644 index 00000000..2fcda919 --- /dev/null +++ b/bd-business/bd-business-system/src/main/java/com/hzs/system/base/controller/api/ApiRegionVertexController.java @@ -0,0 +1,19 @@ +package com.hzs.system.base.controller.api; + + +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RestController; + +/** + *

+ * 区域体系分组配置表 前端控制器 + *

+ * + * @author sangelxiu1 + * @since 2025-06-25 + */ +@RestController +@RequestMapping("/com.hzs.common.domain/bd-region-vertex") +public class ApiRegionVertexController { + +} diff --git a/bd-business/bd-business-system/src/main/java/com/hzs/system/base/controller/manage/BdRegionVertexController.java b/bd-business/bd-business-system/src/main/java/com/hzs/system/base/controller/manage/BdRegionVertexController.java new file mode 100644 index 00000000..ba4a268c --- /dev/null +++ b/bd-business/bd-business-system/src/main/java/com/hzs/system/base/controller/manage/BdRegionVertexController.java @@ -0,0 +1,61 @@ +package com.hzs.system.base.controller.manage; + + +import cn.hutool.core.util.ObjectUtil; +import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; +import com.hzs.common.core.constant.CacheConstants; +import com.hzs.common.core.enums.EDelayBusType; +import com.hzs.common.core.utils.DateUtils; +import com.hzs.common.core.utils.StringUtils; +import com.hzs.common.core.web.controller.BaseController; +import com.hzs.common.core.web.domain.AjaxResult; +import com.hzs.common.core.web.page.TableDataInfo; +import com.hzs.common.domain.system.base.BdCurrency; +import com.hzs.common.domain.system.base.BdRegionVertex; +import com.hzs.common.security.utils.SecurityUtils; +import com.hzs.system.base.service.IBdRegionVertexService; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.web.bind.annotation.*; + +import java.util.List; + +/** + *

+ * 区域体系分组配置表 前端控制器 + *

+ * + * @author sangelxiu1 + * @since 2025-06-25 + */ +@RestController +@RequestMapping("/manage/bd-region-vertex") +public class BdRegionVertexController extends BaseController { + @Autowired + private IBdRegionVertexService bdRegionVertexService; + + @GetMapping("/list") + public TableDataInfo list(BdRegionVertex param) { + startPage(); + List list = bdRegionVertexService.getList(param); + return getDataTable(list); + } + @PostMapping("/add") + public AjaxResult add(@RequestBody BdRegionVertex param) { + bdRegionVertexService.add(param); + return AjaxResult.success(); + } + @PostMapping("/update") + public AjaxResult update(@RequestBody BdRegionVertex param) { + bdRegionVertexService.update(param); + return AjaxResult.success(); + } + @PostMapping("/delete") + public AjaxResult delete(@RequestBody BdRegionVertex param) { + bdRegionVertexService.delete(param); + return AjaxResult.success(); + } + @GetMapping("/getById") + public AjaxResult getById(BdRegionVertex param) { + return AjaxResult.success(bdRegionVertexService.getById(param)); + } +} diff --git a/bd-business/bd-business-system/src/main/java/com/hzs/system/base/mapper/BdRegionVertexMapper.java b/bd-business/bd-business-system/src/main/java/com/hzs/system/base/mapper/BdRegionVertexMapper.java new file mode 100644 index 00000000..c2531fb4 --- /dev/null +++ b/bd-business/bd-business-system/src/main/java/com/hzs/system/base/mapper/BdRegionVertexMapper.java @@ -0,0 +1,17 @@ +package com.hzs.system.base.mapper; + +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import com.hzs.common.domain.system.base.BdRegionVertex; +import feign.Param; + +/** + *

+ * 区域体系分组配置表 Mapper 接口 + *

+ * + * @author sangelxiu1 + * @since 2025-06-25 + */ +public interface BdRegionVertexMapper extends BaseMapper { + int validateMappingCount(@Param("pkId") Long pkId); +} diff --git a/bd-business/bd-business-system/src/main/java/com/hzs/system/base/service/IBdRegionVertexService.java b/bd-business/bd-business-system/src/main/java/com/hzs/system/base/service/IBdRegionVertexService.java new file mode 100644 index 00000000..27ee3c20 --- /dev/null +++ b/bd-business/bd-business-system/src/main/java/com/hzs/system/base/service/IBdRegionVertexService.java @@ -0,0 +1,24 @@ +package com.hzs.system.base.service; + +import com.baomidou.mybatisplus.extension.service.IService; +import com.hzs.common.domain.system.base.BdRegionVertex; + +import java.util.List; + +/** + *

+ * 区域体系分组配置表 服务类 + *

+ * + * @author sangelxiu1 + * @since 2025-06-25 + */ +public interface IBdRegionVertexService extends IService { + + List getList(BdRegionVertex param); + + void add(BdRegionVertex param); + void delete(BdRegionVertex param); + void update(BdRegionVertex param); + BdRegionVertex getById(BdRegionVertex param); +} diff --git a/bd-business/bd-business-system/src/main/java/com/hzs/system/base/service/impl/BdRegionVertexServiceImpl.java b/bd-business/bd-business-system/src/main/java/com/hzs/system/base/service/impl/BdRegionVertexServiceImpl.java new file mode 100644 index 00000000..9c0ca883 --- /dev/null +++ b/bd-business/bd-business-system/src/main/java/com/hzs/system/base/service/impl/BdRegionVertexServiceImpl.java @@ -0,0 +1,106 @@ +package com.hzs.system.base.service.impl; + +import cn.hutool.core.util.ObjectUtil; +import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import com.hzs.common.core.exception.ServiceException; +import com.hzs.common.core.utils.StringUtils; +import com.hzs.common.domain.system.base.BdRegionVertex; +import com.hzs.common.security.utils.SecurityUtils; +import com.hzs.system.base.mapper.BdRegionVertexMapper; +import com.hzs.system.base.service.IBdRegionVertexService; +import org.springframework.stereotype.Service; + +import java.util.Collections; +import java.util.Date; +import java.util.List; + +/** + *

+ * 区域体系分组配置表 服务实现类 + *

+ * + * @author sangelxiu1 + * @since 2025-06-25 + */ +@Service +public class BdRegionVertexServiceImpl extends ServiceImpl implements IBdRegionVertexService { + + @Override + public List getList(BdRegionVertex param) { + LambdaQueryWrapper queryWrapper = new LambdaQueryWrapper<>(); + if(ObjectUtil.isNotEmpty(param)){ + if(StringUtils.isNotEmpty(param.getName())){ + queryWrapper.like(BdRegionVertex::getName, param.getName()); + } + } + return baseMapper.selectList(queryWrapper); + } + + @Override + public void add(BdRegionVertex param) { + if(ObjectUtil.isNotEmpty(param)){ + if(StringUtils.isNotEmpty(param.getName())){ + throw new ServiceException("区域体系分组名称不能为空!"); + } + } + LambdaQueryWrapper queryWrapper = new LambdaQueryWrapper<>(); + queryWrapper.eq(BdRegionVertex::getName, param.getName()); + int sameNameCount = baseMapper.selectCount(queryWrapper); + if(sameNameCount > 0){ + throw new ServiceException("已存在相同的区域体系分组名称!"); + } + param.setPkCreator(SecurityUtils.getUserId()); + param.setCreationTime(new Date()); + param.setPkModified(param.getPkCreator()); + param.setModifiedTime(param.getModifiedTime()); + baseMapper.insert(param); + } + + @Override + public void delete(BdRegionVertex param) { + // 验证是否已被引用 + if(ObjectUtil.isNotEmpty(param)){ + if(ObjectUtil.isNotEmpty(param.getPkId())){ + throw new ServiceException("区域体系分组主键不能为空!"); + } + } + int validateMappingCount = baseMapper.validateMappingCount(param.getPkId()); + if(validateMappingCount > 0){ + throw new ServiceException("存在已引用此配置的体系信息, 不允许删除!"); + } + baseMapper.deleteById(param.getPkId()); + } + + @Override + public void update(BdRegionVertex param) { + if(ObjectUtil.isNotEmpty(param)){ + if(ObjectUtil.isNotEmpty(param.getPkId())){ + throw new ServiceException("区域体系分组主键不能为空!"); + } + if(StringUtils.isNotEmpty(param.getName())){ + throw new ServiceException("区域体系分组名称不能为空!"); + } + } + LambdaQueryWrapper queryWrapper = new LambdaQueryWrapper<>(); + queryWrapper.eq(BdRegionVertex::getName, param.getName()); + queryWrapper.ne(BdRegionVertex::getPkId, param.getPkId()); + int sameNameCount = baseMapper.selectCount(queryWrapper); + if(sameNameCount > 0){ + throw new ServiceException("已存在相同的区域体系分组名称!"); + } + param.setPkModified(SecurityUtils.getUserId()); + param.setModifiedTime(new Date()); + baseMapper.updateById(param); + } + + @Override + public BdRegionVertex getById(BdRegionVertex param) { + if(ObjectUtil.isNotEmpty(param)){ + if(ObjectUtil.isNotEmpty(param.getPkId())){ + throw new ServiceException("区域体系分组主键不能为空!"); + } + } + return baseMapper.selectById(param.getPkId()); + } +} diff --git a/bd-business/bd-business-system/src/main/java/com/hzs/system/base/vo/BdRegionVertexVo.java b/bd-business/bd-business-system/src/main/java/com/hzs/system/base/vo/BdRegionVertexVo.java new file mode 100644 index 00000000..dd292c5c --- /dev/null +++ b/bd-business/bd-business-system/src/main/java/com/hzs/system/base/vo/BdRegionVertexVo.java @@ -0,0 +1,8 @@ +package com.hzs.system.base.vo; + +import com.hzs.common.domain.system.base.BdRegionVertex; +import lombok.Data; + +@Data +public class BdRegionVertexVo extends BdRegionVertex { +} diff --git a/bd-business/bd-business-system/src/main/resources/mapper/system/base/BdRegionVertexMapper.xml b/bd-business/bd-business-system/src/main/resources/mapper/system/base/BdRegionVertexMapper.xml new file mode 100644 index 00000000..975a5660 --- /dev/null +++ b/bd-business/bd-business-system/src/main/resources/mapper/system/base/BdRegionVertexMapper.xml @@ -0,0 +1,23 @@ + + + + + + + + + + + + + + + CREATION_TIME, + MODIFIED_TIME, + PK_ID, NAME + + + + diff --git a/bd-common/bd-common-domain/src/main/java/com/hzs/common/domain/system/base/BdRegionVertex.java b/bd-common/bd-common-domain/src/main/java/com/hzs/common/domain/system/base/BdRegionVertex.java new file mode 100644 index 00000000..d34e8e68 --- /dev/null +++ b/bd-common/bd-common-domain/src/main/java/com/hzs/common/domain/system/base/BdRegionVertex.java @@ -0,0 +1,38 @@ +package com.hzs.common.domain.system.base; + +import com.baomidou.mybatisplus.annotation.KeySequence; +import com.baomidou.mybatisplus.annotation.TableName; +import com.baomidou.mybatisplus.annotation.TableField; +import com.hzs.common.core.web.domain.BaseEntity; +import lombok.Data; +import lombok.EqualsAndHashCode; +import lombok.experimental.Accessors; + +/** + *

+ * 区域体系分组配置表 + *

+ * + * @author sangelxiu1 + * @since 2025-06-25 + */ +@Data +@EqualsAndHashCode(callSuper = true) +@Accessors(chain = true) +@TableName("BD_REGION_VERTEX") +@KeySequence("BD_REGION_VERTEX_SEQ") +public class BdRegionVertex extends BaseEntity { + + private static final long serialVersionUID = 1L; + + @TableField("PK_ID") + private Long pkId; + + /** + * 区域体系分组名称 + */ + @TableField("NAME") + private String name; + + +} diff --git a/sql/2025年6月25日_区域体系分组配置.sql b/sql/2025年6月25日_区域体系分组配置.sql new file mode 100644 index 00000000..9721c469 --- /dev/null +++ b/sql/2025年6月25日_区域体系分组配置.sql @@ -0,0 +1,24 @@ +CREATE TABLE "RETAIL"."BD_REGION_VERTEX" ( + "PK_ID" NUMBER(6,0), + "CREATION_TIME" DATE NOT NULL, + "MODIFIED_TIME" DATE, + "NAME" VARCHAR2(200) NOT NULL +) +; + +COMMENT ON COLUMN "RETAIL"."BD_REGION_VERTEX"."CREATION_TIME" IS '创建时间'; + +COMMENT ON COLUMN "RETAIL"."BD_REGION_VERTEX"."MODIFIED_TIME" IS '更新时间'; + +COMMENT ON COLUMN "RETAIL"."BD_REGION_VERTEX"."NAME" IS '区域体系分组名称'; + +COMMENT ON TABLE "RETAIL"."BD_REGION_VERTEX" IS '区域体系分组配置表'; + +CREATE SEQUENCE BD_REGION_VERTEX_SEQ + START WITH 1 + INCREMENT BY 1; + +ALTER TABLE "RETAIL"."BD_VERTEX" + ADD ("REGION_VERTEX_PK_ID" NUMBER(6,0)); + +COMMENT ON COLUMN "RETAIL"."BD_VERTEX"."REGION_VERTEX_PK_ID" IS '区域体系分组配置表ID';