1. 实现集中式的附件统一管理,统一上传统一预览(代码生成器,公共组件,公共附件元数据定义)

2. 实现统一的 DB 字段数据库定义(代码生成器,共用规范检查)

(cherry picked from commit c2195ee3cf)
This commit is contained in:
chenbowen
2025-08-01 08:47:13 +08:00
committed by chenbowen
parent f9dc200d26
commit 014bd716de
63 changed files with 1674 additions and 351 deletions

View File

@@ -176,6 +176,4 @@ public interface ErrorCodeConstants {
// ========== 用户与部门关系 1-002-029-000 ==========
ErrorCode USER_DEPT_NOT_EXISTS = new ErrorCode(1_002_029_000, "用户与部门关系不存在");
// ========== 数据命名与简写标准 ==========
ErrorCode STD_NMS_NOT_EXISTS = new ErrorCode(1_002_030_000, "数据命名与简写标准不存在");
}

View File

@@ -1,29 +0,0 @@
package cn.iocoder.yudao.module.system.controller.admin.stdnms.vo;
import lombok.*;
import java.util.*;
import io.swagger.v3.oas.annotations.media.Schema;
import cn.iocoder.yudao.framework.common.pojo.PageParam;
import org.springframework.format.annotation.DateTimeFormat;
import java.time.LocalDateTime;
import static cn.iocoder.yudao.framework.common.util.date.DateUtils.FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND;
@Schema(description = "管理后台 - 数据命名与简写标准分页 Request VO")
@Data
public class StdNmsPageReqVO extends PageParam {
@Schema(description = "英文")
private String word;
@Schema(description = "简写")
private String abbr;
@Schema(description = "中文意思")
private String info;
@Schema(description = "创建时间")
@DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
private LocalDateTime[] createTime;
}

View File

@@ -1,35 +0,0 @@
package cn.iocoder.yudao.module.system.controller.admin.stdnms.vo;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.*;
import java.util.*;
import org.springframework.format.annotation.DateTimeFormat;
import java.time.LocalDateTime;
import com.alibaba.excel.annotation.*;
@Schema(description = "管理后台 - 数据命名与简写标准 Response VO")
@Data
@ExcelIgnoreUnannotated
public class StdNmsRespVO {
@Schema(description = "主键ID", requiredMode = Schema.RequiredMode.REQUIRED, example = "2987")
@ExcelProperty("主键ID")
private Long id;
@Schema(description = "英文", requiredMode = Schema.RequiredMode.REQUIRED)
@ExcelProperty("英文")
private String word;
@Schema(description = "简写", requiredMode = Schema.RequiredMode.REQUIRED)
@ExcelProperty("简写")
private String abbr;
@Schema(description = "中文意思", requiredMode = Schema.RequiredMode.REQUIRED)
@ExcelProperty("中文意思")
private String info;
@Schema(description = "创建时间", requiredMode = Schema.RequiredMode.REQUIRED)
@ExcelProperty("创建时间")
private LocalDateTime createTime;
}

View File

@@ -1,27 +0,0 @@
package cn.iocoder.yudao.module.system.controller.admin.stdnms.vo;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.*;
import java.util.*;
import jakarta.validation.constraints.*;
@Schema(description = "管理后台 - 数据命名与简写标准新增/修改 Request VO")
@Data
public class StdNmsSaveReqVO {
@Schema(description = "主键ID", requiredMode = Schema.RequiredMode.REQUIRED, example = "2987")
private Long id;
@Schema(description = "英文", requiredMode = Schema.RequiredMode.REQUIRED)
@NotEmpty(message = "英文不能为空")
private String word;
@Schema(description = "简写", requiredMode = Schema.RequiredMode.REQUIRED)
@NotEmpty(message = "简写不能为空")
private String abbr;
@Schema(description = "中文意思", requiredMode = Schema.RequiredMode.REQUIRED)
@NotEmpty(message = "中文意思不能为空")
private String info;
}

View File

