代码生成-导入表结构

This commit is contained in:
TinyAnts 2022-06-14 17:00:35 +08:00
parent 57c94a1e7d
commit 61790c7444
13 changed files with 261 additions and 143 deletions

View File

@ -24,7 +24,6 @@
<groupId>commons-collections</groupId> <groupId>commons-collections</groupId>
<artifactId>commons-collections</artifactId> <artifactId>commons-collections</artifactId>
<version>3.2.2</version> <version>3.2.2</version>
</dependency> </dependency>
<!--velocity代码生成使用模板 --> <!--velocity代码生成使用模板 -->
<dependency> <dependency>

View File

@ -0,0 +1,17 @@
package com.hxkj.generator.config;
public class GenConfig {
// 作者姓名
public static String authorName = "LikeAdmin";
// 生成包名
public static String packageName = "com.hxkj.like-admin";
// 表前缀名
public static String tablePrefix = "ls_";
// 是否去除表前缀
public static Boolean isRemoveTablePrefix = true;
}

View File

@ -1,11 +1,14 @@
package com.hxkj.generator.controller; package com.hxkj.generator.controller;
import com.baomidou.mybatisplus.core.toolkit.Assert;
import com.hxkj.common.core.AjaxResult; import com.hxkj.common.core.AjaxResult;
import com.hxkj.common.core.PageResult; import com.hxkj.common.core.PageResult;
import com.hxkj.common.validator.annotation.IDMust; import com.hxkj.common.validator.annotation.IDMust;
import com.hxkj.generator.service.IGenerateService; import com.hxkj.generator.service.IGenerateService;
import com.hxkj.generator.validate.GenParam; import com.hxkj.generator.validate.GenParam;
import com.hxkj.generator.validate.PageParam; import com.hxkj.generator.validate.PageParam;
import com.hxkj.generator.vo.DbTableVo;
import com.hxkj.generator.vo.GenTableVo;
import org.springframework.validation.annotation.Validated; import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*; import org.springframework.web.bind.annotation.*;
@ -30,7 +33,7 @@ public class GenController {
@GetMapping("/db") @GetMapping("/db")
public Object db(@Validated PageParam pageParam, public Object db(@Validated PageParam pageParam,
@RequestParam Map<String, String> params) { @RequestParam Map<String, String> params) {
PageResult<Map<String, String>> list = iGenerateService.db(pageParam, params); PageResult<DbTableVo> list = iGenerateService.db(pageParam, params);
return AjaxResult.success(list); return AjaxResult.success(list);
} }
@ -40,10 +43,10 @@ public class GenController {
* @author fzr * @author fzr
* @return Object * @return Object
*/ */
@GetMapping("/genList") @GetMapping("/list")
public Object genList(@Validated PageParam pageParam, public Object list(@Validated PageParam pageParam,
@RequestParam Map<String, String> params) { @RequestParam Map<String, String> params) {
PageResult<Map<String, Object>> list = iGenerateService.genList(pageParam, params); PageResult<GenTableVo> list = iGenerateService.list(pageParam, params);
return AjaxResult.success(list); return AjaxResult.success(list);
} }
@ -53,9 +56,9 @@ public class GenController {
* @author fzr * @author fzr
* @return Object * @return Object
*/ */
@GetMapping("/genDetail") @GetMapping("/detail")
public Object genDetail(@Validated @IDMust() @RequestParam("id") Integer id) { public Object detail(@Validated @IDMust() @RequestParam("id") Integer id) {
Map<String, Object> maps = iGenerateService.genDetail(id); Map<String, Object> maps = iGenerateService.detail(id);
return AjaxResult.success(maps); return AjaxResult.success(maps);
} }
@ -67,6 +70,7 @@ public class GenController {
*/ */
@PostMapping("/importTable") @PostMapping("/importTable")
public Object importTable(String tables) { public Object importTable(String tables) {
Assert.notNull(tables, "tables参数缺失");
String[] tableNames = tables.split(","); String[] tableNames = tables.split(",");
iGenerateService.importTable(tableNames); iGenerateService.importTable(tableNames);
return AjaxResult.success(); return AjaxResult.success();

View File

@ -20,12 +20,12 @@ public class GenTable implements Serializable {
private String tableComment; private String tableComment;
private String subTableName; private String subTableName;
private String subTableFk; private String subTableFk;
private String authorName;
private String entityName; private String entityName;
private String packageName; private String packageName;
private String moduleName; private String moduleName;
private String businessName; private String businessName;
private String functionName; private String functionName;
private String functionAuthor;
private String genTpl; private String genTpl;
private Integer genType; private Integer genType;
private String genPath; private String genPath;

View File

@ -3,6 +3,7 @@ package com.hxkj.generator.mapper;
import com.hxkj.common.core.basics.IBaseMapper; import com.hxkj.common.core.basics.IBaseMapper;
import com.hxkj.generator.entity.GenTable; import com.hxkj.generator.entity.GenTable;
import com.hxkj.generator.entity.GenTableColumn; import com.hxkj.generator.entity.GenTableColumn;
import com.hxkj.generator.vo.DbTableVo;
import org.apache.ibatis.annotations.Mapper; import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select; import org.apache.ibatis.annotations.Select;
@ -35,7 +36,7 @@ public interface GenTableMapper extends IBaseMapper<GenTable> {
"AND lower(table_comment) like lower(concat('%', #{tableComment}, '%'))" + "AND lower(table_comment) like lower(concat('%', #{tableComment}, '%'))" +
"</if>", "</if>",
"</script>"}) "</script>"})
List<Map<String, String>> selectDbTableList(Map<String, String> params); List<DbTableVo> selectDbTableList(Map<String, String> params);
/** /**
* 根据表名集查询表 * 根据表名集查询表

View File

@ -3,6 +3,8 @@ package com.hxkj.generator.service;
import com.hxkj.common.core.PageResult; import com.hxkj.common.core.PageResult;
import com.hxkj.generator.validate.GenParam; import com.hxkj.generator.validate.GenParam;
import com.hxkj.generator.validate.PageParam; import com.hxkj.generator.validate.PageParam;
import com.hxkj.generator.vo.DbTableVo;
import com.hxkj.generator.vo.GenTableVo;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
@ -20,7 +22,7 @@ public interface IGenerateService {
* @param params 搜索参数 * @param params 搜索参数
* @return PageResult<Map<String, String>> * @return PageResult<Map<String, String>>
*/ */
PageResult<Map<String, String>> db(PageParam pageParam, Map<String, String> params); PageResult<DbTableVo> db(PageParam pageParam, Map<String, String> params);
/** /**
* 生成列表 * 生成列表
@ -28,7 +30,7 @@ public interface IGenerateService {
* @author fzr * @author fzr
* @return Object * @return Object
*/ */
PageResult<Map<String, Object>> genList(PageParam pageParam, Map<String, String> params); PageResult<GenTableVo> list(PageParam pageParam, Map<String, String> params);
/** /**
* 生成详情 * 生成详情
@ -36,7 +38,7 @@ public interface IGenerateService {
* @author fzr * @author fzr
* @return Object * @return Object
*/ */
Map<String, Object> genDetail(Integer id); Map<String, Object> detail(Integer id);
/** /**
* 导入表结构 * 导入表结构

View File

@ -1,13 +1,17 @@
package com.hxkj.generator.service.impl; package com.hxkj.generator.service.impl;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.core.toolkit.Assert; import com.baomidou.mybatisplus.core.toolkit.Assert;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.github.pagehelper.PageHelper; import com.github.pagehelper.PageHelper;
import com.hxkj.common.constant.GenConstants; import com.hxkj.common.constant.GenConstants;
import com.hxkj.common.core.PageResult; import com.hxkj.common.core.PageResult;
import com.hxkj.common.exception.OperateException;
import com.hxkj.common.utils.StringUtil; import com.hxkj.common.utils.StringUtil;
import com.hxkj.common.utils.TimeUtil; import com.hxkj.common.utils.TimeUtil;
import com.hxkj.generator.config.GenConfig;
import com.hxkj.generator.entity.GenTable; import com.hxkj.generator.entity.GenTable;
import com.hxkj.generator.entity.GenTableColumn; import com.hxkj.generator.entity.GenTableColumn;
import com.hxkj.generator.mapper.GenTableColumnMapper; import com.hxkj.generator.mapper.GenTableColumnMapper;
@ -17,9 +21,13 @@ import com.hxkj.generator.util.GenUtil;
import com.hxkj.generator.util.VelocityUtil; import com.hxkj.generator.util.VelocityUtil;
import com.hxkj.generator.validate.GenParam; import com.hxkj.generator.validate.GenParam;
import com.hxkj.generator.validate.PageParam; import com.hxkj.generator.validate.PageParam;
import com.hxkj.generator.vo.DbTableVo;
import com.hxkj.generator.vo.GenColumnVo;
import com.hxkj.generator.vo.GenTableVo;
import org.apache.velocity.Template; import org.apache.velocity.Template;
import org.apache.velocity.VelocityContext; import org.apache.velocity.VelocityContext;
import org.apache.velocity.app.Velocity; import org.apache.velocity.app.Velocity;
import org.springframework.beans.BeanUtils;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional; import org.springframework.transaction.annotation.Transactional;
@ -48,24 +56,20 @@ public class GenerateServiceImpl implements IGenerateService {
* @return PageResult<Map<String, String>> * @return PageResult<Map<String, String>>
*/ */
@Override @Override
public PageResult<Map<String, String>> db(PageParam pageParam, Map<String, String> params) { public PageResult<DbTableVo> db(PageParam pageParam, Map<String, String> params) {
Integer page = pageParam.getPageNo(); Integer page = pageParam.getPageNo();
Integer limit = pageParam.getPageSize(); Integer limit = pageParam.getPageSize();
PageHelper.startPage(page, limit); PageHelper.startPage(page, limit);
List<Map<String, String>> tables = genTableMapper.selectDbTableList(params); List<DbTableVo> tables = genTableMapper.selectDbTableList(params);
List<Map<String, String>> list = new LinkedList<>(); for (DbTableVo vo : tables) {
for (Map<String, String> item : tables) { if (vo.getUpdateTime() == null) {
Map<String, String> map = new LinkedHashMap<>(); vo.setUpdateTime("");
map.put("tableName", item.get("table_name")); }
map.put("tableComment", item.get("table_comment"));
map.put("createTime", item.get("create_time"));
map.put("updateTime", item.getOrDefault("update_time", ""));
list.add(map);
} }
return PageResult.pageHelper(tables, list); return PageResult.pageHelper(tables);
} }
/** /**
@ -76,13 +80,13 @@ public class GenerateServiceImpl implements IGenerateService {
* @return PageResult<Map<String, Object>> * @return PageResult<Map<String, Object>>
*/ */
@Override @Override
public PageResult<Map<String, Object>> genList(PageParam pageParam, Map<String, String> params) { public PageResult<GenTableVo> list(PageParam pageParam, Map<String, String> params) {
Integer page = pageParam.getPageNo(); Integer page = pageParam.getPageNo();
Integer limit = pageParam.getPageSize(); Integer limit = pageParam.getPageSize();
QueryWrapper<GenTable> queryWrapper = new QueryWrapper<>(); QueryWrapper<GenTable> queryWrapper = new QueryWrapper<>();
queryWrapper.orderByDesc("id"); queryWrapper.orderByDesc("id");
queryWrapper.select("id,entity_name,table_name,table_comment,create_time,update_time"); queryWrapper.select("id,gen_tpl,entity_name,table_name,table_comment,create_time,update_time");
genTableMapper.setSearch(queryWrapper, params, new String[]{ genTableMapper.setSearch(queryWrapper, params, new String[]{
"like:tableName@table_name:str", "like:tableName@table_name:str",
@ -90,22 +94,18 @@ public class GenerateServiceImpl implements IGenerateService {
"datetime:startTime-endTime@create_time:str" "datetime:startTime-endTime@create_time:str"
}); });
PageHelper.startPage(page, limit); IPage<GenTable> iPage = genTableMapper.selectPage(new Page<>(page, limit), queryWrapper);
List<Map<String, Object>> tables = genTableMapper.selectMaps(queryWrapper);
List<Map<String, Object>> list = new LinkedList<>(); List<GenTableVo> list = new LinkedList<>();
for (Map<String, Object> item : tables) { for (GenTable item : iPage.getRecords()) {
Map<String, Object> map = new LinkedHashMap<>(); GenTableVo vo = new GenTableVo();
map.put("id", item.get("id")); BeanUtils.copyProperties(item, vo);
map.put("tableName", item.get("table_name")); vo.setCreateTime(TimeUtil.timestampToDate(item.getCreateTime()));
map.put("entityName", item.get("entity_name")); vo.setUpdateTime(TimeUtil.timestampToDate(item.getUpdateTime()));
map.put("tableComment", item.get("table_comment")); list.add(vo);
map.put("createTime", TimeUtil.timestampToDate(item.get("create_time").toString()));
map.put("updateTime", TimeUtil.timestampToDate(item.get("update_time").toString()));
list.add(map);
} }
return PageResult.pageHelper(tables, list); return PageResult.iPageHandle(iPage.getTotal(), iPage.getCurrent(), iPage.getSize(), list);
} }
/** /**
@ -115,7 +115,7 @@ public class GenerateServiceImpl implements IGenerateService {
* @return Object * @return Object
*/ */
@Override @Override
public Map<String, Object> genDetail(Integer id) { public Map<String, Object> detail(Integer id) {
Map<String, Object> maps = new LinkedHashMap<>(); Map<String, Object> maps = new LinkedHashMap<>();
GenTable genTable = genTableMapper.selectById(id); GenTable genTable = genTableMapper.selectById(id);
@ -123,9 +123,10 @@ public class GenerateServiceImpl implements IGenerateService {
Map<String, Object> base = new LinkedHashMap<>(); Map<String, Object> base = new LinkedHashMap<>();
base.put("id", genTable.getId()); base.put("id", genTable.getId());
base.put("tableName", genTable.getTableName()); base.put("tableName", genTable.getTableName());
base.put("entityName", genTable.getEntityName());
base.put("tableComment", genTable.getTableComment()); base.put("tableComment", genTable.getTableComment());
base.put("functionAuthor", genTable.getFunctionName()); base.put("entityName", genTable.getEntityName());
base.put("authorName", genTable.getAuthorName());
base.put("remarks", genTable.getRemarks());
base.put("createTime", TimeUtil.timestampToDate(genTable.getCreateTime())); base.put("createTime", TimeUtil.timestampToDate(genTable.getCreateTime()));
base.put("updateTime", TimeUtil.timestampToDate(genTable.getUpdateTime())); base.put("updateTime", TimeUtil.timestampToDate(genTable.getUpdateTime()));
maps.put("base", base); maps.put("base", base);
@ -142,10 +143,17 @@ public class GenerateServiceImpl implements IGenerateService {
maps.put("gen", gen); maps.put("gen", gen);
// 字段信息 // 字段信息
List<GenTableColumn> columns = genTableColumnMapper.selectList( QueryWrapper<GenTableColumn> queryWrapper = new QueryWrapper<>();
new QueryWrapper<GenTableColumn>() queryWrapper.eq("table_id", id);
.eq("table_id", id) queryWrapper.orderByAsc("sort");
.orderByDesc("sort")); List<GenColumnVo> columns = new LinkedList<>();
for (GenTableColumn item : genTableColumnMapper.selectList(queryWrapper)) {
GenColumnVo vo = new GenColumnVo();
BeanUtils.copyProperties(item, vo);
vo.setCreateTime(TimeUtil.timestampToDate(item.getCreateTime()));
vo.setUpdateTime(TimeUtil.timestampToDate(item.getUpdateTime()));
columns.add(vo);
}
maps.put("column", columns); maps.put("column", columns);
@ -161,21 +169,24 @@ public class GenerateServiceImpl implements IGenerateService {
@Override @Override
@Transactional @Transactional
public void importTable(String[] tableNames) { public void importTable(String[] tableNames) {
try {
List<Map<String, String>> tables = genTableMapper.selectDbTableListByNames(tableNames); List<Map<String, String>> tables = genTableMapper.selectDbTableListByNames(tableNames);
for (Map<String, String> map : tables) { for (Map<String, String> map : tables) {
// 生成表信息 // 取基本数据
String tableName = map.get("table_name"); String tableName = map.get("table_name");
String tableDesc = map.get("table_comment"); String tableDesc = map.get("table_comment");
// 生成表信息
GenTable table = new GenTable(); GenTable table = new GenTable();
table.setTableName(tableName); table.setTableName(tableName);
table.setTableComment(tableDesc); table.setTableComment(tableDesc);
table.setAuthorName(GenConfig.authorName);
table.setEntityName(GenUtil.toClassName(tableName)); table.setEntityName(GenUtil.toClassName(tableName));
table.setPackageName("com.hxkj.admin"); table.setModuleName(GenUtil.toModuleName(GenConfig.packageName));
table.setModuleName(GenUtil.toModuleName("com.hxkj.admin")); table.setPackageName(GenConfig.packageName);
table.setBusinessName(GenUtil.toBusinessName(tableName)); table.setBusinessName(GenUtil.toBusinessName(tableName));
table.setFunctionName(GenUtil.replaceText(tableDesc)); table.setFunctionName(GenUtil.replaceText(tableDesc));
table.setFunctionAuthor("likeAdmin");
table.setCreateTime(System.currentTimeMillis() / 1000); table.setCreateTime(System.currentTimeMillis() / 1000);
table.setUpdateTime(System.currentTimeMillis() / 1000); table.setUpdateTime(System.currentTimeMillis() / 1000);
int row = genTableMapper.insert(table); int row = genTableMapper.insert(table);
@ -183,18 +194,19 @@ public class GenerateServiceImpl implements IGenerateService {
// 生成列信息 // 生成列信息
if (row > 0) { if (row > 0) {
List<GenTableColumn> genTableColumns = genTableMapper.selectDbTableColumnsByName(tableName); List<GenTableColumn> genTableColumns = genTableMapper.selectDbTableColumnsByName(tableName);
for (GenTableColumn column : genTableColumns) {
String columnType = GenUtil.getDbType(column.getColumnType());
String columnName = column.getColumnName();
for (GenTableColumn column : genTableColumns) {
String columnName = column.getColumnName();
String columnType = GenUtil.getDbType(column.getColumnType());
column.setTableId(table.getId()); column.setTableId(table.getId());
column.setJavaField(StringUtil.toCamelCase(columnName));
column.setJavaType(GenConstants.TYPE_STRING);
column.setQueryType(GenConstants.QUERY_EQ);
column.setIsInsert(GenConstants.REQUIRE);
column.setUpdateTime(table.getUpdateTime()); column.setUpdateTime(table.getUpdateTime());
column.setCreateTime(table.getCreateTime()); column.setCreateTime(table.getCreateTime());
column.setJavaField(StringUtil.toCamelCase(columnName));
column.setJavaType("String");
column.setQueryType("EQ");
column.setIsInsert(GenConstants.REQUIRE);
// 文本域组
if (GenUtil.isArraysContains(GenConstants.COLUMN_TYPE_STR, columnType) || if (GenUtil.isArraysContains(GenConstants.COLUMN_TYPE_STR, columnType) ||
GenUtil.isArraysContains(GenConstants.COLUMN_TYPE_TEXT, columnType)) { GenUtil.isArraysContains(GenConstants.COLUMN_TYPE_TEXT, columnType)) {
Integer columnLength = GenUtil.getColumnLength(column.getColumnType()); Integer columnLength = GenUtil.getColumnLength(column.getColumnType());
@ -204,11 +216,13 @@ public class GenerateServiceImpl implements IGenerateService {
column.setHtmlType(htmlType); column.setHtmlType(htmlType);
} }
// 日期组件
else if (GenUtil.isArraysContains(GenConstants.COLUMN_TYPE_TIME, columnType)) { else if (GenUtil.isArraysContains(GenConstants.COLUMN_TYPE_TIME, columnType)) {
column.setJavaType(GenConstants.TYPE_DATE); column.setJavaType(GenConstants.TYPE_DATE);
column.setHtmlType(GenConstants.HTML_DATETIME); column.setHtmlType(GenConstants.HTML_DATETIME);
} }
// 数字组件
else if (GenUtil.isArraysContains(GenConstants.COLUMN_TYPE_NUMBER, columnType)) { else if (GenUtil.isArraysContains(GenConstants.COLUMN_TYPE_NUMBER, columnType)) {
column.setHtmlType(GenConstants.HTML_INPUT); column.setHtmlType(GenConstants.HTML_INPUT);
String[] str = StringUtil.split(StringUtil.substringBetween(column.getColumnType(), "(", ")"), ","); String[] str = StringUtil.split(StringUtil.substringBetween(column.getColumnType(), "(", ")"), ",");
@ -256,7 +270,7 @@ public class GenerateServiceImpl implements IGenerateService {
// 文件字段设置文件上传控件 // 文件字段设置文件上传控件
column.setHtmlType(GenConstants.HTML_FILE_UPLOAD); column.setHtmlType(GenConstants.HTML_FILE_UPLOAD);
} else if (StringUtil.endsWithIgnoreCase(columnName, "content")) { } else if (StringUtil.endsWithIgnoreCase(columnName, "content")) {
// 内容字段设置富文本控件 // 内容字段设置富文本控件
column.setHtmlType(GenConstants.HTML_EDITOR); column.setHtmlType(GenConstants.HTML_EDITOR);
} }
@ -264,6 +278,9 @@ public class GenerateServiceImpl implements IGenerateService {
} }
} }
} }
} catch (Exception e) {
throw new OperateException("导入失败:" + e.getMessage());
}
} }
/** /**
@ -279,15 +296,15 @@ public class GenerateServiceImpl implements IGenerateService {
Assert.notNull(model, "数据已丢失"); Assert.notNull(model, "数据已丢失");
model.setTableName(genParam.getTableName()); model.setTableName(genParam.getTableName());
model.setEntityName(genParam.getEntityName());
model.setTableComment(genParam.getTableComment()); model.setTableComment(genParam.getTableComment());
model.setFunctionAuthor(genParam.getFunctionAuthor()); model.setAuthorName(genParam.getAuthorName());
model.setRemarks(genParam.getRemarks()); model.setEntityName(genParam.getEntityName());
model.setGenTpl(genParam.getGenTpl());
model.setModuleName(genParam.getModuleName()); model.setModuleName(genParam.getModuleName());
model.setPackageName(genParam.getPackageName()); model.setPackageName(genParam.getPackageName());
model.setBusinessName(genParam.getBusinessName()); model.setBusinessName(genParam.getBusinessName());
model.setFunctionName(genParam.getFunctionName()); model.setFunctionName(genParam.getFunctionName());
model.setRemarks(genParam.getRemarks());
model.setGenTpl(genParam.getGenTpl());
model.setGenType(genParam.getGenType()); model.setGenType(genParam.getGenType());
model.setGenPath(genParam.getGenPath()); model.setGenPath(genParam.getGenPath());
genTableMapper.updateById(model); genTableMapper.updateById(model);

View File

@ -132,4 +132,8 @@ public class GenUtil {
} }
} }
public static void setPkColumn() {
}
} }

View File

@ -54,7 +54,7 @@ public class VelocityUtil {
velocityContext.put("BusinessName", StringUtil.capitalize(genTable.getBusinessName())); velocityContext.put("BusinessName", StringUtil.capitalize(genTable.getBusinessName()));
velocityContext.put("businessName", genTable.getBusinessName()); velocityContext.put("businessName", genTable.getBusinessName());
velocityContext.put("packageName", packageName); velocityContext.put("packageName", packageName);
velocityContext.put("author", genTable.getFunctionAuthor()); velocityContext.put("author", genTable.getAuthorName());
velocityContext.put("datetime", TimeUtil.nowDate()); velocityContext.put("datetime", TimeUtil.nowDate());
return velocityContext; return velocityContext;
} }

View File

@ -40,10 +40,10 @@ public class GenParam implements Serializable {
@Length(min = 1, max = 200, message = "表描述不能大于200个字符") @Length(min = 1, max = 200, message = "表描述不能大于200个字符")
private String tableComment; private String tableComment;
@NotNull(message = "functionAuthor参数缺失") @NotNull(message = "authorName参数缺失")
@NotEmpty(message = "表描述不能为空") @NotEmpty(message = "作者名称不能为空")
@Length(min = 1, max = 60, message = "表描述不能大于200个字符") @Length(min = 1, max = 100, message = "作者名称不能大于60个字符")
private String functionAuthor; private String authorName;
@Length(max = 60, message = "备注不能大于200个字符") @Length(max = 60, message = "备注不能大于200个字符")
private String remarks; private String remarks;

View File

@ -0,0 +1,20 @@
package com.hxkj.generator.vo;
import lombok.Data;
import java.io.Serializable;
/***
* 表实体
*/
@Data
public class DbTableVo implements Serializable {
private static final long serialVersionUID = 1L;
private String tableName; // 表的名称
private String tableComment; // 表的描述
private String createTime; // 创建时间
private String updateTime; // 更新时间
}

View File

@ -0,0 +1,32 @@
package com.hxkj.generator.vo;
import lombok.Data;
import java.io.Serializable;
/***
* 列实体
*/
@Data
public class GenColumnVo implements Serializable {
private static final long serialVersionUID = 1L;
private Integer id; // 主键
private String columnName; // 字段名称
private String columnComment; // 字段描述
private String columnType; // 字段类型
private String javaType; // JAVA类型
private String javaField; // JAVA字段
private Integer isRequired; // 是否必填
private Integer isInsert; // 是否插入字段
private Integer isEdit; // 是否编辑字段
private Integer isList; // 是否列表字段
private Integer isQuery; // 是否查询字段
private String queryType; // 查询方式: [等于不等于大于小于范围]
private String htmlType; // 显示类型: [文本框文本域下拉框复选框单选框日期控件]
private String dictType; // 字典类型
private String createTime; // 创建时间
private String updateTime; // 更新时间
}

View File

@ -0,0 +1,22 @@
package com.hxkj.generator.vo;
import lombok.Data;
import java.io.Serializable;
/**
* 生成表实体
*/
@Data
public class GenTableVo implements Serializable {
private static final long serialVersionUID = 1L;
private Integer id; // 生成主键
private String genTpl; // 生成模板
private String tableName; // 表的名称
private String tableComment; // 表的描述
private String createTime; // 创建时间
private String updateTime; // 删除时间
}