diff --git a/ruoyi-generator/src/main/java/com/ruoyi/generator/controller/GenController.java b/ruoyi-generator/src/main/java/com/ruoyi/generator/controller/GenController.java index 6199d50c8..12bc3417c 100644 --- a/ruoyi-generator/src/main/java/com/ruoyi/generator/controller/GenController.java +++ b/ruoyi-generator/src/main/java/com/ruoyi/generator/controller/GenController.java @@ -37,36 +37,6 @@ import com.ruoyi.generator.service.IGenTableService; @RestController @RequestMapping("/tool/gen") public class GenController extends BaseController { - @Autowired - private IGenTableService genTableService; - - @Autowired - private IGenTableColumnService genTableColumnService; - - /** - * 查询代码生成列表 - */ - @PreAuthorize("@ss.hasPermi('tool:gen:list')") - @GetMapping("/list") - public TableDataInfo genList(GenTable genTable) { - startPage(); - List list = genTableService.selectGenTableList(genTable); - return getDataTable(list); - } - - /** - * 修改代码生成业务 - */ - @PreAuthorize("@ss.hasPermi('tool:gen:query')") - @GetMapping(value = "/{talbleId}") - public AjaxResult getInfo(@PathVariable Long talbleId) { - GenTable table = genTableService.selectGenTableById(talbleId); - List list = genTableColumnService.selectGenTableColumnListByTableId(talbleId); - Map map = new HashMap(); - map.put("info", table); - map.put("rows", list); - return AjaxResult.success(map); - } /** * 查询数据库列表 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 deleted file mode 100644 index 62f91782b..000000000 --- a/ruoyi-generator/src/main/java/com/ruoyi/generator/domain/GenTableColumn.java +++ /dev/null @@ -1,32 +0,0 @@ -package com.ruoyi.generator.domain; - -import javax.validation.constraints.NotBlank; - -import com.ruoyi.common.core.domain.BaseEntity; -import com.ruoyi.common.utils.StringUtils; - -/** - * 代码生成业务字段表 gen_table_column - * - * @author ruoyi - */ -public class GenTableColumn extends BaseEntity { - - public static boolean isSuperColumn(String javaField) { - return StringUtils.equalsAnyIgnoreCase(javaField, - // BaseEntity - "createBy", "createTime", "updateBy", "updateTime", "remark", - // TreeEntity - "parentName", "parentId", "orderNum", "ancestors"); - } - - public boolean isUsableColumn() { - return isUsableColumn(javaField); - } - - public static boolean isUsableColumn(String javaField) { - // isSuperColumn()中的名单用于避免生成多余Domain属性,若某些属性在生成页面时需要用到不能忽略,则放在此处白名单 - return StringUtils.equalsAnyIgnoreCase(javaField, "parentId", "orderNum", "remark"); - } - -} diff --git a/ruoyi-generator/src/main/java/com/ruoyi/generator/mapper/GenTableColumnMapper.java b/ruoyi-generator/src/main/java/com/ruoyi/generator/mapper/GenTableColumnMapper.java deleted file mode 100644 index 3e71d14ee..000000000 --- a/ruoyi-generator/src/main/java/com/ruoyi/generator/mapper/GenTableColumnMapper.java +++ /dev/null @@ -1,60 +0,0 @@ -package com.ruoyi.generator.mapper; - -import java.util.List; - -import com.ruoyi.generator.domain.GenTableColumn; - -/** - * 业务字段 数据层 - * - * @author ruoyi - */ -public interface GenTableColumnMapper { - /** - * 根据表名称查询列信息 - * - * @param tableName 表名称 - * @return 列信息 - */ - public List selectDbTableColumnsByName(String tableName); - - /** - * 查询业务字段列表 - * - * @param tableId 业务字段编号 - * @return 业务字段集合 - */ - public List selectGenTableColumnListByTableId(Long tableId); - - /** - * 新增业务字段 - * - * @param genTableColumn 业务字段信息 - * @return 结果 - */ - public int insertGenTableColumn(GenTableColumn genTableColumn); - - /** - * 修改业务字段 - * - * @param genTableColumn 业务字段信息 - * @return 结果 - */ - public int updateGenTableColumn(GenTableColumn genTableColumn); - - /** - * 删除业务字段 - * - * @param genTableColumns 列数据 - * @return 结果 - */ - public int deleteGenTableColumns(List genTableColumns); - - /** - * 批量删除业务字段 - * - * @param ids 需要删除的数据ID - * @return 结果 - */ - public int deleteGenTableColumnByIds(Long[] ids); -} diff --git a/ruoyi-generator/src/main/resources/mapper/generator/GenTableColumnMapper.xml b/ruoyi-generator/src/main/resources/mapper/generator/GenTableColumnMapper.xml deleted file mode 100644 index 0bf0eea90..000000000 --- a/ruoyi-generator/src/main/resources/mapper/generator/GenTableColumnMapper.xml +++ /dev/null @@ -1,127 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - select column_id, table_id, column_name, column_comment, column_type, java_type, java_field, is_pk, is_increment, is_required, is_insert, is_edit, is_list, is_query, query_type, html_type, dict_type, sort, create_by, create_time, update_by, update_time from gen_table_column - - - - - - - - insert into gen_table_column ( - table_id, - column_name, - column_comment, - column_type, - java_type, - java_field, - is_pk, - is_increment, - is_required, - is_insert, - is_edit, - is_list, - is_query, - query_type, - html_type, - dict_type, - sort, - create_by, - create_time - )values( - #{tableId}, - #{columnName}, - #{columnComment}, - #{columnType}, - #{javaType}, - #{javaField}, - #{isPk}, - #{isIncrement}, - #{isRequired}, - #{isInsert}, - #{isEdit}, - #{isList}, - #{isQuery}, - #{queryType}, - #{htmlType}, - #{dictType}, - #{sort}, - #{createBy}, - sysdate() - ) - - - - update gen_table_column - - column_comment = #{columnComment}, - java_type = #{javaType}, - java_field = #{javaField}, - is_insert = #{isInsert}, - is_edit = #{isEdit}, - is_list = #{isList}, - is_query = #{isQuery}, - is_required = #{isRequired}, - query_type = #{queryType}, - html_type = #{htmlType}, - dict_type = #{dictType}, - sort = #{sort}, - update_by = #{updateBy}, - update_time = sysdate() - - where column_id = #{columnId} - - - - delete from gen_table_column where table_id in - - #{tableId} - - - - - delete from gen_table_column where column_id in - - #{item.columnId} - - - - \ No newline at end of file diff --git a/ruoyi-generator/src/main/resources/mapper/generator/GenTableMapper.xml b/ruoyi-generator/src/main/resources/mapper/generator/GenTableMapper.xml index 83ba469dc..db722886f 100644 --- a/ruoyi-generator/src/main/resources/mapper/generator/GenTableMapper.xml +++ b/ruoyi-generator/src/main/resources/mapper/generator/GenTableMapper.xml @@ -4,75 +4,6 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - select table_id, table_name, table_comment, class_name, tpl_category, package_name, module_name, business_name, function_name, function_author, gen_type, gen_path, options, create_by, create_time, update_by, update_time, remark from gen_table - - - - - + - + - + - + - + insert into gen_table ( table_name, @@ -156,7 +87,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" sysdate() ) - + update gen_table @@ -178,12 +109,12 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" where table_id = #{tableId} - + - delete from gen_table where table_id in + delete from gen_table where table_id in #{tableId} - \ No newline at end of file + diff --git a/ruoyi-ui/src/api/tool/codegen.js b/ruoyi-ui/src/api/tool/codegen.js index d95ed38d5..dc09a8098 100644 --- a/ruoyi-ui/src/api/tool/codegen.js +++ b/ruoyi-ui/src/api/tool/codegen.js @@ -1,2 +1,18 @@ import request from '@/utils/request' +// 获得表定义分页 +export function getCodeGenTablePage(query) { + return request({ + url: '/tool/codegen/page', + method: 'get', + params: query + }) +} + +// 获得表和字段的明细 +export function getCodeGenDetail(tableId) { + return request({ + url: '/tool/codegen/detail?tableId=' + tableId, + method: 'get', + }) +} diff --git a/ruoyi-ui/src/api/tool/gen.js b/ruoyi-ui/src/api/tool/gen.js index afaf2a959..1ca718fb2 100644 --- a/ruoyi-ui/src/api/tool/gen.js +++ b/ruoyi-ui/src/api/tool/gen.js @@ -1,13 +1,5 @@ import request from '@/utils/request' -// 查询生成表数据 -export function listTable(query) { - return request({ - url: '/tool/gen/list', - method: 'get', - params: query - }) -} // 查询db数据库列表 export function listDbTable(query) { return request({ diff --git a/ruoyi-ui/src/views/tool/gen/basicInfoForm.vue b/ruoyi-ui/src/views/tool/gen/basicInfoForm.vue index f3e87172b..8f78fe176 100644 --- a/ruoyi-ui/src/views/tool/gen/basicInfoForm.vue +++ b/ruoyi-ui/src/views/tool/gen/basicInfoForm.vue @@ -18,8 +18,8 @@ - - + + @@ -51,7 +51,7 @@ export default { className: [ { required: true, message: "请输入实体类名称", trigger: "blur" } ], - functionAuthor: [ + author: [ { required: true, message: "请输入作者", trigger: "blur" } ] } diff --git a/ruoyi-ui/src/views/tool/gen/editTable.vue b/ruoyi-ui/src/views/tool/gen/editTable.vue index 39071894e..ac661d702 100644 --- a/ruoyi-ui/src/views/tool/gen/editTable.vue +++ b/ruoyi-ui/src/views/tool/gen/editTable.vue @@ -2,11 +2,10 @@ - + - - + - - + - + - + - + - + @@ -110,10 +108,15 @@ + + + - + @@ -125,7 +128,8 @@