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 12bc3417cf..4778ed77c0 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 @@ -76,18 +76,6 @@ public class GenController extends BaseController { return AjaxResult.success(); } - /** - * 修改保存代码生成业务 - */ - @PreAuthorize("@ss.hasPermi('tool:gen:edit')") - @Log(title = "代码生成", businessType = BusinessType.UPDATE) - @PutMapping - public AjaxResult editSave(@Validated @RequestBody GenTable genTable) { - genTableService.validateEdit(genTable); - genTableService.updateGenTable(genTable); - return AjaxResult.success(); - } - /** * 删除代码生成 */ diff --git a/ruoyi-generator/src/main/java/com/ruoyi/generator/mapper/GenTableMapper.java b/ruoyi-generator/src/main/java/com/ruoyi/generator/mapper/GenTableMapper.java index cc59bd2f42..fbd7341338 100644 --- a/ruoyi-generator/src/main/java/com/ruoyi/generator/mapper/GenTableMapper.java +++ b/ruoyi-generator/src/main/java/com/ruoyi/generator/mapper/GenTableMapper.java @@ -50,27 +50,4 @@ public interface GenTableMapper { */ public GenTable selectGenTableByName(String tableName); - /** - * 新增业务 - * - * @param genTable 业务信息 - * @return 结果 - */ - public int insertGenTable(GenTable genTable); - - /** - * 修改业务 - * - * @param genTable 业务信息 - * @return 结果 - */ - public int updateGenTable(GenTable genTable); - - /** - * 批量删除业务 - * - * @param ids 需要删除的数据ID - * @return 结果 - */ - public int deleteGenTableByIds(Long[] ids); } diff --git a/ruoyi-generator/src/main/java/com/ruoyi/generator/service/GenTableColumnServiceImpl.java b/ruoyi-generator/src/main/java/com/ruoyi/generator/service/GenTableColumnServiceImpl.java deleted file mode 100644 index ac144794e4..0000000000 --- a/ruoyi-generator/src/main/java/com/ruoyi/generator/service/GenTableColumnServiceImpl.java +++ /dev/null @@ -1,64 +0,0 @@ -package com.ruoyi.generator.service; - -import java.util.List; - -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.stereotype.Service; -import com.ruoyi.common.core.text.Convert; -import com.ruoyi.generator.domain.GenTableColumn; -import com.ruoyi.generator.mapper.GenTableColumnMapper; - -/** - * 业务字段 服务层实现 - * - * @author ruoyi - */ -@Service -public class GenTableColumnServiceImpl implements IGenTableColumnService { - @Autowired - private GenTableColumnMapper genTableColumnMapper; - - /** - * 查询业务字段列表 - * - * @param tableId 业务字段编号 - * @return 业务字段集合 - */ - @Override - public List selectGenTableColumnListByTableId(Long tableId) { - return genTableColumnMapper.selectGenTableColumnListByTableId(tableId); - } - - /** - * 新增业务字段 - * - * @param genTableColumn 业务字段信息 - * @return 结果 - */ - @Override - public int insertGenTableColumn(GenTableColumn genTableColumn) { - return genTableColumnMapper.insertGenTableColumn(genTableColumn); - } - - /** - * 修改业务字段 - * - * @param genTableColumn 业务字段信息 - * @return 结果 - */ - @Override - public int updateGenTableColumn(GenTableColumn genTableColumn) { - return genTableColumnMapper.updateGenTableColumn(genTableColumn); - } - - /** - * 删除业务字段对象 - * - * @param ids 需要删除的数据ID - * @return 结果 - */ - @Override - public int deleteGenTableColumnByIds(String ids) { - return genTableColumnMapper.deleteGenTableColumnByIds(Convert.toLongArray(ids)); - } -} diff --git a/ruoyi-generator/src/main/java/com/ruoyi/generator/service/IGenTableColumnService.java b/ruoyi-generator/src/main/java/com/ruoyi/generator/service/IGenTableColumnService.java deleted file mode 100644 index d4aa88693f..0000000000 --- a/ruoyi-generator/src/main/java/com/ruoyi/generator/service/IGenTableColumnService.java +++ /dev/null @@ -1,44 +0,0 @@ -package com.ruoyi.generator.service; - -import java.util.List; - -import com.ruoyi.generator.domain.GenTableColumn; - -/** - * 业务字段 服务层 - * - * @author ruoyi - */ -public interface IGenTableColumnService { - /** - * 查询业务字段列表 - * - * @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 ids 需要删除的数据ID - * @return 结果 - */ - public int deleteGenTableColumnByIds(String ids); -} diff --git a/ruoyi-generator/src/main/java/com/ruoyi/generator/service/IGenTableService.java b/ruoyi-generator/src/main/java/com/ruoyi/generator/service/IGenTableService.java deleted file mode 100644 index f342cfa7e2..0000000000 --- a/ruoyi-generator/src/main/java/com/ruoyi/generator/service/IGenTableService.java +++ /dev/null @@ -1,114 +0,0 @@ -package com.ruoyi.generator.service; - -import java.util.List; -import java.util.Map; - -import com.ruoyi.generator.domain.GenTable; - -/** - * 业务 服务层 - * - * @author ruoyi - */ -public interface IGenTableService { - /** - * 查询业务列表 - * - * @param genTable 业务信息 - * @return 业务集合 - */ - public List selectGenTableList(GenTable genTable); - - /** - * 查询据库列表 - * - * @param genTable 业务信息 - * @return 数据库表集合 - */ - public List selectDbTableList(GenTable genTable); - - /** - * 查询据库列表 - * - * @param tableNames 表名称组 - * @return 数据库表集合 - */ - public List selectDbTableListByNames(String[] tableNames); - - /** - * 查询业务信息 - * - * @param id 业务ID - * @return 业务信息 - */ - public GenTable selectGenTableById(Long id); - - /** - * 修改业务 - * - * @param genTable 业务信息 - * @return 结果 - */ - public void updateGenTable(GenTable genTable); - - /** - * 删除业务信息 - * - * @param tableIds 需要删除的表数据ID - * @return 结果 - */ - public void deleteGenTableByIds(Long[] tableIds); - - /** - * 导入表结构 - * - * @param tableList 导入表列表 - */ - public void importGenTable(List tableList); - - /** - * 预览代码 - * - * @param tableId 表编号 - * @return 预览数据列表 - */ - public Map previewCode(Long tableId); - - /** - * 生成代码(下载方式) - * - * @param tableName 表名称 - * @return 数据 - */ - public byte[] downloadCode(String tableName); - - /** - * 生成代码(自定义路径) - * - * @param tableName 表名称 - * @return 数据 - */ - public void generatorCode(String tableName); - - /** - * 同步数据库 - * - * @param tableName 表名称 - */ - public void synchDb(String tableName); - - /** - * 批量生成代码(下载方式) - * - * @param tableNames 表数组 - * @return 数据 - */ - public byte[] downloadCode(String[] tableNames); - - /** - * 修改保存参数校验 - * - * @param genTable 业务信息 - */ - public void validateEdit(GenTable genTable); -} diff --git a/ruoyi-generator/src/main/resources/mapper/generator/GenTableMapper.xml b/ruoyi-generator/src/main/resources/mapper/generator/GenTableMapper.xml index db722886f2..33b8f56a26 100644 --- a/ruoyi-generator/src/main/resources/mapper/generator/GenTableMapper.xml +++ b/ruoyi-generator/src/main/resources/mapper/generator/GenTableMapper.xml @@ -54,67 +54,4 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" where t.table_name = #{tableName} order by c.sort - - insert into gen_table ( - table_name, - table_comment, - class_name, - tpl_category, - package_name, - module_name, - business_name, - function_name, - function_author, - gen_type, - gen_path, - remark, - create_by, - create_time - )values( - #{tableName}, - #{tableComment}, - #{className}, - #{tplCategory}, - #{packageName}, - #{moduleName}, - #{businessName}, - #{functionName}, - #{functionAuthor}, - #{genType}, - #{genPath}, - #{remark}, - #{createBy}, - sysdate() - ) - - - - update gen_table - - table_name = #{tableName}, - table_comment = #{tableComment}, - class_name = #{className}, - function_author = #{functionAuthor}, - gen_type = #{genType}, - gen_path = #{genPath}, - tpl_category = #{tplCategory}, - package_name = #{packageName}, - module_name = #{moduleName}, - business_name = #{businessName}, - function_name = #{functionName}, - options = #{options}, - update_by = #{updateBy}, - remark = #{remark}, - update_time = sysdate() - - where table_id = #{tableId} - - - - delete from gen_table where table_id in - - #{tableId} - - - diff --git a/ruoyi-ui/src/api/tool/codegen.js b/ruoyi-ui/src/api/tool/codegen.js index dc09a8098c..3b5eaf911e 100644 --- a/ruoyi-ui/src/api/tool/codegen.js +++ b/ruoyi-ui/src/api/tool/codegen.js @@ -3,7 +3,7 @@ import request from '@/utils/request' // 获得表定义分页 export function getCodeGenTablePage(query) { return request({ - url: '/tool/codegen/page', + url: '/tool/codegen/table/page', method: 'get', params: query }) @@ -16,3 +16,12 @@ export function getCodeGenDetail(tableId) { method: 'get', }) } + +// 修改代码生成信息 +export function updateCodegen(data) { + return request({ + url: '/tool/codegen/update', + method: 'put', + data: data + }) +} diff --git a/ruoyi-ui/src/api/tool/gen.js b/ruoyi-ui/src/api/tool/gen.js index 1ca718fb28..fe7d7fa499 100644 --- a/ruoyi-ui/src/api/tool/gen.js +++ b/ruoyi-ui/src/api/tool/gen.js @@ -9,23 +9,6 @@ export function listDbTable(query) { }) } -// 查询表详细信息 -export function getGenTable(tableId) { - return request({ - url: '/tool/gen/' + tableId, - method: 'get' - }) -} - -// 修改代码生成信息 -export function updateGenTable(data) { - return request({ - url: '/tool/gen', - method: 'put', - data: data - }) -} - // 导入表 export function importTable(data) { return request({ diff --git a/ruoyi-ui/src/utils/constants.js b/ruoyi-ui/src/utils/constants.js index ac05b64a8c..586e2de1db 100644 --- a/ruoyi-ui/src/utils/constants.js +++ b/ruoyi-ui/src/utils/constants.js @@ -39,3 +39,12 @@ export const SysDataScopeEnum = { DEPT_AND_CHILD: 4, // 部门及以下数据权限 DEPT_SELF: 5 // 仅本人数据权限 } + +/** + * 代码生成模板类型 + */ +export const ToolCodegenTemplateTypeEnum = { + CRUD: 1, // 基础 CRUD + TREE: 2, // 树形 CRUD + SUB: 3, // 主子表 CRUD +} diff --git a/ruoyi-ui/src/utils/dict.js b/ruoyi-ui/src/utils/dict.js index 538c7a4570..ed71a09b3a 100644 --- a/ruoyi-ui/src/utils/dict.js +++ b/ruoyi-ui/src/utils/dict.js @@ -16,7 +16,9 @@ export const DICT_TYPE = { SYS_LOGIN_RESULT: 'sys_login_result', SYS_CONFIG_TYPE: 'sys_config_type', - INF_REDIS_TIMEOUT_TYPE: 'inf_redis_timeout_type' + INF_REDIS_TIMEOUT_TYPE: 'inf_redis_timeout_type', + + TOOL_CODEGEN_TEMPLATE_TYPE: 'tool_codegen_template_type', } /** diff --git a/ruoyi-ui/src/views/tool/gen/editTable.vue b/ruoyi-ui/src/views/tool/gen/editTable.vue index ac661d702c..5e45188a67 100644 --- a/ruoyi-ui/src/views/tool/gen/editTable.vue +++ b/ruoyi-ui/src/views/tool/gen/editTable.vue @@ -98,13 +98,11 @@ @@ -128,9 +126,8 @@