Merge branch 'master' of https://gitee.com/y_project/RuoYi-Vue
Conflicts:
ruoyi-common/src/main/java/com/ruoyi/common/constant/GenConstants.java
ruoyi-generator/src/main/java/com/ruoyi/generator/controller/GenController.java
ruoyi-generator/src/main/java/com/ruoyi/generator/domain/GenTable.java
ruoyi-generator/src/main/java/com/ruoyi/generator/domain/GenTableColumn.java
ruoyi-generator/src/main/java/com/ruoyi/generator/mapper/GenTableMapper.java
ruoyi-generator/src/main/java/com/ruoyi/generator/service/GenTableServiceImpl.java
ruoyi-generator/src/main/java/com/ruoyi/generator/service/IGenTableService.java
ruoyi-generator/src/main/java/com/ruoyi/generator/util/VelocityInitializer.java
ruoyi-generator/src/main/java/com/ruoyi/generator/util/VelocityUtils.java
ruoyi-generator/src/main/resources/mapper/generator/GenTableMapper.xml
ruoyi-generator/src/main/resources/vm/java/controller.java.vm
ruoyi-generator/src/main/resources/vm/java/domain.java.vm
ruoyi-generator/src/main/resources/vm/java/mapper.java.vm
ruoyi-generator/src/main/resources/vm/java/serviceImpl.java.vm
ruoyi-generator/src/main/resources/vm/vue/index.vue.vm
ruoyi-generator/src/main/resources/vm/xml/mapper.xml.vm
ruoyi-ui/src/views/system/user/index.vue
ruoyi-ui/src/views/tool/gen/editTable.vue
ruoyi-ui/src/views/tool/gen/genInfoForm.vue
ruoyi-ui/src/views/tool/gen/index.vue
sql/ry_20210108.sql
已修改22个文件
已添加1个文件
已重命名1个文件
已删除1个文件
| | |
| | | <project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
|
| | | <java.version>1.8</java.version>
|
| | | <maven-jar-plugin.version>3.1.1</maven-jar-plugin.version>
|
| | | <druid.version>1.2.2</druid.version>
|
| | | <druid.version>1.2.4</druid.version>
|
| | | <bitwalker.version>1.21</bitwalker.version>
|
| | | <swagger.version>2.9.2</swagger.version>
|
| | | <kaptcha.version>2.3.2</kaptcha.version>
|
| | |
| | | /** æ 表ï¼å¢å æ¹æ¥ï¼ */ |
| | | public static final String TPL_TREE = "tree"; |
| | | |
| | | /** 主å表ï¼å¢å æ¹æ¥ï¼ */ |
| | | public static final String TPL_SUB = "sub"; |
| | | |
| | | /** æ ç¼ç åæ®µ */ |
| | | public static final String TREE_CODE = "treeCode"; |
| | | |
| | |
| | | }
|
| | | else
|
| | | {
|
| | | if ((Double) val % 1 > 0)
|
| | | if ((Double) val % 1 != 0)
|
| | | {
|
| | | val = new BigDecimal(val.toString());
|
| | | }
|
| | |
| | | public AjaxResult getInfo(@PathVariable Long talbleId) |
| | | { |
| | | GenTable table = genTableService.selectGenTableById(talbleId); |
| | | List<GenTable> tables = genTableService.selectGenTableAll(); |
| | | List<GenTableColumn> list = genTableColumnService.selectGenTableColumnListByTableId(talbleId); |
| | | Map<String, Object> map = new HashMap<String, Object>(); |
| | | map.put("info", table); |
| | | map.put("rows", list); |
| | | map.put("tables", tables); |
| | | return AjaxResult.success(map); |
| | | } |
| | | |
| | |
| | | @NotBlank(message = "表æè¿°ä¸è½ä¸ºç©º") |
| | | private String tableComment; |
| | | |
| | | /** å
³èç¶è¡¨ç表å */ |
| | | private String subTableName; |
| | | |
| | | /** æ¬è¡¨å
³èç¶è¡¨çå¤é®å */ |
| | | private String subTableFkName; |
| | | |
| | | /** å®ä½ç±»åç§°(é¦åæ¯å¤§å) */ |
| | | @NotBlank(message = "å®ä½ç±»åç§°ä¸è½ä¸ºç©º") |
| | | private String className; |
| | | |
| | | /** 使ç¨ç模æ¿ï¼crudå表æä½ treeæ 表æä½ï¼ */ |
| | | /** 使ç¨ç模æ¿ï¼crudå表æä½ treeæ 表æä½ sub主å表æä½ï¼ */ |
| | | private String tplCategory; |
| | | |
| | | /** çæå
è·¯å¾ */ |
| | |
| | | |
| | | /** 主é®ä¿¡æ¯ */ |
| | | private GenTableColumn pkColumn; |
| | | |
| | | /** åè¡¨ä¿¡æ¯ */ |
| | | private GenTable subTable; |
| | | |
| | | /** 表åä¿¡æ¯ */ |
| | | @Valid |
| | |
| | | public void setTableComment(String tableComment) |
| | | { |
| | | this.tableComment = tableComment; |
| | | } |
| | | |
| | | public String getSubTableName() |
| | | { |
| | | return subTableName; |
| | | } |
| | | |
| | | public void setSubTableName(String subTableName) |
| | | { |
| | | this.subTableName = subTableName; |
| | | } |
| | | |
| | | public String getSubTableFkName() |
| | | { |
| | | return subTableFkName; |
| | | } |
| | | |
| | | public void setSubTableFkName(String subTableFkName) |
| | | { |
| | | this.subTableFkName = subTableFkName; |
| | | } |
| | | |
| | | public String getClassName() |
| | |
| | | this.pkColumn = pkColumn; |
| | | } |
| | | |
| | | public GenTable getSubTable() |
| | | { |
| | | return subTable; |
| | | } |
| | | |
| | | public void setSubTable(GenTable subTable) |
| | | { |
| | | this.subTable = subTable; |
| | | } |
| | | |
| | | public List<GenTableColumn> getColumns() |
| | | { |
| | | return columns; |
| | |
| | | this.parentMenuName = parentMenuName; |
| | | } |
| | | |
| | | public boolean isSub() |
| | | { |
| | | return isSub(this.tplCategory); |
| | | } |
| | | |
| | | public static boolean isSub(String tplCategory) |
| | | { |
| | | return tplCategory != null && StringUtils.equals(GenConstants.TPL_SUB, tplCategory); |
| | | } |
| | | |
| | | public boolean isTree() |
| | | { |
| | | return isTree(this.tplCategory); |
| | |
| | | /** æ¥è¯¢æ¹å¼ï¼EQçäºãNEä¸çäºãGT大äºãLTå°äºãLIKE模ç³ãBETWEENèå´ï¼ */ |
| | | private String queryType; |
| | | |
| | | /** æ¾ç¤ºç±»åï¼inputææ¬æ¡ãtextareaææ¬åãselect䏿æ¡ãcheckboxå¤éæ¡ãradioåéæ¡ãdatetimeæ¥ææ§ä»¶ãuploadä¸ä¼ æ§ä»¶ãeditorå¯ææ¬æ§ä»¶ï¼ */ |
| | | /** æ¾ç¤ºç±»åï¼inputææ¬æ¡ãtextareaææ¬åãselect䏿æ¡ãcheckboxå¤éæ¡ãradioåéæ¡ãdatetimeæ¥ææ§ä»¶ãimageå¾çä¸ä¼ æ§ä»¶ãuploadæä»¶ä¸ä¼ æ§ä»¶ãeditorå¯ææ¬æ§ä»¶ï¼ */ |
| | | private String htmlType; |
| | | |
| | | /** åå
¸ç±»å */ |
| | |
| | | return javaField; |
| | | } |
| | | |
| | | public String getCapJavaField() |
| | | { |
| | | return StringUtils.capitalize(javaField); |
| | | } |
| | | |
| | | public void setIsPk(String isPk) |
| | | { |
| | | this.isPk = isPk; |
| | |
| | | public List<GenTable> selectDbTableListByNames(String[] tableNames); |
| | | |
| | | /** |
| | | * æ¥è¯¢ææè¡¨ä¿¡æ¯ |
| | | * |
| | | * @return 表信æ¯éå |
| | | */ |
| | | public List<GenTable> selectGenTableAll(); |
| | | |
| | | /** |
| | | * æ¥è¯¢è¡¨IDä¸å¡ä¿¡æ¯ |
| | | * |
| | | * @param id ä¸å¡ID |
| | |
| | | } |
| | | |
| | | /** |
| | | * æ¥è¯¢ææè¡¨ä¿¡æ¯ |
| | | * |
| | | * @return 表信æ¯éå |
| | | */ |
| | | @Override |
| | | public List<GenTable> selectGenTableAll() |
| | | { |
| | | return genTableMapper.selectGenTableAll(); |
| | | } |
| | | |
| | | /** |
| | | * ä¿®æ¹ä¸å¡ |
| | | * |
| | | * @param genTable ä¸å¡ä¿¡æ¯ |
| | |
| | | Map<String, String> dataMap = new LinkedHashMap<>(); |
| | | // æ¥è¯¢è¡¨ä¿¡æ¯ |
| | | GenTable table = genTableMapper.selectGenTableById(tableId); |
| | | // æ¥è¯¢åä¿¡æ¯ |
| | | List<GenTableColumn> columns = table.getColumns(); |
| | | setPkColumn(table, columns); |
| | | // 设置主åè¡¨ä¿¡æ¯ |
| | | setSubTable(table); |
| | | // 设置主é®åä¿¡æ¯ |
| | | setPkColumn(table); |
| | | VelocityInitializer.initVelocity(); |
| | | |
| | | VelocityContext context = VelocityUtils.prepareContext(table); |
| | |
| | | { |
| | | // æ¥è¯¢è¡¨ä¿¡æ¯ |
| | | GenTable table = genTableMapper.selectGenTableByName(tableName); |
| | | // æ¥è¯¢åä¿¡æ¯ |
| | | List<GenTableColumn> columns = table.getColumns(); |
| | | setPkColumn(table, columns); |
| | | // 设置主åè¡¨ä¿¡æ¯ |
| | | setSubTable(table); |
| | | // 设置主é®åä¿¡æ¯ |
| | | setPkColumn(table); |
| | | |
| | | VelocityInitializer.initVelocity(); |
| | | |
| | |
| | | List<String> tableColumnNames = tableColumns.stream().map(GenTableColumn::getColumnName).collect(Collectors.toList()); |
| | | |
| | | List<GenTableColumn> dbTableColumns = genTableColumnMapper.selectDbTableColumnsByName(tableName); |
| | | if (StringUtils.isEmpty(dbTableColumns)) |
| | | { |
| | | throw new CustomException("åæ¥æ°æ®å¤±è´¥ï¼åè¡¨ç»æä¸åå¨"); |
| | | } |
| | | List<String> dbTableColumnNames = dbTableColumns.stream().map(GenTableColumn::getColumnName).collect(Collectors.toList()); |
| | | |
| | | dbTableColumns.forEach(column -> { |
| | |
| | | { |
| | | // æ¥è¯¢è¡¨ä¿¡æ¯ |
| | | GenTable table = genTableMapper.selectGenTableByName(tableName); |
| | | // æ¥è¯¢åä¿¡æ¯ |
| | | List<GenTableColumn> columns = table.getColumns(); |
| | | setPkColumn(table, columns); |
| | | // 设置主åè¡¨ä¿¡æ¯ |
| | | setSubTable(table); |
| | | // 设置主é®åä¿¡æ¯ |
| | | setPkColumn(table); |
| | | |
| | | VelocityInitializer.initVelocity(); |
| | | |
| | |
| | | { |
| | | throw new CustomException("æ åç§°åæ®µä¸è½ä¸ºç©º"); |
| | | } |
| | | else if (GenConstants.TPL_SUB.equals(genTable.getTplCategory())) |
| | | { |
| | | if (StringUtils.isEmpty(genTable.getSubTableName())) |
| | | { |
| | | throw new CustomException("å
³èå表ç表åä¸è½ä¸ºç©º"); |
| | | } |
| | | else if (StringUtils.isEmpty(genTable.getSubTableFkName())) |
| | | { |
| | | throw new CustomException("å表å
³èçå¤é®åä¸è½ä¸ºç©º"); |
| | | } |
| | | } |
| | | } |
| | | } |
| | | |
| | |
| | | * 设置主é®åä¿¡æ¯ |
| | | * |
| | | * @param table ä¸å¡è¡¨ä¿¡æ¯ |
| | | * @param columns ä¸å¡å段å表 |
| | | */ |
| | | public void setPkColumn(GenTable table, List<GenTableColumn> columns) |
| | | public void setPkColumn(GenTable table) |
| | | { |
| | | for (GenTableColumn column : columns) |
| | | for (GenTableColumn column : table.getColumns()) |
| | | { |
| | | if (column.isPk()) |
| | | { |
| | |
| | | } |
| | | if (StringUtils.isNull(table.getPkColumn())) |
| | | { |
| | | table.setPkColumn(columns.get(0)); |
| | | table.setPkColumn(table.getColumns().get(0)); |
| | | } |
| | | if (GenConstants.TPL_SUB.equals(table.getTplCategory())) |
| | | { |
| | | for (GenTableColumn column : table.getSubTable().getColumns()) |
| | | { |
| | | if (column.isPk()) |
| | | { |
| | | table.getSubTable().setPkColumn(column); |
| | | break; |
| | | } |
| | | } |
| | | if (StringUtils.isNull(table.getSubTable().getPkColumn())) |
| | | { |
| | | table.getSubTable().setPkColumn(table.getSubTable().getColumns().get(0)); |
| | | } |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * 设置主åè¡¨ä¿¡æ¯ |
| | | * |
| | | * @param table ä¸å¡è¡¨ä¿¡æ¯ |
| | | */ |
| | | public void setSubTable(GenTable table) |
| | | { |
| | | String subTableName = table.getSubTableName(); |
| | | if (StringUtils.isNotEmpty(subTableName)) |
| | | { |
| | | table.setSubTable(genTableMapper.selectGenTableByName(subTableName)); |
| | | } |
| | | } |
| | | |
| | |
| | | public List<GenTable> selectDbTableListByNames(String[] tableNames); |
| | | |
| | | /** |
| | | * æ¥è¯¢ææè¡¨ä¿¡æ¯ |
| | | * |
| | | * @return 表信æ¯éå |
| | | */ |
| | | public List<GenTable> selectGenTableAll(); |
| | | |
| | | /** |
| | | * æ¥è¯¢ä¸å¡ä¿¡æ¯ |
| | | * |
| | | * @param id ä¸å¡ID |
| | |
| | | /** |
| | | * VelocityEngineå·¥å |
| | | * |
| | | * @author RuoYi |
| | | * @author ruoyi |
| | | */ |
| | | public class VelocityInitializer |
| | | { |
| | |
| | | velocityContext.put("author", genTable.getFunctionAuthor()); |
| | | velocityContext.put("datetime", DateUtils.getDate()); |
| | | velocityContext.put("pkColumn", genTable.getPkColumn()); |
| | | velocityContext.put("importList", getImportList(genTable.getColumns())); |
| | | velocityContext.put("importList", getImportList(genTable)); |
| | | velocityContext.put("permissionPrefix", getPermissionPrefix(moduleName, businessName)); |
| | | velocityContext.put("columns", genTable.getColumns()); |
| | | velocityContext.put("table", genTable); |
| | |
| | | if (GenConstants.TPL_TREE.equals(tplCategory)) |
| | | { |
| | | setTreeVelocityContext(velocityContext, genTable); |
| | | } |
| | | if (GenConstants.TPL_SUB.equals(tplCategory)) |
| | | { |
| | | setSubVelocityContext(velocityContext, genTable); |
| | | } |
| | | return velocityContext; |
| | | } |
| | |
| | | } |
| | | } |
| | | |
| | | public static void setSubVelocityContext(VelocityContext context, GenTable genTable) |
| | | { |
| | | GenTable subTable = genTable.getSubTable(); |
| | | String subTableName = genTable.getSubTableName(); |
| | | String subTableFkName = genTable.getSubTableFkName(); |
| | | String subClassName = genTable.getSubTable().getClassName(); |
| | | String subTableFkClassName = StringUtils.convertToCamelCase(subTableFkName); |
| | | |
| | | context.put("subTable", subTable); |
| | | context.put("subTableName", subTableName); |
| | | context.put("subTableFkName", subTableFkName); |
| | | context.put("subTableFkClassName", subTableFkClassName); |
| | | context.put("subTableFkclassName", StringUtils.uncapitalize(subTableFkClassName)); |
| | | context.put("subClassName", subClassName); |
| | | context.put("subclassName", StringUtils.uncapitalize(subClassName)); |
| | | context.put("subImportList", getImportList(genTable.getSubTable())); |
| | | } |
| | | |
| | | /** |
| | | * è·å模æ¿ä¿¡æ¯ |
| | | * |
| | |
| | | else if (GenConstants.TPL_TREE.equals(tplCategory)) |
| | | { |
| | | templates.add("vm/vue/index-tree.vue.vm"); |
| | | } |
| | | else if (GenConstants.TPL_SUB.equals(tplCategory)) |
| | | { |
| | | templates.add("vm/vue/index.vue.vm"); |
| | | templates.add("vm/java/sub-domain.java.vm"); |
| | | } |
| | | return templates; |
| | | } |
| | |
| | | if (template.contains("domain.java.vm")) |
| | | { |
| | | fileName = StringUtils.format("{}/domain/{}.java", javaPath, className); |
| | | } |
| | | if (template.contains("sub-domain.java.vm") && StringUtils.equals(GenConstants.TPL_SUB, genTable.getTplCategory())) |
| | | { |
| | | fileName = StringUtils.format("{}/domain/{}.java", javaPath, genTable.getSubTable().getClassName()); |
| | | } |
| | | else if (template.contains("mapper.java.vm")) |
| | | { |
| | |
| | | /** |
| | | * æ ¹æ®åç±»åè·å导å
¥å
|
| | | * |
| | | * @param columns åéå |
| | | * @param genTable ä¸å¡è¡¨å¯¹è±¡ |
| | | * @return è¿åéè¦å¯¼å
¥çå
å表 |
| | | */ |
| | | public static HashSet<String> getImportList(List<GenTableColumn> columns) |
| | | public static HashSet<String> getImportList(GenTable genTable) |
| | | { |
| | | List<GenTableColumn> columns = genTable.getColumns(); |
| | | GenTable subGenTable = genTable.getSubTable(); |
| | | HashSet<String> importList = new HashSet<String>(); |
| | | if (StringUtils.isNotNull(subGenTable)) |
| | | { |
| | | importList.add("java.util.List"); |
| | | } |
| | | for (GenTableColumn column : columns) |
| | | { |
| | | if (!column.isSuperColumn() && GenConstants.TYPE_DATE.equals(column.getJavaType())) |
| | |
| | | <mapper namespace="com.ruoyi.generator.mapper.GenTableMapper"> |
| | | |
| | | <resultMap type="GenTable" id="GenTableResult"> |
| | | <id property="tableId" column="table_id" /> |
| | | <result property="tableName" column="table_name" /> |
| | | <result property="tableComment" column="table_comment" /> |
| | | <result property="className" column="class_name" /> |
| | | <result property="tplCategory" column="tpl_category" /> |
| | | <result property="packageName" column="package_name" /> |
| | | <result property="moduleName" column="module_name" /> |
| | | <result property="businessName" column="business_name" /> |
| | | <result property="functionName" column="function_name" /> |
| | | <result property="functionAuthor" column="function_author" /> |
| | | <result property="genType" column="gen_type" /> |
| | | <result property="genPath" column="gen_path" /> |
| | | <result property="options" column="options" /> |
| | | <result property="createBy" column="create_by" /> |
| | | <result property="createTime" column="create_time" /> |
| | | <result property="updateBy" column="update_by" /> |
| | | <result property="updateTime" column="update_time" /> |
| | | <result property="remark" column="remark" /> |
| | | <id property="tableId" column="table_id" /> |
| | | <result property="tableName" column="table_name" /> |
| | | <result property="tableComment" column="table_comment" /> |
| | | <result property="subTableName" column="sub_table_name" /> |
| | | <result property="subTableFkName" column="sub_table_fk_name" /> |
| | | <result property="className" column="class_name" /> |
| | | <result property="tplCategory" column="tpl_category" /> |
| | | <result property="packageName" column="package_name" /> |
| | | <result property="moduleName" column="module_name" /> |
| | | <result property="businessName" column="business_name" /> |
| | | <result property="functionName" column="function_name" /> |
| | | <result property="functionAuthor" column="function_author" /> |
| | | <result property="genType" column="gen_type" /> |
| | | <result property="genPath" column="gen_path" /> |
| | | <result property="options" column="options" /> |
| | | <result property="createBy" column="create_by" /> |
| | | <result property="createTime" column="create_time" /> |
| | | <result property="updateBy" column="update_by" /> |
| | | <result property="updateTime" column="update_time" /> |
| | | <result property="remark" column="remark" /> |
| | | <collection property="columns" javaType="java.util.List" resultMap="GenTableColumnResult" /> |
| | | </resultMap> |
| | | |
| | |
| | | </resultMap> |
| | | |
| | | <sql id="selectGenTableVo"> |
| | | 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 |
| | | select table_id, table_name, table_comment, sub_table_name, sub_table_fk_name, 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 |
| | | </sql> |
| | | |
| | | <select id="selectGenTableList" parameterType="GenTable" resultMap="GenTableResult"> |
| | |
| | | </select> |
| | | |
| | | <select id="selectGenTableById" parameterType="Long" resultMap="GenTableResult"> |
| | | SELECT t.table_id, t.table_name, t.table_comment, t.class_name, t.tpl_category, t.package_name, t.module_name, t.business_name, t.function_name, t.function_author, t.gen_type, t.gen_path, t.options, t.remark, |
| | | SELECT t.table_id, t.table_name, t.table_comment, t.sub_table_name, t.sub_table_fk_name, t.class_name, t.tpl_category, t.package_name, t.module_name, t.business_name, t.function_name, t.function_author, t.gen_type, t.gen_path, t.options, t.remark, |
| | | c.column_id, c.column_name, c.column_comment, c.column_type, c.java_type, c.java_field, c.is_pk, c.is_increment, c.is_required, c.is_insert, c.is_edit, c.is_list, c.is_query, c.query_type, c.html_type, c.dict_type, c.sort |
| | | FROM gen_table t |
| | | LEFT JOIN gen_table_column c ON t.table_id = c.table_id |
| | |
| | | </select> |
| | | |
| | | <select id="selectGenTableByName" parameterType="String" resultMap="GenTableResult"> |
| | | SELECT t.table_id, t.table_name, t.table_comment, t.class_name, t.tpl_category, t.package_name, t.module_name, t.business_name, t.function_name, t.function_author, t.gen_type, t.gen_path, t.options, t.remark, |
| | | SELECT t.table_id, t.table_name, t.table_comment, t.sub_table_name, t.sub_table_fk_name, t.class_name, t.tpl_category, t.package_name, t.module_name, t.business_name, t.function_name, t.function_author, t.gen_type, t.gen_path, t.options, t.remark, |
| | | c.column_id, c.column_name, c.column_comment, c.column_type, c.java_type, c.java_field, c.is_pk, c.is_increment, c.is_required, c.is_insert, c.is_edit, c.is_list, c.is_query, c.query_type, c.html_type, c.dict_type, c.sort |
| | | FROM gen_table t |
| | | LEFT JOIN gen_table_column c ON t.table_id = c.table_id |
| | | where t.table_name = #{tableName} order by c.sort |
| | | </select> |
| | | |
| | | |
| | | <select id="selectGenTableAll" parameterType="String" resultMap="GenTableResult"> |
| | | SELECT t.table_id, t.table_name, t.table_comment, t.sub_table_name, t.sub_table_fk_name, t.class_name, t.tpl_category, t.package_name, t.module_name, t.business_name, t.function_name, t.function_author, t.options, t.remark, |
| | | c.column_id, c.column_name, c.column_comment, c.column_type, c.java_type, c.java_field, c.is_pk, c.is_increment, c.is_required, c.is_insert, c.is_edit, c.is_list, c.is_query, c.query_type, c.html_type, c.dict_type, c.sort |
| | | FROM gen_table t |
| | | LEFT JOIN gen_table_column c ON t.table_id = c.table_id |
| | | order by c.sort |
| | | </select> |
| | | |
| | | <insert id="insertGenTable" parameterType="GenTable" useGeneratedKeys="true" keyProperty="tableId"> |
| | | insert into gen_table ( |
| | | <if test="tableName != null">table_name,</if> |
| | |
| | | <set> |
| | | <if test="tableName != null">table_name = #{tableName},</if> |
| | | <if test="tableComment != null and tableComment != ''">table_comment = #{tableComment},</if> |
| | | <if test="subTableName != null">sub_table_name = #{subTableName},</if> |
| | | <if test="subTableFkName != null">sub_table_fk_name = #{subTableFkName},</if> |
| | | <if test="className != null and className != ''">class_name = #{className},</if> |
| | | <if test="functionAuthor != null and functionAuthor != ''">function_author = #{functionAuthor},</if> |
| | | <if test="genType != null and genType != ''">gen_type = #{genType},</if> |
| | |
| | | import ${packageName}.domain.${ClassName}; |
| | | import ${packageName}.service.I${ClassName}Service; |
| | | import com.ruoyi.common.utils.poi.ExcelUtil; |
| | | #if($table.crud) |
| | | #if($table.crud || $table.sub) |
| | | import com.ruoyi.common.core.page.TableDataInfo; |
| | | #elseif($table.tree) |
| | | #end |
| | |
| | | */ |
| | | @PreAuthorize("@ss.hasPermi('${permissionPrefix}:list')") |
| | | @GetMapping("/list") |
| | | #if($table.crud) |
| | | #if($table.crud || $table.sub) |
| | | public TableDataInfo list(${ClassName} ${className}) { |
| | | startPage(); |
| | | List<${ClassName}> list = i${ClassName}Service.queryList(${className}); |
| | |
| | | #set($AttrName=$column.javaField.substring(0,1).toUpperCase() + ${column.javaField.substring(1)}) |
| | | #if($column.query) |
| | | #if($column.queryType == "EQ") |
| | | #if($javaType == 'String') |
| | | #if($javaType == 'String') |
| | | if (StringUtils.isNotBlank(${className}.get$AttrName())){ |
| | | lqw.eq(${ClassName}::get$AttrName ,${className}.get$AttrName()); |
| | | } |
| | | #else |
| | | #else |
| | | if (${className}.get$AttrName() != null){ |
| | | lqw.eq(${ClassName}::get$AttrName ,${className}.get$AttrName()); |
| | | } |
| | | #end |
| | | #elseif($queryType == "NE") |
| | | #if($javaType == 'String') |
| | | #if($javaType == 'String') |
| | | if (StringUtils.isNotBlank(${className}.get$AttrName())){ |
| | | lqw.ne(${ClassName}::get$AttrName ,${className}.get$AttrName()); |
| | | } |
| | | #else |
| | | #else |
| | | if (${className}.get$AttrName() != null){ |
| | | lqw.ne(${ClassName}::get$AttrName ,${className}.get$AttrName()); |
| | | } |
| | | #end |
| | | #end |
| | | #elseif($queryType == "GT") |
| | | #if($javaType == 'String') |
| | | #if($javaType == 'String') |
| | | if (StringUtils.isNotBlank(${className}.get$AttrName())){ |
| | | lqw.gt(${ClassName}::get$AttrName ,${className}.get$AttrName()); |
| | | } |
| | | #else |
| | | #else |
| | | if (${className}.get$AttrName() != null){ |
| | | lqw.gt(${ClassName}::get$AttrName ,${className}.get$AttrName()); |
| | | } |
| | | #end |
| | | #elseif($queryType == "GTE") |
| | | #if($javaType == 'String') |
| | | #if($javaType == 'String') |
| | | if (StringUtils.isNotBlank(${className}.get$AttrName())){ |
| | | lqw.ge(${ClassName}::get$AttrName ,${className}.get$AttrName()); |
| | | } |
| | | #else |
| | | #else |
| | | if (${className}.get$AttrName() != null){ |
| | | lqw.ge(${ClassName}::get$AttrName ,${className}.get$AttrName()); |
| | | } |
| | | #end |
| | | #elseif($queryType == "LT") |
| | | #if($javaType == 'String') |
| | | #if($javaType == 'String') |
| | | if (StringUtils.isNotBlank(${className}.get$AttrName())){ |
| | | lqw.lt(${ClassName}::get$AttrName ,${className}.get$AttrName()); |
| | | } |
| | | #else |
| | | #else |
| | | if (${className}.get$AttrName() != null){ |
| | | lqw.lt(${ClassName}::get$AttrName ,${className}.get$AttrName()); |
| | | } |
¶Ô±ÈÐÂÎļþ |
| | |
| | | package ${packageName}.domain;
|
| | |
|
| | | #foreach ($import in $subImportList)
|
| | | import ${import};
|
| | | #end
|
| | | import org.apache.commons.lang3.builder.ToStringBuilder;
|
| | | import org.apache.commons.lang3.builder.ToStringStyle;
|
| | | import com.ruoyi.common.annotation.Excel;
|
| | | import com.ruoyi.common.core.domain.BaseEntity;
|
| | |
|
| | | /**
|
| | | * ${subTable.functionName}对象 ${subTableName}
|
| | | * |
| | | * @author ${author}
|
| | | * @date ${datetime}
|
| | | */
|
| | | public class ${subClassName} extends BaseEntity
|
| | | {
|
| | | private static final long serialVersionUID = 1L;
|
| | |
|
| | | #foreach ($column in $subTable.columns)
|
| | | #if(!$table.isSuperColumn($column.javaField))
|
| | | /** $column.columnComment */
|
| | | #if($column.list)
|
| | | #set($parentheseIndex=$column.columnComment.indexOf("ï¼"))
|
| | | #if($parentheseIndex != -1)
|
| | | #set($comment=$column.columnComment.substring(0, $parentheseIndex))
|
| | | #else
|
| | | #set($comment=$column.columnComment)
|
| | | #end
|
| | | #if($parentheseIndex != -1)
|
| | | @Excel(name = "${comment}", readConverterExp = "$column.readConverterExp()")
|
| | | #elseif($column.javaType == 'Date')
|
| | | @JsonFormat(pattern = "yyyy-MM-dd")
|
| | | @Excel(name = "${comment}", width = 30, dateFormat = "yyyy-MM-dd")
|
| | | #else
|
| | | @Excel(name = "${comment}")
|
| | | #end
|
| | | #end
|
| | | private $column.javaType $column.javaField;
|
| | |
|
| | | #end
|
| | | #end
|
| | | #foreach ($column in $subTable.columns)
|
| | | #if(!$table.isSuperColumn($column.javaField))
|
| | | #if($column.javaField.length() > 2 && $column.javaField.substring(1,2).matches("[A-Z]"))
|
| | | #set($AttrName=$column.javaField)
|
| | | #else
|
| | | #set($AttrName=$column.javaField.substring(0,1).toUpperCase() + ${column.javaField.substring(1)})
|
| | | #end
|
| | | public void set${AttrName}($column.javaType $column.javaField) |
| | | {
|
| | | this.$column.javaField = $column.javaField;
|
| | | }
|
| | |
|
| | | public $column.javaType get${AttrName}() |
| | | {
|
| | | return $column.javaField;
|
| | | }
|
| | | #end
|
| | | #end
|
| | |
|
| | | @Override
|
| | | public String toString() {
|
| | | return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
|
| | | #foreach ($column in $subTable.columns)
|
| | | #if($column.javaField.length() > 2 && $column.javaField.substring(1,2).matches("[A-Z]"))
|
| | | #set($AttrName=$column.javaField)
|
| | | #else
|
| | | #set($AttrName=$column.javaField.substring(0,1).toUpperCase() + ${column.javaField.substring(1)})
|
| | | #end
|
| | | .append("${column.javaField}", get${AttrName}())
|
| | | #end
|
| | | .toString();
|
| | | }
|
| | | }
|
| | |
| | | <el-col :span="1.5">
|
| | | <el-button
|
| | | type="primary"
|
| | | plain
|
| | | plain
|
| | | icon="el-icon-plus"
|
| | | size="mini"
|
| | | @click="handleAdd"
|
| | |
| | | </el-form-item>
|
| | | #elseif($column.htmlType == "fileUpload")
|
| | | <el-form-item label="${comment}">
|
| | | <imageUpload v-model="form.${field}"/>
|
| | | <fileUpload v-model="form.${field}"/>
|
| | | </el-form-item>
|
| | | #elseif($column.htmlType == "editor")
|
| | | <el-form-item label="${comment}">
|
| | |
| | | <el-col :span="1.5"> |
| | | <el-button |
| | | type="primary" |
| | | plain |
| | | plain |
| | | icon="el-icon-plus" |
| | | size="mini" |
| | | @click="handleAdd" |
| | |
| | | <el-col :span="1.5"> |
| | | <el-button |
| | | type="success" |
| | | plain |
| | | plain |
| | | icon="el-icon-edit" |
| | | size="mini" |
| | | :disabled="single" |
| | |
| | | <el-col :span="1.5"> |
| | | <el-button |
| | | type="danger" |
| | | plain |
| | | plain |
| | | icon="el-icon-delete" |
| | | size="mini" |
| | | :disabled="multiple" |
| | |
| | | <el-col :span="1.5"> |
| | | <el-button |
| | | type="warning" |
| | | plain |
| | | plain |
| | | icon="el-icon-download" |
| | | size="mini" |
| | | @click="handleExport" |
| | |
| | | #end |
| | | #end |
| | | #end |
| | | #if($table.sub) |
| | | <el-divider content-position="center">${subTable.functionName}ä¿¡æ¯</el-divider> |
| | | <el-row :gutter="10" class="mb8"> |
| | | <el-col :span="1.5"> |
| | | <el-button type="primary" icon="el-icon-plus" size="mini" @click="handleAdd${subClassName}">æ·»å </el-button> |
| | | </el-col> |
| | | <el-col :span="1.5"> |
| | | <el-button type="danger" icon="el-icon-delete" size="mini" @click="handleDelete${subClassName}">å é¤</el-button> |
| | | </el-col> |
| | | </el-row> |
| | | <el-table :data="${subclassName}List" :row-class-name="row${subClassName}Index" @selection-change="handle${subClassName}SelectionChange" ref="${subclassName}"> |
| | | <el-table-column type="selection" width="50" align="center" /> |
| | | <el-table-column label="åºå·" align="center" prop="index" width="50"/> |
| | | #foreach($column in $subTable.columns) |
| | | #set($javaField=$column.javaField) |
| | | #set($parentheseIndex=$column.columnComment.indexOf("ï¼")) |
| | | #if($parentheseIndex != -1) |
| | | #set($comment=$column.columnComment.substring(0, $parentheseIndex)) |
| | | #else |
| | | #set($comment=$column.columnComment) |
| | | #end |
| | | #if($column.pk || $javaField == ${subTableFkclassName}) |
| | | #elseif($column.list && "" != $javaField) |
| | | <el-table-column label="$comment" prop="${javaField}"> |
| | | <template slot-scope="scope"> |
| | | <el-input v-model="scope.row.$javaField" placeholder="请è¾å
¥$comment" /> |
| | | </template> |
| | | </el-table-column> |
| | | #end |
| | | #end |
| | | </el-table> |
| | | #end |
| | | </el-form> |
| | | <div slot="footer" class="dialog-footer"> |
| | | <el-button type="primary" @click="submitForm">ç¡® å®</el-button> |
| | |
| | | loading: true, |
| | | // é䏿°ç» |
| | | ids: [], |
| | | #if($table.sub) |
| | | // å表é䏿°æ® |
| | | checked${subClassName}: [], |
| | | #end |
| | | // éå个ç¦ç¨ |
| | | single: true, |
| | | // éå¤ä¸ªç¦ç¨ |
| | |
| | | total: 0, |
| | | // ${functionName}è¡¨æ ¼æ°æ® |
| | | ${businessName}List: [], |
| | | #if($table.sub) |
| | | // ${subTable.functionName}è¡¨æ ¼æ°æ® |
| | | ${subclassName}List: [], |
| | | #end |
| | | // å¼¹åºå±æ é¢ |
| | | title: "", |
| | | // æ¯å¦æ¾ç¤ºå¼¹åºå± |
| | |
| | | #end |
| | | #end |
| | | }; |
| | | #if($table.sub) |
| | | this.${subclassName}List = []; |
| | | #end |
| | | this.resetForm("form"); |
| | | }, |
| | | /** æç´¢æé®æä½ */ |
| | |
| | | this.form.$column.javaField = this.form.${column.javaField}.split(","); |
| | | #end |
| | | #end |
| | | #if($table.sub) |
| | | this.${subclassName}List = response.data.${subclassName}List; |
| | | #end |
| | | this.open = true; |
| | | this.title = "ä¿®æ¹${functionName}"; |
| | | }); |
| | |
| | | #if($column.htmlType == "checkbox") |
| | | this.form.$column.javaField = this.form.${column.javaField}.join(","); |
| | | #end |
| | | #end |
| | | #if($table.sub) |
| | | this.form.${subclassName}List = this.${subclassName}List; |
| | | #end |
| | | if (this.form.${pkColumn.javaField} != null) { |
| | | update${BusinessName}(this.form).then(response => { |
| | |
| | | this.msgSuccess("å 餿å"); |
| | | }) |
| | | }, |
| | | #if($table.sub) |
| | | /** ${subTable.functionName}åºå· */ |
| | | row${subClassName}Index({ row, rowIndex }) { |
| | | row.index = rowIndex + 1; |
| | | }, |
| | | /** ${subTable.functionName}æ·»å æé®æä½ */ |
| | | handleAdd${subClassName}() { |
| | | let obj = {}; |
| | | #foreach($column in $subTable.columns) |
| | | #if($column.pk || $column.javaField == ${subTableFkclassName}) |
| | | #elseif($column.list && "" != $javaField) |
| | | obj.$column.javaField = ""; |
| | | #end |
| | | #end |
| | | this.${subclassName}List.push(obj); |
| | | }, |
| | | /** ${subTable.functionName}å é¤æé®æä½ */ |
| | | handleDelete${subClassName}() { |
| | | if (this.checked${subClassName}.length == 0) { |
| | | this.$alert("请å
éæ©è¦å é¤ç${subTable.functionName}æ°æ®", "æç¤º", { confirmButtonText: "ç¡®å®", }); |
| | | } else { |
| | | this.${subclassName}List.splice(this.checked${subClassName}[0].index - 1, 1); |
| | | } |
| | | }, |
| | | /** åéæ¡é䏿°æ® */ |
| | | handle${subClassName}SelectionChange(selection) { |
| | | if (selection.length > 1) { |
| | | this.$refs.${subclassName}.clearSelection(); |
| | | this.$refs.${subclassName}.toggleRowSelection(selection.pop()); |
| | | } else { |
| | | this.checked${subClassName} = selection; |
| | | } |
| | | }, |
| | | #end |
| | | /** å¯¼åºæé®æä½ */ |
| | | handleExport() { |
| | | const queryParams = this.queryParams; |
| | |
| | | return item;
|
| | | });
|
| | | } else {
|
| | | this.fileList = [];
|
| | | return [];
|
| | | }
|
| | | },
|
| | |
| | | <!-- @author Shiyn/ huangmx 20200807ä¼å-->
|
| | | <template>
|
| | | <div class="top-right-btn">
|
| | | <el-row>
|
| | |
| | | <el-tooltip class="item" effect="dark" content="å·æ°" placement="top">
|
| | | <el-button size="mini" circle icon="el-icon-refresh" @click="refresh()" />
|
| | | </el-tooltip>
|
| | | <el-tooltip class="item" effect="dark" content="æ¾éå" placement="top" v-if="columns">
|
| | | <el-button size="mini" circle icon="el-icon-menu" @click="showColumn()" />
|
| | | </el-tooltip>
|
| | | </el-row>
|
| | | <el-dialog :title="title" :visible.sync="open" append-to-body>
|
| | | <el-transfer
|
| | | :titles="['æ¾ç¤º', 'éè']"
|
| | | v-model="value"
|
| | | :data="columns"
|
| | | @change="dataChange"
|
| | | ></el-transfer>
|
| | | </el-dialog>
|
| | | </div>
|
| | | </template>
|
| | | <script>
|
| | | export default {
|
| | | name: "RightToolbar",
|
| | | data() {
|
| | | return {};
|
| | | return {
|
| | | // æ¾éæ°æ®
|
| | | value: [],
|
| | | // å¼¹åºå±æ é¢
|
| | | title: "æ¾ç¤º/éè",
|
| | | // æ¯å¦æ¾ç¤ºå¼¹åºå±
|
| | | open: false,
|
| | | };
|
| | | },
|
| | | props: {
|
| | | showSearch: {
|
| | | type: Boolean,
|
| | | default: true,
|
| | | },
|
| | | columns: {
|
| | | type: Array,
|
| | | },
|
| | | },
|
| | |
|
| | | methods: {
|
| | | //æç´¢
|
| | | // æç´¢
|
| | | toggleSearch() {
|
| | | this.$emit("update:showSearch", !this.showSearch);
|
| | | },
|
| | | //å·æ°
|
| | | // å·æ°
|
| | | refresh() {
|
| | | this.$emit("queryTable");
|
| | | },
|
| | | // å³ä¾§å表å
ç´ åå
|
| | | dataChange(data) {
|
| | | for (var item in this.columns) {
|
| | | const key = this.columns[item].key;
|
| | | this.columns[item].visible = !data.includes(key);
|
| | | }
|
| | | },
|
| | | // æå¼æ¾éådialog
|
| | | showColumn() {
|
| | | this.open = true;
|
| | | },
|
| | | },
|
| | | };
|
| | | </script>
|
| | | <style lang="scss" scoped>
|
| | | ::v-deep .el-transfer__button {
|
| | | border-radius: 50%;
|
| | | padding: 12px;
|
| | | display: block;
|
| | | margin-left: 0px;
|
| | | }
|
| | | ::v-deep .el-transfer__button:first-child {
|
| | | margin-bottom: 10px;
|
| | | }
|
| | | </style>
|
| | |
| | | v-hasPermi="['system:user:export']" |
| | | >导åº</el-button> |
| | | </el-col> |
| | | <right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar> |
| | | <right-toolbar :showSearch.sync="showSearch" @queryTable="getList" :columns="columns"></right-toolbar> |
| | | </el-row> |
| | | |
| | | <el-table v-loading="loading" :data="userList" @selection-change="handleSelectionChange"> |
| | | <el-table-column type="selection" width="50" align="center" /> |
| | | <el-table-column label="ç¨æ·ç¼å·" align="center" prop="userId" /> |
| | | <el-table-column label="ç¨æ·åç§°" align="center" prop="userName" :show-overflow-tooltip="true" /> |
| | | <el-table-column label="ç¨æ·æµç§°" align="center" prop="nickName" :show-overflow-tooltip="true" /> |
| | | <el-table-column label="é¨é¨" align="center" prop="dept.deptName" :show-overflow-tooltip="true" /> |
| | | <el-table-column label="ææºå·ç " align="center" prop="phonenumber" width="120" /> |
| | | <el-table-column label="ç¶æ" align="center"> |
| | | <el-table-column label="ç¨æ·ç¼å·" align="center" key="userId" prop="userId" v-if="columns[0].visible" /> |
| | | <el-table-column label="ç¨æ·åç§°" align="center" key="userName" prop="userName" v-if="columns[1].visible" :show-overflow-tooltip="true" /> |
| | | <el-table-column label="ç¨æ·æµç§°" align="center" key="nickName" prop="nickName" v-if="columns[2].visible" :show-overflow-tooltip="true" /> |
| | | <el-table-column label="é¨é¨" align="center" key="deptName" prop="dept.deptName" v-if="columns[3].visible" :show-overflow-tooltip="true" /> |
| | | <el-table-column label="ææºå·ç " align="center" key="phonenumber" prop="phonenumber" v-if="columns[4].visible" width="120" /> |
| | | <el-table-column label="ç¶æ" align="center" key="status" v-if="columns[5].visible"> |
| | | <template slot-scope="scope"> |
| | | <el-switch |
| | | v-model="scope.row.status" |
| | |
| | | ></el-switch> |
| | | </template> |
| | | </el-table-column> |
| | | <el-table-column label="å建æ¶é´" align="center" prop="createTime" width="160"> |
| | | <el-table-column label="å建æ¶é´" align="center" prop="createTime" v-if="columns[6].visible" width="160"> |
| | | <template slot-scope="scope"> |
| | | <span>{{ parseTime(scope.row.createTime) }}</span> |
| | | </template> |
| | |
| | | status: undefined, |
| | | deptId: undefined |
| | | }, |
| | | // åä¿¡æ¯ |
| | | columns: [ |
| | | { key: 0, label: `ç¨æ·ç¼å·`, visible: true }, |
| | | { key: 1, label: `ç¨æ·åç§°`, visible: true }, |
| | | { key: 2, label: `ç¨æ·æµç§°`, visible: true }, |
| | | { key: 3, label: `é¨é¨`, visible: true }, |
| | | { key: 4, label: `ææºå·ç `, visible: true }, |
| | | { key: 5, label: `ç¶æ`, visible: true }, |
| | | { key: 6, label: `å建æ¶é´`, visible: true } |
| | | ], |
| | | // è¡¨åæ ¡éª |
| | | rules: { |
| | | userName: [ |
| | |
| | | } |
| | | } |
| | | }; |
| | | </script> |
| | | </script> |
| | |
| | | </el-table> |
| | | </el-tab-pane> |
| | | <el-tab-pane label="çæä¿¡æ¯" name="genInfo"> |
| | | <gen-info-form ref="genInfo" :info="info" :menus="menus"/> |
| | | <gen-info-form ref="genInfo" :info="info" :tables="tables" :menus="menus"/> |
| | | </el-tab-pane> |
| | | </el-tabs> |
| | | <el-form label-width="100px"> |
| | |
| | | activeName: "cloum", |
| | | // è¡¨æ ¼çé«åº¦ |
| | | tableHeight: document.documentElement.scrollHeight - 245 + "px", |
| | | // è¡¨ä¿¡æ¯ |
| | | tables: [], |
| | | // 表åä¿¡æ¯ |
| | | cloumns: [], |
| | | // åå
¸ä¿¡æ¯ |
| | |
| | | getGenTable(tableId).then(res => { |
| | | this.cloumns = res.data.rows; |
| | | this.info = res.data.info; |
| | | this.tables = res.data.tables; |
| | | }); |
| | | /** æ¥è¯¢åå
¸ä¸æå表 */ |
| | | getDictOptionselect().then(response => { |
| | |
| | | <el-col :span="12"> |
| | | <el-form-item prop="tplCategory"> |
| | | <span slot="label">çææ¨¡æ¿</span> |
| | | <el-select v-model="info.tplCategory"> |
| | | <el-select v-model="info.tplCategory" @change="tplSelectChange"> |
| | | <el-option label="å表ï¼å¢å æ¹æ¥ï¼" value="crud" /> |
| | | <el-option label="æ 表ï¼å¢å æ¹æ¥ï¼" value="tree" /> |
| | | <el-option label="主å表ï¼å¢å æ¹æ¥ï¼" value="sub" /> |
| | | </el-select> |
| | | </el-form-item> |
| | | </el-col> |
| | |
| | | </span> |
| | | <el-select v-model="info.treeCode" placeholder="è¯·éæ©"> |
| | | <el-option |
| | | v-for="column in info.columns" |
| | | :key="column.columnName" |
| | | v-for="(column, index) in info.columns" |
| | | :key="index" |
| | | :label="column.columnName + 'ï¼' + column.columnComment" |
| | | :value="column.columnName" |
| | | ></el-option> |
| | |
| | | </span> |
| | | <el-select v-model="info.treeParentCode" placeholder="è¯·éæ©"> |
| | | <el-option |
| | | v-for="column in info.columns" |
| | | :key="column.columnName" |
| | | v-for="(column, index) in info.columns" |
| | | :key="index" |
| | | :label="column.columnName + 'ï¼' + column.columnComment" |
| | | :value="column.columnName" |
| | | ></el-option> |
| | |
| | | </span> |
| | | <el-select v-model="info.treeName" placeholder="è¯·éæ©"> |
| | | <el-option |
| | | v-for="column in info.columns" |
| | | :key="column.columnName" |
| | | v-for="(column, index) in info.columns" |
| | | :key="index" |
| | | :label="column.columnName + 'ï¼' + column.columnComment" |
| | | :value="column.columnName" |
| | | ></el-option> |
| | | </el-select> |
| | | </el-form-item> |
| | | </el-col> |
| | | </el-row> |
| | | <el-row v-show="info.tplCategory == 'sub'"> |
| | | <h4 class="form-header">å
³èä¿¡æ¯</h4> |
| | | <el-col :span="12"> |
| | | <el-form-item> |
| | | <span slot="label"> |
| | | å
³èå表ç表å |
| | | <el-tooltip content="å
³èå表ç表åï¼ å¦ï¼sys_user" placement="top"> |
| | | <i class="el-icon-question"></i> |
| | | </el-tooltip> |
| | | </span> |
| | | <el-select v-model="info.subTableName" placeholder="è¯·éæ©" @change="subSelectChange"> |
| | | <el-option |
| | | v-for="(table, index) in tables" |
| | | :key="index" |
| | | :label="table.tableName + 'ï¼' + table.tableComment" |
| | | :value="table.tableName" |
| | | ></el-option> |
| | | </el-select> |
| | | </el-form-item> |
| | | </el-col> |
| | | <el-col :span="12"> |
| | | <el-form-item> |
| | | <span slot="label"> |
| | | å表å
³èçå¤é®å |
| | | <el-tooltip content="å表å
³èçå¤é®åï¼ å¦ï¼user_id" placement="top"> |
| | | <i class="el-icon-question"></i> |
| | | </el-tooltip> |
| | | </span> |
| | | <el-select v-model="info.subTableFkName" placeholder="è¯·éæ©"> |
| | | <el-option |
| | | v-for="(column, index) in subColumns" |
| | | :key="index" |
| | | :label="column.columnName + 'ï¼' + column.columnComment" |
| | | :value="column.columnName" |
| | | ></el-option> |
| | |
| | | type: Object, |
| | | default: null |
| | | }, |
| | | tables: { |
| | | type: Array, |
| | | default: null |
| | | }, |
| | | menus: { |
| | | type: Array, |
| | | default: [] |
| | |
| | | }, |
| | | data() { |
| | | return { |
| | | subColumns: [], |
| | | rules: { |
| | | tplCategory: [ |
| | | { required: true, message: "è¯·éæ©çææ¨¡æ¿", trigger: "blur" } |
| | |
| | | }; |
| | | }, |
| | | created() {}, |
| | | watch: { |
| | | 'info.subTableName': function(val) { |
| | | this.setSubTableColumns(val); |
| | | } |
| | | }, |
| | | methods: { |
| | | /** 转æ¢èåæ°æ®ç»æ */ |
| | | normalizer(node) { |
| | |
| | | label: node.menuName, |
| | | children: node.children |
| | | }; |
| | | }, |
| | | /** éæ©å表å触å */ |
| | | subSelectChange(value) { |
| | | this.info.subTableFkName = ''; |
| | | }, |
| | | /** éæ©çææ¨¡æ¿è§¦å */ |
| | | tplSelectChange(value) { |
| | | if(value !== 'sub') { |
| | | this.info.subTableName = ''; |
| | | this.info.subTableFkName = ''; |
| | | } |
| | | }, |
| | | /** 设置å
³èå¤é® */ |
| | | setSubTableColumns(value) { |
| | | for (var item in this.tables) { |
| | | const name = this.tables[item].tableName; |
| | | if (value === name) { |
| | | this.subColumns = this.tables[item].columns; |
| | | break; |
| | | } |
| | | } |
| | | } |
| | | } |
| | | }; |
| | |
| | | </el-row> |
| | | |
| | | <el-table v-loading="loading" :data="tableList" @selection-change="handleSelectionChange"> |
| | | <el-table-column type="selection" width="55"></el-table-column> |
| | | <el-table-column type="selection" align="center" width="55"></el-table-column> |
| | | <el-table-column label="åºå·" type="index" width="50" align="center"> |
| | | <template slot-scope="scope"> |
| | | <span>{{(queryParams.pageNum - 1) * queryParams.pageSize + scope.$index + 1}}</span> |
ÎļþÃû´Ó sql/ry_20201128.sql ÐÞ¸Ä |
| | |
| | | table_id bigint(20) not null auto_increment comment 'ç¼å·', |
| | | table_name varchar(200) default '' comment '表åç§°', |
| | | table_comment varchar(500) default '' comment '表æè¿°', |
| | | sub_table_name varchar(64) default null comment 'å
³èå表ç表å', |
| | | sub_table_fk_name varchar(64) default null comment 'å表å
³èçå¤é®å', |
| | | class_name varchar(100) default '' comment 'å®ä½ç±»åç§°', |
| | | tpl_category varchar(200) default 'crud' comment '使ç¨ç模æ¿ï¼crudå表æä½ treeæ 表æä½ï¼', |
| | | package_name varchar(100) comment 'çæå
è·¯å¾', |