@@ -1,50 +0,0 @@
package cn.iocoder.yudao.module.system.dal.dataobject.stdnms;
import cn.iocoder.yudao.framework.mybatis.core.dataobject.BaseDO;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.KeySequence;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import lombok.*;
/**
* 数据命名与简写标准 DO
*
* @author 后台管理
*/
@TableName("system_std_nms")
@KeySequence("system_std_nms_seq") // 用于 Oracle、PostgreSQL、Kingbase、DB2、H2 数据库的主键自增。如果是 MySQL 等数据库,可不写。
@Data
@EqualsAndHashCode(callSuper = true)
@ToString(callSuper = true)
@Builder
@NoArgsConstructor
@AllArgsConstructor
/**
* 支持业务基类继承isBusiness=true 时继承 BusinessBaseDO否则继承 BaseDO
*/
public class StdNmsDO extends BaseDO {
/**
* 主键ID
*/
@TableId(type = IdType.ASSIGN_ID)
private Long id;
/**
* 英文
*/
private String word;
/**
* 简写
*/
private String abbr;
/**
* 中文意思
*/
private String info;
/**
* 是否删除(取消逻辑删除)
*/
private Boolean deleted;
}

View File

@@ -1,28 +0,0 @@
package cn.iocoder.yudao.module.system.dal.mysql.stdnms;
import cn.iocoder.yudao.framework.common.pojo.PageResult;
import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX;
import cn.iocoder.yudao.module.system.controller.admin.stdnms.vo.StdNmsPageReqVO;
import cn.iocoder.yudao.module.system.dal.dataobject.stdnms.StdNmsDO;
import org.apache.ibatis.annotations.Mapper;
import java.util.List;
/**
* 数据命名与简写标准 Mapper
*
* @author 后台管理
*/
@Mapper
public interface StdNmsMapper extends BaseMapperX<StdNmsDO> {
// 使用自定义 XML SQL 分页查询word 不区分大小写
List<StdNmsDO> selectPageCustom(StdNmsPageReqVO reqVO);
default PageResult<StdNmsDO> selectPage(StdNmsPageReqVO reqVO) {
List<StdNmsDO> records = selectPageCustom(reqVO);
// 这里只做简单封装,如需 total 可自定义 count SQL
return new PageResult<>(records, (long) records.size());
}
}

View File

@@ -1,62 +0,0 @@
package cn.iocoder.yudao.module.system.service.stdnms;
import java.util.*;
import jakarta.validation.*;
import cn.iocoder.yudao.module.system.controller.admin.stdnms.vo.*;
import cn.iocoder.yudao.module.system.dal.dataobject.stdnms.StdNmsDO;
import cn.iocoder.yudao.framework.common.pojo.PageResult;
import cn.iocoder.yudao.framework.common.pojo.PageParam;
/**
* 数据命名与简写标准 Service 接口
*
* @author 后台管理
*/
public interface StdNmsService {
/**
* 创建数据命名与简写标准
*
* @param createReqVO 创建信息
* @return 编号
*/
Long createStdNms(@Valid StdNmsSaveReqVO createReqVO);
/**
* 更新数据命名与简写标准
*
* @param updateReqVO 更新信息
*/
void updateStdNms(@Valid StdNmsSaveReqVO updateReqVO);
/**
* 删除数据命名与简写标准
*
* @param id 编号
*/
void deleteStdNms(Long id);
/**
* 批量删除数据命名与简写标准
*
* @param ids 编号
*/
void deleteStdNmsListByIds(List<Long> ids);
/**
* 获得数据命名与简写标准
*
* @param id 编号
* @return 数据命名与简写标准
*/
StdNmsDO getStdNms(Long id);
/**
* 获得数据命名与简写标准分页
*
* @param pageReqVO 分页查询
* @return 数据命名与简写标准分页
*/
PageResult<StdNmsDO> getStdNmsPage(StdNmsPageReqVO pageReqVO);
}

View File

