微服务版后端初始化
This commit is contained in:
32
xjrsoft-common/xjrsoft-common-generate/pom.xml
Normal file
32
xjrsoft-common/xjrsoft-common-generate/pom.xml
Normal file
@ -0,0 +1,32 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project xmlns="http://maven.apache.org/POM/4.0.0"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||
<parent>
|
||||
<artifactId>xjrsoft-common</artifactId>
|
||||
<groupId>com.xjrsoft</groupId>
|
||||
<version>1.0.0-SNAPSHOT</version>
|
||||
</parent>
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
|
||||
<artifactId>xjrsoft-common-generate</artifactId>
|
||||
|
||||
<properties>
|
||||
<maven.compiler.source>${java.version}</maven.compiler.source>
|
||||
<maven.compiler.target>${java.version}</maven.compiler.target>
|
||||
</properties>
|
||||
|
||||
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>org.projectlombok</groupId>
|
||||
<artifactId>lombok</artifactId>
|
||||
<version>${lombok.version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.xjrsoft</groupId>
|
||||
<artifactId>xjrsoft-common-core</artifactId>
|
||||
<version>${xjrsoft.framework.version}</version>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
</project>
|
||||
@ -0,0 +1,22 @@
|
||||
package com.xjrsoft.common.generate.model;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
/**
|
||||
* @title: 按钮配置
|
||||
* @Author tzx
|
||||
* @Date: 2022/4/17 22:25
|
||||
* @Version 1.0
|
||||
*/
|
||||
@Data
|
||||
public class ButtonConfig {
|
||||
private String name;
|
||||
|
||||
private String code;
|
||||
|
||||
private String icon;
|
||||
|
||||
private Boolean isDefault;
|
||||
|
||||
private Boolean isUse;
|
||||
}
|
||||
@ -0,0 +1,70 @@
|
||||
package com.xjrsoft.common.generate.model;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* @title: ColumnConfig
|
||||
* @Author tzx
|
||||
* @Date: 2022/4/17 22:29
|
||||
* @Version 1.0
|
||||
*/
|
||||
@Data
|
||||
public class ColumnConfig {
|
||||
|
||||
/**
|
||||
* 显示名称
|
||||
*/
|
||||
private String label;
|
||||
/**
|
||||
* 列名
|
||||
*/
|
||||
private String columnName;
|
||||
|
||||
/**
|
||||
* 对其
|
||||
*/
|
||||
private String alignType;
|
||||
|
||||
/**
|
||||
* 宽度
|
||||
*/
|
||||
private String columnWidth;
|
||||
|
||||
/**
|
||||
* 宽度
|
||||
*/
|
||||
private Boolean autoWidth;
|
||||
|
||||
/**
|
||||
* 组件类型
|
||||
*/
|
||||
private String componentType;
|
||||
|
||||
/**
|
||||
* 是否合计
|
||||
*/
|
||||
private Boolean isTotal;
|
||||
|
||||
|
||||
/**
|
||||
* 是否是数字
|
||||
*/
|
||||
private Boolean isNumber;
|
||||
|
||||
/**
|
||||
* 日期时间格式
|
||||
*/
|
||||
private String format;
|
||||
|
||||
/**
|
||||
* 组件key值
|
||||
*/
|
||||
private String key;
|
||||
|
||||
/**
|
||||
* 组件配置信息
|
||||
*/
|
||||
private Map<String, Object> componentProps;
|
||||
}
|
||||
@ -0,0 +1,101 @@
|
||||
package com.xjrsoft.common.generate.model;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
/**
|
||||
* @title: 字段配置
|
||||
* @Author tzx
|
||||
* @Date: 2022/4/17 0:24
|
||||
* @Version 1.0
|
||||
*/
|
||||
@Data
|
||||
public class FieldConfig {
|
||||
|
||||
|
||||
/**
|
||||
* 是否主键
|
||||
*/
|
||||
private Boolean pk;
|
||||
|
||||
/**
|
||||
* 字段名称
|
||||
*/
|
||||
private String fieldName;
|
||||
|
||||
/**
|
||||
* 字段长度
|
||||
*/
|
||||
private String fieldLength;
|
||||
|
||||
/**
|
||||
* 字段类型
|
||||
*/
|
||||
private String fieldType;
|
||||
|
||||
/**
|
||||
* 字段备注
|
||||
*/
|
||||
private String fieldComment;
|
||||
|
||||
|
||||
/**
|
||||
* 是否为 新增 自动填充字段
|
||||
*/
|
||||
private Boolean autoInsert;
|
||||
|
||||
/**
|
||||
* 是否为 修改 自动填充字段
|
||||
*/
|
||||
private Boolean autoUpdate;
|
||||
|
||||
|
||||
/**
|
||||
* 是否为 逻辑删除字段
|
||||
*/
|
||||
private Boolean deleteMark;
|
||||
|
||||
/**
|
||||
* 字段对应的组件类型
|
||||
*/
|
||||
private String componentType;
|
||||
|
||||
/**
|
||||
* 数据来源类型
|
||||
*/
|
||||
private String datasourceType;
|
||||
|
||||
/**
|
||||
* 数据来源id
|
||||
*/
|
||||
private String datasourceId;
|
||||
|
||||
/**
|
||||
* 格式
|
||||
*/
|
||||
private String pattern;
|
||||
|
||||
/**
|
||||
* 是否是多选字段
|
||||
*/
|
||||
private boolean isMulti;
|
||||
|
||||
/**
|
||||
* 多个值分隔符
|
||||
*/
|
||||
private String separator;
|
||||
|
||||
/**
|
||||
* 多个值显示格式
|
||||
*/
|
||||
private String showFormat;
|
||||
|
||||
/**
|
||||
* label
|
||||
*/
|
||||
private String label;
|
||||
|
||||
/**
|
||||
* 是否必填
|
||||
*/
|
||||
private boolean isRequired;
|
||||
}
|
||||
@ -0,0 +1,43 @@
|
||||
package com.xjrsoft.common.generate.model;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
/**
|
||||
* 前端代码结构
|
||||
* @Author: tzx
|
||||
* @Date: 2022/6/2 15:51
|
||||
*/
|
||||
@Data
|
||||
public class FrontCode {
|
||||
/**
|
||||
* 列表页面代码
|
||||
*/
|
||||
private String listCode;
|
||||
/**
|
||||
* 表单页面代码
|
||||
*/
|
||||
private String formCode;
|
||||
/**
|
||||
* 接口请求代码
|
||||
*/
|
||||
private String apiCode;
|
||||
|
||||
/**
|
||||
* 数据模型代码
|
||||
*/
|
||||
private String modelCode;
|
||||
|
||||
/**
|
||||
* 配置json 代码
|
||||
*/
|
||||
private String configJsonCode;
|
||||
|
||||
private String workflowPermissionCode;
|
||||
|
||||
private String simpleFormCode;
|
||||
|
||||
/**
|
||||
* 表单容器代码
|
||||
*/
|
||||
private String containerCode;
|
||||
}
|
||||
@ -0,0 +1,48 @@
|
||||
package com.xjrsoft.common.generate.model;
|
||||
|
||||
import com.xjrsoft.common.core.domain.generator.FormConfig;
|
||||
import lombok.Data;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @Author: tzx
|
||||
* @Date: 2022/4/28 14:45
|
||||
*/
|
||||
@Data
|
||||
public class GeneratorConfig {
|
||||
/**
|
||||
* 包名
|
||||
*/
|
||||
private String databaseId;
|
||||
|
||||
/**
|
||||
* 表关联信息
|
||||
*/
|
||||
private List<TableConfig> tableConfigs;
|
||||
|
||||
/**
|
||||
* 表单设计json
|
||||
*/
|
||||
private FormConfig formJson;
|
||||
|
||||
/**
|
||||
* 列表配置
|
||||
*/
|
||||
private ListConfig listConfig;
|
||||
|
||||
/**
|
||||
* 输出配置
|
||||
*/
|
||||
private OutputConfig outputConfig;
|
||||
|
||||
/**
|
||||
* 菜单配置
|
||||
*/
|
||||
private MenuConfig menuConfig;
|
||||
|
||||
/**
|
||||
* 表结构配置
|
||||
*/
|
||||
private List<TableStructureConfig> tableStructureConfigs;
|
||||
}
|
||||
@ -0,0 +1,92 @@
|
||||
package com.xjrsoft.common.generate.model;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* @title: 左侧菜单配置
|
||||
* @Author tzx
|
||||
* @Date: 2022/4/12 22:14
|
||||
* @Version 1.0
|
||||
*/
|
||||
@Data
|
||||
public class LeftMenuConfig {
|
||||
/**
|
||||
* 左侧菜单是否为树结构
|
||||
*/
|
||||
private Boolean isTree;
|
||||
|
||||
/**
|
||||
* 左侧菜单宽度 按照 1/3 | 1/4 | 1/5
|
||||
*/
|
||||
private Integer leftWidth;
|
||||
|
||||
/**
|
||||
* datasource | dic
|
||||
*/
|
||||
private String datasourceType;
|
||||
|
||||
/**
|
||||
* 如果是数据源 就需要有数据源id
|
||||
*/
|
||||
private String datasourceId;
|
||||
|
||||
/**
|
||||
* 关联字段
|
||||
*/
|
||||
private String relationFieldName;
|
||||
|
||||
/**
|
||||
* 列表关联字段关联字段
|
||||
*/
|
||||
private String listFieldName;
|
||||
|
||||
/**
|
||||
* 如果是数据源 则需要配置 数据字段名 (与parentFiledName 搭配拼接树结构)
|
||||
*/
|
||||
private String fieldName;
|
||||
|
||||
|
||||
/**
|
||||
* 如果是数据源 则需要配置 父级字段名 (与fieldName 搭配拼接树结构)
|
||||
*/
|
||||
private String parentFiledName;
|
||||
|
||||
/**
|
||||
* 显示字段
|
||||
*/
|
||||
private String showFieldName;
|
||||
|
||||
/**
|
||||
* 数据项Id 用户查询数据字典详情
|
||||
*/
|
||||
private String dictionaryItemId;
|
||||
|
||||
|
||||
/**
|
||||
* 菜单显示名称
|
||||
*/
|
||||
private String menuName;
|
||||
|
||||
/**
|
||||
* 父级菜单图标
|
||||
*/
|
||||
private String parentIcon;
|
||||
|
||||
/**
|
||||
* 子级菜单图标
|
||||
*/
|
||||
private String childIcon;
|
||||
|
||||
/**
|
||||
* api配置
|
||||
*/
|
||||
private Map<String, Object> apiConfig;
|
||||
|
||||
/**
|
||||
* 静态数据
|
||||
*/
|
||||
private List<Map<String, Object>> staticData;
|
||||
}
|
||||
@ -0,0 +1,76 @@
|
||||
package com.xjrsoft.common.generate.model;
|
||||
|
||||
import com.xjrsoft.common.core.constant.StringPool;
|
||||
import lombok.Data;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @title: 列表配置
|
||||
* @Author tzx
|
||||
* @Date: 2022/4/12 21:55
|
||||
* @Version 1.0
|
||||
*/
|
||||
@Data
|
||||
public class ListConfig {
|
||||
|
||||
/**
|
||||
* 是否有左侧菜单
|
||||
*/
|
||||
private Boolean isLeftMenu = false;
|
||||
|
||||
/**
|
||||
* 是否分页
|
||||
*/
|
||||
private Boolean isPage = true;
|
||||
|
||||
/**
|
||||
* 每页显示数量
|
||||
*/
|
||||
private Integer pageSize;
|
||||
|
||||
/**
|
||||
* 左侧菜单配置
|
||||
*/
|
||||
private LeftMenuConfig leftMenuConfig;
|
||||
|
||||
/**
|
||||
* 查询配置
|
||||
*/
|
||||
private List<QueryConfig> queryConfigs;
|
||||
|
||||
/**
|
||||
* 列配置
|
||||
*/
|
||||
private List<ColumnConfig> columnConfigs;
|
||||
|
||||
/**
|
||||
* 按钮配置
|
||||
*/
|
||||
private List<ButtonConfig> buttonConfigs;
|
||||
|
||||
/**
|
||||
* 合计配置
|
||||
*/
|
||||
private List<TotalConfig> totalConfigs;
|
||||
|
||||
/**
|
||||
* 是否默认排序
|
||||
*/
|
||||
private Boolean defaultOrder = false;
|
||||
|
||||
/**
|
||||
* 排序字段
|
||||
*/
|
||||
private String orderBy;
|
||||
|
||||
/**
|
||||
* 排序类型
|
||||
*/
|
||||
private String orderType = StringPool.EMPTY;
|
||||
|
||||
/**
|
||||
* 列表标题
|
||||
*/
|
||||
private String listTitle;
|
||||
}
|
||||
@ -0,0 +1,39 @@
|
||||
package com.xjrsoft.common.generate.model;
|
||||
|
||||
import lombok.Data;
|
||||
import org.hibernate.validator.constraints.Length;
|
||||
|
||||
import javax.validation.constraints.NotNull;
|
||||
|
||||
/**
|
||||
* @title: 菜单配置
|
||||
* @Author tzx
|
||||
* @Date: 2022/4/16 23:08
|
||||
* @Version 1.0
|
||||
*/
|
||||
@Data
|
||||
public class MenuConfig {
|
||||
|
||||
private String id;
|
||||
|
||||
/**
|
||||
* 编号
|
||||
*/
|
||||
@NotNull(message = "菜单编号不能为空!")
|
||||
@Length( max = 50, message = "编号长度不能超过50个字符!")
|
||||
private String code;
|
||||
|
||||
@NotNull(message = "菜单名不能为空!")
|
||||
@Length( max = 50, message = "编号长度不能超过50个字符!")
|
||||
private String name;
|
||||
|
||||
private String parentId = "0";
|
||||
|
||||
private String systemId = "1";
|
||||
|
||||
private String icon;
|
||||
|
||||
private Integer sortCode;
|
||||
|
||||
private String remark;
|
||||
}
|
||||
@ -0,0 +1,87 @@
|
||||
package com.xjrsoft.common.generate.model;
|
||||
|
||||
import lombok.Data;
|
||||
import org.hibernate.validator.constraints.Length;
|
||||
|
||||
import javax.validation.constraints.NotNull;
|
||||
import javax.validation.constraints.Pattern;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @title: 输出配置
|
||||
* @Author tzx
|
||||
* @Date: 2022/4/14 21:45
|
||||
* @Version 1.0
|
||||
*/
|
||||
@Data
|
||||
public class OutputConfig {
|
||||
/**
|
||||
* 创建人
|
||||
*/
|
||||
@NotNull(message = "创建人不能为空!")
|
||||
@Length(max = 20, message = "创建人不能超过20字符!")
|
||||
private String creator;
|
||||
|
||||
/**
|
||||
* 功能类名(必须英文字母开头 首字母不能使用字符以及数字)
|
||||
*/
|
||||
@NotNull(message = "功能名称不能为空!")
|
||||
@Length(max = 20, message = "功能名称不能超过20字符!")
|
||||
@Pattern(regexp = "^[a-zA-Z][a-zA-Z0-9]*$", message = "功能名称只能是数字和字母组成,必须英文字母开头 首字母不能使用字符以及数字!")
|
||||
private String className;
|
||||
|
||||
|
||||
/**
|
||||
* 描述 注释
|
||||
*/
|
||||
@NotNull(message = "描述不能为空!")
|
||||
@Length(max = 200, message = "描述不能超过200字符!")
|
||||
private String comment;
|
||||
|
||||
private String remarks;
|
||||
|
||||
/**
|
||||
* 输出区域(数据字典显示,数据字典id)
|
||||
*/
|
||||
@NotNull(message = "输出区域不能为空!")
|
||||
private String outputArea;
|
||||
|
||||
/**
|
||||
* 输出区域数据字典值
|
||||
*/
|
||||
private String outputValue;
|
||||
|
||||
/**
|
||||
* 只生成前端源码
|
||||
*/
|
||||
private Boolean onlyFront = false;
|
||||
|
||||
/**
|
||||
* 只生成接口
|
||||
*/
|
||||
private Boolean onlyInterface = false;
|
||||
|
||||
/**
|
||||
* 是否生产移动端
|
||||
*/
|
||||
private Boolean isApp = false;
|
||||
|
||||
/**
|
||||
* 是否生成菜单
|
||||
*/
|
||||
private Boolean isMenu = true;
|
||||
|
||||
/**
|
||||
* 是否配置数据权限
|
||||
*/
|
||||
private Boolean isDataAuth;
|
||||
/**
|
||||
* 选择的数据权限id集合
|
||||
*/
|
||||
private List<String> dataAuthList;
|
||||
|
||||
/**
|
||||
* 0-数据优先模板,1-界面优先模板,2-简易模板
|
||||
*/
|
||||
private Integer type;
|
||||
}
|
||||
@ -0,0 +1,45 @@
|
||||
package com.xjrsoft.common.generate.model;
|
||||
|
||||
import lombok.Data;
|
||||
import org.hibernate.validator.constraints.Length;
|
||||
|
||||
import javax.validation.constraints.NotNull;
|
||||
|
||||
/**
|
||||
* @title: 查询配置
|
||||
* @Author tzx
|
||||
* @Date: 2022/4/12 21:42
|
||||
* @Version 1.0
|
||||
*/
|
||||
@Data
|
||||
public class QueryConfig {
|
||||
/**
|
||||
* 查询字段
|
||||
*/
|
||||
@NotNull(message = "查询字段不能为空!")
|
||||
@Length(max = 30, message = "查询字段长度不能超过30!")
|
||||
private String fieldName;
|
||||
|
||||
/**
|
||||
* 查询框名称
|
||||
*/
|
||||
@NotNull(message = "查询框名称不能为空!")
|
||||
@Length(max = 20, message = "查询框名称不能超过20!")
|
||||
private String label;
|
||||
|
||||
/**
|
||||
* 时间查询类型
|
||||
*/
|
||||
@NotNull(message = "是否为时间查询不能为空!")
|
||||
private Boolean isDate;
|
||||
|
||||
/**
|
||||
* 查询组件宽度
|
||||
*/
|
||||
private Integer width;
|
||||
|
||||
/**
|
||||
* 格式
|
||||
*/
|
||||
private String format;
|
||||
}
|
||||
@ -0,0 +1,55 @@
|
||||
package com.xjrsoft.common.generate.model;
|
||||
|
||||
import lombok.Data;
|
||||
import org.hibernate.validator.constraints.Length;
|
||||
|
||||
import javax.validation.constraints.NotNull;
|
||||
|
||||
/**
|
||||
* @title: 数据表配置
|
||||
* @Author tzx
|
||||
* @Date: 2022/4/12 21:19
|
||||
* @Version 1.0
|
||||
*/
|
||||
@Data
|
||||
public class TableConfig {
|
||||
|
||||
/**
|
||||
* 表名
|
||||
*/
|
||||
@NotNull(message = "表名不能为空!")
|
||||
@Length(max = 30, message = "表名长度不能超过30!")
|
||||
private String tableName;
|
||||
|
||||
/**
|
||||
* 是否主表
|
||||
*/
|
||||
// @NotNull(message = "是否主表不能为空!")
|
||||
private Boolean isMain = false;
|
||||
|
||||
/**
|
||||
* 主键字段
|
||||
*/
|
||||
@NotNull(message = "主键字段不能为空!")
|
||||
@Length(max = 30, message = "主键长度不能超过30!")
|
||||
private String pkField;
|
||||
|
||||
/**
|
||||
* 主键字段类型
|
||||
*/
|
||||
@NotNull(message = "主键字段类型不能为空!")
|
||||
@Length(max = 30, message = "主键类型长度不能超过30!")
|
||||
private String pkType;
|
||||
|
||||
/**
|
||||
* 关联字段
|
||||
*/
|
||||
@Length(max = 30, message = "关联字段长度不能超过30!")
|
||||
private String relationField;
|
||||
|
||||
/**
|
||||
* 关联表对应字段
|
||||
*/
|
||||
@Length(max = 30, message = "关联表对应字段长度不能超过30!")
|
||||
private String relationTableField;
|
||||
}
|
||||
@ -0,0 +1,33 @@
|
||||
package com.xjrsoft.common.generate.model;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
/**
|
||||
* @title: 表结构配置的字段配置
|
||||
* @Author tzx
|
||||
* @Date: 2022/4/30 22:58
|
||||
* @Version 1.0
|
||||
*/
|
||||
@Data
|
||||
public class TableFieldConfig {
|
||||
/**
|
||||
* 字段名称
|
||||
*/
|
||||
private String fieldName;
|
||||
|
||||
/**
|
||||
* 字段类型 0:文本 (默认255) 1:长文本 (max) 2:数字 3:小数 4:日期 5:日期时间 6:外键
|
||||
*/
|
||||
private Integer fieldType;
|
||||
|
||||
/**
|
||||
* 字段长度 (默认50)
|
||||
*/
|
||||
private Integer fieldLength = 50;
|
||||
|
||||
/**
|
||||
* 字段备注
|
||||
*/
|
||||
private String fieldComment;
|
||||
|
||||
}
|
||||
@ -0,0 +1,49 @@
|
||||
package com.xjrsoft.common.generate.model;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @title: 代码优先表结构配置
|
||||
* @Author tzx
|
||||
* @Date: 2022/4/30 22:51
|
||||
* @Version 1.0
|
||||
*/
|
||||
@Data
|
||||
public class TableStructureConfig {
|
||||
|
||||
/**
|
||||
* 操作 operator
|
||||
* 1 沿用旧表
|
||||
* 2 创建新表(重新生成表名)
|
||||
* 3 覆盖旧表
|
||||
* 4 不操作
|
||||
*/
|
||||
private Integer operator = 4;
|
||||
|
||||
/**
|
||||
* 表名
|
||||
*/
|
||||
private String tableName;
|
||||
/**
|
||||
* 表注释
|
||||
*/
|
||||
private String tableComment;
|
||||
|
||||
/**
|
||||
* 是否主表
|
||||
*/
|
||||
private Boolean isMain;
|
||||
|
||||
/**
|
||||
* 主键名
|
||||
*/
|
||||
private String pkField;
|
||||
|
||||
/**
|
||||
* 表的字段配置
|
||||
*/
|
||||
private List<TableFieldConfig> tableFieldConfigs;
|
||||
|
||||
}
|
||||
@ -0,0 +1,22 @@
|
||||
package com.xjrsoft.common.generate.model;
|
||||
|
||||
import lombok.Data;
|
||||
import org.hibernate.validator.constraints.Length;
|
||||
|
||||
import javax.validation.constraints.NotNull;
|
||||
|
||||
/**
|
||||
* @title: 列表页合计配置
|
||||
* @Author tzx
|
||||
* @Date: 2022/4/14 21:42
|
||||
* @Version 1.0
|
||||
*/
|
||||
@Data
|
||||
public class TotalConfig {
|
||||
/**
|
||||
* 需要合计字段
|
||||
*/
|
||||
@NotNull(message = "合计字段不能为空!")
|
||||
@Length(max = 30, message = "合计字段长度不能超过30!")
|
||||
private String fieldName;
|
||||
}
|
||||
Reference in New Issue
Block a user