## Feat - 区域体系分组配置
This commit is contained in:
parent
eabe4f2efc
commit
bb9bd5b7d4
|
@ -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;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 区域体系分组配置表 前端控制器
|
||||
* </p>
|
||||
*
|
||||
* @author sangelxiu1
|
||||
* @since 2025-06-25
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("/com.hzs.common.domain/bd-region-vertex")
|
||||
public class ApiRegionVertexController {
|
||||
|
||||
}
|
|
@ -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;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 区域体系分组配置表 前端控制器
|
||||
* </p>
|
||||
*
|
||||
* @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<BdRegionVertex> 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));
|
||||
}
|
||||
}
|
|
@ -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;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 区域体系分组配置表 Mapper 接口
|
||||
* </p>
|
||||
*
|
||||
* @author sangelxiu1
|
||||
* @since 2025-06-25
|
||||
*/
|
||||
public interface BdRegionVertexMapper extends BaseMapper<BdRegionVertex> {
|
||||
int validateMappingCount(@Param("pkId") Long pkId);
|
||||
}
|
|
@ -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;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 区域体系分组配置表 服务类
|
||||
* </p>
|
||||
*
|
||||
* @author sangelxiu1
|
||||
* @since 2025-06-25
|
||||
*/
|
||||
public interface IBdRegionVertexService extends IService<BdRegionVertex> {
|
||||
|
||||
List<BdRegionVertex> getList(BdRegionVertex param);
|
||||
|
||||
void add(BdRegionVertex param);
|
||||
void delete(BdRegionVertex param);
|
||||
void update(BdRegionVertex param);
|
||||
BdRegionVertex getById(BdRegionVertex param);
|
||||
}
|
|
@ -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;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 区域体系分组配置表 服务实现类
|
||||
* </p>
|
||||
*
|
||||
* @author sangelxiu1
|
||||
* @since 2025-06-25
|
||||
*/
|
||||
@Service
|
||||
public class BdRegionVertexServiceImpl extends ServiceImpl<BdRegionVertexMapper, BdRegionVertex> implements IBdRegionVertexService {
|
||||
|
||||
@Override
|
||||
public List<BdRegionVertex> getList(BdRegionVertex param) {
|
||||
LambdaQueryWrapper<BdRegionVertex> 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<BdRegionVertex> 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<BdRegionVertex> 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());
|
||||
}
|
||||
}
|
|
@ -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 {
|
||||
}
|
|
@ -0,0 +1,23 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
<mapper namespace="com.hzs.system.base.mapper.BdRegionVertexMapper">
|
||||
|
||||
<!-- 通用查询映射结果 -->
|
||||
<resultMap id="BaseResultMap" type="com.hzs.common.domain.system.base.BdRegionVertex">
|
||||
<result column="CREATION_TIME" property="creationTime" />
|
||||
<result column="MODIFIED_TIME" property="modifiedTime" />
|
||||
<result column="PK_ID" property="pkId" />
|
||||
<result column="NAME" property="name" />
|
||||
</resultMap>
|
||||
|
||||
<!-- 通用查询结果列 -->
|
||||
<sql id="Base_Column_List">
|
||||
CREATION_TIME,
|
||||
MODIFIED_TIME,
|
||||
PK_ID, NAME
|
||||
</sql>
|
||||
<select id="validateMappingCount" resultType="java.lang.Integer" parameterType="java.lang.Long">
|
||||
select count(1) from BD_VERTEX where REGION_VERTEX_PK_ID = #{pkId}
|
||||
</select>
|
||||
|
||||
</mapper>
|
|
@ -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;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 区域体系分组配置表
|
||||
* </p>
|
||||
*
|
||||
* @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;
|
||||
|
||||
|
||||
}
|
|
@ -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';
|
Loading…
Reference in New Issue