@@ -1,92 +0,0 @@
package cn.iocoder.yudao.module.system.service.stdnms;
import cn.hutool.core.collection.CollUtil;
import org.springframework.stereotype.Service;
import jakarta.annotation.Resource;
import org.springframework.validation.annotation.Validated;
import org.springframework.transaction.annotation.Transactional;
import java.util.*;
import cn.iocoder.yudao.module.system.controller.admin.stdnms.vo.*;
import cn.iocoder.yudao.module.system.dal.dataobject.stdnms.StdNmsDO;
import cn.iocoder.yudao.framework.common.pojo.PageResult;
import cn.iocoder.yudao.framework.common.pojo.PageParam;
import cn.iocoder.yudao.framework.common.util.object.BeanUtils;
import cn.iocoder.yudao.module.system.dal.mysql.stdnms.StdNmsMapper;
import static cn.iocoder.yudao.framework.common.exception.util.ServiceExceptionUtil.exception;
import static cn.iocoder.yudao.framework.common.util.collection.CollectionUtils.convertList;
import static cn.iocoder.yudao.framework.common.util.collection.CollectionUtils.diffList;
import static cn.iocoder.yudao.module.system.enums.ErrorCodeConstants.*;
/**
* 数据命名与简写标准 Service 实现类
*
* @author 后台管理
*/
@Service
@Validated
public class StdNmsServiceImpl implements StdNmsService {
@Resource
private StdNmsMapper stdNmsMapper;
@Override
public Long createStdNms(StdNmsSaveReqVO createReqVO) {
// 插入
StdNmsDO stdNms = BeanUtils.toBean(createReqVO, StdNmsDO.class);
stdNmsMapper.insert(stdNms);
// 返回
return stdNms.getId();
}
@Override
public void updateStdNms(StdNmsSaveReqVO updateReqVO) {
// 校验存在
validateStdNmsExists(updateReqVO.getId());
// 更新
StdNmsDO updateObj = BeanUtils.toBean(updateReqVO, StdNmsDO.class);
stdNmsMapper.updateById(updateObj);
}
@Override
public void deleteStdNms(Long id) {
// 校验存在
validateStdNmsExists(id);
// 删除
stdNmsMapper.deleteById(id);
}
@Override
public void deleteStdNmsListByIds(List<Long> ids) {
// 校验存在
validateStdNmsExists(ids);
// 删除
stdNmsMapper.deleteByIds(ids);
}
private void validateStdNmsExists(List<Long> ids) {
List<StdNmsDO> list = stdNmsMapper.selectByIds(ids);
if (CollUtil.isEmpty(list) || list.size() != ids.size()) {
throw exception(STD_NMS_NOT_EXISTS);
}
}
private void validateStdNmsExists(Long id) {
if (stdNmsMapper.selectById(id) == null) {
throw exception(STD_NMS_NOT_EXISTS);
}
}
@Override
public StdNmsDO getStdNms(Long id) {
return stdNmsMapper.selectById(id);
}
@Override
public PageResult<StdNmsDO> getStdNmsPage(StdNmsPageReqVO pageReqVO) {
return stdNmsMapper.selectPage(pageReqVO);
}
}

View File

@@ -1,24 +0,0 @@
<?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="cn.iocoder.yudao.module.system.dal.mysql.stdnms.StdNmsMapper">
<select id="selectPageCustom" resultType="cn.iocoder.yudao.module.system.dal.dataobject.stdnms.StdNmsDO">
SELECT * FROM system_std_nms
<where>
<if test="word != null and word != ''">
AND LOWER(word) LIKE CONCAT('%', LOWER(#{word}), '%')
</if>
<if test="abbr != null and abbr != ''">
AND abbr = #{abbr}
</if>
<if test="info != null and info != ''">
AND info = #{info}
</if>
<if test="createTime != null and createTime[0] != null and createTime[1] != null">
AND create_time BETWEEN #{createTime[0]} AND #{createTime[1]}
</if>
</where>
ORDER BY id DESC
</select>
</mapper>