feat: 代码生成 Beta 公测版本
This commit is contained in:
@@ -19,13 +19,34 @@ import java.util.Map;
|
|||||||
@Data
|
@Data
|
||||||
public class GeneratorProperties {
|
public class GeneratorProperties {
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 默认配置
|
||||||
|
*/
|
||||||
|
private DefaultConfig defaultConfig ;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 模板配置
|
||||||
|
*/
|
||||||
private Map<String, TemplateConfig> templateConfigs = MapUtil.newHashMap(true);
|
private Map<String, TemplateConfig> templateConfigs = MapUtil.newHashMap(true);
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 后端应用名
|
||||||
|
*/
|
||||||
|
|
||||||
|
private String backendAppName;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 前端应用名
|
||||||
|
*/
|
||||||
|
private String frontendAppName;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 模板配置
|
* 模板配置
|
||||||
*/
|
*/
|
||||||
@Data
|
@Data
|
||||||
public static class TemplateConfig{
|
public static class TemplateConfig {
|
||||||
|
|
||||||
private String templatePath;
|
private String templatePath;
|
||||||
|
|
||||||
@@ -34,7 +55,18 @@ public class GeneratorProperties {
|
|||||||
/**
|
/**
|
||||||
* 文件扩展名,如 .java
|
* 文件扩展名,如 .java
|
||||||
*/
|
*/
|
||||||
private String extension= FileNameUtil.EXT_JAVA;
|
private String extension = FileNameUtil.EXT_JAVA;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 默认配置
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
public static class DefaultConfig {
|
||||||
|
|
||||||
|
private String author;
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -3,7 +3,6 @@ package com.youlai.system.controller;
|
|||||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||||
import com.youlai.system.common.result.PageResult;
|
import com.youlai.system.common.result.PageResult;
|
||||||
import com.youlai.system.common.result.Result;
|
import com.youlai.system.common.result.Result;
|
||||||
import com.youlai.system.model.bo.TableMetaData;
|
|
||||||
import com.youlai.system.model.form.GenConfigForm;
|
import com.youlai.system.model.form.GenConfigForm;
|
||||||
import com.youlai.system.model.query.TablePageQuery;
|
import com.youlai.system.model.query.TablePageQuery;
|
||||||
import com.youlai.system.model.vo.GeneratorPreviewVO;
|
import com.youlai.system.model.vo.GeneratorPreviewVO;
|
||||||
@@ -33,18 +32,18 @@ public class GeneratorController {
|
|||||||
|
|
||||||
@Operation(summary = "获取数据表分页列表")
|
@Operation(summary = "获取数据表分页列表")
|
||||||
@GetMapping("/table/page")
|
@GetMapping("/table/page")
|
||||||
public PageResult<TableMetaData> getTablePage(
|
public PageResult<TablePageVO> getTablePage(
|
||||||
TablePageQuery queryParams
|
TablePageQuery queryParams
|
||||||
) {
|
) {
|
||||||
Page<TableMetaData> result = generatorService.getTablePage(queryParams);
|
Page<TablePageVO> result = generatorService.getTablePage(queryParams);
|
||||||
return PageResult.success(result);
|
return PageResult.success(result);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Operation(summary = "获取代码生成配置")
|
@Operation(summary = "获取代码生成配置")
|
||||||
@GetMapping("/{tableName}/config")
|
@GetMapping("/{tableName}/config")
|
||||||
public Result<GenConfigForm> getGenConfig(
|
public Result<GenConfigForm> getGenConfigFormData(
|
||||||
@Parameter(description = "表名", example = "sys_user") @PathVariable String tableName) {
|
@Parameter(description = "表名", example = "sys_user") @PathVariable String tableName) {
|
||||||
GenConfigForm formData = generatorService.getGenConfig(tableName);
|
GenConfigForm formData = generatorService.getGenConfigFormData(tableName);
|
||||||
return Result.success(formData);
|
return Result.success(formData);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -6,7 +6,7 @@ import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
|
|||||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||||
import com.youlai.system.common.result.PageResult;
|
import com.youlai.system.common.result.PageResult;
|
||||||
import com.youlai.system.common.result.Result;
|
import com.youlai.system.common.result.Result;
|
||||||
import com.youlai.system.common.util.ExcelUtils;
|
import com.youlai.system.util.ExcelUtils;
|
||||||
import com.youlai.system.enums.LogModuleEnum;
|
import com.youlai.system.enums.LogModuleEnum;
|
||||||
import com.youlai.system.model.dto.UserImportDTO;
|
import com.youlai.system.model.dto.UserImportDTO;
|
||||||
import com.youlai.system.plugin.norepeat.annotation.PreventRepeatSubmit;
|
import com.youlai.system.plugin.norepeat.annotation.PreventRepeatSubmit;
|
||||||
|
|||||||
@@ -32,20 +32,20 @@ public enum FormTypeEnum implements IBaseEnum<Integer> {
|
|||||||
*/
|
*/
|
||||||
RADIO(3, "单选框"),
|
RADIO(3, "单选框"),
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 复选框
|
||||||
|
*/
|
||||||
|
CHECK_BOX(4, "复选框"),
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 数字输入框
|
* 数字输入框
|
||||||
*/
|
*/
|
||||||
INPUT_NUMBER(4, "数字输入框"),
|
INPUT_NUMBER(5, "数字输入框"),
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 开关
|
* 开关
|
||||||
*/
|
*/
|
||||||
SWITCH(5, "开关"),
|
SWITCH(6, "开关"),
|
||||||
|
|
||||||
/**
|
|
||||||
* 复选框
|
|
||||||
*/
|
|
||||||
CHECK_BOX(6, "复选框"),
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 文本域
|
* 文本域
|
||||||
@@ -60,7 +60,7 @@ public enum FormTypeEnum implements IBaseEnum<Integer> {
|
|||||||
/**
|
/**
|
||||||
* 日期框
|
* 日期框
|
||||||
*/
|
*/
|
||||||
DATE(9, "日期框"),;
|
DATE(9, "日期框");
|
||||||
|
|
||||||
|
|
||||||
// Mybatis-Plus 提供注解表示插入数据库时插入该值
|
// Mybatis-Plus 提供注解表示插入数据库时插入该值
|
||||||
|
|||||||
84
src/main/java/com/youlai/system/enums/JavaTypeEnum.java
Normal file
84
src/main/java/com/youlai/system/enums/JavaTypeEnum.java
Normal file
@@ -0,0 +1,84 @@
|
|||||||
|
package com.youlai.system.enums;
|
||||||
|
|
||||||
|
import lombok.Getter;
|
||||||
|
|
||||||
|
import java.util.HashMap;
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 表单类型枚举
|
||||||
|
*
|
||||||
|
* @author Ray
|
||||||
|
* @since 2.10.0
|
||||||
|
*/
|
||||||
|
@Getter
|
||||||
|
public enum JavaTypeEnum {
|
||||||
|
|
||||||
|
VARCHAR("varchar", "String", "string"),
|
||||||
|
CHAR("char", "String", "string"),
|
||||||
|
BLOB("blob", "byte[]", "Uint8Array"),
|
||||||
|
TEXT("text", "String", "string"),
|
||||||
|
JSON("json", "String", "any"),
|
||||||
|
INTEGER("int", "Integer", "number"),
|
||||||
|
TINYINT("tinyint", "Integer", "number"),
|
||||||
|
SMALLINT("smallint", "Integer", "number"),
|
||||||
|
MEDIUMINT("mediumint", "Integer", "number"),
|
||||||
|
BIGINT("bigint", "Long", "bigint"),
|
||||||
|
FLOAT("float", "Float", "number"),
|
||||||
|
DOUBLE("double", "Double", "number"),
|
||||||
|
DECIMAL("decimal", "BigDecimal", "number"),
|
||||||
|
DATE("date", "LocalDate", "Date"),
|
||||||
|
DATETIME("datetime", "LocalDateTime", "Date");
|
||||||
|
|
||||||
|
// 数据库类型
|
||||||
|
private final String dbType;
|
||||||
|
// Java类型
|
||||||
|
private final String javaType;
|
||||||
|
// TypeScript类型
|
||||||
|
private final String tsType;
|
||||||
|
|
||||||
|
// 数据库类型和Java类型的映射
|
||||||
|
private static final Map<String, JavaTypeEnum> typeMap = new HashMap<>();
|
||||||
|
|
||||||
|
// 初始化映射关系
|
||||||
|
static {
|
||||||
|
for (JavaTypeEnum javaTypeEnum : JavaTypeEnum.values()) {
|
||||||
|
typeMap.put(javaTypeEnum.getDbType(), javaTypeEnum);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
JavaTypeEnum(String dbType, String javaType, String tsType) {
|
||||||
|
this.dbType = dbType;
|
||||||
|
this.javaType = javaType;
|
||||||
|
this.tsType = tsType;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 根据数据库类型获取对应的Java类型
|
||||||
|
*
|
||||||
|
* @param dbType 数据库类型
|
||||||
|
* @return 对应的Java类型
|
||||||
|
*/
|
||||||
|
public static String getJavaTypeByDbType(String dbType) {
|
||||||
|
JavaTypeEnum javaTypeEnum = typeMap.get(dbType);
|
||||||
|
if (javaTypeEnum != null) {
|
||||||
|
return javaTypeEnum.getJavaType();
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 根据Java类型获取对应的TypeScript类型
|
||||||
|
*
|
||||||
|
* @param javaType Java类型
|
||||||
|
* @return 对应的TypeScript类型
|
||||||
|
*/
|
||||||
|
public static String getTsTypeByJavaType(String javaType) {
|
||||||
|
for (JavaTypeEnum javaTypeEnum : JavaTypeEnum.values()) {
|
||||||
|
if (javaTypeEnum.getJavaType().equals(javaType)) {
|
||||||
|
return javaTypeEnum.getTsType();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -17,38 +17,39 @@ import lombok.RequiredArgsConstructor;
|
|||||||
@RequiredArgsConstructor
|
@RequiredArgsConstructor
|
||||||
public enum QueryTypeEnum implements IBaseEnum<Integer> {
|
public enum QueryTypeEnum implements IBaseEnum<Integer> {
|
||||||
|
|
||||||
|
/** 等于 */
|
||||||
EQ(1, "="),
|
EQ(1, "="),
|
||||||
|
|
||||||
|
/** 模糊匹配 */
|
||||||
|
LIKE(2, "LIKE '%s%'"),
|
||||||
|
|
||||||
NE(2, "!="),
|
/** 包含 */
|
||||||
|
IN(3, "IN"),
|
||||||
|
|
||||||
|
/** 范围 */
|
||||||
|
BETWEEN(4, "BETWEEN"),
|
||||||
|
|
||||||
GT(3, ">"),
|
/** 大于 */
|
||||||
|
GT(5, ">"),
|
||||||
|
|
||||||
|
/** 大于等于 */
|
||||||
|
GE(6, ">="),
|
||||||
|
|
||||||
GE(4, ">="),
|
/** 小于 */
|
||||||
|
LT(7, "<"),
|
||||||
|
|
||||||
LT(5, "<"),
|
/** 小于等于 */
|
||||||
|
LE(8, "<="),
|
||||||
|
|
||||||
LE(6, "<="),
|
/** 不等于 */
|
||||||
|
NE(9, "!="),
|
||||||
|
|
||||||
BETWEEN(7, "BETWEEN"),
|
/** 左模糊匹配 */
|
||||||
|
LIKE_LEFT(10, "LIKE '%s'"),
|
||||||
|
|
||||||
LIKE(8, "LIKE '%s%'"),
|
/** 右模糊匹配 */
|
||||||
|
LIKE_RIGHT(11, "LIKE 's%'");
|
||||||
|
|
||||||
LIKE_LEFT(9, "LIKE '%s'"),
|
|
||||||
|
|
||||||
LIKE_RIGHT(10, "LIKE 's%'"),
|
|
||||||
|
|
||||||
IN(11, "IN"),
|
|
||||||
|
|
||||||
NOT_IN(12, "NOT IN"),
|
|
||||||
|
|
||||||
IS_NULL(13, "IS NULL"),
|
|
||||||
|
|
||||||
IS_NOT_NULL(14, "IS NOT NULL")
|
|
||||||
;
|
|
||||||
|
|
||||||
// 存储在数据库中的枚举属性值
|
// 存储在数据库中的枚举属性值
|
||||||
@EnumValue
|
@EnumValue
|
||||||
|
|||||||
@@ -4,7 +4,7 @@ import cn.hutool.captcha.generator.CodeGenerator;
|
|||||||
import cn.hutool.core.util.StrUtil;
|
import cn.hutool.core.util.StrUtil;
|
||||||
import com.youlai.system.common.constant.SecurityConstants;
|
import com.youlai.system.common.constant.SecurityConstants;
|
||||||
import com.youlai.system.common.result.ResultCode;
|
import com.youlai.system.common.result.ResultCode;
|
||||||
import com.youlai.system.common.util.ResponseUtils;
|
import com.youlai.system.util.ResponseUtils;
|
||||||
import jakarta.servlet.FilterChain;
|
import jakarta.servlet.FilterChain;
|
||||||
import jakarta.servlet.ServletException;
|
import jakarta.servlet.ServletException;
|
||||||
import jakarta.servlet.http.HttpServletRequest;
|
import jakarta.servlet.http.HttpServletRequest;
|
||||||
|
|||||||
@@ -8,7 +8,7 @@ import cn.hutool.jwt.JWTUtil;
|
|||||||
import com.youlai.system.common.constant.SecurityConstants;
|
import com.youlai.system.common.constant.SecurityConstants;
|
||||||
import com.youlai.system.common.result.ResultCode;
|
import com.youlai.system.common.result.ResultCode;
|
||||||
import com.youlai.system.security.util.JwtUtils;
|
import com.youlai.system.security.util.JwtUtils;
|
||||||
import com.youlai.system.common.util.ResponseUtils;
|
import com.youlai.system.util.ResponseUtils;
|
||||||
import jakarta.servlet.FilterChain;
|
import jakarta.servlet.FilterChain;
|
||||||
import jakarta.servlet.ServletException;
|
import jakarta.servlet.ServletException;
|
||||||
import jakarta.servlet.http.HttpServletRequest;
|
import jakarta.servlet.http.HttpServletRequest;
|
||||||
|
|||||||
@@ -6,7 +6,6 @@ import com.youlai.system.model.bo.ColumnMetaData;
|
|||||||
import com.youlai.system.model.bo.TableMetaData;
|
import com.youlai.system.model.bo.TableMetaData;
|
||||||
import com.youlai.system.model.entity.SysDept;
|
import com.youlai.system.model.entity.SysDept;
|
||||||
import com.youlai.system.model.query.TablePageQuery;
|
import com.youlai.system.model.query.TablePageQuery;
|
||||||
import com.youlai.system.model.vo.TableColumnVO;
|
|
||||||
import com.youlai.system.model.vo.TablePageVO;
|
import com.youlai.system.model.vo.TablePageVO;
|
||||||
import org.apache.ibatis.annotations.Mapper;
|
import org.apache.ibatis.annotations.Mapper;
|
||||||
|
|
||||||
@@ -23,7 +22,7 @@ import java.util.List;
|
|||||||
public interface DatabaseMapper extends BaseMapper<SysDept> {
|
public interface DatabaseMapper extends BaseMapper<SysDept> {
|
||||||
|
|
||||||
|
|
||||||
Page<TableMetaData> getTablePage(Page<TableMetaData> page, TablePageQuery queryParams);
|
Page<TablePageVO> getTablePage(Page<TablePageVO> page, TablePageQuery queryParams);
|
||||||
|
|
||||||
List<ColumnMetaData> getTableColumns(String tableName);
|
List<ColumnMetaData> getTableColumns(String tableName);
|
||||||
|
|
||||||
|
|||||||
@@ -1,7 +1,9 @@
|
|||||||
package com.youlai.system.model.entity;
|
package com.youlai.system.model.entity;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.annotation.TableField;
|
||||||
import com.baomidou.mybatisplus.annotation.TableName;
|
import com.baomidou.mybatisplus.annotation.TableName;
|
||||||
|
|
||||||
|
import com.fasterxml.jackson.annotation.JsonIgnore;
|
||||||
import com.youlai.system.common.base.BaseEntity;
|
import com.youlai.system.common.base.BaseEntity;
|
||||||
import com.youlai.system.enums.FormTypeEnum;
|
import com.youlai.system.enums.FormTypeEnum;
|
||||||
import com.youlai.system.enums.QueryTypeEnum;
|
import com.youlai.system.enums.QueryTypeEnum;
|
||||||
@@ -53,7 +55,7 @@ public class GenFieldConfig extends BaseEntity {
|
|||||||
/**
|
/**
|
||||||
* 字段描述
|
* 字段描述
|
||||||
*/
|
*/
|
||||||
private String comment;
|
private String fieldComment;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 表单类型
|
* 表单类型
|
||||||
@@ -86,4 +88,12 @@ public class GenFieldConfig extends BaseEntity {
|
|||||||
private Integer isRequired;
|
private Integer isRequired;
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* TypeScript类型
|
||||||
|
*/
|
||||||
|
@TableField(exist = false)
|
||||||
|
@JsonIgnore
|
||||||
|
private String tsType;
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -61,7 +61,7 @@ public class GenConfigForm {
|
|||||||
private String fieldType;
|
private String fieldType;
|
||||||
|
|
||||||
@Schema(description = "字段描述")
|
@Schema(description = "字段描述")
|
||||||
private String comment;
|
private String fieldComment;
|
||||||
|
|
||||||
@Schema(description = "是否在列表显示")
|
@Schema(description = "是否在列表显示")
|
||||||
private Integer isShowInList;
|
private Integer isShowInList;
|
||||||
|
|||||||
@@ -1,34 +0,0 @@
|
|||||||
package com.youlai.system.model.vo;
|
|
||||||
|
|
||||||
import io.swagger.v3.oas.annotations.media.Schema;
|
|
||||||
import lombok.Data;
|
|
||||||
|
|
||||||
@Schema(description = "数据表字段VO")
|
|
||||||
@Data
|
|
||||||
public class TableColumnVO {
|
|
||||||
|
|
||||||
@Schema(description = "字段名称", example = "id")
|
|
||||||
private String columnName;
|
|
||||||
|
|
||||||
@Schema(description = "字段类型", example = "bigint")
|
|
||||||
private String dataType;
|
|
||||||
|
|
||||||
@Schema(description = "字段描述", example = "主键")
|
|
||||||
private String columnComment;
|
|
||||||
|
|
||||||
@Schema(description = "字段长度", example = "20")
|
|
||||||
private Integer characterMaximumLength;
|
|
||||||
|
|
||||||
@Schema(description = "是否主键(1-是 0-否)", example = "1")
|
|
||||||
private Integer isPrimaryKey;
|
|
||||||
|
|
||||||
@Schema(description = "是否可为空(1-是 0-否)", example = "1")
|
|
||||||
private String isNullable;
|
|
||||||
|
|
||||||
@Schema(description = "字符集", example = "utf8mb4")
|
|
||||||
private String characterSetName;
|
|
||||||
|
|
||||||
@Schema(description = "字符集排序规则", example = "utf8mb4_general_ci")
|
|
||||||
private String collationName;
|
|
||||||
|
|
||||||
}
|
|
||||||
@@ -4,7 +4,7 @@ import io.swagger.v3.oas.annotations.media.Schema;
|
|||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
|
|
||||||
|
|
||||||
@Schema(description = "数据表VO")
|
@Schema(description = "表视图对象")
|
||||||
@Data
|
@Data
|
||||||
public class TablePageVO {
|
public class TablePageVO {
|
||||||
|
|
||||||
|
|||||||
@@ -3,12 +3,10 @@ package com.youlai.system.plugin.syslog.aspect;
|
|||||||
import cn.hutool.core.date.DateUtil;
|
import cn.hutool.core.date.DateUtil;
|
||||||
import cn.hutool.core.date.TimeInterval;
|
import cn.hutool.core.date.TimeInterval;
|
||||||
import cn.hutool.core.util.StrUtil;
|
import cn.hutool.core.util.StrUtil;
|
||||||
import cn.hutool.http.useragent.Browser;
|
|
||||||
import cn.hutool.http.useragent.OS;
|
|
||||||
import cn.hutool.http.useragent.UserAgent;
|
import cn.hutool.http.useragent.UserAgent;
|
||||||
import cn.hutool.http.useragent.UserAgentUtil;
|
import cn.hutool.http.useragent.UserAgentUtil;
|
||||||
import com.youlai.system.common.constant.SecurityConstants;
|
import com.youlai.system.common.constant.SecurityConstants;
|
||||||
import com.youlai.system.common.util.IPUtils;
|
import com.youlai.system.util.IPUtils;
|
||||||
import com.youlai.system.model.entity.SysLog;
|
import com.youlai.system.model.entity.SysLog;
|
||||||
import com.youlai.system.plugin.syslog.annotation.LogAnnotation;
|
import com.youlai.system.plugin.syslog.annotation.LogAnnotation;
|
||||||
import com.youlai.system.security.util.SecurityUtils;
|
import com.youlai.system.security.util.SecurityUtils;
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
package com.youlai.system.security.exception;
|
package com.youlai.system.security.exception;
|
||||||
|
|
||||||
import com.youlai.system.common.result.ResultCode;
|
import com.youlai.system.common.result.ResultCode;
|
||||||
import com.youlai.system.common.util.ResponseUtils;
|
import com.youlai.system.util.ResponseUtils;
|
||||||
import org.springframework.security.access.AccessDeniedException;
|
import org.springframework.security.access.AccessDeniedException;
|
||||||
import org.springframework.security.web.access.AccessDeniedHandler;
|
import org.springframework.security.web.access.AccessDeniedHandler;
|
||||||
import org.springframework.stereotype.Component;
|
import org.springframework.stereotype.Component;
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
package com.youlai.system.security.exception;
|
package com.youlai.system.security.exception;
|
||||||
|
|
||||||
import com.youlai.system.common.result.ResultCode;
|
import com.youlai.system.common.result.ResultCode;
|
||||||
import com.youlai.system.common.util.ResponseUtils;
|
import com.youlai.system.util.ResponseUtils;
|
||||||
import org.springframework.security.authentication.BadCredentialsException;
|
import org.springframework.security.authentication.BadCredentialsException;
|
||||||
import org.springframework.security.core.AuthenticationException;
|
import org.springframework.security.core.AuthenticationException;
|
||||||
import org.springframework.security.web.AuthenticationEntryPoint;
|
import org.springframework.security.web.AuthenticationEntryPoint;
|
||||||
|
|||||||
@@ -1,15 +1,7 @@
|
|||||||
package com.youlai.system.service;
|
package com.youlai.system.service;
|
||||||
|
|
||||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
|
||||||
import com.baomidou.mybatisplus.extension.service.IService;
|
import com.baomidou.mybatisplus.extension.service.IService;
|
||||||
import com.youlai.system.model.entity.GenConfig;
|
import com.youlai.system.model.entity.GenConfig;
|
||||||
import com.youlai.system.model.form.GenConfigForm;
|
|
||||||
import com.youlai.system.model.query.TablePageQuery;
|
|
||||||
import com.youlai.system.model.vo.GeneratorPreviewVO;
|
|
||||||
import com.youlai.system.model.vo.TableColumnVO;
|
|
||||||
import com.youlai.system.model.vo.TablePageVO;
|
|
||||||
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 代码生成配置接口
|
* 代码生成配置接口
|
||||||
|
|||||||
@@ -1,11 +1,9 @@
|
|||||||
package com.youlai.system.service;
|
package com.youlai.system.service;
|
||||||
|
|
||||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||||
import com.youlai.system.model.bo.TableMetaData;
|
|
||||||
import com.youlai.system.model.form.GenConfigForm;
|
import com.youlai.system.model.form.GenConfigForm;
|
||||||
import com.youlai.system.model.query.TablePageQuery;
|
import com.youlai.system.model.query.TablePageQuery;
|
||||||
import com.youlai.system.model.vo.GeneratorPreviewVO;
|
import com.youlai.system.model.vo.GeneratorPreviewVO;
|
||||||
import com.youlai.system.model.vo.TableColumnVO;
|
|
||||||
import com.youlai.system.model.vo.TablePageVO;
|
import com.youlai.system.model.vo.TablePageVO;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
@@ -24,7 +22,7 @@ public interface GeneratorService {
|
|||||||
* @param queryParams 查询参数
|
* @param queryParams 查询参数
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
Page<TableMetaData> getTablePage(TablePageQuery queryParams);
|
Page<TablePageVO> getTablePage(TablePageQuery queryParams);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 获取预览生成代码
|
* 获取预览生成代码
|
||||||
@@ -40,7 +38,7 @@ public interface GeneratorService {
|
|||||||
* @param tableName 表名
|
* @param tableName 表名
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
GenConfigForm getGenConfig(String tableName);
|
GenConfigForm getGenConfigFormData(String tableName);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 保存代码生成配置
|
* 保存代码生成配置
|
||||||
|
|||||||
@@ -15,18 +15,22 @@ import com.youlai.system.SystemApplication;
|
|||||||
import com.youlai.system.config.property.GeneratorProperties;
|
import com.youlai.system.config.property.GeneratorProperties;
|
||||||
import com.youlai.system.converter.GenConfigConverter;
|
import com.youlai.system.converter.GenConfigConverter;
|
||||||
import com.youlai.system.enums.FormTypeEnum;
|
import com.youlai.system.enums.FormTypeEnum;
|
||||||
|
import com.youlai.system.enums.JavaTypeEnum;
|
||||||
import com.youlai.system.enums.QueryTypeEnum;
|
import com.youlai.system.enums.QueryTypeEnum;
|
||||||
import com.youlai.system.exception.BusinessException;
|
import com.youlai.system.exception.BusinessException;
|
||||||
import com.youlai.system.mapper.DatabaseMapper;
|
import com.youlai.system.mapper.DatabaseMapper;
|
||||||
|
import com.youlai.system.model.bo.ColumnMetaData;
|
||||||
|
import com.youlai.system.model.bo.TableMetaData;
|
||||||
|
import com.youlai.system.model.entity.GenConfig;
|
||||||
import com.youlai.system.model.entity.GenFieldConfig;
|
import com.youlai.system.model.entity.GenFieldConfig;
|
||||||
import com.youlai.system.model.form.GenConfigForm;
|
import com.youlai.system.model.form.GenConfigForm;
|
||||||
import com.youlai.system.model.query.TablePageQuery;
|
import com.youlai.system.model.query.TablePageQuery;
|
||||||
|
import com.youlai.system.model.vo.GeneratorPreviewVO;
|
||||||
|
import com.youlai.system.model.vo.TablePageVO;
|
||||||
import com.youlai.system.service.GeneratorService;
|
import com.youlai.system.service.GeneratorService;
|
||||||
import com.youlai.system.service.GenConfigService;
|
import com.youlai.system.service.GenConfigService;
|
||||||
import com.youlai.system.service.GenFieldConfigService;
|
import com.youlai.system.service.GenFieldConfigService;
|
||||||
import lombok.RequiredArgsConstructor;
|
import lombok.RequiredArgsConstructor;
|
||||||
import org.apache.logging.log4j.util.Strings;
|
|
||||||
import org.springframework.beans.factory.annotation.Value;
|
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
@@ -42,14 +46,10 @@ import java.util.*;
|
|||||||
@RequiredArgsConstructor
|
@RequiredArgsConstructor
|
||||||
public class GeneratorServiceImpl implements GeneratorService {
|
public class GeneratorServiceImpl implements GeneratorService {
|
||||||
|
|
||||||
@Value("${spring.application.name}")
|
|
||||||
private String applicationName;
|
|
||||||
|
|
||||||
private final DatabaseMapper databaseMapper;
|
private final DatabaseMapper databaseMapper;
|
||||||
private final GeneratorProperties generatorProperties;
|
private final GeneratorProperties generatorProperties;
|
||||||
private final GenConfigService genConfigService;
|
private final GenConfigService genConfigService;
|
||||||
private final GenFieldConfigService genFieldConfigService;
|
private final GenFieldConfigService genFieldConfigService;
|
||||||
|
|
||||||
private final GenConfigConverter genConfigConverter;
|
private final GenConfigConverter genConfigConverter;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -58,8 +58,8 @@ public class GeneratorServiceImpl implements GeneratorService {
|
|||||||
* @param queryParams 查询参数
|
* @param queryParams 查询参数
|
||||||
* @return 分页结果
|
* @return 分页结果
|
||||||
*/
|
*/
|
||||||
public Page<TableMetaData> getTablePage(TablePageQuery queryParams) {
|
public Page<TablePageVO> getTablePage(TablePageQuery queryParams) {
|
||||||
Page<TableMetaData> page = new Page<>(queryParams.getPageNum(), queryParams.getPageSize());
|
Page<TablePageVO> page = new Page<>(queryParams.getPageNum(), queryParams.getPageSize());
|
||||||
return databaseMapper.getTablePage(page, queryParams);
|
return databaseMapper.getTablePage(page, queryParams);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -70,7 +70,7 @@ public class GeneratorServiceImpl implements GeneratorService {
|
|||||||
* @return 代码生成配置
|
* @return 代码生成配置
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public GenConfigForm getGenConfig(String tableName) {
|
public GenConfigForm getGenConfigFormData(String tableName) {
|
||||||
// 查询表生成配置
|
// 查询表生成配置
|
||||||
GenConfig genConfig = genConfigService.getOne(
|
GenConfig genConfig = genConfigService.getOne(
|
||||||
new LambdaQueryWrapper<>(GenConfig.class)
|
new LambdaQueryWrapper<>(GenConfig.class)
|
||||||
@@ -96,6 +96,8 @@ public class GeneratorServiceImpl implements GeneratorService {
|
|||||||
String packageName = SystemApplication.class.getPackageName();
|
String packageName = SystemApplication.class.getPackageName();
|
||||||
genConfig.setPackageName(packageName);
|
genConfig.setPackageName(packageName);
|
||||||
|
|
||||||
|
genConfig.setAuthor(generatorProperties.getDefaultConfig().getAuthor());
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// 根据表的列 + 已经存在的字段生成配置 得到 组合后的字段生成配置
|
// 根据表的列 + 已经存在的字段生成配置 得到 组合后的字段生成配置
|
||||||
@@ -114,19 +116,15 @@ public class GeneratorServiceImpl implements GeneratorService {
|
|||||||
String columnName = tableColumn.getColumnName();
|
String columnName = tableColumn.getColumnName();
|
||||||
GenFieldConfig genFieldConfig = fieldConfigList.stream()
|
GenFieldConfig genFieldConfig = fieldConfigList.stream()
|
||||||
.filter(item -> StrUtil.equals(item.getColumnName(), columnName))
|
.filter(item -> StrUtil.equals(item.getColumnName(), columnName))
|
||||||
.findFirst().orElseGet(() -> {
|
.findFirst()
|
||||||
GenFieldConfig fieldConfig = new GenFieldConfig();
|
.orElseGet(() -> createDefaultFieldConfig(tableColumn));
|
||||||
fieldConfig.setColumnName(tableColumn.getColumnName());
|
|
||||||
fieldConfig.setColumnType(tableColumn.getDataType());
|
|
||||||
fieldConfig.setComment(tableColumn.getColumnComment());
|
|
||||||
fieldConfig.setFieldName(StrUtil.toCamelCase(columnName));
|
|
||||||
fieldConfig.setFieldType(StrUtil.toCamelCase(tableColumn.getDataType()));
|
|
||||||
fieldConfig.setIsRequired("YES".equals(tableColumn.getIsNullable()) ? 1 : 0);
|
|
||||||
fieldConfig.setFormType(FormTypeEnum.INPUT);
|
|
||||||
fieldConfig.setQueryType(QueryTypeEnum.EQ);
|
|
||||||
return fieldConfig;
|
|
||||||
|
|
||||||
});
|
// 根据列类型设置字段类型
|
||||||
|
String fieldType = genFieldConfig.getFieldType();
|
||||||
|
if (StrUtil.isBlank(fieldType)) {
|
||||||
|
String javaType = JavaTypeEnum.getJavaTypeByDbType(genFieldConfig.getColumnType());
|
||||||
|
genFieldConfig.setFieldType(javaType);
|
||||||
|
}
|
||||||
genFieldConfigs.add(genFieldConfig);
|
genFieldConfigs.add(genFieldConfig);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -135,6 +133,24 @@ public class GeneratorServiceImpl implements GeneratorService {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 创建默认字段配置
|
||||||
|
*
|
||||||
|
* @param tableColumn 表字段元数据
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
private GenFieldConfig createDefaultFieldConfig(ColumnMetaData tableColumn) {
|
||||||
|
GenFieldConfig fieldConfig = new GenFieldConfig();
|
||||||
|
fieldConfig.setColumnName(tableColumn.getColumnName());
|
||||||
|
fieldConfig.setColumnType(tableColumn.getDataType());
|
||||||
|
fieldConfig.setFieldComment(tableColumn.getColumnComment());
|
||||||
|
fieldConfig.setFieldName(StrUtil.toCamelCase(tableColumn.getColumnName()));
|
||||||
|
fieldConfig.setIsRequired("YES".equals(tableColumn.getIsNullable()) ? 1 : 0);
|
||||||
|
fieldConfig.setFormType(FormTypeEnum.INPUT);
|
||||||
|
fieldConfig.setQueryType(QueryTypeEnum.EQ);
|
||||||
|
return fieldConfig;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 保存代码生成配置
|
* 保存代码生成配置
|
||||||
*
|
*
|
||||||
@@ -204,7 +220,7 @@ public class GeneratorServiceImpl implements GeneratorService {
|
|||||||
// controller
|
// controller
|
||||||
String subPackageName = templateConfig.getPackageName();
|
String subPackageName = templateConfig.getPackageName();
|
||||||
// 文件路径 com.youlai.system.controller
|
// 文件路径 com.youlai.system.controller
|
||||||
String filePath = getFilePath(templateName, packageName, subPackageName);
|
String filePath = getFilePath(templateName, packageName, subPackageName,entityName);
|
||||||
previewVO.setPath(filePath);
|
previewVO.setPath(filePath);
|
||||||
|
|
||||||
/* 3. 生成文件内容 */
|
/* 3. 生成文件内容 */
|
||||||
@@ -227,32 +243,48 @@ public class GeneratorServiceImpl implements GeneratorService {
|
|||||||
if ("MapperXml".equals(templateName)) {
|
if ("MapperXml".equals(templateName)) {
|
||||||
return entityName + "Mapper" + extension;
|
return entityName + "Mapper" + extension;
|
||||||
}
|
}
|
||||||
if ("API".equals(templateName) || "VIEW".equals(templateName)) {
|
if ("API".equals(templateName)) {
|
||||||
return StrUtil.toSymbolCase(entityName, '-') + extension;
|
return StrUtil.toSymbolCase(entityName, '-') + extension;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if ("VIEW".equals(templateName)) {
|
||||||
|
return "index.vue";
|
||||||
|
}
|
||||||
|
|
||||||
return entityName + templateName + extension;
|
return entityName + templateName + extension;
|
||||||
}
|
}
|
||||||
|
|
||||||
private String getFilePath(String templateName, String packageName, String subPackageName) {
|
private String getFilePath(String templateName, String packageName, String subPackageName,String entityName) {
|
||||||
String path;
|
String path;
|
||||||
if ("MapperXml".equals(templateName)) {
|
if ("MapperXml".equals(templateName)) {
|
||||||
path = (applicationName
|
path = (generatorProperties.getBackendAppName()
|
||||||
+ File.separator
|
+ File.separator
|
||||||
+ "src" + File.separator + "main" + File.separator + "resources"
|
+ "src" + File.separator + "main" + File.separator + "resources"
|
||||||
+ File.separator + subPackageName
|
+ File.separator + subPackageName
|
||||||
).replace(".", File.separator);
|
);
|
||||||
} else if ("API".equals(templateName) || "VIEW".equals(templateName)) {
|
} else if ("API".equals(templateName) ) {
|
||||||
path = ("vue3-element-admin"
|
path = (generatorProperties.getFrontendAppName()
|
||||||
+ File.separator
|
+ File.separator
|
||||||
+ "src" + File.separator + subPackageName
|
+ "src" + File.separator + subPackageName
|
||||||
).replace(".", File.separator);
|
);
|
||||||
} else {
|
} else if("VIEW".equals(templateName)){
|
||||||
path = (applicationName
|
path = (generatorProperties.getFrontendAppName()
|
||||||
|
+ File.separator
|
||||||
|
+ "src" + File.separator + subPackageName
|
||||||
|
+ File.separator
|
||||||
|
+ StrUtil.toSymbolCase(entityName, '-')
|
||||||
|
);
|
||||||
|
}else {
|
||||||
|
path = (generatorProperties.getBackendAppName()
|
||||||
+ File.separator
|
+ File.separator
|
||||||
+ "src" + File.separator + "main" + File.separator + "java"
|
+ "src" + File.separator + "main" + File.separator + "java"
|
||||||
+ File.separator + packageName + File.separator + subPackageName
|
+ File.separator + packageName + File.separator + subPackageName
|
||||||
).replace(".", File.separator);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// subPackageName = model.entity => model/entity
|
||||||
|
path = path.replace(".", File.separator);
|
||||||
|
|
||||||
return path;
|
return path;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -277,13 +309,14 @@ public class GeneratorServiceImpl implements GeneratorService {
|
|||||||
bindMap.put("tableName", genConfig.getTableName());
|
bindMap.put("tableName", genConfig.getTableName());
|
||||||
bindMap.put("author", genConfig.getAuthor());
|
bindMap.put("author", genConfig.getAuthor());
|
||||||
bindMap.put("lowerFirstEntityName", StrUtil.lowerFirst(entityName));
|
bindMap.put("lowerFirstEntityName", StrUtil.lowerFirst(entityName));
|
||||||
bindMap.put("tableComment", genConfig.getBusinessName());
|
bindMap.put("businessName", genConfig.getBusinessName());
|
||||||
bindMap.put("fieldConfigs", fieldConfigs);
|
bindMap.put("fieldConfigs", fieldConfigs);
|
||||||
|
|
||||||
for (GenFieldConfig fieldConfig : fieldConfigs) {
|
for (GenFieldConfig fieldConfig : fieldConfigs) {
|
||||||
bindMap.put("hasLocalDateTime", "LocalDateTime".equals(fieldConfig.getFieldType()));
|
bindMap.put("hasLocalDateTime", "LocalDateTime".equals(fieldConfig.getFieldType()));
|
||||||
bindMap.put("hasBigDecimal", "BigDecimal".equals(fieldConfig.getFieldType()));
|
bindMap.put("hasBigDecimal", "BigDecimal".equals(fieldConfig.getFieldType()));
|
||||||
bindMap.put("hasRequiredField", ObjectUtil.equals(fieldConfig.getIsRequired(), 1));
|
bindMap.put("hasRequiredField", ObjectUtil.equals(fieldConfig.getIsRequired(), 1));
|
||||||
|
fieldConfig.setTsType(JavaTypeEnum.getTsTypeByJavaType(fieldConfig.getFieldType()));
|
||||||
}
|
}
|
||||||
|
|
||||||
TemplateEngine templateEngine = TemplateUtil.createEngine(new TemplateConfig("templates", TemplateConfig.ResourceMode.CLASSPATH));
|
TemplateEngine templateEngine = TemplateUtil.createEngine(new TemplateConfig("templates", TemplateConfig.ResourceMode.CLASSPATH));
|
||||||
|
|||||||
@@ -2,7 +2,7 @@ package com.youlai.system.service.impl;
|
|||||||
|
|
||||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||||
import com.youlai.system.common.util.DateUtils;
|
import com.youlai.system.util.DateUtils;
|
||||||
import com.youlai.system.model.bo.VisitCount;
|
import com.youlai.system.model.bo.VisitCount;
|
||||||
import com.youlai.system.model.entity.SysLog;
|
import com.youlai.system.model.entity.SysLog;
|
||||||
import com.youlai.system.model.query.LogPageQuery;
|
import com.youlai.system.model.query.LogPageQuery;
|
||||||
|
|||||||
@@ -9,7 +9,7 @@ import com.baomidou.mybatisplus.core.metadata.IPage;
|
|||||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||||
import com.youlai.system.common.constant.SystemConstants;
|
import com.youlai.system.common.constant.SystemConstants;
|
||||||
import com.youlai.system.common.util.DateUtils;
|
import com.youlai.system.util.DateUtils;
|
||||||
import com.youlai.system.converter.UserConverter;
|
import com.youlai.system.converter.UserConverter;
|
||||||
import com.youlai.system.security.util.SecurityUtils;
|
import com.youlai.system.security.util.SecurityUtils;
|
||||||
import com.youlai.system.mapper.SysUserMapper;
|
import com.youlai.system.mapper.SysUserMapper;
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
|
|
||||||
package com.youlai.system.common.util;
|
package com.youlai.system.util;
|
||||||
|
|
||||||
import cn.hutool.core.date.DateTime;
|
import cn.hutool.core.date.DateTime;
|
||||||
import cn.hutool.core.date.DateUtil;
|
import cn.hutool.core.date.DateUtil;
|
||||||
@@ -1,4 +1,4 @@
|
|||||||
package com.youlai.system.common.util;
|
package com.youlai.system.util;
|
||||||
|
|
||||||
import com.alibaba.excel.EasyExcel;
|
import com.alibaba.excel.EasyExcel;
|
||||||
import com.youlai.system.plugin.easyexcel.MyAnalysisEventListener;
|
import com.youlai.system.plugin.easyexcel.MyAnalysisEventListener;
|
||||||
@@ -1,4 +1,4 @@
|
|||||||
package com.youlai.system.common.util;
|
package com.youlai.system.util;
|
||||||
|
|
||||||
import cn.hutool.core.util.StrUtil;
|
import cn.hutool.core.util.StrUtil;
|
||||||
import jakarta.annotation.PostConstruct;
|
import jakarta.annotation.PostConstruct;
|
||||||
@@ -1,4 +1,4 @@
|
|||||||
package com.youlai.system.common.util;
|
package com.youlai.system.util;
|
||||||
|
|
||||||
import cn.hutool.json.JSONUtil;
|
import cn.hutool.json.JSONUtil;
|
||||||
import com.youlai.system.common.result.Result;
|
import com.youlai.system.common.result.Result;
|
||||||
@@ -1,5 +1,9 @@
|
|||||||
### 代码生成器配置
|
# 代码生成器配置
|
||||||
generator:
|
generator:
|
||||||
|
defaultConfig:
|
||||||
|
author: youlaitech
|
||||||
|
backendAppName: youlai-boot
|
||||||
|
frontendAppName: vue3-element-admin
|
||||||
## 模板配置
|
## 模板配置
|
||||||
templateConfigs:
|
templateConfigs:
|
||||||
Controller:
|
Controller:
|
||||||
@@ -18,6 +22,9 @@ generator:
|
|||||||
templatePath: generator/mapper.xml.vm
|
templatePath: generator/mapper.xml.vm
|
||||||
packageName: mapper
|
packageName: mapper
|
||||||
extension: .xml
|
extension: .xml
|
||||||
|
Converter:
|
||||||
|
templatePath: generator/converter.java.vm
|
||||||
|
packageName: converter
|
||||||
Query:
|
Query:
|
||||||
templatePath: generator/query.java.vm
|
templatePath: generator/query.java.vm
|
||||||
packageName: model.query
|
packageName: model.query
|
||||||
|
|||||||
@@ -5,7 +5,7 @@
|
|||||||
<mapper namespace="com.youlai.system.mapper.DatabaseMapper">
|
<mapper namespace="com.youlai.system.mapper.DatabaseMapper">
|
||||||
|
|
||||||
<!-- 查询数据库表分页 -->
|
<!-- 查询数据库表分页 -->
|
||||||
<select id="getTablePage" resultType="com.youlai.system.model.bo.TableMetaData">
|
<select id="getTablePage" resultType="com.youlai.system.model.vo.TablePageVO">
|
||||||
SELECT
|
SELECT
|
||||||
TABLE_NAME ,
|
TABLE_NAME ,
|
||||||
TABLE_COMMENT ,
|
TABLE_COMMENT ,
|
||||||
|
|||||||
@@ -4,25 +4,4 @@
|
|||||||
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||||
<mapper namespace="com.youlai.system.mapper.GenFieldConfigMapper">
|
<mapper namespace="com.youlai.system.mapper.GenFieldConfigMapper">
|
||||||
|
|
||||||
<resultMap id="BaseResultMap" type="com.youlai.system.model.entity.GenFieldConfig">
|
|
||||||
<id property="id" column="id" jdbcType="BIGINT"/>
|
|
||||||
<result property="configId" column="config_id" jdbcType="BIGINT"/>
|
|
||||||
<result property="name" column="name" jdbcType="VARCHAR"/>
|
|
||||||
<result property="type" column="type" jdbcType="VARCHAR"/>
|
|
||||||
<result property="description" column="description" jdbcType="VARCHAR"/>
|
|
||||||
<result property="showInList" column="show_in_list" jdbcType="TINYINT"/>
|
|
||||||
<result property="showInForm" column="show_in_form" jdbcType="TINYINT"/>
|
|
||||||
<result property="showInQuery" column="show_in_query" jdbcType="TINYINT"/>
|
|
||||||
<result property="formType" column="form_type" jdbcType="VARCHAR"/>
|
|
||||||
<result property="queryMethod" column="query_method" jdbcType="VARCHAR"/>
|
|
||||||
<result property="createTime" column="create_time" jdbcType="TIMESTAMP"/>
|
|
||||||
<result property="updateTime" column="update_time" jdbcType="TIMESTAMP"/>
|
|
||||||
</resultMap>
|
|
||||||
|
|
||||||
<sql id="Base_Column_List">
|
|
||||||
id,config_id,name,
|
|
||||||
type,description,show_in_list,
|
|
||||||
show_in_form,show_in_query,form_type,
|
|
||||||
query_method,create_time,update_time
|
|
||||||
</sql>
|
|
||||||
</mapper>
|
</mapper>
|
||||||
|
|||||||
@@ -1,121 +1,93 @@
|
|||||||
import request from "@/utils/request";
|
import request from "@/utils/request";
|
||||||
|
|
||||||
const ${className.toUpperCase()}_BASE_URL = "/api/v1/${className.toLowerCase()}s";
|
const ${entityName.toUpperCase()}_BASE_URL = "/api/v1/${entityName.toLowerCase()}s";
|
||||||
|
|
||||||
class ${className}API {
|
class ${entityName}API {
|
||||||
/** 获取${className}分页数据 */
|
/** 获取${businessName}分页数据 */
|
||||||
static getPage(queryParams?: ${className}PageQuery) {
|
static getPage(queryParams?: ${entityName}PageQuery) {
|
||||||
return request<any, PageResult<${className}PageVO[]>>({
|
return request<any, PageResult<${entityName}PageVO[]>>({
|
||||||
url: `${${className.toUpperCase()}_BASE_URL}/page`,
|
url: `${${entityName.toUpperCase()}_BASE_URL}/page`,
|
||||||
method: "get",
|
method: "get",
|
||||||
params: queryParams,
|
params: queryParams,
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
/** 获取${className}下拉数据源 */
|
|
||||||
static getOptions() {
|
|
||||||
return request<any, OptionType[]>({
|
|
||||||
url: `${${className.toUpperCase()}_BASE_URL}/options`,
|
|
||||||
method: "get",
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 获取${className}的菜单ID集合
|
* 获取${businessName}表单数据
|
||||||
*
|
*
|
||||||
* @param ${className.toLowerCase()}Id ${className}ID
|
* @param id ${entityName}ID
|
||||||
* @returns ${className}的菜单ID集合
|
* @returns ${entityName}表单数据
|
||||||
*/
|
|
||||||
static get${className}MenuIds(${className.toLowerCase()}Id: number) {
|
|
||||||
return request<any, number[]>({
|
|
||||||
url: `${${className.toUpperCase()}_BASE_URL}/${${className.toLowerCase()}Id}/menuIds`,
|
|
||||||
method: "get",
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 分配菜单权限
|
|
||||||
*
|
|
||||||
* @param ${className.toLowerCase()}Id ${className}ID
|
|
||||||
* @param data 菜单ID集合
|
|
||||||
*/
|
|
||||||
static update${className}Menus(${className.toLowerCase()}Id: number, data: number[]) {
|
|
||||||
return request({
|
|
||||||
url: `${${className.toUpperCase()}_BASE_URL}/${${className.toLowerCase()}Id}/menus`,
|
|
||||||
method: "put",
|
|
||||||
data: data,
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 获取${className}表单数据
|
|
||||||
*
|
|
||||||
* @param id ${className}ID
|
|
||||||
* @returns ${className}表单数据
|
|
||||||
*/
|
*/
|
||||||
static getFormData(id: number) {
|
static getFormData(id: number) {
|
||||||
return request<any, ${className}Form>({
|
return request<any, ${entityName}Form>({
|
||||||
url: `${${className.toUpperCase()}_BASE_URL}/${id}/form`,
|
url: `${${entityName.toUpperCase()}_BASE_URL}/${id}/form`,
|
||||||
method: "get",
|
method: "get",
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
/** 添加${className} */
|
/** 添加${businessName}*/
|
||||||
static add(data: ${className}Form) {
|
static add(data: ${entityName}Form) {
|
||||||
return request({
|
return request({
|
||||||
url: `${${className.toUpperCase()}_BASE_URL}`,
|
url: `${${entityName.toUpperCase()}_BASE_URL}`,
|
||||||
method: "post",
|
method: "post",
|
||||||
data: data,
|
data: data,
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 更新${className}
|
* 更新${businessName}
|
||||||
*
|
*
|
||||||
* @param id ${className}ID
|
* @param id ${entityName}ID
|
||||||
* @param data ${className}表单数据
|
* @param data ${entityName}表单数据
|
||||||
*/
|
*/
|
||||||
static update(id: number, data: ${className}Form) {
|
static update(id: number, data: ${entityName}Form) {
|
||||||
return request({
|
return request({
|
||||||
url: `${${className.toUpperCase()}_BASE_URL}/${id}`,
|
url: `${${entityName.toUpperCase()}_BASE_URL}/${id}`,
|
||||||
method: "put",
|
method: "put",
|
||||||
data: data,
|
data: data,
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 批量删除${className},多个以英文逗号(,)分割
|
* 批量删除${businessName},多个以英文逗号(,)分割
|
||||||
*
|
*
|
||||||
* @param ids ${className}ID字符串,多个以英文逗号(,)分割
|
* @param ids ${businessName}ID字符串,多个以英文逗号(,)分割
|
||||||
*/
|
*/
|
||||||
static deleteByIds(ids: string) {
|
static deleteByIds(ids: string) {
|
||||||
return request({
|
return request({
|
||||||
url: `${${className.toUpperCase()}_BASE_URL}/${ids}`,
|
url: `${${entityName.toUpperCase()}_BASE_URL}/${ids}`,
|
||||||
method: "delete",
|
method: "delete",
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
export default ${className}API;
|
export default ${entityName}API;
|
||||||
|
|
||||||
/** ${className}分页查询参数 */
|
/** $${businessName}分页查询参数 */
|
||||||
export interface ${className}PageQuery extends PageQuery {
|
export interface ${entityName}PageQuery extends PageQuery {
|
||||||
/** 搜索关键字 */
|
/** 搜索关键字 */
|
||||||
keywords?: string;
|
keywords?: string;
|
||||||
}
|
}
|
||||||
|
|
||||||
/** ${className}分页对象 */
|
/** ${businessName}表单对象 */
|
||||||
export interface ${className}PageVO {
|
export interface ${entityName}Form {
|
||||||
#foreach($field in $fields)
|
#foreach($fieldConfig in $fieldConfigs)
|
||||||
/** ${field.comment} */
|
#if($fieldConfig.isShowInForm)
|
||||||
${field.name}?: ${field.type};
|
#if("$!fieldConfig.fieldComment" != "")
|
||||||
|
/** ${fieldConfig.fieldComment} */
|
||||||
|
#end
|
||||||
|
${fieldConfig.fieldName}?: ${fieldConfig.tsType};
|
||||||
|
#end
|
||||||
#end
|
#end
|
||||||
}
|
}
|
||||||
|
|
||||||
/** ${className}表单对象 */
|
/** ${businessName}分页对象 */
|
||||||
export interface ${className}Form {
|
export interface ${entityName}PageVO {
|
||||||
#foreach($field in $fields)
|
#foreach($fieldConfig in $fieldConfigs)
|
||||||
/** ${field.comment} */
|
#if($fieldConfig.isShowInList)
|
||||||
${field.name}?: ${field.type};
|
#if("$!fieldConfig.fieldComment" != "")
|
||||||
|
/** ${fieldConfig.fieldComment} */
|
||||||
|
#end
|
||||||
|
${fieldConfig.fieldName}?: ${fieldConfig.tsType};
|
||||||
|
#end
|
||||||
#end
|
#end
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -17,12 +17,12 @@ import org.springframework.web.bind.annotation.*;
|
|||||||
import jakarta.validation.Valid;
|
import jakarta.validation.Valid;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* $!{tableComment}前端控制层
|
* $!{businessName}前端控制层
|
||||||
*
|
*
|
||||||
* @author ${author}
|
* @author ${author}
|
||||||
* @since ${date}
|
* @since ${date}
|
||||||
*/
|
*/
|
||||||
@Tag(name = "${tableComment}接口")
|
@Tag(name = "${businessName}接口")
|
||||||
@RestController
|
@RestController
|
||||||
@RequestMapping("/api/v1/${lowerFirstEntityName}s")
|
@RequestMapping("/api/v1/${lowerFirstEntityName}s")
|
||||||
@RequiredArgsConstructor
|
@RequiredArgsConstructor
|
||||||
@@ -30,41 +30,41 @@ public class ${entityName}Controller {
|
|||||||
|
|
||||||
private final ${entityName}Serivie ${lowerFirstEntityName}Service;
|
private final ${entityName}Serivie ${lowerFirstEntityName}Service;
|
||||||
|
|
||||||
@Operation(summary = "$!{tableComment}分页列表")
|
@Operation(summary = "$!{businessName}分页列表")
|
||||||
@GetMapping("/page")
|
@GetMapping("/page")
|
||||||
public PageResult<${entityName}PageVO> get${entityName}Page(${entityName}PageQuery queryParams ) {
|
public PageResult<${entityName}PageVO> get${entityName}Page(${entityName}PageQuery queryParams ) {
|
||||||
IPage<${entityName}PageVO> result = ${lowerFirstEntityName}Service.get${entityName}Page(queryParams);
|
IPage<${entityName}PageVO> result = ${lowerFirstEntityName}Service.get${entityName}Page(queryParams);
|
||||||
return PageResult.success(result);
|
return PageResult.success(result);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Operation(summary = "新增$!{tableComment}")
|
@Operation(summary = "新增${businessName}")
|
||||||
@PostMapping
|
@PostMapping
|
||||||
public Result save${entityName}(@RequestBody @Valid ${entityName}Form formData ) {
|
public Result save${entityName}(@RequestBody @Valid ${entityName}Form formData ) {
|
||||||
boolean result = ${lowerFirstEntityName}Service.save${entityName}(formData);
|
boolean result = ${lowerFirstEntityName}Service.save${entityName}(formData);
|
||||||
return Result.judge(result);
|
return Result.judge(result);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Operation(summary = "获取$!{tableComment}表单数据")
|
@Operation(summary = "获取${businessName}表单数据")
|
||||||
@GetMapping("/{id}/form")
|
@GetMapping("/{id}/form")
|
||||||
public Result<${entityName}Form> get${entityName}Form(
|
public Result<${entityName}Form> get${entityName}Form(
|
||||||
@Parameter(description = "$!{tableComment}ID") @PathVariable Long id
|
@Parameter(description = "$!{businessName}ID") @PathVariable Long id
|
||||||
) {
|
) {
|
||||||
${entityName}Form formData = ${lowerFirstEntityName}Service.get${entityName}FormData(id);
|
${entityName}Form formData = ${lowerFirstEntityName}Service.get${entityName}FormData(id);
|
||||||
return Result.success(formData);
|
return Result.success(formData);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Operation(summary = "修改$!{tableComment}")
|
@Operation(summary = "修改${businessName}")
|
||||||
@PutMapping(value = "/{id}")
|
@PutMapping(value = "/{id}")
|
||||||
public Result update${entityName}(@Parameter(description = "$!{tableComment}ID") @PathVariable Long id,
|
public Result update${entityName}(@Parameter(description = "$!{businessName}ID") @PathVariable Long id,
|
||||||
@RequestBody @Validated ${entityName}Form formData) {
|
@RequestBody @Validated ${entityName}Form formData) {
|
||||||
boolean result = ${lowerFirstEntityName}Service.update${entityName}(id, formData);
|
boolean result = ${lowerFirstEntityName}Service.update${entityName}(id, formData);
|
||||||
return Result.judge(result);
|
return Result.judge(result);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Operation(summary = "删除$!{tableComment}")
|
@Operation(summary = "删除${businessName}")
|
||||||
@DeleteMapping("/{ids}")
|
@DeleteMapping("/{ids}")
|
||||||
public Result delete${entityName}s(
|
public Result delete${entityName}s(
|
||||||
@Parameter(description = "$!{tableComment}ID,多个以英文逗号(,)分割") @PathVariable String ids
|
@Parameter(description = "$!{businessName}ID,多个以英文逗号(,)分割") @PathVariable String ids
|
||||||
) {
|
) {
|
||||||
boolean result = ${lowerFirstEntityName}Service.delete${entityName}s(ids);
|
boolean result = ${lowerFirstEntityName}Service.delete${entityName}s(ids);
|
||||||
return Result.judge(result);
|
return Result.judge(result);
|
||||||
|
|||||||
@@ -6,7 +6,7 @@ import ${package}.model.entity.${entityName};
|
|||||||
import ${package}.model.form.${entityName}Form;
|
import ${package}.model.form.${entityName}Form;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* $!{tableComment}对象转换器
|
* $!{businessName}对象转换器
|
||||||
*
|
*
|
||||||
* @author ${author}
|
* @author ${author}
|
||||||
* @since ${date}
|
* @since ${date}
|
||||||
|
|||||||
@@ -12,7 +12,7 @@ import com.baomidou.mybatisplus.annotation.TableName;
|
|||||||
import com.youlai.system.common.base.BaseEntity;
|
import com.youlai.system.common.base.BaseEntity;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* $!{tableComment}实体对象
|
* $!{businessName}实体对象
|
||||||
*
|
*
|
||||||
* @author ${author}
|
* @author ${author}
|
||||||
* @since ${date}
|
* @since ${date}
|
||||||
|
|||||||
@@ -16,14 +16,14 @@ import jakarta.validation.constraints.*;
|
|||||||
#end
|
#end
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* $!{tableComment}表单对象
|
* $!{businessName}表单对象
|
||||||
*
|
*
|
||||||
* @author ${author}
|
* @author ${author}
|
||||||
* @since ${date}
|
* @since ${date}
|
||||||
*/
|
*/
|
||||||
@Getter
|
@Getter
|
||||||
@Setter
|
@Setter
|
||||||
@Schema(description = "$!{tableComment}表单对象")
|
@Schema(description = "$!{businessName}表单对象")
|
||||||
public class ${entityName}Form implements Serializable {
|
public class ${entityName}Form implements Serializable {
|
||||||
|
|
||||||
@Serial
|
@Serial
|
||||||
@@ -32,7 +32,7 @@ public class ${entityName}Form implements Serializable {
|
|||||||
## ---------- BEGIN 字段循环遍历 ----------
|
## ---------- BEGIN 字段循环遍历 ----------
|
||||||
#if($fieldConfigs)
|
#if($fieldConfigs)
|
||||||
#foreach($fieldConfig in ${fieldConfigs})
|
#foreach($fieldConfig in ${fieldConfigs})
|
||||||
#if($fieldConfig.showInForm)
|
#if($fieldConfig.isShowInForm)
|
||||||
#if($fieldConfig.isRequired)
|
#if($fieldConfig.isRequired)
|
||||||
#if($fieldConfig.fieldType == 'String')
|
#if($fieldConfig.fieldType == 'String')
|
||||||
@NotBlank(message = "$fieldConfig.fieldComment不能为空")
|
@NotBlank(message = "$fieldConfig.fieldComment不能为空")
|
||||||
|
|||||||
@@ -2,114 +2,127 @@
|
|||||||
<div class="app-container">
|
<div class="app-container">
|
||||||
<div class="search-container">
|
<div class="search-container">
|
||||||
<el-form ref="queryFormRef" :model="queryParams" :inline="true">
|
<el-form ref="queryFormRef" :model="queryParams" :inline="true">
|
||||||
<el-form-item prop="keywords" label="关键字">
|
#foreach($fieldConfig in $fieldConfigs)
|
||||||
<el-input
|
#if($fieldConfig.isShowInQuery == 1)
|
||||||
v-model="queryParams.keywords"
|
<el-form-item :label="$fieldConfig.fieldComment" :key="$fieldConfig.fieldName">
|
||||||
placeholder="${className}名称"
|
#if($fieldConfig.formType == "INPUT")
|
||||||
clearable
|
<el-input v-model="queryParams.$fieldConfig.fieldName" :placeholder="$fieldConfig.fieldComment" clearable @keyup.enter="handleQuery" />
|
||||||
@keyup.enter="handleQuery"
|
#elseif($fieldConfig.formType == "SELECT")
|
||||||
/>
|
<el-select v-model="queryParams.$fieldConfig.fieldName" :placeholder="$fieldConfig.fieldComment" clearable>
|
||||||
</el-form-item>
|
<!-- 这里可以根据具体需求生成select options -->
|
||||||
|
<el-option v-for="option in $fieldConfig.options" :key="option.value" :label="option.label" :value="option.value"></el-option>
|
||||||
|
</el-select>
|
||||||
|
#elseif($fieldConfig.formType == "RADIO")
|
||||||
|
<el-radio-group v-model="queryParams.$fieldConfig.fieldName">
|
||||||
|
<el-radio v-for="option in $fieldConfig.options" :key="option.value" :label="option.value">{{ option.label }}</el-radio>
|
||||||
|
</el-radio-group>
|
||||||
|
#elseif($fieldConfig.formType == "CHECK_BOX")
|
||||||
|
<el-checkbox-group v-model="queryParams.$fieldConfig.fieldName">
|
||||||
|
<el-checkbox v-for="option in $fieldConfig.options" :key="option.value" :label="option.value">{{ option.label }}</el-checkbox>
|
||||||
|
</el-checkbox-group>
|
||||||
|
#elseif($fieldConfig.formType == "INPUT_NUMBER")
|
||||||
|
<el-input-number v-model="queryParams.$fieldConfig.fieldName" :placeholder="$fieldConfig.fieldComment" />
|
||||||
|
#elseif($fieldConfig.formType == "SWITCH")
|
||||||
|
<el-switch v-model="queryParams.$fieldConfig.fieldName" />
|
||||||
|
#elseif($fieldConfig.formType == "TEXT_AREA")
|
||||||
|
<el-input type="textarea" v-model="queryParams.$fieldConfig.fieldName" :placeholder="$fieldConfig.fieldComment" />
|
||||||
|
#elseif($fieldConfig.formType == "DATE_TIME")
|
||||||
|
<el-date-picker v-model="queryParams.$fieldConfig.fieldName" type="datetime" :placeholder="$fieldConfig.fieldComment" />
|
||||||
|
#elseif($fieldConfig.formType == "DATE")
|
||||||
|
<el-date-picker v-model="queryParams.$fieldConfig.fieldName" type="date" :placeholder="$fieldConfig.fieldComment" />
|
||||||
|
#end
|
||||||
|
</el-form-item>
|
||||||
|
#end
|
||||||
|
#end
|
||||||
<el-form-item>
|
<el-form-item>
|
||||||
<el-button type="primary" @click="handleQuery">
|
<el-button type="primary" @click="handleQuery"><i-ep-search />搜索</el-button>
|
||||||
<i-ep-search />
|
<el-button @click="handleResetQuery"><i-ep-refresh />重置</el-button>
|
||||||
搜索
|
|
||||||
</el-button>
|
|
||||||
<el-button @click="handleResetQuery">
|
|
||||||
<i-ep-refresh />
|
|
||||||
重置
|
|
||||||
</el-button>
|
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
</el-form>
|
</el-form>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<el-card shadow="never" class="table-container">
|
<el-card shadow="never" class="table-container">
|
||||||
<template #header>
|
<template #header>
|
||||||
<el-button type="success" @click="handleOpenDialog()">
|
<el-button type="success" @click="handleOpenDialog"><i-ep-plus />新增</el-button>
|
||||||
<i-ep-plus />
|
<el-button type="danger" :disabled="ids.length === 0" @click="handleDelete"><i-ep-delete />删除</el-button>
|
||||||
新增
|
|
||||||
</el-button>
|
|
||||||
<el-button
|
|
||||||
type="danger"
|
|
||||||
:disabled="ids.length === 0"
|
|
||||||
@click="handleDelete()"
|
|
||||||
>
|
|
||||||
<i-ep-delete />
|
|
||||||
删除
|
|
||||||
</el-button>
|
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<el-table
|
<el-table
|
||||||
ref="dataTableRef"
|
ref="dataTableRef"
|
||||||
v-loading="loading"
|
v-loading="loading"
|
||||||
:data="${className.toLowerCase()}List"
|
:data="pageData"
|
||||||
highlight-current-row
|
highlight-current-row
|
||||||
border
|
border
|
||||||
@selection-change="handleSelectionChange"
|
@selection-change="handleSelectionChange"
|
||||||
>
|
>
|
||||||
<el-table-column type="selection" width="55" align="center" />
|
<el-table-column type="selection" width="55" align="center" />
|
||||||
#foreach($field in $fields)
|
#foreach($fieldConfig in $fieldConfigs)
|
||||||
<el-table-column label="${field.comment}" prop="${field.name}" min-width="100" />
|
#if($fieldConfig.isShowInList == 1)
|
||||||
|
<el-table-column
|
||||||
|
:key="$fieldConfig.fieldName"
|
||||||
|
:label="$fieldConfig.fieldComment"
|
||||||
|
:prop="$fieldConfig.fieldName"
|
||||||
|
min-width="100"
|
||||||
|
/>
|
||||||
#end
|
#end
|
||||||
|
#end
|
||||||
<el-table-column fixed="right" label="操作" width="220">
|
<el-table-column fixed="right" label="操作" width="220">
|
||||||
<template #default="scope">
|
<template #default="scope">
|
||||||
<el-button
|
<el-button type="primary" size="small" link @click="handleOpenDialog(scope.row.id)"><i-ep-edit />编辑</el-button>
|
||||||
type="primary"
|
<el-button type="danger" size="small" link @click="handleDelete(scope.row.id)"><i-ep-delete />删除</el-button>
|
||||||
size="small"
|
|
||||||
link
|
|
||||||
@click="handleOpenDialog(scope.row.id)"
|
|
||||||
>
|
|
||||||
<i-ep-edit />
|
|
||||||
编辑
|
|
||||||
</el-button>
|
|
||||||
<el-button
|
|
||||||
type="danger"
|
|
||||||
size="small"
|
|
||||||
link
|
|
||||||
@click="handleDelete(scope.row.id)"
|
|
||||||
>
|
|
||||||
<i-ep-delete />
|
|
||||||
删除
|
|
||||||
</el-button>
|
|
||||||
</template>
|
</template>
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
</el-table>
|
</el-table>
|
||||||
|
|
||||||
<pagination
|
<pagination
|
||||||
v-if="total > 0"
|
v-if="total > 0"
|
||||||
v-model:total="total"
|
v-model:total="total"
|
||||||
v-model:page="queryParams.pageNum"
|
v-model:page="queryParams.pageNum"
|
||||||
v-model:limit="queryParams.pageSize"
|
v-model:limit="queryParams.pageSize"
|
||||||
@pagination="handleQuery"
|
@pagination="handleQuery"
|
||||||
/>
|
/>
|
||||||
</el-card>
|
</el-card>
|
||||||
|
|
||||||
<!-- ${className}表单弹窗 -->
|
<!-- $!{businessName}表单弹窗 -->
|
||||||
<el-dialog
|
<el-dialog v-model="dialog.visible" :title="dialog.title" width="500px" @close="handleCloseDialog">
|
||||||
v-model="dialog.visible"
|
<el-form ref="dataFormRef" :model="formData" :rules="rules" label-width="100px">
|
||||||
:title="dialog.title"
|
#foreach($fieldConfig in $fieldConfigs)
|
||||||
width="500px"
|
#if($fieldConfig.isShowInForm == 1)
|
||||||
@close="handleCloseDialog"
|
<el-form-item :label="$fieldConfig.fieldComment" :key="$fieldConfig.fieldName">
|
||||||
>
|
#if($fieldConfig.formType == "INPUT")
|
||||||
<el-form
|
<el-input v-model="formData.$fieldConfig.fieldName" :placeholder="'请输入$fieldConfig.fieldComment" />
|
||||||
ref="${className.toLowerCase()}FormRef"
|
#elseif($fieldConfig.formType == "SELECT")
|
||||||
:model="formData"
|
<el-select v-model="formData.$fieldConfig.fieldName" :placeholder="'请选择$fieldConfig.fieldComment">
|
||||||
:rules="rules"
|
<!-- 这里可以根据具体需求生成select options -->
|
||||||
label-width="100px"
|
<el-option v-for="option in $fieldConfig.options" :key="option.value" :label="option.label" :value="option.value"></el-option>
|
||||||
>
|
</el-select>
|
||||||
#foreach($field in $fields)
|
#elseif($fieldConfig.formType == "RADIO")
|
||||||
<el-form-item label="${field.comment}" prop="${field.name}">
|
<el-radio-group v-model="formData.$fieldConfig.fieldName">
|
||||||
<el-input v-model="formData.${field.name}" placeholder="请输入${field.comment}" />
|
<el-radio v-for="option in $fieldConfig.options" :key="option.value" :label="option.value">{{ option.label }}</el-radio>
|
||||||
</el-form-item>
|
</el-radio-group>
|
||||||
|
#elseif($fieldConfig.formType == "CHECK_BOX")
|
||||||
|
<el-checkbox-group v-model="formData.$fieldConfig.fieldName">
|
||||||
|
<el-checkbox v-for="option in $fieldConfig.options" :key="option.value" :label="option.value">{{ option.label }}</el-checkbox>
|
||||||
|
</el-checkbox-group>
|
||||||
|
#elseif($fieldConfig.formType == "INPUT_NUMBER")
|
||||||
|
<el-input-number v-model="formData.$fieldConfig.fieldName" :placeholder="'请输入$fieldConfig.fieldComment" />
|
||||||
|
#elseif($fieldConfig.formType == "SWITCH")
|
||||||
|
<el-switch v-model="formData.$fieldConfig.fieldName" />
|
||||||
|
#elseif($fieldConfig.formType == "TEXT_AREA")
|
||||||
|
<el-input type="textarea" v-model="formData.$fieldConfig.fieldName" :placeholder="'请输入$fieldConfig.fieldComment" />
|
||||||
|
#elseif($fieldConfig.formType == "DATE_TIME")
|
||||||
|
<el-date-picker v-model="formData.$fieldConfig.fieldName" type="datetime" :placeholder="'请选择$fieldConfig.fieldComment" />
|
||||||
|
#elseif($fieldConfig.formType == "DATE")
|
||||||
|
<el-date-picker v-model="formData.$fieldConfig.fieldName" type="date" :placeholder="'请选择$fieldConfig.fieldComment" />
|
||||||
|
#end
|
||||||
|
</el-form-item>
|
||||||
#end
|
#end
|
||||||
|
#end
|
||||||
</el-form>
|
</el-form>
|
||||||
|
|
||||||
<template #footer>
|
<template #footer>
|
||||||
<div class="dialog-footer">
|
<div class="dialog-footer">
|
||||||
<el-button type="primary" @click="handleSubmit">确 定</el-button>
|
<el-button type="primary" @click="handleSubmit">确定</el-button>
|
||||||
<el-button @click="handleCloseDialog">取 消</el-button>
|
<el-button @click="handleCloseDialog">取消</el-button>
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
</el-dialog>
|
</el-dialog>
|
||||||
@@ -118,55 +131,60 @@
|
|||||||
|
|
||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
defineOptions({
|
defineOptions({
|
||||||
name: "${className}",
|
name: "${entityName}",
|
||||||
inheritAttrs: false,
|
inheritAttrs: false,
|
||||||
});
|
});
|
||||||
|
|
||||||
import ${className}API, { ${className}PageVO, ${className}Form, ${className}PageQuery } from "@/api/${className.toLowerCase()}";
|
import ${entityName}API, { ${entityName}PageVO, ${entityName}Form, ${entityName}PageQuery } from "@/api/${lowerFirstEntityName}";
|
||||||
|
|
||||||
const queryFormRef = ref(ElForm);
|
const queryFormRef = ref(null);
|
||||||
const ${className.toLowerCase()}FormRef = ref(ElForm);
|
const dataFormRef = ref(null);
|
||||||
|
|
||||||
const loading = ref(false);
|
const loading = ref(false);
|
||||||
const ids = ref<number[]>([]);
|
const ids = ref<number[]>([]);
|
||||||
const total = ref(0);
|
const total = ref(0);
|
||||||
|
|
||||||
const queryParams = reactive<${className}PageQuery>({
|
const queryParams = reactive<RolePageQuery>({
|
||||||
pageNum: 1,
|
pageNum: 1,
|
||||||
pageSize: 10,
|
pageSize: 10,
|
||||||
|
keywords: '',
|
||||||
|
name: '',
|
||||||
|
code: '',
|
||||||
});
|
});
|
||||||
|
|
||||||
// ${className}表格数据
|
// $!{businessName}表格数据
|
||||||
const ${className.toLowerCase()}List = ref<${className}PageVO[]>();
|
const pageData = ref<RolePageVO[]>([]);
|
||||||
|
|
||||||
// 弹窗
|
// 弹窗
|
||||||
const dialog = reactive({
|
const dialog = reactive({
|
||||||
title: "",
|
title: "",
|
||||||
visible: false,
|
visible: false,
|
||||||
});
|
});
|
||||||
// ${className}表单
|
// $!{businessName}表单
|
||||||
const formData = reactive<${className}Form>({});
|
const formData = reactive<RoleForm>({
|
||||||
|
keywords: '',
|
||||||
const rules = reactive({
|
name: '',
|
||||||
#foreach($field in $fields)
|
code: '',
|
||||||
${field.name}: [{ required: true, message: "请输入${field.comment}", trigger: "blur" }],
|
|
||||||
#end
|
|
||||||
});
|
});
|
||||||
|
|
||||||
/** 查询 */
|
const rules = reactive({
|
||||||
|
name: [{ required: true, message: "请输入$!{businessName}名称", trigger: "blur" }],
|
||||||
|
code: [{ required: true, message: "请输入$!{businessName}编码", trigger: "blur" }],
|
||||||
|
});
|
||||||
|
|
||||||
|
/** 查询$!{businessName} */
|
||||||
function handleQuery() {
|
function handleQuery() {
|
||||||
loading.value = true;
|
loading.value = true;
|
||||||
${className}API.getPage(queryParams)
|
${entityName}API.getPage(queryParams)
|
||||||
.then((data) => {
|
.then((data) => {
|
||||||
${className.toLowerCase()}List.value = data.list;
|
pageData.value = data.list;
|
||||||
total.value = data.total;
|
total.value = data.total;
|
||||||
})
|
})
|
||||||
.finally(() => {
|
.finally(() => {
|
||||||
loading.value = false;
|
loading.value = false;
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
/** 重置$!{businessName}查询 */
|
||||||
/** 重置查询 */
|
|
||||||
function handleResetQuery() {
|
function handleResetQuery() {
|
||||||
queryFormRef.value.resetFields();
|
queryFormRef.value.resetFields();
|
||||||
queryParams.pageNum = 1;
|
queryParams.pageNum = 1;
|
||||||
@@ -175,4 +193,86 @@
|
|||||||
|
|
||||||
/** 行复选框选中记录选中ID集合 */
|
/** 行复选框选中记录选中ID集合 */
|
||||||
function handleSelectionChange(selection: any) {
|
function handleSelectionChange(selection: any) {
|
||||||
ids.value = selection.map((item: any
|
ids.value = selection.map((item: any) => item.id);
|
||||||
|
}
|
||||||
|
|
||||||
|
/** 打开$!{businessName}弹窗 */
|
||||||
|
function handleOpenDialog(id?: number) {
|
||||||
|
dialog.visible = true;
|
||||||
|
if (id) {
|
||||||
|
dialog.title = "修改$!{businessName}";
|
||||||
|
${entityName}API.getFormData(id).then((data) => {
|
||||||
|
Object.assign(formData, data);
|
||||||
|
});
|
||||||
|
} else {
|
||||||
|
dialog.title = "新增$!{businessName}";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/** 提交$!{businessName}表单 */
|
||||||
|
function handleSubmit() {
|
||||||
|
dataFormRef.value.validate((valid: any) => {
|
||||||
|
if (valid) {
|
||||||
|
loading.value = true;
|
||||||
|
const id = formData.id;
|
||||||
|
if (id) {
|
||||||
|
${entityName}API.update(id, formData)
|
||||||
|
.then(() => {
|
||||||
|
ElMessage.success("修改成功");
|
||||||
|
handleCloseDialog();
|
||||||
|
handleResetQuery();
|
||||||
|
})
|
||||||
|
.finally(() => (loading.value = false));
|
||||||
|
} else {
|
||||||
|
${entityName}API.add(formData)
|
||||||
|
.then(() => {
|
||||||
|
ElMessage.success("新增成功");
|
||||||
|
handleCloseDialog();
|
||||||
|
handleResetQuery();
|
||||||
|
})
|
||||||
|
.finally(() => (loading.value = false));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
/** 关闭$!{businessName}弹窗 */
|
||||||
|
function handleCloseDialog() {
|
||||||
|
dialog.visible = false;
|
||||||
|
dataFormRef.value.resetFields();
|
||||||
|
dataFormRef.value.clearValidate();
|
||||||
|
formData.id = undefined;
|
||||||
|
}
|
||||||
|
|
||||||
|
/** 删除$!{businessName} */
|
||||||
|
function handleDelete(id?: number) {
|
||||||
|
const ids = [id || ids.value].join(",");
|
||||||
|
if (!ids) {
|
||||||
|
ElMessage.warning("请勾选删除项");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
ElMessageBox.confirm("确认删除已选中的数据项?", "警告", {
|
||||||
|
confirmButtonText: "确定",
|
||||||
|
cancelButtonText: "取消",
|
||||||
|
type: "warning",
|
||||||
|
}).then(
|
||||||
|
() => {
|
||||||
|
loading.value = true;
|
||||||
|
${entityName}API.deleteByIds(ids)
|
||||||
|
.then(() => {
|
||||||
|
ElMessage.success("删除成功");
|
||||||
|
handleResetQuery();
|
||||||
|
})
|
||||||
|
.finally(() => (loading.value = false));
|
||||||
|
},
|
||||||
|
() => {
|
||||||
|
ElMessage.info("已取消删除");
|
||||||
|
}
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
onMounted(() => {
|
||||||
|
handleQuery();
|
||||||
|
});
|
||||||
|
</script>
|
||||||
|
|||||||
@@ -7,7 +7,7 @@ import ${package}.model.query.${entityName}Query;
|
|||||||
import org.apache.ibatis.annotations.Mapper;
|
import org.apache.ibatis.annotations.Mapper;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* $!{tableComment}Mapper接口
|
* $!{businessName}Mapper接口
|
||||||
*
|
*
|
||||||
* @author ${author}
|
* @author ${author}
|
||||||
* @since ${date}
|
* @since ${date}
|
||||||
@@ -16,7 +16,7 @@ import org.apache.ibatis.annotations.Mapper;
|
|||||||
public interface ${entityName}Mapper extends BaseMapper<${entityName}> {
|
public interface ${entityName}Mapper extends BaseMapper<${entityName}> {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 获取$!{tableComment}分页数据
|
* 获取${businessName}分页数据
|
||||||
*
|
*
|
||||||
* @param page 分页对象
|
* @param page 分页对象
|
||||||
* @param queryParams 查询参数
|
* @param queryParams 查询参数
|
||||||
|
|||||||
@@ -2,7 +2,7 @@
|
|||||||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||||
<mapper namespace="${package}.mapper.${entityName}Mapper">
|
<mapper namespace="${package}.mapper.${entityName}Mapper">
|
||||||
|
|
||||||
<!-- 获取${tableComment}分页列表 -->
|
<!-- 获取${businessName}分页列表 -->
|
||||||
<select id="get${entityName}Page" resultType="${package}.model.vo.${entityName}VO">
|
<select id="get${entityName}Page" resultType="${package}.model.vo.${entityName}VO">
|
||||||
SELECT
|
SELECT
|
||||||
*
|
*
|
||||||
|
|||||||
@@ -12,12 +12,12 @@ import java.math.BigDecimal;
|
|||||||
#end
|
#end
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* $!{tableComment}分页查询对象
|
* $!{businessName}分页查询对象
|
||||||
*
|
*
|
||||||
* @author ${author}
|
* @author ${author}
|
||||||
* @since ${date}
|
* @since ${date}
|
||||||
*/
|
*/
|
||||||
@Schema(description ="$!{tableComment}分页查询对象")
|
@Schema(description ="$!{businessName}查询对象")
|
||||||
@Getter
|
@Getter
|
||||||
@Setter
|
@Setter
|
||||||
public class ${entityName}Query extends BasePageQuery {
|
public class ${entityName}Query extends BasePageQuery {
|
||||||
@@ -25,9 +25,9 @@ public class ${entityName}Query extends BasePageQuery {
|
|||||||
private static final long serialVersionUID = 1L;
|
private static final long serialVersionUID = 1L;
|
||||||
#if($fieldConfigs)
|
#if($fieldConfigs)
|
||||||
#foreach($fieldConfig in ${fieldConfigs})
|
#foreach($fieldConfig in ${fieldConfigs})
|
||||||
#if($fieldConfig.showInQuery)
|
#if($fieldConfig.isShowInQuery)
|
||||||
#if("$!fieldConfig.fieldComment" != "")
|
#if("$!fieldConfig.fieldComment" != "")
|
||||||
@Schema(description = "${field.fieldComment}")
|
@Schema(description = "${fieldConfig.fieldComment}")
|
||||||
#end
|
#end
|
||||||
private ${fieldConfig.fieldType} ${fieldConfig.fieldName};
|
private ${fieldConfig.fieldType} ${fieldConfig.fieldName};
|
||||||
#end
|
#end
|
||||||
|
|||||||
@@ -8,7 +8,7 @@ import com.baomidou.mybatisplus.core.metadata.IPage;
|
|||||||
import com.baomidou.mybatisplus.extension.service.IService;
|
import com.baomidou.mybatisplus.extension.service.IService;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* $!{tableComment}服务类
|
* $!{businessName}服务类
|
||||||
*
|
*
|
||||||
* @author ${author}
|
* @author ${author}
|
||||||
* @since ${date}
|
* @since ${date}
|
||||||
@@ -16,41 +16,41 @@ import com.baomidou.mybatisplus.extension.service.IService;
|
|||||||
public interface ${entityName}Service extends IService<${entityName}> {
|
public interface ${entityName}Service extends IService<${entityName}> {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*$!{tableComment}分页列表
|
*$!{businessName}分页列表
|
||||||
*
|
*
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
IPage<${entityName}VO> get${entityName}Page(${entityName}Query queryParams);
|
IPage<${entityName}VO> get${entityName}Page(${entityName}Query queryParams);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 获取$!{tableComment}表单数据
|
* 获取${businessName}表单数据
|
||||||
*
|
*
|
||||||
* @param id $!{tableComment}ID
|
* @param id $!{businessName}ID
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
${entityName}Form get${entityName}FormData(Long id);
|
${entityName}Form get${entityName}FormData(Long id);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 新增$!{tableComment}
|
* 新增${businessName}
|
||||||
*
|
*
|
||||||
* @param formData $!{tableComment}表单对象
|
* @param formData $!{businessName}表单对象
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
boolean save${entityName}(${entityName}Form formData);
|
boolean save${entityName}(${entityName}Form formData);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 修改$!{tableComment}
|
* 修改${businessName}
|
||||||
*
|
*
|
||||||
* @param id $!{tableComment}ID
|
* @param id $!{businessName}ID
|
||||||
* @param formData $!{tableComment}表单对象
|
* @param formData $!{businessName}表单对象
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
boolean update${entityName}(Long id, ${entityName}Form formData);
|
boolean update${entityName}(Long id, ${entityName}Form formData);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 删除$!{tableComment}
|
* 删除${businessName}
|
||||||
*
|
*
|
||||||
* @param ids $!{tableComment}ID,多个以英文逗号(,)分割
|
* @param ids $!{businessName}ID,多个以英文逗号(,)分割
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
boolean delete${entityName}s(String ids);
|
boolean delete${entityName}s(String ids);
|
||||||
|
|||||||
@@ -21,7 +21,7 @@ import cn.hutool.core.lang.Assert;
|
|||||||
import cn.hutool.core.util.StrUtil;
|
import cn.hutool.core.util.StrUtil;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* $!{tableComment}服务实现类
|
* $!{businessName}服务实现类
|
||||||
*
|
*
|
||||||
* @author ${author}
|
* @author ${author}
|
||||||
* @since ${date}
|
* @since ${date}
|
||||||
@@ -33,10 +33,10 @@ public class ${entityName}ServiceImpl extends ServiceImpl<${entityName}Mapper, $
|
|||||||
private final ${entityName}Converter ${lowerFirstEntityName}Converter;
|
private final ${entityName}Converter ${lowerFirstEntityName}Converter;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 获取$!{tableComment}分页列表
|
* 获取${businessName}分页列表
|
||||||
*
|
*
|
||||||
* @param queryParams 查询参数
|
* @param queryParams 查询参数
|
||||||
* @return {@link IPage<${entityName}PageVO>} $!{tableComment}分页列表
|
* @return {@link IPage<${entityName}PageVO>} $!{businessName}分页列表
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public IPage<${entityName}VO> get${entityName}Page(${entityName}Query queryParams) {
|
public IPage<${entityName}VO> get${entityName}Page(${entityName}Query queryParams) {
|
||||||
@@ -48,9 +48,9 @@ public class ${entityName}ServiceImpl extends ServiceImpl<${entityName}Mapper, $
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 获取$!{tableComment}表单数据
|
* 获取${businessName}表单数据
|
||||||
*
|
*
|
||||||
* @param id $!{tableComment}ID
|
* @param id $!{businessName}ID
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
@@ -60,9 +60,9 @@ public class ${entityName}ServiceImpl extends ServiceImpl<${entityName}Mapper, $
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 新增$!{tableComment}
|
* 新增${businessName}
|
||||||
*
|
*
|
||||||
* @param formData $!{tableComment}表单对象
|
* @param formData $!{businessName}表单对象
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
@@ -72,10 +72,10 @@ public class ${entityName}ServiceImpl extends ServiceImpl<${entityName}Mapper, $
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 更新$!{tableComment}
|
* 更新${businessName}
|
||||||
*
|
*
|
||||||
* @param id $!{tableComment}ID
|
* @param id $!{businessName}ID
|
||||||
* @param formData $!{tableComment}表单对象
|
* @param formData $!{businessName}表单对象
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
@@ -85,14 +85,14 @@ public class ${entityName}ServiceImpl extends ServiceImpl<${entityName}Mapper, $
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 删除$!{tableComment}
|
* 删除${businessName}
|
||||||
*
|
*
|
||||||
* @param ids $!{tableComment}ID,多个以英文逗号(,)分割
|
* @param ids $!{businessName}ID,多个以英文逗号(,)分割
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public boolean delete${entityName}s(String ids) {
|
public boolean delete${entityName}s(String ids) {
|
||||||
Assert.isTrue(StrUtil.isNotBlank(ids), "删除的$!{tableComment}数据为空");
|
Assert.isTrue(StrUtil.isNotBlank(ids), "删除的${businessName}数据为空");
|
||||||
// 逻辑删除
|
// 逻辑删除
|
||||||
List<Long> idList = Arrays.stream(ids.split(","))
|
List<Long> idList = Arrays.stream(ids.split(","))
|
||||||
.map(Long::parseLong)
|
.map(Long::parseLong)
|
||||||
|
|||||||
@@ -14,14 +14,14 @@ import java.math.BigDecimal;
|
|||||||
#end
|
#end
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* $!{tableComment}视图对象
|
* $!{businessName}视图对象
|
||||||
*
|
*
|
||||||
* @author ${author}
|
* @author ${author}
|
||||||
* @since ${date}
|
* @since ${date}
|
||||||
*/
|
*/
|
||||||
@Getter
|
@Getter
|
||||||
@Setter
|
@Setter
|
||||||
@Schema( description = "$!{tableComment}视图对象")
|
@Schema( description = "$!{businessName}视图对象")
|
||||||
public class ${entityName}VO implements Serializable {
|
public class ${entityName}VO implements Serializable {
|
||||||
|
|
||||||
@Serial
|
@Serial
|
||||||
@@ -29,10 +29,12 @@ public class ${entityName}VO implements Serializable {
|
|||||||
|
|
||||||
#if($fieldConfigs)
|
#if($fieldConfigs)
|
||||||
#foreach($fieldConfig in ${fieldConfigs})
|
#foreach($fieldConfig in ${fieldConfigs})
|
||||||
#if("$!fieldConfig.fieldComment" != "")
|
#if($fieldConfig.isShowInList)
|
||||||
|
#if("$!fieldConfig.fieldComment" != "")
|
||||||
@Schema(description = "${fieldConfig.fieldComment}")
|
@Schema(description = "${fieldConfig.fieldComment}")
|
||||||
#end
|
#end
|
||||||
private ${fieldConfig.fieldType} ${fieldConfig.fieldName};
|
private ${fieldConfig.fieldType} ${fieldConfig.fieldName};
|
||||||
|
#end
|
||||||
#end
|
#end
|
||||||
#end
|
#end
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user