diff --git a/pom.xml b/pom.xml
index 0f26eb5fc..dd9fbe7d0 100644
--- a/pom.xml
+++ b/pom.xml
@@ -37,7 +37,6 @@
-
3.0.2
@@ -169,6 +168,13 @@
${spring-boot-admin.version}
+
+
+ org.springframework.boot
+ spring-boot-starter-test
+ test
+
+
org.projectlombok
diff --git a/ruoyi-common/src/main/java/com/ruoyi/common/constant/GenConstants.java b/ruoyi-common/src/main/java/com/ruoyi/common/constant/GenConstants.java
index 7284290ab..78afc5c9e 100644
--- a/ruoyi-common/src/main/java/com/ruoyi/common/constant/GenConstants.java
+++ b/ruoyi-common/src/main/java/com/ruoyi/common/constant/GenConstants.java
@@ -5,105 +5,158 @@ package com.ruoyi.common.constant;
*
* @author ruoyi
*/
-public class GenConstants
-{
- /** 单表(增删改查) */
- public static final String TPL_CRUD = "crud";
+public class GenConstants {
- /** 树表(增删改查) */
- public static final String TPL_TREE = "tree";
-
-
- /** 树编码字段 */
+ /**
+ * 树编码字段
+ */
public static final String TREE_CODE = "treeCode";
- /** 树父编码字段 */
+ /**
+ * 树父编码字段
+ */
public static final String TREE_PARENT_CODE = "treeParentCode";
- /** 树名称字段 */
+ /**
+ * 树名称字段
+ */
public static final String TREE_NAME = "treeName";
- /** 上级菜单ID字段 */
+ /**
+ * 上级菜单ID字段
+ */
public static final String PARENT_MENU_ID = "parentMenuId";
- /** 上级菜单名称字段 */
+ /**
+ * 上级菜单名称字段
+ */
public static final String PARENT_MENU_NAME = "parentMenuName";
- /** 数据库字符串类型 */
- public static final String[] COLUMNTYPE_STR = { "char", "varchar", "nvarchar", "varchar2" };
+ /**
+ * 数据库字符串类型
+ */
+ public static final String[] COLUMNTYPE_STR = {"char", "varchar", "nvarchar", "varchar2"};
- /** 数据库文本类型 */
- public static final String[] COLUMNTYPE_TEXT = { "tinytext", "text", "mediumtext", "longtext" };
+ /**
+ * 数据库文本类型
+ */
+ public static final String[] COLUMNTYPE_TEXT = {"tinytext", "text", "mediumtext", "longtext"};
- /** 数据库时间类型 */
- public static final String[] COLUMNTYPE_TIME = { "datetime", "time", "date", "timestamp" };
+ /**
+ * 数据库时间类型
+ */
+ public static final String[] COLUMNTYPE_TIME = {"datetime", "time", "date", "timestamp"};
- /** 数据库数字类型 */
- public static final String[] COLUMNTYPE_NUMBER = { "tinyint", "smallint", "mediumint", "int", "number", "integer",
- "bit", "bigint", "float", "double", "decimal" };
+ /**
+ * 数据库数字类型
+ */
+ public static final String[] COLUMNTYPE_NUMBER = {"tinyint", "smallint", "mediumint", "int", "number", "integer",
+ "bit", "bigint", "float", "double", "decimal"};
- /** 页面不需要编辑字段 */
- public static final String[] COLUMNNAME_NOT_EDIT = { "id", "create_by", "create_time", "del_flag" };
+ /**
+ * 页面不需要编辑字段
+ */
+ public static final String[] COLUMNNAME_NOT_EDIT = {"id", "create_by", "create_time", "del_flag"};
- /** 页面不需要显示的列表字段 */
- public static final String[] COLUMNNAME_NOT_LIST = { "id", "create_by", "create_time", "del_flag", "update_by",
- "update_time" };
+ /**
+ * 页面不需要显示的列表字段
+ */
+ public static final String[] COLUMNNAME_NOT_LIST = {"id", "create_by", "create_time", "del_flag", "update_by",
+ "update_time"};
- /** 页面不需要查询字段 */
- public static final String[] COLUMNNAME_NOT_QUERY = { "id", "create_by", "create_time", "del_flag", "update_by",
- "update_time", "remark" };
+ /**
+ * 页面不需要查询字段
+ */
+ public static final String[] COLUMNNAME_NOT_QUERY = {"id", "create_by", "create_time", "del_flag", "update_by",
+ "update_time", "remark"};
- /** Entity基类字段 */
- public static final String[] BASE_ENTITY = { "createBy", "createTime", "updateBy", "updateTime", "remark" };
+ /**
+ * Entity基类字段
+ */
+ public static final String[] BASE_ENTITY = {"createBy", "createTime", "updateBy", "updateTime", "remark"};
- /** Tree基类字段 */
- public static final String[] TREE_ENTITY = { "parentName", "parentId", "orderNum", "ancestors", "children" };
+ /**
+ * Tree基类字段
+ */
+ public static final String[] TREE_ENTITY = {"parentName", "parentId", "orderNum", "ancestors", "children"};
- /** 文本框 */
+ /**
+ * 文本框
+ */
public static final String HTML_INPUT = "input";
- /** 文本域 */
+ /**
+ * 文本域
+ */
public static final String HTML_TEXTAREA = "textarea";
- /** 下拉框 */
+ /**
+ * 下拉框
+ */
public static final String HTML_SELECT = "select";
- /** 单选框 */
+ /**
+ * 单选框
+ */
public static final String HTML_RADIO = "radio";
- /** 复选框 */
+ /**
+ * 复选框
+ */
public static final String HTML_CHECKBOX = "checkbox";
- /** 日期控件 */
+ /**
+ * 日期控件
+ */
public static final String HTML_DATETIME = "datetime";
- /** 上传控件 */
+ /**
+ * 上传控件
+ */
public static final String HTML_UPLOAD_IMAGE = "uploadImage";
- /** 富文本控件 */
+ /**
+ * 富文本控件
+ */
public static final String HTML_EDITOR = "editor";
- /** 字符串类型 */
+ /**
+ * 字符串类型
+ */
public static final String TYPE_STRING = "String";
- /** 整型 */
+ /**
+ * 整型
+ */
public static final String TYPE_INTEGER = "Integer";
- /** 长整型 */
+ /**
+ * 长整型
+ */
public static final String TYPE_LONG = "Long";
- /** 浮点型 */
+ /**
+ * 浮点型
+ */
public static final String TYPE_DOUBLE = "Double";
- /** 高精度计算类型 */
+ /**
+ * 高精度计算类型
+ */
public static final String TYPE_BIGDECIMAL = "BigDecimal";
- /** 时间类型 */
+ /**
+ * 时间类型
+ */
public static final String TYPE_DATE = "Date";
- /** 模糊查询 */
+ /**
+ * 模糊查询
+ */
public static final String QUERY_LIKE = "LIKE";
- /** 需要 */
+ /**
+ * 需要
+ */
public static final String REQUIRE = "1";
}
diff --git a/ruoyi-generator/src/main/java/com/ruoyi/generator/domain/GenTable.java b/ruoyi-generator/src/main/java/com/ruoyi/generator/domain/GenTable.java
index 8872de3df..9344aa151 100644
--- a/ruoyi-generator/src/main/java/com/ruoyi/generator/domain/GenTable.java
+++ b/ruoyi-generator/src/main/java/com/ruoyi/generator/domain/GenTable.java
@@ -3,6 +3,7 @@ package com.ruoyi.generator.domain;
import java.util.List;
import javax.validation.Valid;
import javax.validation.constraints.NotBlank;
+
import org.apache.commons.lang3.ArrayUtils;
import com.ruoyi.common.constant.GenConstants;
import com.ruoyi.common.core.domain.BaseEntity;
@@ -13,108 +14,87 @@ import com.ruoyi.common.utils.StringUtils;
*
* @author ruoyi
*/
-public class GenTable extends BaseEntity
-{
- private static final long serialVersionUID = 1L;
+public class GenTable extends BaseEntity {
- /** 编号 */
- private Long tableId;
-
- /** 表名称 */
- @NotBlank(message = "表名称不能为空")
- private String tableName;
-
- /** 表描述 */
- @NotBlank(message = "表描述不能为空")
- private String tableComment;
-
- /** 实体类名称(首字母大写) */
- @NotBlank(message = "实体类名称不能为空")
- private String className;
-
- /** 使用的模板(crud单表操作 tree树表操作) */
- private String tplCategory;
-
- /** 生成包路径 */
+ /**
+ * 生成包路径
+ */
@NotBlank(message = "生成包路径不能为空")
private String packageName;
- /** 生成模块名 */
- @NotBlank(message = "生成模块名不能为空")
- private String moduleName;
-
- /** 生成业务名 */
- @NotBlank(message = "生成业务名不能为空")
- private String businessName;
-
- /** 生成功能名 */
- @NotBlank(message = "生成功能名不能为空")
- private String functionName;
-
- /** 生成作者 */
- @NotBlank(message = "作者不能为空")
- private String functionAuthor;
-
- /** 生成代码方式(0zip压缩包 1自定义路径) */
+ /**
+ * 生成代码方式(0zip压缩包 1自定义路径)
+ */
private String genType;
- /** 生成路径(不填默认项目路径) */
+ /**
+ * 生成路径(不填默认项目路径)
+ */
private String genPath;
- /** 主键信息 */
+ /**
+ * 主键信息
+ */
private GenTableColumn pkColumn;
- /** 表列信息 */
+ /**
+ * 表列信息
+ */
@Valid
private List columns;
- /** 其它生成选项 */
+ /**
+ * 其它生成选项
+ */
private String options;
- /** 树编码字段 */
+ /**
+ * 树编码字段
+ */
private String treeCode;
- /** 树父编码字段 */
+ /**
+ * 树父编码字段
+ */
private String treeParentCode;
- /** 树名称字段 */
+ /**
+ * 树名称字段
+ */
private String treeName;
- /** 上级菜单ID字段 */
+ /**
+ * 上级菜单ID字段
+ */
private String parentMenuId;
- /** 上级菜单名称字段 */
+ /**
+ * 上级菜单名称字段
+ */
private String parentMenuName;
- public boolean isTree()
- {
+ public boolean isTree() {
return isTree(this.tplCategory);
}
- public static boolean isTree(String tplCategory)
- {
+ public static boolean isTree(String tplCategory) {
return tplCategory != null && StringUtils.equals(GenConstants.TPL_TREE, tplCategory);
}
- public boolean isCrud()
- {
+ public boolean isCrud() {
return isCrud(this.tplCategory);
}
- public static boolean isCrud(String tplCategory)
- {
+ public static boolean isCrud(String tplCategory) {
return tplCategory != null && StringUtils.equals(GenConstants.TPL_CRUD, tplCategory);
}
- public boolean isSuperColumn(String javaField)
- {
+ public boolean isSuperColumn(String javaField) {
return isSuperColumn(this.tplCategory, javaField);
}
- public static boolean isSuperColumn(String tplCategory, String javaField)
- {
- if (isTree(tplCategory))
- {
+ public static boolean isSuperColumn(String tplCategory, String javaField) {
+ if (isTree(tplCategory)) {
return StringUtils.equalsAnyIgnoreCase(javaField,
ArrayUtils.addAll(GenConstants.TREE_ENTITY, GenConstants.BASE_ENTITY));
}
diff --git a/ruoyi-generator/src/main/java/com/ruoyi/generator/domain/GenTableColumn.java b/ruoyi-generator/src/main/java/com/ruoyi/generator/domain/GenTableColumn.java
index 883fa9e01..4209a3859 100644
--- a/ruoyi-generator/src/main/java/com/ruoyi/generator/domain/GenTableColumn.java
+++ b/ruoyi-generator/src/main/java/com/ruoyi/generator/domain/GenTableColumn.java
@@ -6,7 +6,7 @@ import com.ruoyi.common.utils.StringUtils;
/**
* 代码生成业务字段表 gen_table_column
- *
+ *
* @author ruoyi
*/
public class GenTableColumn extends BaseEntity
@@ -68,86 +68,6 @@ public class GenTableColumn extends BaseEntity
/** 排序 */
private Integer sort;
- public void setColumnId(Long columnId)
- {
- this.columnId = columnId;
- }
-
- public Long getColumnId()
- {
- return columnId;
- }
-
- public void setTableId(Long tableId)
- {
- this.tableId = tableId;
- }
-
- public Long getTableId()
- {
- return tableId;
- }
-
- public void setColumnName(String columnName)
- {
- this.columnName = columnName;
- }
-
- public String getColumnName()
- {
- return columnName;
- }
-
- public void setColumnComment(String columnComment)
- {
- this.columnComment = columnComment;
- }
-
- public String getColumnComment()
- {
- return columnComment;
- }
-
- public void setColumnType(String columnType)
- {
- this.columnType = columnType;
- }
-
- public String getColumnType()
- {
- return columnType;
- }
-
- public void setJavaType(String javaType)
- {
- this.javaType = javaType;
- }
-
- public String getJavaType()
- {
- return javaType;
- }
-
- public void setJavaField(String javaField)
- {
- this.javaField = javaField;
- }
-
- public String getJavaField()
- {
- return javaField;
- }
-
- public void setIsPk(String isPk)
- {
- this.isPk = isPk;
- }
-
- public String getIsPk()
- {
- return isPk;
- }
-
public boolean isPk()
{
return isPk(this.isPk);
@@ -278,46 +198,6 @@ public class GenTableColumn extends BaseEntity
return isQuery != null && StringUtils.equals("1", isQuery);
}
- public void setQueryType(String queryType)
- {
- this.queryType = queryType;
- }
-
- public String getQueryType()
- {
- return queryType;
- }
-
- public String getHtmlType()
- {
- return htmlType;
- }
-
- public void setHtmlType(String htmlType)
- {
- this.htmlType = htmlType;
- }
-
- public void setDictType(String dictType)
- {
- this.dictType = dictType;
- }
-
- public String getDictType()
- {
- return dictType;
- }
-
- public void setSort(Integer sort)
- {
- this.sort = sort;
- }
-
- public Integer getSort()
- {
- return sort;
- }
-
public boolean isSuperColumn()
{
return isSuperColumn(this.javaField);
diff --git a/src/main/java/cn/iocoder/dashboard/modules/system/enums/logger/SysLoginLogTypeEnum.java b/src/main/java/cn/iocoder/dashboard/modules/system/enums/logger/SysLoginLogTypeEnum.java
index 9249dd1e7..81a48e72b 100644
--- a/src/main/java/cn/iocoder/dashboard/modules/system/enums/logger/SysLoginLogTypeEnum.java
+++ b/src/main/java/cn/iocoder/dashboard/modules/system/enums/logger/SysLoginLogTypeEnum.java
@@ -10,8 +10,12 @@ import lombok.Getter;
@AllArgsConstructor
public enum SysLoginLogTypeEnum {
- LOGIN(1),
- LOGOUT(2);
+ LOGIN_USERNAME(100), // 使用账号登录
+
+ LOGOUT_SELF(200), // 自己主动登出
+ LOGOUT_TIMEOUT(201), // 超时登出
+ LOGOUT_DELETE(202), // 强制退出
+ ;
/**
* 日志类型
diff --git a/src/main/java/cn/iocoder/dashboard/modules/system/service/auth/impl/SysAuthServiceImpl.java b/src/main/java/cn/iocoder/dashboard/modules/system/service/auth/impl/SysAuthServiceImpl.java
index e86af8c87..ec562af4c 100644
--- a/src/main/java/cn/iocoder/dashboard/modules/system/service/auth/impl/SysAuthServiceImpl.java
+++ b/src/main/java/cn/iocoder/dashboard/modules/system/service/auth/impl/SysAuthServiceImpl.java
@@ -137,7 +137,7 @@ public class SysAuthServiceImpl implements SysAuthService {
private void createLoginLog(String username, SysLoginResultEnum loginResult) {
SysLoginLogCreateReqVO reqVO = new SysLoginLogCreateReqVO();
- reqVO.setLogType(SysLoginLogTypeEnum.LOGIN.getType());
+ reqVO.setLogType(SysLoginLogTypeEnum.LOGIN_USERNAME.getType());
reqVO.setTraceId(TracerUtils.getTraceId());
reqVO.setUsername(username);
reqVO.setUserAgent(ServletUtils.getUserAgent());
diff --git a/src/main/java/cn/iocoder/dashboard/modules/tool/controller/codegen/ToolCodeGenController.java b/src/main/java/cn/iocoder/dashboard/modules/tool/controller/codegen/ToolCodeGenController.java
new file mode 100644
index 000000000..9f142e101
--- /dev/null
+++ b/src/main/java/cn/iocoder/dashboard/modules/tool/controller/codegen/ToolCodeGenController.java
@@ -0,0 +1,21 @@
+package cn.iocoder.dashboard.modules.tool.controller.codegen;
+
+import cn.iocoder.dashboard.common.pojo.CommonResult;
+import cn.iocoder.dashboard.common.pojo.PageResult;
+import cn.iocoder.dashboard.modules.tool.controller.codegen.vo.ToolCodeGenTablePageItemRespVO;
+import org.springframework.web.bind.annotation.GetMapping;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RestController;
+
+import static cn.iocoder.dashboard.common.pojo.CommonResult.success;
+
+@RestController
+@RequestMapping("/tool/code-gen")
+public class ToolCodeGenController {
+
+ @GetMapping("/table/page")
+ public CommonResult> getCodeGenTablePage() {
+ return success(null);
+ }
+
+}
diff --git a/src/main/java/cn/iocoder/dashboard/modules/tool/controller/codegen/vo/ToolCodeGenTableBaseRespVO.java b/src/main/java/cn/iocoder/dashboard/modules/tool/controller/codegen/vo/ToolCodeGenTableBaseRespVO.java
new file mode 100644
index 000000000..91b80df94
--- /dev/null
+++ b/src/main/java/cn/iocoder/dashboard/modules/tool/controller/codegen/vo/ToolCodeGenTableBaseRespVO.java
@@ -0,0 +1,4 @@
+package cn.iocoder.dashboard.modules.tool.controller.codegen.vo;
+
+public class ToolCodeGenTableBaseRespVO {
+}
diff --git a/src/main/java/cn/iocoder/dashboard/modules/tool/controller/codegen/vo/ToolCodeGenTablePageItemRespVO.java b/src/main/java/cn/iocoder/dashboard/modules/tool/controller/codegen/vo/ToolCodeGenTablePageItemRespVO.java
new file mode 100644
index 000000000..d176291ca
--- /dev/null
+++ b/src/main/java/cn/iocoder/dashboard/modules/tool/controller/codegen/vo/ToolCodeGenTablePageItemRespVO.java
@@ -0,0 +1,7 @@
+package cn.iocoder.dashboard.modules.tool.controller.codegen.vo;
+
+public class ToolCodeGenTablePageItemRespVO extends ToolCodeGenTableBaseRespVO {
+
+
+
+}
diff --git a/src/main/java/cn/iocoder/dashboard/modules/tool/controller/codegen/vo/package-info.java b/src/main/java/cn/iocoder/dashboard/modules/tool/controller/codegen/vo/package-info.java
new file mode 100644
index 000000000..a2a9340c6
--- /dev/null
+++ b/src/main/java/cn/iocoder/dashboard/modules/tool/controller/codegen/vo/package-info.java
@@ -0,0 +1 @@
+package cn.iocoder.dashboard.modules.tool.controller.codegen.vo;
diff --git a/src/main/java/cn/iocoder/dashboard/modules/tool/controller/package-info.java b/src/main/java/cn/iocoder/dashboard/modules/tool/controller/package-info.java
new file mode 100644
index 000000000..631d5fd44
--- /dev/null
+++ b/src/main/java/cn/iocoder/dashboard/modules/tool/controller/package-info.java
@@ -0,0 +1 @@
+package cn.iocoder.dashboard.modules.tool.controller;
diff --git a/src/main/java/cn/iocoder/dashboard/modules/tool/dal/mysql/dao/coegen/ToolInformationSchemaColumnMapper.java b/src/main/java/cn/iocoder/dashboard/modules/tool/dal/mysql/dao/coegen/ToolInformationSchemaColumnMapper.java
new file mode 100644
index 000000000..4a257697b
--- /dev/null
+++ b/src/main/java/cn/iocoder/dashboard/modules/tool/dal/mysql/dao/coegen/ToolInformationSchemaColumnMapper.java
@@ -0,0 +1,18 @@
+package cn.iocoder.dashboard.modules.tool.dal.mysql.dao.coegen;
+
+import cn.iocoder.dashboard.framework.mybatis.core.mapper.BaseMapperX;
+import cn.iocoder.dashboard.modules.tool.dal.mysql.dataobject.codegen.ToolInformationSchemaColumnDO;
+import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
+import org.apache.ibatis.annotations.Mapper;
+
+import java.util.List;
+
+@Mapper
+public interface ToolInformationSchemaColumnMapper extends BaseMapperX {
+
+ default List selectListByTableName(String tableName) {
+ return selectList(new QueryWrapper().eq("table_name", tableName)
+ .orderByAsc("ordinal_position"));
+ }
+
+}
diff --git a/src/main/java/cn/iocoder/dashboard/modules/tool/dal/mysql/dao/coegen/ToolInformationSchemaTableMapper.java b/src/main/java/cn/iocoder/dashboard/modules/tool/dal/mysql/dao/coegen/ToolInformationSchemaTableMapper.java
new file mode 100644
index 000000000..05fe395d8
--- /dev/null
+++ b/src/main/java/cn/iocoder/dashboard/modules/tool/dal/mysql/dao/coegen/ToolInformationSchemaTableMapper.java
@@ -0,0 +1,17 @@
+package cn.iocoder.dashboard.modules.tool.dal.mysql.dao.coegen;
+
+import cn.iocoder.dashboard.framework.mybatis.core.mapper.BaseMapperX;
+import cn.iocoder.dashboard.modules.tool.dal.mysql.dataobject.codegen.ToolInformationSchemaTableDO;
+import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
+import org.apache.ibatis.annotations.Mapper;
+
+import java.util.List;
+
+@Mapper
+public interface ToolInformationSchemaTableMapper extends BaseMapperX {
+
+ default List selectListByTableSchema(String tableSchema) {
+ return selectList(new QueryWrapper().eq("table_schema", tableSchema));
+ }
+
+}
diff --git a/src/main/java/cn/iocoder/dashboard/modules/tool/dal/mysql/dao/package-info.java b/src/main/java/cn/iocoder/dashboard/modules/tool/dal/mysql/dao/package-info.java
new file mode 100644
index 000000000..362f8a3b5
--- /dev/null
+++ b/src/main/java/cn/iocoder/dashboard/modules/tool/dal/mysql/dao/package-info.java
@@ -0,0 +1 @@
+package cn.iocoder.dashboard.modules.tool.dal.mysql.dao;
diff --git a/src/main/java/cn/iocoder/dashboard/modules/tool/dal/mysql/dataobject/codegen/ToolCodegenColumnDO.java b/src/main/java/cn/iocoder/dashboard/modules/tool/dal/mysql/dataobject/codegen/ToolCodegenColumnDO.java
new file mode 100644
index 000000000..c9100460b
--- /dev/null
+++ b/src/main/java/cn/iocoder/dashboard/modules/tool/dal/mysql/dataobject/codegen/ToolCodegenColumnDO.java
@@ -0,0 +1,22 @@
+package cn.iocoder.dashboard.modules.tool.dal.mysql.dataobject.codegen;
+
+import cn.iocoder.dashboard.framework.mybatis.core.dataobject.BaseDO;
+import com.baomidou.mybatisplus.annotation.TableName;
+import lombok.Builder;
+import lombok.Data;
+import lombok.EqualsAndHashCode;
+
+/**
+ * 代码生成 column 字段定义
+ *
+ * @author 芋道源码
+ */
+@TableName(value = "tool_codegen_table_column", autoResultMap = true)
+@Data
+@Builder
+@EqualsAndHashCode(callSuper = true)
+public class ToolCodegenColumnDO extends BaseDO {
+
+
+
+}
diff --git a/src/main/java/cn/iocoder/dashboard/modules/tool/dal/mysql/dataobject/codegen/ToolCodegenTableDO.java b/src/main/java/cn/iocoder/dashboard/modules/tool/dal/mysql/dataobject/codegen/ToolCodegenTableDO.java
new file mode 100644
index 000000000..518528f92
--- /dev/null
+++ b/src/main/java/cn/iocoder/dashboard/modules/tool/dal/mysql/dataobject/codegen/ToolCodegenTableDO.java
@@ -0,0 +1,87 @@
+package cn.iocoder.dashboard.modules.tool.dal.mysql.dataobject.codegen;
+
+import cn.iocoder.dashboard.framework.mybatis.core.dataobject.BaseDO;
+import cn.iocoder.dashboard.modules.tool.enums.codegen.ToolCodeGenTemplateTypeEnum;
+import com.baomidou.mybatisplus.annotation.TableName;
+import lombok.Builder;
+import lombok.Data;
+import lombok.EqualsAndHashCode;
+
+/**
+ * 代码生成 table 表定义
+ *
+ * @author 芋道源码
+ */
+@TableName(value = "tool_codegen_table", autoResultMap = true)
+@Data
+@Builder
+@EqualsAndHashCode(callSuper = true)
+public class ToolCodegenTableDO extends BaseDO {
+
+ // ========== 表相关字段 ==========
+
+ /**
+ * ID 编号
+ */
+ private Long id;
+ /**
+ * 表名称
+ */
+// @NotBlank(message = "表名称不能为空")
+ private String tableName;
+ /**
+ * 表描述
+ */
+// @NotBlank(message = "表描述不能为空")
+ private String tableComment;
+ /**
+ * 备注
+ */
+ private String remark;
+
+ // ========== 类相关字段 ==========
+
+ /**
+ * 模块名,即一级目录
+ *
+ * 例如说,infra、system、tool 等等
+ */
+// @NotBlank(message = "模块名不能为空")
+ private String moduleName;
+ /**
+ * 业务名,即二级目录
+ *
+ * 例如说,user、permission、dict 等等
+ */
+// @NotBlank(message = "生成业务名不能为空")
+ private String businessName;
+ /**
+ * 类名称(首字母大写)
+ *
+ * 例如说,SysUser、SysMenu、SysDictData 等等
+ */
+// @NotBlank(message = "实体类名称不能为空")
+ private String className;
+ /**
+ * 类描述
+ */
+// @NotBlank(message = "生成功能名不能为空")
+ private String classComment;
+ /**
+ * 作者
+ */
+// @NotBlank(message = "作者不能为空")
+ private String author;
+
+ // ========== 生成相关字段 ==========
+
+ /**
+ * 模板类型
+ *
+ * 枚举 {@link ToolCodeGenTemplateTypeEnum}
+ */
+ private Integer templateType;
+
+ // ========== 菜单相关字段 ==========
+
+}
diff --git a/src/main/java/cn/iocoder/dashboard/modules/tool/dal/mysql/dataobject/codegen/ToolInformationSchemaColumnDO.java b/src/main/java/cn/iocoder/dashboard/modules/tool/dal/mysql/dataobject/codegen/ToolInformationSchemaColumnDO.java
new file mode 100644
index 000000000..2cbf10219
--- /dev/null
+++ b/src/main/java/cn/iocoder/dashboard/modules/tool/dal/mysql/dataobject/codegen/ToolInformationSchemaColumnDO.java
@@ -0,0 +1,45 @@
+package cn.iocoder.dashboard.modules.tool.dal.mysql.dataobject.codegen;
+
+import com.baomidou.mybatisplus.annotation.TableField;
+import com.baomidou.mybatisplus.annotation.TableName;
+import lombok.Builder;
+import lombok.Data;
+
+/**
+ * MySQL 数据库中的 column 字段定义
+ *
+ * @author 芋道源码
+ */
+@TableName(value = "information_schema.columns", autoResultMap = true)
+@Data
+@Builder
+public class ToolInformationSchemaColumnDO {
+
+ /**
+ * 表名称
+ */
+ private String tableName;
+ /**
+ * 字段名
+ */
+ private String columnName;
+ /**
+ * 字段类型
+ */
+ private String columnType;
+ /**
+ * 是否允许为空
+ */
+ @TableField("case when is_nullable = 'yes' then '1' else '0' end")
+ private Boolean nullable;
+ /**
+ * 是否主键
+ */
+ @TableField("case when column_key = 'PRI' then '1' else '0' end")
+ private Boolean primaryKey;
+ /**
+ * 排序字段
+ */
+ private Integer ordinalPosition;
+
+}
diff --git a/src/main/java/cn/iocoder/dashboard/modules/tool/dal/mysql/dataobject/codegen/ToolInformationSchemaTableDO.java b/src/main/java/cn/iocoder/dashboard/modules/tool/dal/mysql/dataobject/codegen/ToolInformationSchemaTableDO.java
new file mode 100644
index 000000000..5e67f9e30
--- /dev/null
+++ b/src/main/java/cn/iocoder/dashboard/modules/tool/dal/mysql/dataobject/codegen/ToolInformationSchemaTableDO.java
@@ -0,0 +1,36 @@
+package cn.iocoder.dashboard.modules.tool.dal.mysql.dataobject.codegen;
+
+import com.baomidou.mybatisplus.annotation.TableName;
+import lombok.Builder;
+import lombok.Data;
+
+import java.util.Date;
+
+/**
+ * MySQL 数据库中的 table 表定义
+ *
+ * @author 芋道源码
+ */
+@TableName(value = "information_schema.tables", autoResultMap = true)
+@Data
+@Builder
+public class ToolInformationSchemaTableDO {
+
+ /**
+ * 数据库
+ */
+ private String tableSchema;
+ /**
+ * 表名称
+ */
+ private String tableName;
+ /**
+ * 表描述
+ */
+ private String tableComment;
+ /**
+ * 创建时间
+ */
+ private Date createTime;
+
+}
diff --git a/src/main/java/cn/iocoder/dashboard/modules/tool/dal/mysql/dataobject/package-info.java b/src/main/java/cn/iocoder/dashboard/modules/tool/dal/mysql/dataobject/package-info.java
new file mode 100644
index 000000000..32458ba0c
--- /dev/null
+++ b/src/main/java/cn/iocoder/dashboard/modules/tool/dal/mysql/dataobject/package-info.java
@@ -0,0 +1 @@
+package cn.iocoder.dashboard.modules.tool.dal.mysql.dataobject;
diff --git a/src/main/java/cn/iocoder/dashboard/modules/tool/enums/codegen/ToolCodeGenTemplateTypeEnum.java b/src/main/java/cn/iocoder/dashboard/modules/tool/enums/codegen/ToolCodeGenTemplateTypeEnum.java
new file mode 100644
index 000000000..7939b84e8
--- /dev/null
+++ b/src/main/java/cn/iocoder/dashboard/modules/tool/enums/codegen/ToolCodeGenTemplateTypeEnum.java
@@ -0,0 +1,25 @@
+package cn.iocoder.dashboard.modules.tool.enums.codegen;
+
+import lombok.AllArgsConstructor;
+import lombok.Getter;
+
+/**
+ * 代码生成模板类型
+ *
+ * @author 芋道源码
+ */
+@AllArgsConstructor
+@Getter
+public enum ToolCodeGenTemplateTypeEnum {
+
+ CRUD(1), // 基础 CRUD
+ TREE(2), // 树形 CRUD
+ SUB(3) // 子表 CRUD
+ ;
+
+ /**
+ * 类型
+ */
+ private final Integer type;
+
+}
diff --git a/src/main/java/cn/iocoder/dashboard/modules/tool/enums/package-info.java b/src/main/java/cn/iocoder/dashboard/modules/tool/enums/package-info.java
new file mode 100644
index 000000000..f76f926d5
--- /dev/null
+++ b/src/main/java/cn/iocoder/dashboard/modules/tool/enums/package-info.java
@@ -0,0 +1 @@
+package cn.iocoder.dashboard.modules.tool.enums;
diff --git a/src/main/java/cn/iocoder/dashboard/modules/tool/package-info.java b/src/main/java/cn/iocoder/dashboard/modules/tool/package-info.java
new file mode 100644
index 000000000..d161f55db
--- /dev/null
+++ b/src/main/java/cn/iocoder/dashboard/modules/tool/package-info.java
@@ -0,0 +1,7 @@
+/**
+ * tool 包下,我们放研发工具,提升研发效率与质量。
+ * 例如说:代码生成器、接口文档等等
+ *
+ * 缩写:tool
+ */
+package cn.iocoder.dashboard.modules.tool;
diff --git a/src/test/java/cn/iocoder/dashboard/TestApplication.java b/src/test/java/cn/iocoder/dashboard/TestApplication.java
new file mode 100644
index 000000000..96af4814a
--- /dev/null
+++ b/src/test/java/cn/iocoder/dashboard/TestApplication.java
@@ -0,0 +1,7 @@
+package cn.iocoder.dashboard;
+
+import org.springframework.boot.autoconfigure.SpringBootApplication;
+
+@SpringBootApplication
+public class TestApplication {
+}
diff --git a/src/test/java/cn/iocoder/dashboard/modules/tool/dal/mysql/dao/coegen/ToolInformationSchemaColumnMapperTest.java b/src/test/java/cn/iocoder/dashboard/modules/tool/dal/mysql/dao/coegen/ToolInformationSchemaColumnMapperTest.java
new file mode 100644
index 000000000..382a55b86
--- /dev/null
+++ b/src/test/java/cn/iocoder/dashboard/modules/tool/dal/mysql/dao/coegen/ToolInformationSchemaColumnMapperTest.java
@@ -0,0 +1,27 @@
+package cn.iocoder.dashboard.modules.tool.dal.mysql.dao.coegen;
+
+import cn.iocoder.dashboard.TestApplication;
+import cn.iocoder.dashboard.modules.tool.dal.mysql.dataobject.codegen.ToolInformationSchemaColumnDO;
+import org.junit.jupiter.api.Test;
+import org.springframework.boot.test.context.SpringBootTest;
+
+import javax.annotation.Resource;
+import java.util.List;
+
+import static org.junit.jupiter.api.Assertions.assertTrue;
+
+
+@SpringBootTest(classes = TestApplication.class, webEnvironment = SpringBootTest.WebEnvironment.RANDOM_PORT)
+public class ToolInformationSchemaColumnMapperTest {
+
+ @Resource
+ private ToolInformationSchemaColumnMapper toolInformationSchemaColumnMapper;
+
+ @Test
+ public void testSelectListByTableName() {
+ List columns = toolInformationSchemaColumnMapper
+ .selectListByTableName("inf_config");
+ assertTrue(columns.size() > 0);
+ }
+
+}
diff --git a/src/test/java/cn/iocoder/dashboard/modules/tool/dal/mysql/dao/coegen/ToolInformationSchemaTableMapperTest.java b/src/test/java/cn/iocoder/dashboard/modules/tool/dal/mysql/dao/coegen/ToolInformationSchemaTableMapperTest.java
new file mode 100644
index 000000000..da5aa1830
--- /dev/null
+++ b/src/test/java/cn/iocoder/dashboard/modules/tool/dal/mysql/dao/coegen/ToolInformationSchemaTableMapperTest.java
@@ -0,0 +1,26 @@
+package cn.iocoder.dashboard.modules.tool.dal.mysql.dao.coegen;
+
+import cn.iocoder.dashboard.TestApplication;
+import cn.iocoder.dashboard.modules.tool.dal.mysql.dataobject.codegen.ToolInformationSchemaTableDO;
+import org.junit.jupiter.api.Test;
+import org.springframework.boot.test.context.SpringBootTest;
+
+import javax.annotation.Resource;
+import java.util.List;
+
+import static org.junit.jupiter.api.Assertions.assertTrue;
+
+@SpringBootTest(classes = TestApplication.class, webEnvironment = SpringBootTest.WebEnvironment.RANDOM_PORT)
+class ToolInformationSchemaTableMapperTest {
+
+ @Resource
+ private ToolInformationSchemaTableMapper toolInformationSchemaTableMapper;
+
+ @Test
+ public void tstSelectListByTableSchema() {
+ List tables = toolInformationSchemaTableMapper
+ .selectListByTableSchema("ruoyi-vue-pro");
+ assertTrue(tables.size() > 0);
+ }
+
+}