Compare commits

...

2 Commits

Author SHA1 Message Date
FCL
910b997bc5 Merge remote-tracking branch 'origin/test' into test 2025-10-21 17:04:01 +08:00
FCL
8e89318376 feat:表单设计器模板管理 2025-10-21 17:03:53 +08:00
10 changed files with 826 additions and 0 deletions

View File

@@ -29,6 +29,7 @@ public interface ErrorCodeConstants {
ErrorCode DATA_FORM_NOT_EXISTS = new ErrorCode(1_032_001_000, "通用数据不存在");
ErrorCode DATA_FORM_EMPTY_COLLECTION_ID = new ErrorCode(1_032_001_000, "未指定数据集ID");
ErrorCode DICTIONARY_BUSINESS_NOT_EXISTS = new ErrorCode(1_032_001_000, "业务参数字典不存在");
ErrorCode DATA_TEMPLATE_NOT_EXISTS = new ErrorCode(1_032_001_000, "表单设计器模板不存在");
ErrorCode DICTIONARY_BUSINESS_DATA_MORE_THAN_ONE = new ErrorCode(1_032_001_000, "业务参数字典[数据]key重名请联系管理员处理");
ErrorCode DICTIONARY_BUSINESS_CATEGORY_MORE_THAN_ONE = new ErrorCode(1_032_001_000, "业务参数字典[分类]key重名请联系管理员处理");
ErrorCode DICTIONARY_BUSINESS_CLASSIFY_DUPLICATE = new ErrorCode(1_032_001_000, "分类名称重复,请重新输入");

View File

@@ -0,0 +1,64 @@
package com.zt.plat.module.qms.common.data.controller.vo;
import lombok.*;
import io.swagger.v3.oas.annotations.media.Schema;
import com.zt.plat.framework.common.pojo.PageParam;
import org.springframework.format.annotation.DateTimeFormat;
import java.time.LocalDateTime;
import static com.zt.plat.framework.common.util.date.DateUtils.FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND;
@Schema(description = "管理后台 - 表单设计器模板分页 Request VO")
@Data
public class DataTemplatePageReqVO extends PageParam {
@Schema(description = "上级id", example = "14825")
private Long parentId;
@Schema(description = "主数据id用于版本识别", example = "12080")
private Long mainId;
@Schema(description = "id路径")
private String idPath;
@Schema(description = "名称", example = "张三")
private String name;
@Schema(description = "节点类型,字典qms_tree_node_typecategory-分类data-表单", example = "2")
private String nodeType;
@Schema(description = "数据键")
private String dataKey;
@Schema(description = "版本")
private Integer version;
@Schema(description = "是否最新版本,默认显示最新版本")
private String currentFlag;
@Schema(description = "禁用状态,0-启用1-禁用")
private String cancelFlag;
@Schema(description = "排序号")
private Integer sortNo;
@Schema(description = "其他配置")
private String customConfig;
@Schema(description = "模板内容")
private String formContent;
@Schema(description = "移动端模板内容")
private String mobileContent;
@Schema(description = "所属部门")
private String systemDepartmentCode;
@Schema(description = "备注")
private String remark;
@Schema(description = "创建时间")
@DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
private LocalDateTime[] createTime;
}

View File

@@ -0,0 +1,82 @@
package com.zt.plat.module.qms.common.data.controller.vo;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.*;
import java.time.LocalDateTime;
import com.alibaba.excel.annotation.*;
@Schema(description = "管理后台 - 表单设计器模板 Response VO")
@Data
@ExcelIgnoreUnannotated
public class DataTemplateRespVO {
@Schema(description = "主键", requiredMode = Schema.RequiredMode.REQUIRED, example = "10340")
@ExcelProperty("主键")
private Long id;
@Schema(description = "上级id", requiredMode = Schema.RequiredMode.REQUIRED, example = "14825")
@ExcelProperty("上级id")
private Long parentId;
@Schema(description = "主数据id用于版本识别", requiredMode = Schema.RequiredMode.REQUIRED, example = "12080")
@ExcelProperty("主数据id用于版本识别")
private Long mainId;
@Schema(description = "id路径", requiredMode = Schema.RequiredMode.REQUIRED)
@ExcelProperty("id路径")
private String idPath;
@Schema(description = "名称", requiredMode = Schema.RequiredMode.REQUIRED, example = "张三")
@ExcelProperty("名称")
private String name;
@Schema(description = "节点类型,字典qms_tree_node_typecategory-分类data-表单", requiredMode = Schema.RequiredMode.REQUIRED, example = "2")
@ExcelProperty("节点类型,字典qms_tree_node_typecategory-分类data-表单")
private String nodeType;
@Schema(description = "数据键", requiredMode = Schema.RequiredMode.REQUIRED)
@ExcelProperty("数据键")
private String dataKey;
@Schema(description = "版本", requiredMode = Schema.RequiredMode.REQUIRED)
@ExcelProperty("版本")
private Integer version;
@Schema(description = "是否最新版本,默认显示最新版本", requiredMode = Schema.RequiredMode.REQUIRED)
@ExcelProperty("是否最新版本,默认显示最新版本")
private String currentFlag;
@Schema(description = "禁用状态,0-启用1-禁用", requiredMode = Schema.RequiredMode.REQUIRED)
@ExcelProperty("禁用状态,0-启用1-禁用")
private String cancelFlag;
@Schema(description = "排序号")
@ExcelProperty("排序号")
private Integer sortNo;
@Schema(description = "其他配置")
@ExcelProperty("其他配置")
private String customConfig;
@Schema(description = "模板内容")
@ExcelProperty("模板内容")
private String formContent;
@Schema(description = "移动端模板内容")
@ExcelProperty("移动端模板内容")
private String mobileContent;
@Schema(description = "所属部门")
@ExcelProperty("所属部门")
private String systemDepartmentCode;
@Schema(description = "备注")
@ExcelProperty("备注")
private String remark;
@Schema(description = "创建时间")
@ExcelProperty("创建时间")
private LocalDateTime createTime;
}

View File

@@ -0,0 +1,72 @@
package com.zt.plat.module.qms.common.data.controller.vo;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.*;
import jakarta.validation.constraints.*;
@Schema(description = "管理后台 - 表单设计器模板新增/修改 Request VO")
@Data
public class DataTemplateSaveReqVO {
@Schema(description = "主键", requiredMode = Schema.RequiredMode.REQUIRED, example = "10340")
private Long id;
@Schema(description = "上级id", requiredMode = Schema.RequiredMode.REQUIRED, example = "14825")
@NotNull(message = "上级id不能为空")
private Long parentId;
@Schema(description = "主数据id用于版本识别", requiredMode = Schema.RequiredMode.REQUIRED, example = "12080")
@NotNull(message = "主数据id用于版本识别不能为空")
private Long mainId;
@Schema(description = "id路径", requiredMode = Schema.RequiredMode.REQUIRED)
@NotEmpty(message = "id路径不能为空")
private String idPath;
@Schema(description = "名称", requiredMode = Schema.RequiredMode.REQUIRED, example = "张三")
@NotEmpty(message = "名称不能为空")
private String name;
@Schema(description = "节点类型,字典qms_tree_node_typecategory-分类data-表单", requiredMode = Schema.RequiredMode.REQUIRED, example = "2")
@NotEmpty(message = "节点类型,字典qms_tree_node_typecategory-分类data-表单不能为空")
private String nodeType;
@Schema(description = "数据键", requiredMode = Schema.RequiredMode.REQUIRED)
@NotEmpty(message = "数据键不能为空")
private String dataKey;
@Schema(description = "版本", requiredMode = Schema.RequiredMode.REQUIRED)
@NotNull(message = "版本不能为空")
private Integer version;
@Schema(description = "是否最新版本,默认显示最新版本", requiredMode = Schema.RequiredMode.REQUIRED)
@NotEmpty(message = "是否最新版本,默认显示最新版本不能为空")
private String currentFlag;
@Schema(description = "禁用状态,0-启用1-禁用", requiredMode = Schema.RequiredMode.REQUIRED)
@NotEmpty(message = "禁用状态,0-启用1-禁用不能为空")
private String cancelFlag;
@Schema(description = "排序号")
private Integer sortNo;
@Schema(description = "其他配置")
private String customConfig;
@Schema(description = "模板内容")
private String formContent;
@Schema(description = "移动端模板内容")
private String mobileContent;
@Schema(description = "所属部门")
private String systemDepartmentCode;
@Schema(description = "备注")
private String remark;
//==============扩展字段===============
@Schema(description = "是否创建新版本")
private String newVersionFlag;
}

View File

@@ -0,0 +1,38 @@
package com.zt.plat.module.qms.common.data.dal.mapper;
import com.zt.plat.framework.common.pojo.PageResult;
import com.zt.plat.framework.mybatis.core.query.LambdaQueryWrapperX;
import com.zt.plat.framework.mybatis.core.mapper.BaseMapperX;
import com.zt.plat.module.qms.common.data.controller.vo.DataTemplatePageReqVO;
import com.zt.plat.module.qms.common.data.dal.dataobject.DataTemplateDO;
import org.apache.ibatis.annotations.Mapper;
/**
* 表单设计器模板 Mapper
*
* @author 后台管理
*/
@Mapper
public interface DataTemplateMapper extends BaseMapperX<DataTemplateDO> {
default PageResult<DataTemplateDO> selectPage(DataTemplatePageReqVO reqVO) {
return selectPage(reqVO, new LambdaQueryWrapperX<DataTemplateDO>()
.eqIfPresent(DataTemplateDO::getParentId, reqVO.getParentId())
.eqIfPresent(DataTemplateDO::getIdPath, reqVO.getIdPath())
.likeIfPresent(DataTemplateDO::getName, reqVO.getName())
.eqIfPresent(DataTemplateDO::getNodeType, reqVO.getNodeType())
.eqIfPresent(DataTemplateDO::getDataKey, reqVO.getDataKey())
.eqIfPresent(DataTemplateDO::getVersion, reqVO.getVersion())
.eqIfPresent(DataTemplateDO::getCurrentFlag, reqVO.getCurrentFlag())
.eqIfPresent(DataTemplateDO::getCancelFlag, reqVO.getCancelFlag())
.eqIfPresent(DataTemplateDO::getSortNo, reqVO.getSortNo())
.eqIfPresent(DataTemplateDO::getCustomConfig, reqVO.getCustomConfig())
.eqIfPresent(DataTemplateDO::getFormContent, reqVO.getFormContent())
.eqIfPresent(DataTemplateDO::getMobileContent, reqVO.getMobileContent())
.eqIfPresent(DataTemplateDO::getSystemDepartmentCode, reqVO.getSystemDepartmentCode())
.eqIfPresent(DataTemplateDO::getRemark, reqVO.getRemark())
.betweenIfPresent(DataTemplateDO::getCreateTime, reqVO.getCreateTime())
.orderByDesc(DataTemplateDO::getId));
}
}

View File

@@ -0,0 +1,80 @@
package com.zt.plat.module.qms.common.data.service;
import java.util.*;
import com.zt.plat.framework.common.pojo.CommonResult;
import com.zt.plat.module.qms.common.data.controller.vo.*;
import com.zt.plat.module.qms.common.data.dal.dataobject.DataCollectionDO;
import com.zt.plat.module.qms.common.data.dal.dataobject.DataTemplateDO;
import jakarta.validation.*;
import com.zt.plat.framework.common.pojo.PageResult;
/**
* 表单设计器模板 Service 接口
*
* @author 后台管理
*/
public interface DataTemplateService {
DataTemplateDO getLatestDataByKey(String key);
/*获取分类树数据*/
List<DataTemplateDO> getTreeData();
//保存数据集
CommonResult<String> saveData(@Valid DataTemplateSaveReqVO createReqVO);
CommonResult<String> saveDataWithNewVersion(@Valid DataTemplateSaveReqVO createReqVO);
//保存分类
CommonResult<DataTemplateRespVO> saveClassify(@Valid DataTemplateSaveReqVO createReqVO);
//更新后代节点路径-递归调用
CommonResult<String> updateAllIdPath(Long parentId, Integer level);
List<DataTemplateDO> listByParId(Long parId);
/**
* 创建表单设计器模板
*
* @param createReqVO 创建信息
* @return 编号
*/
DataTemplateRespVO createDataTemplate(@Valid DataTemplateSaveReqVO createReqVO);
/**
* 更新表单设计器模板
*
* @param updateReqVO 更新信息
*/
void updateDataTemplate(@Valid DataTemplateSaveReqVO updateReqVO);
/**
* 删除表单设计器模板
*
* @param id 编号
*/
void deleteDataTemplate(Long id);
/**
* 批量删除表单设计器模板
*
* @param ids 编号
*/
void deleteDataTemplateListByIds(List<Long> ids);
/**
* 获得表单设计器模板
*
* @param id 编号
* @return 表单设计器模板
*/
DataTemplateDO getDataTemplate(Long id);
/**
* 获得表单设计器模板分页
*
* @param pageReqVO 分页查询
* @return 表单设计器模板分页
*/
PageResult<DataTemplateDO> getDataTemplatePage(DataTemplatePageReqVO pageReqVO);
}

View File

@@ -0,0 +1,12 @@
<?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.zt.plat.module.qms.common.data.dal.mapper.DataTemplateMapper">
<!--
一般情况下,尽可能使用 Mapper 进行 CRUD 增删改查即可。
无法满足的场景,例如说多表关联查询,才使用 XML 编写 SQL。
代码生成器暂时只生成 Mapper XML 文件本身,更多推荐 MybatisX 快速开发插件来生成查询。
文档可见https://www.iocoder.cn/MyBatis/x-plugins/
-->
</mapper>