From 4c0bd42a9f5989f93df221bd760b5d831f1c6464 Mon Sep 17 00:00:00 2001
From: chenhj <1263187585@qq.com>
Date: 星期四, 29 五月 2025 11:43:41 +0800
Subject: [PATCH] Merge branch 'master' of http://gitea.lunor.cn/java_templates/ruoyi_java into chen
---
/dev/null | 140 -----------------------------------
ruoyi-framework/pom.xml | 12 +++
ruoyi-admin/pom.xml | 6 -
pom.xml | 19 ++--
ruoyi-common/pom.xml | 8 -
5 files changed, 22 insertions(+), 163 deletions(-)
diff --git a/pom.xml b/pom.xml
index 7ec3d8a..6f6211f 100644
--- a/pom.xml
+++ b/pom.xml
@@ -35,7 +35,7 @@
<jakarta.version>6.0.0</jakarta.version>
<springdoc.version>2.6.0</springdoc.version>
<postgresql.version>42.7.3</postgresql.version>
- <mybatis-plus.version>3.5.3.1</mybatis-plus.version>
+ <mybatis-plus.version>3.5.12</mybatis-plus.version>
<freemarker.version>2.3.30</freemarker.version>
<minio.version>8.4.3</minio.version>
<okhttp.version>4.9.0</okhttp.version>
@@ -156,13 +156,6 @@
<version>${ruoyi.version}</version>
</dependency>
- <!-- 浠g爜鐢熸垚-->
- <dependency>
- <groupId>com.ruoyi</groupId>
- <artifactId>ruoyi-generator</artifactId>
- <version>${ruoyi.version}</version>
- </dependency>
-
<!-- 鏍稿績妯″潡-->
<dependency>
<groupId>com.ruoyi</groupId>
@@ -227,10 +220,17 @@
<scope>provided</scope>
</dependency>
+ <!-- MyBatis-Plus 鏍稿績渚濊禆 -->
+ <dependency>
+ <groupId>com.baomidou</groupId>
+ <artifactId>mybatis-plus-core</artifactId>
+ <version>3.5.12</version> <!-- 涓庝綘鐨� Spring Boot 鍏煎鐨勭増鏈� -->
+ </dependency>
+
<!--mybatis-plus-->
<dependency>
<groupId>com.baomidou</groupId>
- <artifactId>mybatis-plus-boot-starter</artifactId>
+ <artifactId>mybatis-plus-spring-boot3-starter</artifactId>
<version>${mybatis-plus.version}</version>
</dependency>
@@ -254,7 +254,6 @@
<module>ruoyi-framework</module>
<module>ruoyi-system</module>
<module>ruoyi-quartz</module>
- <module>ruoyi-generator</module>
<module>ruoyi-common</module>
<module>basic-server</module>
</modules>
diff --git a/ruoyi-admin/pom.xml b/ruoyi-admin/pom.xml
index 26ec39a..559a649 100644
--- a/ruoyi-admin/pom.xml
+++ b/ruoyi-admin/pom.xml
@@ -74,12 +74,6 @@
<artifactId>ruoyi-quartz</artifactId>
</dependency>
- <!-- 浠g爜鐢熸垚-->
- <dependency>
- <groupId>com.ruoyi</groupId>
- <artifactId>ruoyi-generator</artifactId>
- </dependency>
-
<!-- postgresql椹卞姩鍖� -->
<dependency>
<groupId>org.postgresql</groupId>
diff --git a/ruoyi-common/pom.xml b/ruoyi-common/pom.xml
index 2dce126..e001c16 100644
--- a/ruoyi-common/pom.xml
+++ b/ruoyi-common/pom.xml
@@ -128,13 +128,7 @@
<dependency>
<groupId>com.baomidou</groupId>
<artifactId>mybatis-plus-spring-boot3-starter</artifactId>
- <version>3.5.10</version>
- </dependency>
-
- <dependency>
- <groupId>com.baomidou</groupId>
- <artifactId>mybatis-plus-jsqlparser</artifactId>
- <version>3.5.10</version>
+ <version>3.5.12</version>
</dependency>
<!-- minio -->
diff --git a/ruoyi-framework/pom.xml b/ruoyi-framework/pom.xml
index 5456102..f648fad 100644
--- a/ruoyi-framework/pom.xml
+++ b/ruoyi-framework/pom.xml
@@ -53,6 +53,18 @@
<artifactId>oshi-core</artifactId>
</dependency>
+ <dependency>
+ <groupId>com.baomidou</groupId>
+ <artifactId>mybatis-plus-spring-boot3-starter</artifactId>
+ <version>3.5.12</version>
+ </dependency>
+
+ <dependency>
+ <groupId>com.baomidou</groupId>
+ <artifactId>mybatis-plus-extension</artifactId>
+ <version>3.5.6</version>
+ </dependency>
+
<!-- 绯荤粺妯″潡-->
<dependency>
<groupId>com.ruoyi</groupId>
diff --git a/ruoyi-generator/pom.xml b/ruoyi-generator/pom.xml
deleted file mode 100644
index d142d4c..0000000
--- a/ruoyi-generator/pom.xml
+++ /dev/null
@@ -1,46 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<project xmlns="http://maven.apache.org/POM/4.0.0"
- xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
- xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
- <parent>
- <artifactId>ruoyi</artifactId>
- <groupId>com.ruoyi</groupId>
- <version>3.8.9</version>
- </parent>
- <modelVersion>4.0.0</modelVersion>
-
- <artifactId>ruoyi-generator</artifactId>
-
- <description>
- generator浠g爜鐢熸垚
- </description>
-
- <dependencies>
-
- <!-- velocity浠g爜鐢熸垚浣跨敤妯℃澘 -->
- <dependency>
- <groupId>org.apache.velocity</groupId>
- <artifactId>velocity-engine-core</artifactId>
- </dependency>
-
- <!-- 閫氱敤宸ュ叿-->
- <dependency>
- <groupId>com.ruoyi</groupId>
- <artifactId>ruoyi-common</artifactId>
- </dependency>
-
- <!-- 闃块噷鏁版嵁搴撹繛鎺ユ睜 -->
- <dependency>
- <groupId>com.alibaba</groupId>
- <artifactId>druid-spring-boot-3-starter</artifactId>
- </dependency>
-
- <dependency>
- <groupId>com.baomidou</groupId>
- <artifactId>mybatis-plus-generator</artifactId>
- <version>3.5.12</version>
- </dependency>
-
- </dependencies>
-
-</project>
\ No newline at end of file
diff --git a/ruoyi-generator/src/main/java/com/ruoyi/generator/config/GenConfig.java b/ruoyi-generator/src/main/java/com/ruoyi/generator/config/GenConfig.java
deleted file mode 100644
index 536d13f..0000000
--- a/ruoyi-generator/src/main/java/com/ruoyi/generator/config/GenConfig.java
+++ /dev/null
@@ -1,93 +0,0 @@
-package com.ruoyi.generator.config;
-
-import org.springframework.beans.factory.annotation.Value;
-import org.springframework.boot.context.properties.ConfigurationProperties;
-import org.springframework.context.annotation.PropertySource;
-import org.springframework.stereotype.Component;
-
-/**
- * 璇诲彇浠g爜鐢熸垚鐩稿叧閰嶇疆
- *
- * @author ruoyi
- */
-@Component
-@ConfigurationProperties(prefix = "gen")
-@PropertySource(value = { "classpath:generator.yml" })
-public class GenConfig
-{
- /** 浣滆�� */
- public static String author;
-
- /** 鐢熸垚鍖呰矾寰� */
- public static String packageName;
-
- /** 鑷姩鍘婚櫎琛ㄥ墠缂� */
- public static boolean autoRemovePre;
-
- /** 琛ㄥ墠缂� */
- public static String tablePrefix;
-
- /** 鏄惁鍏佽鐢熸垚鏂囦欢瑕嗙洊鍒版湰鍦帮紙鑷畾涔夎矾寰勶級 */
- public static boolean allowOverwrite;
-
- public static String getAuthor()
- {
- return author;
- }
-
- private final boolean useMyBatisPlus = false; // 鏄惁浣跨敤 MyBatis-Plus
-
- @Value("${author}")
- public void setAuthor(String author)
- {
- GenConfig.author = author;
- }
-
- public static String getPackageName()
- {
- return packageName;
- }
-
- @Value("${packageName}")
- public void setPackageName(String packageName)
- {
- GenConfig.packageName = packageName;
- }
-
- public static boolean getAutoRemovePre()
- {
- return autoRemovePre;
- }
-
- @Value("${autoRemovePre}")
- public void setAutoRemovePre(boolean autoRemovePre)
- {
- GenConfig.autoRemovePre = autoRemovePre;
- }
-
- public static String getTablePrefix()
- {
- return tablePrefix;
- }
-
- @Value("${tablePrefix}")
- public void setTablePrefix(String tablePrefix)
- {
- GenConfig.tablePrefix = tablePrefix;
- }
-
- public static boolean isAllowOverwrite()
- {
- return allowOverwrite;
- }
-
- @Value("${allowOverwrite}")
- public void setAllowOverwrite(boolean allowOverwrite)
- {
- GenConfig.allowOverwrite = allowOverwrite;
- }
-
- public boolean isUseMyBatisPlus() {
- return useMyBatisPlus;
- }
-}
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
deleted file mode 100644
index 4d750e4..0000000
--- a/ruoyi-generator/src/main/java/com/ruoyi/generator/controller/GenController.java
+++ /dev/null
@@ -1,263 +0,0 @@
-package com.ruoyi.generator.controller;
-
-import java.io.IOException;
-import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-import jakarta.servlet.http.HttpServletResponse;
-import org.apache.commons.io.IOUtils;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.security.access.prepost.PreAuthorize;
-import org.springframework.validation.annotation.Validated;
-import org.springframework.web.bind.annotation.DeleteMapping;
-import org.springframework.web.bind.annotation.GetMapping;
-import org.springframework.web.bind.annotation.PathVariable;
-import org.springframework.web.bind.annotation.PostMapping;
-import org.springframework.web.bind.annotation.PutMapping;
-import org.springframework.web.bind.annotation.RequestBody;
-import org.springframework.web.bind.annotation.RequestMapping;
-import org.springframework.web.bind.annotation.RestController;
-import com.alibaba.druid.DbType;
-import com.alibaba.druid.sql.SQLUtils;
-import com.alibaba.druid.sql.ast.SQLStatement;
-import com.alibaba.druid.sql.dialect.mysql.ast.statement.MySqlCreateTableStatement;
-import com.ruoyi.common.annotation.Log;
-import com.ruoyi.common.core.controller.BaseController;
-import com.ruoyi.common.core.domain.AjaxResult;
-import com.ruoyi.common.core.page.TableDataInfo;
-import com.ruoyi.common.core.text.Convert;
-import com.ruoyi.common.enums.BusinessType;
-import com.ruoyi.common.utils.SecurityUtils;
-import com.ruoyi.common.utils.sql.SqlUtil;
-import com.ruoyi.generator.config.GenConfig;
-import com.ruoyi.generator.domain.GenTable;
-import com.ruoyi.generator.domain.GenTableColumn;
-import com.ruoyi.generator.service.IGenTableColumnService;
-import com.ruoyi.generator.service.IGenTableService;
-
-/**
- * 浠g爜鐢熸垚 鎿嶄綔澶勭悊
- *
- * @author ruoyi
- */
-@RestController
-@RequestMapping("/tool/gen")
-public class GenController extends BaseController
-{
- @Autowired
- private IGenTableService genTableService;
-
- @Autowired
- private IGenTableColumnService genTableColumnService;
-
- /**
- * 鏌ヨ浠g爜鐢熸垚鍒楄〃
- */
- @PreAuthorize("@ss.hasPermi('tool:gen:list')")
- @GetMapping("/list")
- public TableDataInfo genList(GenTable genTable)
- {
- startPage();
- List<GenTable> list = genTableService.selectGenTableList(genTable);
- return getDataTable(list);
- }
-
- /**
- * 鑾峰彇浠g爜鐢熸垚淇℃伅
- */
- @PreAuthorize("@ss.hasPermi('tool:gen:query')")
- @GetMapping(value = "/{tableId}")
- public AjaxResult getInfo(@PathVariable Long tableId)
- {
- GenTable table = genTableService.selectGenTableById(tableId);
- List<GenTable> tables = genTableService.selectGenTableAll();
- List<GenTableColumn> list = genTableColumnService.selectGenTableColumnListByTableId(tableId);
- Map<String, Object> map = new HashMap<String, Object>();
- map.put("info", table);
- map.put("rows", list);
- map.put("tables", tables);
- return success(map);
- }
-
- /**
- * 鏌ヨ鏁版嵁搴撳垪琛�
- */
- @PreAuthorize("@ss.hasPermi('tool:gen:list')")
- @GetMapping("/db/list")
- public TableDataInfo dataList(GenTable genTable)
- {
- startPage();
- List<GenTable> list = genTableService.selectDbTableList(genTable);
- return getDataTable(list);
- }
-
- /**
- * 鏌ヨ鏁版嵁琛ㄥ瓧娈靛垪琛�
- */
- @PreAuthorize("@ss.hasPermi('tool:gen:list')")
- @GetMapping(value = "/column/{tableId}")
- public TableDataInfo columnList(Long tableId)
- {
- TableDataInfo dataInfo = new TableDataInfo();
- List<GenTableColumn> list = genTableColumnService.selectGenTableColumnListByTableId(tableId);
- dataInfo.setRows(list);
- dataInfo.setTotal(list.size());
- return dataInfo;
- }
-
- /**
- * 瀵煎叆琛ㄧ粨鏋勶紙淇濆瓨锛�
- */
- @PreAuthorize("@ss.hasPermi('tool:gen:import')")
- @Log(title = "浠g爜鐢熸垚", businessType = BusinessType.IMPORT)
- @PostMapping("/importTable")
- public AjaxResult importTableSave(String tables)
- {
- String[] tableNames = Convert.toStrArray(tables);
- // 鏌ヨ琛ㄤ俊鎭�
- List<GenTable> tableList = genTableService.selectDbTableListByNames(tableNames);
- genTableService.importGenTable(tableList, SecurityUtils.getUsername());
- return success();
- }
-
- /**
- * 鍒涘缓琛ㄧ粨鏋勶紙淇濆瓨锛�
- */
- @PreAuthorize("@ss.hasRole('admin')")
- @Log(title = "鍒涘缓琛�", businessType = BusinessType.OTHER)
- @PostMapping("/createTable")
- public AjaxResult createTableSave(String sql)
- {
- try
- {
- SqlUtil.filterKeyword(sql);
- List<SQLStatement> sqlStatements = SQLUtils.parseStatements(sql, DbType.mysql);
- List<String> tableNames = new ArrayList<>();
- for (SQLStatement sqlStatement : sqlStatements)
- {
- if (sqlStatement instanceof MySqlCreateTableStatement)
- {
- MySqlCreateTableStatement createTableStatement = (MySqlCreateTableStatement) sqlStatement;
- if (genTableService.createTable(createTableStatement.toString()))
- {
- String tableName = createTableStatement.getTableName().replaceAll("`", "");
- tableNames.add(tableName);
- }
- }
- }
- List<GenTable> tableList = genTableService.selectDbTableListByNames(tableNames.toArray(new String[tableNames.size()]));
- String operName = SecurityUtils.getUsername();
- genTableService.importGenTable(tableList, operName);
- return AjaxResult.success();
- }
- catch (Exception e)
- {
- logger.error(e.getMessage(), e);
- return AjaxResult.error("鍒涘缓琛ㄧ粨鏋勫紓甯�");
- }
- }
-
- /**
- * 淇敼淇濆瓨浠g爜鐢熸垚涓氬姟
- */
- @PreAuthorize("@ss.hasPermi('tool:gen:edit')")
- @Log(title = "浠g爜鐢熸垚", businessType = BusinessType.UPDATE)
- @PutMapping
- public AjaxResult editSave(@Validated @RequestBody GenTable genTable)
- {
- genTableService.validateEdit(genTable);
- genTableService.updateGenTable(genTable);
- return success();
- }
-
- /**
- * 鍒犻櫎浠g爜鐢熸垚
- */
- @PreAuthorize("@ss.hasPermi('tool:gen:remove')")
- @Log(title = "浠g爜鐢熸垚", businessType = BusinessType.DELETE)
- @DeleteMapping("/{tableIds}")
- public AjaxResult remove(@PathVariable Long[] tableIds)
- {
- genTableService.deleteGenTableByIds(tableIds);
- return success();
- }
-
- /**
- * 棰勮浠g爜
- */
- @PreAuthorize("@ss.hasPermi('tool:gen:preview')")
- @GetMapping("/preview/{tableId}")
- public AjaxResult preview(@PathVariable("tableId") Long tableId) throws IOException
- {
- Map<String, String> dataMap = genTableService.previewCode(tableId);
- return success(dataMap);
- }
-
- /**
- * 鐢熸垚浠g爜锛堜笅杞芥柟寮忥級
- */
- @PreAuthorize("@ss.hasPermi('tool:gen:code')")
- @Log(title = "浠g爜鐢熸垚", businessType = BusinessType.GENCODE)
- @GetMapping("/download/{tableName}")
- public void download(HttpServletResponse response, @PathVariable("tableName") String tableName) throws IOException
- {
- byte[] data = genTableService.downloadCode(tableName);
- genCode(response, data);
- }
-
- /**
- * 鐢熸垚浠g爜锛堣嚜瀹氫箟璺緞锛�
- */
- @PreAuthorize("@ss.hasPermi('tool:gen:code')")
- @Log(title = "浠g爜鐢熸垚", businessType = BusinessType.GENCODE)
- @GetMapping("/genCode/{tableName}")
- public AjaxResult genCode(@PathVariable("tableName") String tableName)
- {
- if (!GenConfig.isAllowOverwrite())
- {
- return AjaxResult.error("銆愮郴缁熼璁俱�戜笉鍏佽鐢熸垚鏂囦欢瑕嗙洊鍒版湰鍦�");
- }
- genTableService.generatorCode(tableName);
- return success();
- }
-
- /**
- * 鍚屾鏁版嵁搴�
- */
- @PreAuthorize("@ss.hasPermi('tool:gen:edit')")
- @Log(title = "浠g爜鐢熸垚", businessType = BusinessType.UPDATE)
- @GetMapping("/synchDb/{tableName}")
- public AjaxResult synchDb(@PathVariable("tableName") String tableName)
- {
- genTableService.synchDb(tableName);
- return success();
- }
-
- /**
- * 鎵归噺鐢熸垚浠g爜
- */
- @PreAuthorize("@ss.hasPermi('tool:gen:code')")
- @Log(title = "浠g爜鐢熸垚", businessType = BusinessType.GENCODE)
- @GetMapping("/batchGenCode")
- public void batchGenCode(HttpServletResponse response, String tables) throws IOException
- {
- String[] tableNames = Convert.toStrArray(tables);
- byte[] data = genTableService.downloadCode(tableNames);
- genCode(response, data);
- }
-
- /**
- * 鐢熸垚zip鏂囦欢
- */
- private void genCode(HttpServletResponse response, byte[] data) throws IOException
- {
- response.reset();
- response.addHeader("Access-Control-Allow-Origin", "*");
- response.addHeader("Access-Control-Expose-Headers", "Content-Disposition");
- response.setHeader("Content-Disposition", "attachment; filename=\"ruoyi.zip\"");
- response.addHeader("Content-Length", "" + data.length);
- response.setContentType("application/octet-stream; charset=UTF-8");
- IOUtils.write(data, response.getOutputStream());
- }
-}
\ No newline at end of file
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
deleted file mode 100644
index 9ef6cfd..0000000
--- a/ruoyi-generator/src/main/java/com/ruoyi/generator/domain/GenTable.java
+++ /dev/null
@@ -1,385 +0,0 @@
-package com.ruoyi.generator.domain;
-
-import java.util.List;
-import jakarta.validation.Valid;
-import jakarta.validation.constraints.NotBlank;
-import org.apache.commons.lang3.ArrayUtils;
-import com.ruoyi.common.constant.GenConstants;
-import com.ruoyi.common.core.domain.BaseEntity;
-import com.ruoyi.common.utils.StringUtils;
-
-/**
- * 涓氬姟琛� gen_table
- *
- * @author ruoyi
- */
-public class GenTable extends BaseEntity
-{
- private static final long serialVersionUID = 1L;
-
- /** 缂栧彿 */
- private Long tableId;
-
- /** 琛ㄥ悕绉� */
- @NotBlank(message = "琛ㄥ悕绉颁笉鑳戒负绌�")
- private String tableName;
-
- /** 琛ㄦ弿杩� */
- @NotBlank(message = "琛ㄦ弿杩颁笉鑳戒负绌�")
- private String tableComment;
-
- /** 鍏宠仈鐖惰〃鐨勮〃鍚� */
- private String subTableName;
-
- /** 鏈〃鍏宠仈鐖惰〃鐨勫閿悕 */
- private String subTableFkName;
-
- /** 瀹炰綋绫诲悕绉�(棣栧瓧姣嶅ぇ鍐�) */
- @NotBlank(message = "瀹炰綋绫诲悕绉颁笉鑳戒负绌�")
- private String className;
-
- /** 浣跨敤鐨勬ā鏉匡紙crud鍗曡〃鎿嶄綔 tree鏍戣〃鎿嶄綔 sub涓诲瓙琛ㄦ搷浣滐級 */
- private String tplCategory;
-
- /** 鍓嶇绫诲瀷锛坋lement-ui妯$増 element-plus妯$増锛� */
- private String tplWebType;
-
- /** 鐢熸垚鍖呰矾寰� */
- @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;
-
- /** 鐢熸垚浠g爜鏂瑰紡锛�0zip鍘嬬缉鍖� 1鑷畾涔夎矾寰勶級 */
- private String genType;
-
- /** 鐢熸垚璺緞锛堜笉濉粯璁ら」鐩矾寰勶級 */
- private String genPath;
-
- /** 涓婚敭淇℃伅 */
- private GenTableColumn pkColumn;
-
- /** 瀛愯〃淇℃伅 */
- private GenTable subTable;
-
- /** 琛ㄥ垪淇℃伅 */
- @Valid
- private List<GenTableColumn> columns;
-
- /** 鍏跺畠鐢熸垚閫夐」 */
- private String options;
-
- /** 鏍戠紪鐮佸瓧娈� */
- private String treeCode;
-
- /** 鏍戠埗缂栫爜瀛楁 */
- private String treeParentCode;
-
- /** 鏍戝悕绉板瓧娈� */
- private String treeName;
-
- /** 涓婄骇鑿滃崟ID瀛楁 */
- private Long parentMenuId;
-
- /** 涓婄骇鑿滃崟鍚嶇О瀛楁 */
- private String parentMenuName;
-
- public Long getTableId()
- {
- return tableId;
- }
-
- public void setTableId(Long tableId)
- {
- this.tableId = tableId;
- }
-
- public String getTableName()
- {
- return tableName;
- }
-
- public void setTableName(String tableName)
- {
- this.tableName = tableName;
- }
-
- public String getTableComment()
- {
- return tableComment;
- }
-
- 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()
- {
- return className;
- }
-
- public void setClassName(String className)
- {
- this.className = className;
- }
-
- public String getTplCategory()
- {
- return tplCategory;
- }
-
- public void setTplCategory(String tplCategory)
- {
- this.tplCategory = tplCategory;
- }
-
- public String getTplWebType()
- {
- return tplWebType;
- }
-
- public void setTplWebType(String tplWebType)
- {
- this.tplWebType = tplWebType;
- }
-
- public String getPackageName()
- {
- return packageName;
- }
-
- public void setPackageName(String packageName)
- {
- this.packageName = packageName;
- }
-
- public String getModuleName()
- {
- return moduleName;
- }
-
- public void setModuleName(String moduleName)
- {
- this.moduleName = moduleName;
- }
-
- public String getBusinessName()
- {
- return businessName;
- }
-
- public void setBusinessName(String businessName)
- {
- this.businessName = businessName;
- }
-
- public String getFunctionName()
- {
- return functionName;
- }
-
- public void setFunctionName(String functionName)
- {
- this.functionName = functionName;
- }
-
- public String getFunctionAuthor()
- {
- return functionAuthor;
- }
-
- public void setFunctionAuthor(String functionAuthor)
- {
- this.functionAuthor = functionAuthor;
- }
-
- public String getGenType()
- {
- return genType;
- }
-
- public void setGenType(String genType)
- {
- this.genType = genType;
- }
-
- public String getGenPath()
- {
- return genPath;
- }
-
- public void setGenPath(String genPath)
- {
- this.genPath = genPath;
- }
-
- public GenTableColumn getPkColumn()
- {
- return pkColumn;
- }
-
- public void setPkColumn(GenTableColumn pkColumn)
- {
- this.pkColumn = pkColumn;
- }
-
- public GenTable getSubTable()
- {
- return subTable;
- }
-
- public void setSubTable(GenTable subTable)
- {
- this.subTable = subTable;
- }
-
- public List<GenTableColumn> getColumns()
- {
- return columns;
- }
-
- public void setColumns(List<GenTableColumn> columns)
- {
- this.columns = columns;
- }
-
- public String getOptions()
- {
- return options;
- }
-
- public void setOptions(String options)
- {
- this.options = options;
- }
-
- public String getTreeCode()
- {
- return treeCode;
- }
-
- public void setTreeCode(String treeCode)
- {
- this.treeCode = treeCode;
- }
-
- public String getTreeParentCode()
- {
- return treeParentCode;
- }
-
- public void setTreeParentCode(String treeParentCode)
- {
- this.treeParentCode = treeParentCode;
- }
-
- public String getTreeName()
- {
- return treeName;
- }
-
- public void setTreeName(String treeName)
- {
- this.treeName = treeName;
- }
-
- public Long getParentMenuId()
- {
- return parentMenuId;
- }
-
- public void setParentMenuId(Long parentMenuId)
- {
- this.parentMenuId = parentMenuId;
- }
-
- public String getParentMenuName()
- {
- return parentMenuName;
- }
-
- public void setParentMenuName(String parentMenuName)
- {
- 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);
- }
-
- public static boolean isTree(String tplCategory)
- {
- return tplCategory != null && StringUtils.equals(GenConstants.TPL_TREE, tplCategory);
- }
-
- public boolean isCrud()
- {
- return isCrud(this.tplCategory);
- }
-
- public static boolean isCrud(String tplCategory)
- {
- return tplCategory != null && StringUtils.equals(GenConstants.TPL_CRUD, tplCategory);
- }
-
- public boolean isSuperColumn(String javaField)
- {
- return isSuperColumn(this.tplCategory, javaField);
- }
-
- public static boolean isSuperColumn(String tplCategory, String javaField)
- {
- if (isTree(tplCategory))
- {
- return StringUtils.equalsAnyIgnoreCase(javaField,
- ArrayUtils.addAll(GenConstants.TREE_ENTITY, GenConstants.BASE_ENTITY));
- }
- return StringUtils.equalsAnyIgnoreCase(javaField, GenConstants.BASE_ENTITY);
- }
-}
\ No newline at end of file
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 3dc6d62..0000000
--- a/ruoyi-generator/src/main/java/com/ruoyi/generator/domain/GenTableColumn.java
+++ /dev/null
@@ -1,373 +0,0 @@
-package com.ruoyi.generator.domain;
-
-import jakarta.validation.constraints.NotBlank;
-import com.ruoyi.common.core.domain.BaseEntity;
-import com.ruoyi.common.utils.StringUtils;
-
-/**
- * 浠g爜鐢熸垚涓氬姟瀛楁琛� gen_table_column
- *
- * @author ruoyi
- */
-public class GenTableColumn extends BaseEntity
-{
- private static final long serialVersionUID = 1L;
-
- /** 缂栧彿 */
- private Long columnId;
-
- /** 褰掑睘琛ㄧ紪鍙� */
- private Long tableId;
-
- /** 鍒楀悕绉� */
- private String columnName;
-
- /** 鍒楁弿杩� */
- private String columnComment;
-
- /** 鍒楃被鍨� */
- private String columnType;
-
- /** JAVA绫诲瀷 */
- private String javaType;
-
- /** JAVA瀛楁鍚� */
- @NotBlank(message = "Java灞炴�т笉鑳戒负绌�")
- private String javaField;
-
- /** 鏄惁涓婚敭锛�1鏄級 */
- private String isPk;
-
- /** 鏄惁鑷锛�1鏄級 */
- private String isIncrement;
-
- /** 鏄惁蹇呭~锛�1鏄級 */
- private String isRequired;
-
- /** 鏄惁涓烘彃鍏ュ瓧娈碉紙1鏄級 */
- private String isInsert;
-
- /** 鏄惁缂栬緫瀛楁锛�1鏄級 */
- private String isEdit;
-
- /** 鏄惁鍒楄〃瀛楁锛�1鏄級 */
- private String isList;
-
- /** 鏄惁鏌ヨ瀛楁锛�1鏄級 */
- private String isQuery;
-
- /** 鏌ヨ鏂瑰紡锛圗Q绛変簬銆丯E涓嶇瓑浜庛�丟T澶т簬銆丩T灏忎簬銆丩IKE妯$硦銆丅ETWEEN鑼冨洿锛� */
- private String queryType;
-
- /** 鏄剧ず绫诲瀷锛坕nput鏂囨湰妗嗐�乼extarea鏂囨湰鍩熴�乻elect涓嬫媺妗嗐�乧heckbox澶嶉�夋銆乺adio鍗曢�夋銆乨atetime鏃ユ湡鎺т欢銆乮mage鍥剧墖涓婁紶鎺т欢銆乽pload鏂囦欢涓婁紶鎺т欢銆乪ditor瀵屾枃鏈帶浠讹級 */
- private String htmlType;
-
- /** 瀛楀吀绫诲瀷 */
- private String dictType;
-
- /** 鎺掑簭 */
- 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 String getCapJavaField()
- {
- return StringUtils.capitalize(javaField);
- }
-
- public void setIsPk(String isPk)
- {
- this.isPk = isPk;
- }
-
- public String getIsPk()
- {
- return isPk;
- }
-
- public boolean isPk()
- {
- return isPk(this.isPk);
- }
-
- public boolean isPk(String isPk)
- {
- return isPk != null && StringUtils.equals("1", isPk);
- }
-
- public String getIsIncrement()
- {
- return isIncrement;
- }
-
- public void setIsIncrement(String isIncrement)
- {
- this.isIncrement = isIncrement;
- }
-
- public boolean isIncrement()
- {
- return isIncrement(this.isIncrement);
- }
-
- public boolean isIncrement(String isIncrement)
- {
- return isIncrement != null && StringUtils.equals("1", isIncrement);
- }
-
- public void setIsRequired(String isRequired)
- {
- this.isRequired = isRequired;
- }
-
- public String getIsRequired()
- {
- return isRequired;
- }
-
- public boolean isRequired()
- {
- return isRequired(this.isRequired);
- }
-
- public boolean isRequired(String isRequired)
- {
- return isRequired != null && StringUtils.equals("1", isRequired);
- }
-
- public void setIsInsert(String isInsert)
- {
- this.isInsert = isInsert;
- }
-
- public String getIsInsert()
- {
- return isInsert;
- }
-
- public boolean isInsert()
- {
- return isInsert(this.isInsert);
- }
-
- public boolean isInsert(String isInsert)
- {
- return isInsert != null && StringUtils.equals("1", isInsert);
- }
-
- public void setIsEdit(String isEdit)
- {
- this.isEdit = isEdit;
- }
-
- public String getIsEdit()
- {
- return isEdit;
- }
-
- public boolean isEdit()
- {
- return isInsert(this.isEdit);
- }
-
- public boolean isEdit(String isEdit)
- {
- return isEdit != null && StringUtils.equals("1", isEdit);
- }
-
- public void setIsList(String isList)
- {
- this.isList = isList;
- }
-
- public String getIsList()
- {
- return isList;
- }
-
- public boolean isList()
- {
- return isList(this.isList);
- }
-
- public boolean isList(String isList)
- {
- return isList != null && StringUtils.equals("1", isList);
- }
-
- public void setIsQuery(String isQuery)
- {
- this.isQuery = isQuery;
- }
-
- public String getIsQuery()
- {
- return isQuery;
- }
-
- public boolean isQuery()
- {
- return isQuery(this.isQuery);
- }
-
- public boolean isQuery(String isQuery)
- {
- 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);
- }
-
- 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");
- }
-
- public String readConverterExp()
- {
- String remarks = StringUtils.substringBetween(this.columnComment, "锛�", "锛�");
- StringBuffer sb = new StringBuffer();
- if (StringUtils.isNotEmpty(remarks))
- {
- for (String value : remarks.split(" "))
- {
- if (StringUtils.isNotEmpty(value))
- {
- Object startStr = value.subSequence(0, 1);
- String endStr = value.substring(1);
- sb.append("").append(startStr).append("=").append(endStr).append(",");
- }
- }
- return sb.deleteCharAt(sb.length() - 1).toString();
- }
- else
- {
- return this.columnComment;
- }
- }
-}
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 951e166..0000000
--- 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<GenTableColumn> selectDbTableColumnsByName(String tableName);
-
- /**
- * 鏌ヨ涓氬姟瀛楁鍒楄〃
- *
- * @param tableId 涓氬姟瀛楁缂栧彿
- * @return 涓氬姟瀛楁闆嗗悎
- */
- public List<GenTableColumn> 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<GenTableColumn> genTableColumns);
-
- /**
- * 鎵归噺鍒犻櫎涓氬姟瀛楁
- *
- * @param ids 闇�瑕佸垹闄ょ殑鏁版嵁ID
- * @return 缁撴灉
- */
- public int deleteGenTableColumnByIds(Long[] ids);
-}
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
deleted file mode 100644
index 937656d..0000000
--- a/ruoyi-generator/src/main/java/com/ruoyi/generator/mapper/GenTableMapper.java
+++ /dev/null
@@ -1,91 +0,0 @@
-package com.ruoyi.generator.mapper;
-
-import java.util.List;
-import com.ruoyi.generator.domain.GenTable;
-
-/**
- * 涓氬姟 鏁版嵁灞�
- *
- * @author ruoyi
- */
-public interface GenTableMapper
-{
- /**
- * 鏌ヨ涓氬姟鍒楄〃
- *
- * @param genTable 涓氬姟淇℃伅
- * @return 涓氬姟闆嗗悎
- */
- public List<GenTable> selectGenTableList(GenTable genTable);
-
- /**
- * 鏌ヨ鎹簱鍒楄〃
- *
- * @param genTable 涓氬姟淇℃伅
- * @return 鏁版嵁搴撹〃闆嗗悎
- */
- public List<GenTable> selectDbTableList(GenTable genTable);
-
- /**
- * 鏌ヨ鎹簱鍒楄〃
- *
- * @param tableNames 琛ㄥ悕绉扮粍
- * @return 鏁版嵁搴撹〃闆嗗悎
- */
- public List<GenTable> selectDbTableListByNames(String[] tableNames);
-
- /**
- * 鏌ヨ鎵�鏈夎〃淇℃伅
- *
- * @return 琛ㄤ俊鎭泦鍚�
- */
- public List<GenTable> selectGenTableAll();
-
- /**
- * 鏌ヨ琛↖D涓氬姟淇℃伅
- *
- * @param id 涓氬姟ID
- * @return 涓氬姟淇℃伅
- */
- public GenTable selectGenTableById(Long id);
-
- /**
- * 鏌ヨ琛ㄥ悕绉颁笟鍔′俊鎭�
- *
- * @param tableName 琛ㄥ悕绉�
- * @return 涓氬姟淇℃伅
- */
- 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);
-
- /**
- * 鍒涘缓琛�
- *
- * @param sql 琛ㄧ粨鏋�
- * @return 缁撴灉
- */
- public int createTable(String sql);
-}
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 0679689..0000000
--- a/ruoyi-generator/src/main/java/com/ruoyi/generator/service/GenTableColumnServiceImpl.java
+++ /dev/null
@@ -1,68 +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<GenTableColumn> 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/GenTableServiceImpl.java b/ruoyi-generator/src/main/java/com/ruoyi/generator/service/GenTableServiceImpl.java
deleted file mode 100644
index fe4312f..0000000
--- a/ruoyi-generator/src/main/java/com/ruoyi/generator/service/GenTableServiceImpl.java
+++ /dev/null
@@ -1,531 +0,0 @@
-package com.ruoyi.generator.service;
-
-import java.io.ByteArrayOutputStream;
-import java.io.File;
-import java.io.IOException;
-import java.io.StringWriter;
-import java.util.LinkedHashMap;
-import java.util.List;
-import java.util.Map;
-import java.util.function.Function;
-import java.util.stream.Collectors;
-import java.util.zip.ZipEntry;
-import java.util.zip.ZipOutputStream;
-import org.apache.commons.io.FileUtils;
-import org.apache.commons.io.IOUtils;
-import org.apache.velocity.Template;
-import org.apache.velocity.VelocityContext;
-import org.apache.velocity.app.Velocity;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.stereotype.Service;
-import org.springframework.transaction.annotation.Transactional;
-import com.alibaba.fastjson2.JSON;
-import com.alibaba.fastjson2.JSONObject;
-import com.ruoyi.common.constant.Constants;
-import com.ruoyi.common.constant.GenConstants;
-import com.ruoyi.common.core.text.CharsetKit;
-import com.ruoyi.common.exception.ServiceException;
-import com.ruoyi.common.utils.StringUtils;
-import com.ruoyi.generator.domain.GenTable;
-import com.ruoyi.generator.domain.GenTableColumn;
-import com.ruoyi.generator.mapper.GenTableColumnMapper;
-import com.ruoyi.generator.mapper.GenTableMapper;
-import com.ruoyi.generator.util.GenUtils;
-import com.ruoyi.generator.util.VelocityInitializer;
-import com.ruoyi.generator.util.VelocityUtils;
-
-/**
- * 涓氬姟 鏈嶅姟灞傚疄鐜�
- *
- * @author ruoyi
- */
-@Service
-public class GenTableServiceImpl implements IGenTableService
-{
- private static final Logger log = LoggerFactory.getLogger(GenTableServiceImpl.class);
-
- @Autowired
- private GenTableMapper genTableMapper;
-
- @Autowired
- private GenTableColumnMapper genTableColumnMapper;
-
- /**
- * 鏌ヨ涓氬姟淇℃伅
- *
- * @param id 涓氬姟ID
- * @return 涓氬姟淇℃伅
- */
- @Override
- public GenTable selectGenTableById(Long id)
- {
- GenTable genTable = genTableMapper.selectGenTableById(id);
- setTableFromOptions(genTable);
- return genTable;
- }
-
- /**
- * 鏌ヨ涓氬姟鍒楄〃
- *
- * @param genTable 涓氬姟淇℃伅
- * @return 涓氬姟闆嗗悎
- */
- @Override
- public List<GenTable> selectGenTableList(GenTable genTable)
- {
- return genTableMapper.selectGenTableList(genTable);
- }
-
- /**
- * 鏌ヨ鎹簱鍒楄〃
- *
- * @param genTable 涓氬姟淇℃伅
- * @return 鏁版嵁搴撹〃闆嗗悎
- */
- @Override
- public List<GenTable> selectDbTableList(GenTable genTable)
- {
- return genTableMapper.selectDbTableList(genTable);
- }
-
- /**
- * 鏌ヨ鎹簱鍒楄〃
- *
- * @param tableNames 琛ㄥ悕绉扮粍
- * @return 鏁版嵁搴撹〃闆嗗悎
- */
- @Override
- public List<GenTable> selectDbTableListByNames(String[] tableNames)
- {
- return genTableMapper.selectDbTableListByNames(tableNames);
- }
-
- /**
- * 鏌ヨ鎵�鏈夎〃淇℃伅
- *
- * @return 琛ㄤ俊鎭泦鍚�
- */
- @Override
- public List<GenTable> selectGenTableAll()
- {
- return genTableMapper.selectGenTableAll();
- }
-
- /**
- * 淇敼涓氬姟
- *
- * @param genTable 涓氬姟淇℃伅
- * @return 缁撴灉
- */
- @Override
- @Transactional
- public void updateGenTable(GenTable genTable)
- {
- String options = JSON.toJSONString(genTable.getParams());
- genTable.setOptions(options);
- int row = genTableMapper.updateGenTable(genTable);
- if (row > 0)
- {
- for (GenTableColumn genTableColumn : genTable.getColumns())
- {
- genTableColumnMapper.updateGenTableColumn(genTableColumn);
- }
- }
- }
-
- /**
- * 鍒犻櫎涓氬姟瀵硅薄
- *
- * @param tableIds 闇�瑕佸垹闄ょ殑鏁版嵁ID
- * @return 缁撴灉
- */
- @Override
- @Transactional
- public void deleteGenTableByIds(Long[] tableIds)
- {
- genTableMapper.deleteGenTableByIds(tableIds);
- genTableColumnMapper.deleteGenTableColumnByIds(tableIds);
- }
-
- /**
- * 鍒涘缓琛�
- *
- * @param sql 鍒涘缓琛ㄨ鍙�
- * @return 缁撴灉
- */
- @Override
- public boolean createTable(String sql)
- {
- return genTableMapper.createTable(sql) == 0;
- }
-
- /**
- * 瀵煎叆琛ㄧ粨鏋�
- *
- * @param tableList 瀵煎叆琛ㄥ垪琛�
- */
- @Override
- @Transactional
- public void importGenTable(List<GenTable> tableList, String operName)
- {
- try
- {
- for (GenTable table : tableList)
- {
- String tableName = table.getTableName();
- GenUtils.initTable(table, operName);
- int row = genTableMapper.insertGenTable(table);
- if (row > 0)
- {
- // 淇濆瓨鍒椾俊鎭�
- List<GenTableColumn> genTableColumns = genTableColumnMapper.selectDbTableColumnsByName(tableName);
- for (GenTableColumn column : genTableColumns)
- {
- GenUtils.initColumnField(column, table);
- genTableColumnMapper.insertGenTableColumn(column);
- }
- }
- }
- }
- catch (Exception e)
- {
- throw new ServiceException("瀵煎叆澶辫触锛�" + e.getMessage());
- }
- }
-
- /**
- * 棰勮浠g爜
- *
- * @param tableId 琛ㄧ紪鍙�
- * @return 棰勮鏁版嵁鍒楄〃
- */
- @Override
- public Map<String, String> previewCode(Long tableId)
- {
- Map<String, String> dataMap = new LinkedHashMap<>();
- // 鏌ヨ琛ㄤ俊鎭�
- GenTable table = genTableMapper.selectGenTableById(tableId);
- // 璁剧疆涓诲瓙琛ㄤ俊鎭�
- setSubTable(table);
- // 璁剧疆涓婚敭鍒椾俊鎭�
- setPkColumn(table);
- VelocityInitializer.initVelocity();
-
- VelocityContext context = VelocityUtils.prepareContext(table);
-
- // 鑾峰彇妯℃澘鍒楄〃
- List<String> templates = VelocityUtils.getTemplateList(table.getTplCategory(), table.getTplWebType());
- for (String template : templates)
- {
- // 娓叉煋妯℃澘
- StringWriter sw = new StringWriter();
- Template tpl = Velocity.getTemplate(template, Constants.UTF8);
- tpl.merge(context, sw);
- dataMap.put(template, sw.toString());
- }
- return dataMap;
- }
-
- /**
- * 鐢熸垚浠g爜锛堜笅杞芥柟寮忥級
- *
- * @param tableName 琛ㄥ悕绉�
- * @return 鏁版嵁
- */
- @Override
- public byte[] downloadCode(String tableName)
- {
- ByteArrayOutputStream outputStream = new ByteArrayOutputStream();
- ZipOutputStream zip = new ZipOutputStream(outputStream);
- generatorCode(tableName, zip);
- IOUtils.closeQuietly(zip);
- return outputStream.toByteArray();
- }
-
- /**
- * 鐢熸垚浠g爜锛堣嚜瀹氫箟璺緞锛�
- *
- * @param tableName 琛ㄥ悕绉�
- */
- @Override
- public void generatorCode(String tableName)
- {
- // 鏌ヨ琛ㄤ俊鎭�
- GenTable table = genTableMapper.selectGenTableByName(tableName);
- // 璁剧疆涓诲瓙琛ㄤ俊鎭�
- setSubTable(table);
- // 璁剧疆涓婚敭鍒椾俊鎭�
- setPkColumn(table);
-
- VelocityInitializer.initVelocity();
-
- VelocityContext context = VelocityUtils.prepareContext(table);
-
- // 鑾峰彇妯℃澘鍒楄〃
- List<String> templates = VelocityUtils.getTemplateList(table.getTplCategory(), table.getTplWebType());
- for (String template : templates)
- {
- if (!StringUtils.containsAny(template, "sql.vm", "api.js.vm", "index.vue.vm", "index-tree.vue.vm"))
- {
- // 娓叉煋妯℃澘
- StringWriter sw = new StringWriter();
- Template tpl = Velocity.getTemplate(template, Constants.UTF8);
- tpl.merge(context, sw);
- try
- {
- String path = getGenPath(table, template);
- FileUtils.writeStringToFile(new File(path), sw.toString(), CharsetKit.UTF_8);
- }
- catch (IOException e)
- {
- throw new ServiceException("娓叉煋妯℃澘澶辫触锛岃〃鍚嶏細" + table.getTableName());
- }
- }
- }
- }
-
- /**
- * 鍚屾鏁版嵁搴�
- *
- * @param tableName 琛ㄥ悕绉�
- */
- @Override
- @Transactional
- public void synchDb(String tableName)
- {
- GenTable table = genTableMapper.selectGenTableByName(tableName);
- List<GenTableColumn> tableColumns = table.getColumns();
- Map<String, GenTableColumn> tableColumnMap = tableColumns.stream().collect(Collectors.toMap(GenTableColumn::getColumnName, Function.identity()));
-
- List<GenTableColumn> dbTableColumns = genTableColumnMapper.selectDbTableColumnsByName(tableName);
- if (StringUtils.isEmpty(dbTableColumns))
- {
- throw new ServiceException("鍚屾鏁版嵁澶辫触锛屽師琛ㄧ粨鏋勪笉瀛樺湪");
- }
- List<String> dbTableColumnNames = dbTableColumns.stream().map(GenTableColumn::getColumnName).collect(Collectors.toList());
-
- dbTableColumns.forEach(column -> {
- GenUtils.initColumnField(column, table);
- if (tableColumnMap.containsKey(column.getColumnName()))
- {
- GenTableColumn prevColumn = tableColumnMap.get(column.getColumnName());
- column.setColumnId(prevColumn.getColumnId());
- if (column.isList())
- {
- // 濡傛灉鏄垪琛紝缁х画淇濈暀鏌ヨ鏂瑰紡/瀛楀吀绫诲瀷閫夐」
- column.setDictType(prevColumn.getDictType());
- column.setQueryType(prevColumn.getQueryType());
- }
- if (StringUtils.isNotEmpty(prevColumn.getIsRequired()) && !column.isPk()
- && (column.isInsert() || column.isEdit())
- && ((column.isUsableColumn()) || (!column.isSuperColumn())))
- {
- // 濡傛灉鏄�(鏂板/淇敼&闈炰富閿�/闈炲拷鐣ュ強鐖跺睘鎬�)锛岀户缁繚鐣欏繀濉�/鏄剧ず绫诲瀷閫夐」
- column.setIsRequired(prevColumn.getIsRequired());
- column.setHtmlType(prevColumn.getHtmlType());
- }
- genTableColumnMapper.updateGenTableColumn(column);
- }
- else
- {
- genTableColumnMapper.insertGenTableColumn(column);
- }
- });
-
- List<GenTableColumn> delColumns = tableColumns.stream().filter(column -> !dbTableColumnNames.contains(column.getColumnName())).collect(Collectors.toList());
- if (StringUtils.isNotEmpty(delColumns))
- {
- genTableColumnMapper.deleteGenTableColumns(delColumns);
- }
- }
-
- /**
- * 鎵归噺鐢熸垚浠g爜锛堜笅杞芥柟寮忥級
- *
- * @param tableNames 琛ㄦ暟缁�
- * @return 鏁版嵁
- */
- @Override
- public byte[] downloadCode(String[] tableNames)
- {
- ByteArrayOutputStream outputStream = new ByteArrayOutputStream();
- ZipOutputStream zip = new ZipOutputStream(outputStream);
- for (String tableName : tableNames)
- {
- generatorCode(tableName, zip);
- }
- IOUtils.closeQuietly(zip);
- return outputStream.toByteArray();
- }
-
- /**
- * 鏌ヨ琛ㄤ俊鎭苟鐢熸垚浠g爜
- */
- private void generatorCode(String tableName, ZipOutputStream zip)
- {
- // 鏌ヨ琛ㄤ俊鎭�
- GenTable table = genTableMapper.selectGenTableByName(tableName);
- // 璁剧疆涓诲瓙琛ㄤ俊鎭�
- setSubTable(table);
- // 璁剧疆涓婚敭鍒椾俊鎭�
- setPkColumn(table);
-
- VelocityInitializer.initVelocity();
-
- VelocityContext context = VelocityUtils.prepareContext(table);
-
- // 鑾峰彇妯℃澘鍒楄〃
- List<String> templates = VelocityUtils.getTemplateList(table.getTplCategory(), table.getTplWebType());
- for (String template : templates)
- {
- // 娓叉煋妯℃澘
- StringWriter sw = new StringWriter();
- Template tpl = Velocity.getTemplate(template, Constants.UTF8);
- tpl.merge(context, sw);
- try
- {
- // 娣诲姞鍒皕ip
- zip.putNextEntry(new ZipEntry(VelocityUtils.getFileName(template, table)));
- IOUtils.write(sw.toString(), zip, Constants.UTF8);
- IOUtils.closeQuietly(sw);
- zip.flush();
- zip.closeEntry();
- }
- catch (IOException e)
- {
- log.error("娓叉煋妯℃澘澶辫触锛岃〃鍚嶏細" + table.getTableName(), e);
- }
- }
- }
-
- /**
- * 淇敼淇濆瓨鍙傛暟鏍¢獙
- *
- * @param genTable 涓氬姟淇℃伅
- */
- @Override
- public void validateEdit(GenTable genTable)
- {
- if (GenConstants.TPL_TREE.equals(genTable.getTplCategory()))
- {
- String options = JSON.toJSONString(genTable.getParams());
- JSONObject paramsObj = JSON.parseObject(options);
- if (StringUtils.isEmpty(paramsObj.getString(GenConstants.TREE_CODE)))
- {
- throw new ServiceException("鏍戠紪鐮佸瓧娈典笉鑳戒负绌�");
- }
- else if (StringUtils.isEmpty(paramsObj.getString(GenConstants.TREE_PARENT_CODE)))
- {
- throw new ServiceException("鏍戠埗缂栫爜瀛楁涓嶈兘涓虹┖");
- }
- else if (StringUtils.isEmpty(paramsObj.getString(GenConstants.TREE_NAME)))
- {
- throw new ServiceException("鏍戝悕绉板瓧娈典笉鑳戒负绌�");
- }
- }
- else if (GenConstants.TPL_SUB.equals(genTable.getTplCategory()))
- {
- if (StringUtils.isEmpty(genTable.getSubTableName()))
- {
- throw new ServiceException("鍏宠仈瀛愯〃鐨勮〃鍚嶄笉鑳戒负绌�");
- }
- else if (StringUtils.isEmpty(genTable.getSubTableFkName()))
- {
- throw new ServiceException("瀛愯〃鍏宠仈鐨勫閿悕涓嶈兘涓虹┖");
- }
- }
- }
-
- /**
- * 璁剧疆涓婚敭鍒椾俊鎭�
- *
- * @param table 涓氬姟琛ㄤ俊鎭�
- */
- public void setPkColumn(GenTable table)
- {
- for (GenTableColumn column : table.getColumns())
- {
- if (column.isPk())
- {
- table.setPkColumn(column);
- break;
- }
- }
- if (StringUtils.isNull(table.getPkColumn()))
- {
- 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));
- }
- }
-
- /**
- * 璁剧疆浠g爜鐢熸垚鍏朵粬閫夐」鍊�
- *
- * @param genTable 璁剧疆鍚庣殑鐢熸垚瀵硅薄
- */
- public void setTableFromOptions(GenTable genTable)
- {
- JSONObject paramsObj = JSON.parseObject(genTable.getOptions());
- if (StringUtils.isNotNull(paramsObj))
- {
- String treeCode = paramsObj.getString(GenConstants.TREE_CODE);
- String treeParentCode = paramsObj.getString(GenConstants.TREE_PARENT_CODE);
- String treeName = paramsObj.getString(GenConstants.TREE_NAME);
- Long parentMenuId = paramsObj.getLongValue(GenConstants.PARENT_MENU_ID);
- String parentMenuName = paramsObj.getString(GenConstants.PARENT_MENU_NAME);
-
- genTable.setTreeCode(treeCode);
- genTable.setTreeParentCode(treeParentCode);
- genTable.setTreeName(treeName);
- genTable.setParentMenuId(parentMenuId);
- genTable.setParentMenuName(parentMenuName);
- }
- }
-
- /**
- * 鑾峰彇浠g爜鐢熸垚鍦板潃
- *
- * @param table 涓氬姟琛ㄤ俊鎭�
- * @param template 妯℃澘鏂囦欢璺緞
- * @return 鐢熸垚鍦板潃
- */
- public static String getGenPath(GenTable table, String template)
- {
- String genPath = table.getGenPath();
- if (StringUtils.equals(genPath, "/"))
- {
- return System.getProperty("user.dir") + File.separator + "src" + File.separator + VelocityUtils.getFileName(template, table);
- }
- return genPath + File.separator + VelocityUtils.getFileName(template, table);
- }
-}
\ No newline at end of file
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 3037f70..0000000
--- 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<GenTableColumn> 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 695426e..0000000
--- a/ruoyi-generator/src/main/java/com/ruoyi/generator/service/IGenTableService.java
+++ /dev/null
@@ -1,130 +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<GenTable> selectGenTableList(GenTable genTable);
-
- /**
- * 鏌ヨ鎹簱鍒楄〃
- *
- * @param genTable 涓氬姟淇℃伅
- * @return 鏁版嵁搴撹〃闆嗗悎
- */
- public List<GenTable> selectDbTableList(GenTable genTable);
-
- /**
- * 鏌ヨ鎹簱鍒楄〃
- *
- * @param tableNames 琛ㄥ悕绉扮粍
- * @return 鏁版嵁搴撹〃闆嗗悎
- */
- public List<GenTable> selectDbTableListByNames(String[] tableNames);
-
- /**
- * 鏌ヨ鎵�鏈夎〃淇℃伅
- *
- * @return 琛ㄤ俊鎭泦鍚�
- */
- public List<GenTable> selectGenTableAll();
-
- /**
- * 鏌ヨ涓氬姟淇℃伅
- *
- * @param id 涓氬姟ID
- * @return 涓氬姟淇℃伅
- */
- public GenTable selectGenTableById(Long id);
-
- /**
- * 淇敼涓氬姟
- *
- * @param genTable 涓氬姟淇℃伅
- * @return 缁撴灉
- */
- public void updateGenTable(GenTable genTable);
-
- /**
- * 鍒犻櫎涓氬姟淇℃伅
- *
- * @param tableIds 闇�瑕佸垹闄ょ殑琛ㄦ暟鎹甀D
- * @return 缁撴灉
- */
- public void deleteGenTableByIds(Long[] tableIds);
-
- /**
- * 鍒涘缓琛�
- *
- * @param sql 鍒涘缓琛ㄨ鍙�
- * @return 缁撴灉
- */
- public boolean createTable(String sql);
-
- /**
- * 瀵煎叆琛ㄧ粨鏋�
- *
- * @param tableList 瀵煎叆琛ㄥ垪琛�
- * @param operName 鎿嶄綔浜哄憳
- */
- public void importGenTable(List<GenTable> tableList, String operName);
-
- /**
- * 棰勮浠g爜
- *
- * @param tableId 琛ㄧ紪鍙�
- * @return 棰勮鏁版嵁鍒楄〃
- */
- public Map<String, String> previewCode(Long tableId);
-
- /**
- * 鐢熸垚浠g爜锛堜笅杞芥柟寮忥級
- *
- * @param tableName 琛ㄥ悕绉�
- * @return 鏁版嵁
- */
- public byte[] downloadCode(String tableName);
-
- /**
- * 鐢熸垚浠g爜锛堣嚜瀹氫箟璺緞锛�
- *
- * @param tableName 琛ㄥ悕绉�
- * @return 鏁版嵁
- */
- public void generatorCode(String tableName);
-
- /**
- * 鍚屾鏁版嵁搴�
- *
- * @param tableName 琛ㄥ悕绉�
- */
- public void synchDb(String tableName);
-
- /**
- * 鎵归噺鐢熸垚浠g爜锛堜笅杞芥柟寮忥級
- *
- * @param tableNames 琛ㄦ暟缁�
- * @return 鏁版嵁
- */
- public byte[] downloadCode(String[] tableNames);
-
- /**
- * 淇敼淇濆瓨鍙傛暟鏍¢獙
- *
- * @param genTable 涓氬姟淇℃伅
- */
- public void validateEdit(GenTable genTable);
-}
diff --git a/ruoyi-generator/src/main/java/com/ruoyi/generator/util/GenUtils.java b/ruoyi-generator/src/main/java/com/ruoyi/generator/util/GenUtils.java
deleted file mode 100644
index e7ebc20..0000000
--- a/ruoyi-generator/src/main/java/com/ruoyi/generator/util/GenUtils.java
+++ /dev/null
@@ -1,257 +0,0 @@
-package com.ruoyi.generator.util;
-
-import java.util.Arrays;
-import org.apache.commons.lang3.RegExUtils;
-import com.ruoyi.common.constant.GenConstants;
-import com.ruoyi.common.utils.StringUtils;
-import com.ruoyi.generator.config.GenConfig;
-import com.ruoyi.generator.domain.GenTable;
-import com.ruoyi.generator.domain.GenTableColumn;
-
-/**
- * 浠g爜鐢熸垚鍣� 宸ュ叿绫�
- *
- * @author ruoyi
- */
-public class GenUtils
-{
- /**
- * 鍒濆鍖栬〃淇℃伅
- */
- public static void initTable(GenTable genTable, String operName)
- {
- genTable.setClassName(convertClassName(genTable.getTableName()));
- genTable.setPackageName(GenConfig.getPackageName());
- genTable.setModuleName(getModuleName(GenConfig.getPackageName()));
- genTable.setBusinessName(getBusinessName(genTable.getTableName()));
- genTable.setFunctionName(replaceText(genTable.getTableComment()));
- genTable.setFunctionAuthor(GenConfig.getAuthor());
- genTable.setCreateBy(operName);
- }
-
- /**
- * 鍒濆鍖栧垪灞炴�у瓧娈�
- */
- public static void initColumnField(GenTableColumn column, GenTable table)
- {
- String dataType = getDbType(column.getColumnType());
- String columnName = column.getColumnName();
- column.setTableId(table.getTableId());
- column.setCreateBy(table.getCreateBy());
- // 璁剧疆java瀛楁鍚�
- column.setJavaField(StringUtils.toCamelCase(columnName));
- // 璁剧疆榛樿绫诲瀷
- column.setJavaType(GenConstants.TYPE_STRING);
- column.setQueryType(GenConstants.QUERY_EQ);
-
- if (arraysContains(GenConstants.COLUMNTYPE_STR, dataType) || arraysContains(GenConstants.COLUMNTYPE_TEXT, dataType))
- {
- // 瀛楃涓查暱搴﹁秴杩�500璁剧疆涓烘枃鏈煙
- Integer columnLength = getColumnLength(column.getColumnType());
- String htmlType = columnLength >= 500 || arraysContains(GenConstants.COLUMNTYPE_TEXT, dataType) ? GenConstants.HTML_TEXTAREA : GenConstants.HTML_INPUT;
- column.setHtmlType(htmlType);
- }
- else if (arraysContains(GenConstants.COLUMNTYPE_TIME, dataType))
- {
- column.setJavaType(GenConstants.TYPE_DATE);
- column.setHtmlType(GenConstants.HTML_DATETIME);
- }
- else if (arraysContains(GenConstants.COLUMNTYPE_NUMBER, dataType))
- {
- column.setHtmlType(GenConstants.HTML_INPUT);
-
- // 濡傛灉鏄诞鐐瑰瀷 缁熶竴鐢˙igDecimal
- String[] str = StringUtils.split(StringUtils.substringBetween(column.getColumnType(), "(", ")"), ",");
- if (str != null && str.length == 2 && Integer.parseInt(str[1]) > 0)
- {
- column.setJavaType(GenConstants.TYPE_BIGDECIMAL);
- }
- // 濡傛灉鏄暣褰�
- else if (str != null && str.length == 1 && Integer.parseInt(str[0]) <= 10)
- {
- column.setJavaType(GenConstants.TYPE_INTEGER);
- }
- // 闀挎暣褰�
- else
- {
- column.setJavaType(GenConstants.TYPE_LONG);
- }
- }
-
- // 鎻掑叆瀛楁锛堥粯璁ゆ墍鏈夊瓧娈甸兘闇�瑕佹彃鍏ワ級
- column.setIsInsert(GenConstants.REQUIRE);
-
- // 缂栬緫瀛楁
- if (!arraysContains(GenConstants.COLUMNNAME_NOT_EDIT, columnName) && !column.isPk())
- {
- column.setIsEdit(GenConstants.REQUIRE);
- }
- // 鍒楄〃瀛楁
- if (!arraysContains(GenConstants.COLUMNNAME_NOT_LIST, columnName) && !column.isPk())
- {
- column.setIsList(GenConstants.REQUIRE);
- }
- // 鏌ヨ瀛楁
- if (!arraysContains(GenConstants.COLUMNNAME_NOT_QUERY, columnName) && !column.isPk())
- {
- column.setIsQuery(GenConstants.REQUIRE);
- }
-
- // 鏌ヨ瀛楁绫诲瀷
- if (StringUtils.endsWithIgnoreCase(columnName, "name"))
- {
- column.setQueryType(GenConstants.QUERY_LIKE);
- }
- // 鐘舵�佸瓧娈佃缃崟閫夋
- if (StringUtils.endsWithIgnoreCase(columnName, "status"))
- {
- column.setHtmlType(GenConstants.HTML_RADIO);
- }
- // 绫诲瀷&鎬у埆瀛楁璁剧疆涓嬫媺妗�
- else if (StringUtils.endsWithIgnoreCase(columnName, "type")
- || StringUtils.endsWithIgnoreCase(columnName, "sex"))
- {
- column.setHtmlType(GenConstants.HTML_SELECT);
- }
- // 鍥剧墖瀛楁璁剧疆鍥剧墖涓婁紶鎺т欢
- else if (StringUtils.endsWithIgnoreCase(columnName, "image"))
- {
- column.setHtmlType(GenConstants.HTML_IMAGE_UPLOAD);
- }
- // 鏂囦欢瀛楁璁剧疆鏂囦欢涓婁紶鎺т欢
- else if (StringUtils.endsWithIgnoreCase(columnName, "file"))
- {
- column.setHtmlType(GenConstants.HTML_FILE_UPLOAD);
- }
- // 鍐呭瀛楁璁剧疆瀵屾枃鏈帶浠�
- else if (StringUtils.endsWithIgnoreCase(columnName, "content"))
- {
- column.setHtmlType(GenConstants.HTML_EDITOR);
- }
- }
-
- /**
- * 鏍¢獙鏁扮粍鏄惁鍖呭惈鎸囧畾鍊�
- *
- * @param arr 鏁扮粍
- * @param targetValue 鍊�
- * @return 鏄惁鍖呭惈
- */
- public static boolean arraysContains(String[] arr, String targetValue)
- {
- return Arrays.asList(arr).contains(targetValue);
- }
-
- /**
- * 鑾峰彇妯″潡鍚�
- *
- * @param packageName 鍖呭悕
- * @return 妯″潡鍚�
- */
- public static String getModuleName(String packageName)
- {
- int lastIndex = packageName.lastIndexOf(".");
- int nameLength = packageName.length();
- return StringUtils.substring(packageName, lastIndex + 1, nameLength);
- }
-
- /**
- * 鑾峰彇涓氬姟鍚�
- *
- * @param tableName 琛ㄥ悕
- * @return 涓氬姟鍚�
- */
- public static String getBusinessName(String tableName)
- {
- int lastIndex = tableName.lastIndexOf("_");
- int nameLength = tableName.length();
- return StringUtils.substring(tableName, lastIndex + 1, nameLength);
- }
-
- /**
- * 琛ㄥ悕杞崲鎴怞ava绫诲悕
- *
- * @param tableName 琛ㄥ悕绉�
- * @return 绫诲悕
- */
- public static String convertClassName(String tableName)
- {
- boolean autoRemovePre = GenConfig.getAutoRemovePre();
- String tablePrefix = GenConfig.getTablePrefix();
- if (autoRemovePre && StringUtils.isNotEmpty(tablePrefix))
- {
- String[] searchList = StringUtils.split(tablePrefix, ",");
- tableName = replaceFirst(tableName, searchList);
- }
- return StringUtils.convertToCamelCase(tableName);
- }
-
- /**
- * 鎵归噺鏇挎崲鍓嶇紑
- *
- * @param replacementm 鏇挎崲鍊�
- * @param searchList 鏇挎崲鍒楄〃
- * @return
- */
- public static String replaceFirst(String replacementm, String[] searchList)
- {
- String text = replacementm;
- for (String searchString : searchList)
- {
- if (replacementm.startsWith(searchString))
- {
- text = replacementm.replaceFirst(searchString, "");
- break;
- }
- }
- return text;
- }
-
- /**
- * 鍏抽敭瀛楁浛鎹�
- *
- * @param text 闇�瑕佽鏇挎崲鐨勫悕瀛�
- * @return 鏇挎崲鍚庣殑鍚嶅瓧
- */
- public static String replaceText(String text)
- {
- return RegExUtils.replaceAll(text, "(?:琛▅鑻ヤ緷)", "");
- }
-
- /**
- * 鑾峰彇鏁版嵁搴撶被鍨嬪瓧娈�
- *
- * @param columnType 鍒楃被鍨�
- * @return 鎴彇鍚庣殑鍒楃被鍨�
- */
- public static String getDbType(String columnType)
- {
- if (StringUtils.indexOf(columnType, "(") > 0)
- {
- return StringUtils.substringBefore(columnType, "(");
- }
- else
- {
- return columnType;
- }
- }
-
- /**
- * 鑾峰彇瀛楁闀垮害
- *
- * @param columnType 鍒楃被鍨�
- * @return 鎴彇鍚庣殑鍒楃被鍨�
- */
- public static Integer getColumnLength(String columnType)
- {
- if (StringUtils.indexOf(columnType, "(") > 0)
- {
- String length = StringUtils.substringBetween(columnType, "(", ")");
- return Integer.valueOf(length);
- }
- else
- {
- return 0;
- }
- }
-}
diff --git a/ruoyi-generator/src/main/java/com/ruoyi/generator/util/VelocityInitializer.java b/ruoyi-generator/src/main/java/com/ruoyi/generator/util/VelocityInitializer.java
deleted file mode 100644
index 9f69403..0000000
--- a/ruoyi-generator/src/main/java/com/ruoyi/generator/util/VelocityInitializer.java
+++ /dev/null
@@ -1,34 +0,0 @@
-package com.ruoyi.generator.util;
-
-import java.util.Properties;
-import org.apache.velocity.app.Velocity;
-import com.ruoyi.common.constant.Constants;
-
-/**
- * VelocityEngine宸ュ巶
- *
- * @author ruoyi
- */
-public class VelocityInitializer
-{
- /**
- * 鍒濆鍖杤m鏂规硶
- */
- public static void initVelocity()
- {
- Properties p = new Properties();
- try
- {
- // 鍔犺浇classpath鐩綍涓嬬殑vm鏂囦欢
- p.setProperty("resource.loader.file.class", "org.apache.velocity.runtime.resource.loader.ClasspathResourceLoader");
- // 瀹氫箟瀛楃闆�
- p.setProperty(Velocity.INPUT_ENCODING, Constants.UTF8);
- // 鍒濆鍖朧elocity寮曟搸锛屾寚瀹氶厤缃甈roperties
- Velocity.init(p);
- }
- catch (Exception e)
- {
- throw new RuntimeException(e);
- }
- }
-}
diff --git a/ruoyi-generator/src/main/java/com/ruoyi/generator/util/VelocityUtils.java b/ruoyi-generator/src/main/java/com/ruoyi/generator/util/VelocityUtils.java
deleted file mode 100644
index 1a14681..0000000
--- a/ruoyi-generator/src/main/java/com/ruoyi/generator/util/VelocityUtils.java
+++ /dev/null
@@ -1,408 +0,0 @@
-package com.ruoyi.generator.util;
-
-import java.util.ArrayList;
-import java.util.HashSet;
-import java.util.List;
-import java.util.Set;
-import org.apache.velocity.VelocityContext;
-import com.alibaba.fastjson2.JSON;
-import com.alibaba.fastjson2.JSONObject;
-import com.ruoyi.common.constant.GenConstants;
-import com.ruoyi.common.utils.DateUtils;
-import com.ruoyi.common.utils.StringUtils;
-import com.ruoyi.generator.domain.GenTable;
-import com.ruoyi.generator.domain.GenTableColumn;
-
-/**
- * 妯℃澘澶勭悊宸ュ叿绫�
- *
- * @author ruoyi
- */
-public class VelocityUtils
-{
- /** 椤圭洰绌洪棿璺緞 */
- private static final String PROJECT_PATH = "main/java";
-
- /** mybatis绌洪棿璺緞 */
- private static final String MYBATIS_PATH = "main/resources/mapper";
-
- /** 榛樿涓婄骇鑿滃崟锛岀郴缁熷伐鍏� */
- private static final String DEFAULT_PARENT_MENU_ID = "3";
-
- /**
- * 璁剧疆妯℃澘鍙橀噺淇℃伅
- *
- * @return 妯℃澘鍒楄〃
- */
- public static VelocityContext prepareContext(GenTable genTable)
- {
- String moduleName = genTable.getModuleName();
- String businessName = genTable.getBusinessName();
- String packageName = genTable.getPackageName();
- String tplCategory = genTable.getTplCategory();
- String functionName = genTable.getFunctionName();
-
- VelocityContext velocityContext = new VelocityContext();
- velocityContext.put("tplCategory", genTable.getTplCategory());
- velocityContext.put("tableName", genTable.getTableName());
- velocityContext.put("functionName", StringUtils.isNotEmpty(functionName) ? functionName : "銆愯濉啓鍔熻兘鍚嶇О銆�");
- velocityContext.put("ClassName", genTable.getClassName());
- velocityContext.put("className", StringUtils.uncapitalize(genTable.getClassName()));
- velocityContext.put("moduleName", genTable.getModuleName());
- velocityContext.put("BusinessName", StringUtils.capitalize(genTable.getBusinessName()));
- velocityContext.put("businessName", genTable.getBusinessName());
- velocityContext.put("basePackage", getPackagePrefix(packageName));
- velocityContext.put("packageName", packageName);
- velocityContext.put("author", genTable.getFunctionAuthor());
- velocityContext.put("datetime", DateUtils.getDate());
- velocityContext.put("pkColumn", genTable.getPkColumn());
- velocityContext.put("importList", getImportList(genTable));
- velocityContext.put("permissionPrefix", getPermissionPrefix(moduleName, businessName));
- velocityContext.put("columns", genTable.getColumns());
- velocityContext.put("table", genTable);
- velocityContext.put("dicts", getDicts(genTable));
- setMenuVelocityContext(velocityContext, genTable);
- if (GenConstants.TPL_TREE.equals(tplCategory))
- {
- setTreeVelocityContext(velocityContext, genTable);
- }
- if (GenConstants.TPL_SUB.equals(tplCategory))
- {
- setSubVelocityContext(velocityContext, genTable);
- }
- return velocityContext;
- }
-
- public static void setMenuVelocityContext(VelocityContext context, GenTable genTable)
- {
- String options = genTable.getOptions();
- JSONObject paramsObj = JSON.parseObject(options);
- String parentMenuId = getParentMenuId(paramsObj);
- context.put("parentMenuId", parentMenuId);
- }
-
- public static void setTreeVelocityContext(VelocityContext context, GenTable genTable)
- {
- String options = genTable.getOptions();
- JSONObject paramsObj = JSON.parseObject(options);
- String treeCode = getTreecode(paramsObj);
- String treeParentCode = getTreeParentCode(paramsObj);
- String treeName = getTreeName(paramsObj);
-
- context.put("treeCode", treeCode);
- context.put("treeParentCode", treeParentCode);
- context.put("treeName", treeName);
- context.put("expandColumn", getExpandColumn(genTable));
- if (paramsObj.containsKey(GenConstants.TREE_PARENT_CODE))
- {
- context.put("tree_parent_code", paramsObj.getString(GenConstants.TREE_PARENT_CODE));
- }
- if (paramsObj.containsKey(GenConstants.TREE_NAME))
- {
- context.put("tree_name", paramsObj.getString(GenConstants.TREE_NAME));
- }
- }
-
- 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()));
- }
-
- /**
- * 鑾峰彇妯℃澘淇℃伅
- * @param tplCategory 鐢熸垚鐨勬ā鏉�
- * @param tplWebType 鍓嶇绫诲瀷
- * @return 妯℃澘鍒楄〃
- */
- public static List<String> getTemplateList(String tplCategory, String tplWebType)
- {
- String useWebType = "vm/vue";
- if ("element-plus".equals(tplWebType))
- {
- useWebType = "vm/vue/v3";
- }
- List<String> templates = new ArrayList<String>();
- templates.add("vm/java/domain.java.vm");
- templates.add("vm/java/mapper.java.vm");
- templates.add("vm/java/service.java.vm");
- templates.add("vm/java/serviceImpl.java.vm");
- templates.add("vm/java/controller.java.vm");
- templates.add("vm/xml/mapper.xml.vm");
- templates.add("vm/sql/sql.vm");
- templates.add("vm/js/api.js.vm");
- if (GenConstants.TPL_CRUD.equals(tplCategory))
- {
- templates.add(useWebType + "/index.vue.vm");
- }
- else if (GenConstants.TPL_TREE.equals(tplCategory))
- {
- templates.add(useWebType + "/index-tree.vue.vm");
- }
- else if (GenConstants.TPL_SUB.equals(tplCategory))
- {
- templates.add(useWebType + "/index.vue.vm");
- templates.add("vm/java/sub-domain.java.vm");
- }
- return templates;
- }
-
- /**
- * 鑾峰彇鏂囦欢鍚�
- */
- public static String getFileName(String template, GenTable genTable)
- {
- // 鏂囦欢鍚嶇О
- String fileName = "";
- // 鍖呰矾寰�
- String packageName = genTable.getPackageName();
- // 妯″潡鍚�
- String moduleName = genTable.getModuleName();
- // 澶у啓绫诲悕
- String className = genTable.getClassName();
- // 涓氬姟鍚嶇О
- String businessName = genTable.getBusinessName();
-
- String javaPath = PROJECT_PATH + "/" + StringUtils.replace(packageName, ".", "/");
- String mybatisPath = MYBATIS_PATH + "/" + moduleName;
- String vuePath = "vue";
-
- 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"))
- {
- fileName = StringUtils.format("{}/mapper/{}Mapper.java", javaPath, className);
- }
- else if (template.contains("service.java.vm"))
- {
- fileName = StringUtils.format("{}/service/I{}Service.java", javaPath, className);
- }
- else if (template.contains("serviceImpl.java.vm"))
- {
- fileName = StringUtils.format("{}/service/impl/{}ServiceImpl.java", javaPath, className);
- }
- else if (template.contains("controller.java.vm"))
- {
- fileName = StringUtils.format("{}/controller/{}Controller.java", javaPath, className);
- }
- else if (template.contains("mapper.xml.vm"))
- {
- fileName = StringUtils.format("{}/{}Mapper.xml", mybatisPath, className);
- }
- else if (template.contains("sql.vm"))
- {
- fileName = businessName + "Menu.sql";
- }
- else if (template.contains("api.js.vm"))
- {
- fileName = StringUtils.format("{}/api/{}/{}.js", vuePath, moduleName, businessName);
- }
- else if (template.contains("index.vue.vm"))
- {
- fileName = StringUtils.format("{}/views/{}/{}/index.vue", vuePath, moduleName, businessName);
- }
- else if (template.contains("index-tree.vue.vm"))
- {
- fileName = StringUtils.format("{}/views/{}/{}/index.vue", vuePath, moduleName, businessName);
- }
- return fileName;
- }
-
- /**
- * 鑾峰彇鍖呭墠缂�
- *
- * @param packageName 鍖呭悕绉�
- * @return 鍖呭墠缂�鍚嶇О
- */
- public static String getPackagePrefix(String packageName)
- {
- int lastIndex = packageName.lastIndexOf(".");
- return StringUtils.substring(packageName, 0, lastIndex);
- }
-
- /**
- * 鏍规嵁鍒楃被鍨嬭幏鍙栧鍏ュ寘
- *
- * @param genTable 涓氬姟琛ㄥ璞�
- * @return 杩斿洖闇�瑕佸鍏ョ殑鍖呭垪琛�
- */
- 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()))
- {
- importList.add("java.util.Date");
- importList.add("com.fasterxml.jackson.annotation.JsonFormat");
- }
- else if (!column.isSuperColumn() && GenConstants.TYPE_BIGDECIMAL.equals(column.getJavaType()))
- {
- importList.add("java.math.BigDecimal");
- }
- }
- return importList;
- }
-
- /**
- * 鏍规嵁鍒楃被鍨嬭幏鍙栧瓧鍏哥粍
- *
- * @param genTable 涓氬姟琛ㄥ璞�
- * @return 杩斿洖瀛楀吀缁�
- */
- public static String getDicts(GenTable genTable)
- {
- List<GenTableColumn> columns = genTable.getColumns();
- Set<String> dicts = new HashSet<String>();
- addDicts(dicts, columns);
- if (StringUtils.isNotNull(genTable.getSubTable()))
- {
- List<GenTableColumn> subColumns = genTable.getSubTable().getColumns();
- addDicts(dicts, subColumns);
- }
- return StringUtils.join(dicts, ", ");
- }
-
- /**
- * 娣诲姞瀛楀吀鍒楄〃
- *
- * @param dicts 瀛楀吀鍒楄〃
- * @param columns 鍒楅泦鍚�
- */
- public static void addDicts(Set<String> dicts, List<GenTableColumn> columns)
- {
- for (GenTableColumn column : columns)
- {
- if (!column.isSuperColumn() && StringUtils.isNotEmpty(column.getDictType()) && StringUtils.equalsAny(
- column.getHtmlType(),
- new String[] { GenConstants.HTML_SELECT, GenConstants.HTML_RADIO, GenConstants.HTML_CHECKBOX }))
- {
- dicts.add("'" + column.getDictType() + "'");
- }
- }
- }
-
- /**
- * 鑾峰彇鏉冮檺鍓嶇紑
- *
- * @param moduleName 妯″潡鍚嶇О
- * @param businessName 涓氬姟鍚嶇О
- * @return 杩斿洖鏉冮檺鍓嶇紑
- */
- public static String getPermissionPrefix(String moduleName, String businessName)
- {
- return StringUtils.format("{}:{}", moduleName, businessName);
- }
-
- /**
- * 鑾峰彇涓婄骇鑿滃崟ID瀛楁
- *
- * @param paramsObj 鐢熸垚鍏朵粬閫夐」
- * @return 涓婄骇鑿滃崟ID瀛楁
- */
- public static String getParentMenuId(JSONObject paramsObj)
- {
- if (StringUtils.isNotEmpty(paramsObj) && paramsObj.containsKey(GenConstants.PARENT_MENU_ID)
- && StringUtils.isNotEmpty(paramsObj.getString(GenConstants.PARENT_MENU_ID)))
- {
- return paramsObj.getString(GenConstants.PARENT_MENU_ID);
- }
- return DEFAULT_PARENT_MENU_ID;
- }
-
- /**
- * 鑾峰彇鏍戠紪鐮�
- *
- * @param paramsObj 鐢熸垚鍏朵粬閫夐」
- * @return 鏍戠紪鐮�
- */
- public static String getTreecode(JSONObject paramsObj)
- {
- if (paramsObj.containsKey(GenConstants.TREE_CODE))
- {
- return StringUtils.toCamelCase(paramsObj.getString(GenConstants.TREE_CODE));
- }
- return StringUtils.EMPTY;
- }
-
- /**
- * 鑾峰彇鏍戠埗缂栫爜
- *
- * @param paramsObj 鐢熸垚鍏朵粬閫夐」
- * @return 鏍戠埗缂栫爜
- */
- public static String getTreeParentCode(JSONObject paramsObj)
- {
- if (paramsObj.containsKey(GenConstants.TREE_PARENT_CODE))
- {
- return StringUtils.toCamelCase(paramsObj.getString(GenConstants.TREE_PARENT_CODE));
- }
- return StringUtils.EMPTY;
- }
-
- /**
- * 鑾峰彇鏍戝悕绉�
- *
- * @param paramsObj 鐢熸垚鍏朵粬閫夐」
- * @return 鏍戝悕绉�
- */
- public static String getTreeName(JSONObject paramsObj)
- {
- if (paramsObj.containsKey(GenConstants.TREE_NAME))
- {
- return StringUtils.toCamelCase(paramsObj.getString(GenConstants.TREE_NAME));
- }
- return StringUtils.EMPTY;
- }
-
- /**
- * 鑾峰彇闇�瑕佸湪鍝竴鍒椾笂闈㈡樉绀哄睍寮�鎸夐挳
- *
- * @param genTable 涓氬姟琛ㄥ璞�
- * @return 灞曞紑鎸夐挳鍒楀簭鍙�
- */
- public static int getExpandColumn(GenTable genTable)
- {
- String options = genTable.getOptions();
- JSONObject paramsObj = JSON.parseObject(options);
- String treeName = paramsObj.getString(GenConstants.TREE_NAME);
- int num = 0;
- for (GenTableColumn column : genTable.getColumns())
- {
- if (column.isList())
- {
- num++;
- String columnName = column.getColumnName();
- if (columnName.equals(treeName))
- {
- break;
- }
- }
- }
- return num;
- }
-}
diff --git a/ruoyi-generator/src/main/resources/generator.yml.example b/ruoyi-generator/src/main/resources/generator.yml.example
deleted file mode 100644
index d1cbf48..0000000
--- a/ruoyi-generator/src/main/resources/generator.yml.example
+++ /dev/null
@@ -1,12 +0,0 @@
-# 浠g爜鐢熸垚
-gen:
- # 浣滆��
- author: ruoyi
- # 榛樿鐢熸垚鍖呰矾寰� system 闇�鏀规垚鑷繁鐨勬ā鍧楀悕绉� 濡� system monitor tool
- packageName: com.ruoyi.system
- # 鑷姩鍘婚櫎琛ㄥ墠缂�锛岄粯璁ゆ槸false
- autoRemovePre: false
- # 琛ㄥ墠缂�锛堢敓鎴愮被鍚嶄笉浼氬寘鍚〃鍓嶇紑锛屽涓敤閫楀彿鍒嗛殧锛�
- tablePrefix: sys_
- # 鏄惁鍏佽鐢熸垚鏂囦欢瑕嗙洊鍒版湰鍦帮紙鑷畾涔夎矾寰勶級锛岄粯璁や笉鍏佽
- allowOverwrite: false
\ No newline at end of file
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 c9e6b79..0000000
--- a/ruoyi-generator/src/main/resources/mapper/generator/GenTableColumnMapper.xml
+++ /dev/null
@@ -1,127 +0,0 @@
-<?xml version="1.0" encoding="UTF-8" ?>
-<!DOCTYPE mapper
-PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
-"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
-<mapper namespace="com.ruoyi.generator.mapper.GenTableColumnMapper">
-
- <resultMap type="GenTableColumn" id="GenTableColumnResult">
- <id property="columnId" column="column_id" />
- <result property="tableId" column="table_id" />
- <result property="columnName" column="column_name" />
- <result property="columnComment" column="column_comment" />
- <result property="columnType" column="column_type" />
- <result property="javaType" column="java_type" />
- <result property="javaField" column="java_field" />
- <result property="isPk" column="is_pk" />
- <result property="isIncrement" column="is_increment" />
- <result property="isRequired" column="is_required" />
- <result property="isInsert" column="is_insert" />
- <result property="isEdit" column="is_edit" />
- <result property="isList" column="is_list" />
- <result property="isQuery" column="is_query" />
- <result property="queryType" column="query_type" />
- <result property="htmlType" column="html_type" />
- <result property="dictType" column="dict_type" />
- <result property="sort" column="sort" />
- <result property="createBy" column="create_by" />
- <result property="createTime" column="create_time" />
- <result property="updateBy" column="update_by" />
- <result property="updateTime" column="update_time" />
- </resultMap>
-
- <sql id="selectGenTableColumnVo">
- 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
- </sql>
-
- <select id="selectGenTableColumnListByTableId" parameterType="Long" resultMap="GenTableColumnResult">
- <include refid="selectGenTableColumnVo"/>
- where table_id = #{tableId}
- order by sort
- </select>
-
- <select id="selectDbTableColumnsByName" parameterType="String" resultMap="GenTableColumnResult">
- select column_name, (case when (is_nullable = 'no' <![CDATA[ && ]]> column_key != 'PRI') then '1' else '0' end) as is_required, (case when column_key = 'PRI' then '1' else '0' end) as is_pk, ordinal_position as sort, column_comment, (case when extra = 'auto_increment' then '1' else '0' end) as is_increment, column_type
- from information_schema.columns where table_schema = (select database()) and table_name = (#{tableName})
- order by ordinal_position
- </select>
-
- <insert id="insertGenTableColumn" parameterType="GenTableColumn" useGeneratedKeys="true" keyProperty="columnId">
- insert into gen_table_column (
- <if test="tableId != null and tableId != ''">table_id,</if>
- <if test="columnName != null and columnName != ''">column_name,</if>
- <if test="columnComment != null and columnComment != ''">column_comment,</if>
- <if test="columnType != null and columnType != ''">column_type,</if>
- <if test="javaType != null and javaType != ''">java_type,</if>
- <if test="javaField != null and javaField != ''">java_field,</if>
- <if test="isPk != null and isPk != ''">is_pk,</if>
- <if test="isIncrement != null and isIncrement != ''">is_increment,</if>
- <if test="isRequired != null and isRequired != ''">is_required,</if>
- <if test="isInsert != null and isInsert != ''">is_insert,</if>
- <if test="isEdit != null and isEdit != ''">is_edit,</if>
- <if test="isList != null and isList != ''">is_list,</if>
- <if test="isQuery != null and isQuery != ''">is_query,</if>
- <if test="queryType != null and queryType != ''">query_type,</if>
- <if test="htmlType != null and htmlType != ''">html_type,</if>
- <if test="dictType != null and dictType != ''">dict_type,</if>
- <if test="sort != null">sort,</if>
- <if test="createBy != null and createBy != ''">create_by,</if>
- create_time
- )values(
- <if test="tableId != null and tableId != ''">#{tableId},</if>
- <if test="columnName != null and columnName != ''">#{columnName},</if>
- <if test="columnComment != null and columnComment != ''">#{columnComment},</if>
- <if test="columnType != null and columnType != ''">#{columnType},</if>
- <if test="javaType != null and javaType != ''">#{javaType},</if>
- <if test="javaField != null and javaField != ''">#{javaField},</if>
- <if test="isPk != null and isPk != ''">#{isPk},</if>
- <if test="isIncrement != null and isIncrement != ''">#{isIncrement},</if>
- <if test="isRequired != null and isRequired != ''">#{isRequired},</if>
- <if test="isInsert != null and isInsert != ''">#{isInsert},</if>
- <if test="isEdit != null and isEdit != ''">#{isEdit},</if>
- <if test="isList != null and isList != ''">#{isList},</if>
- <if test="isQuery != null and isQuery != ''">#{isQuery},</if>
- <if test="queryType != null and queryType != ''">#{queryType},</if>
- <if test="htmlType != null and htmlType != ''">#{htmlType},</if>
- <if test="dictType != null and dictType != ''">#{dictType},</if>
- <if test="sort != null">#{sort},</if>
- <if test="createBy != null and createBy != ''">#{createBy},</if>
- now()
- )
- </insert>
-
- <update id="updateGenTableColumn" parameterType="GenTableColumn">
- update gen_table_column
- <set>
- <if test="columnComment != null">column_comment = #{columnComment},</if>
- <if test="javaType != null">java_type = #{javaType},</if>
- <if test="javaField != null">java_field = #{javaField},</if>
- <if test="isInsert != null">is_insert = #{isInsert},</if>
- <if test="isEdit != null">is_edit = #{isEdit},</if>
- <if test="isList != null">is_list = #{isList},</if>
- <if test="isQuery != null">is_query = #{isQuery},</if>
- <if test="isRequired != null">is_required = #{isRequired},</if>
- <if test="queryType != null">query_type = #{queryType},</if>
- <if test="htmlType != null">html_type = #{htmlType},</if>
- <if test="dictType != null">dict_type = #{dictType},</if>
- <if test="sort != null">sort = #{sort},</if>
- <if test="updateBy != null">update_by = #{updateBy},</if>
- update_time = now()
- </set>
- where column_id = #{columnId}
- </update>
-
- <delete id="deleteGenTableColumnByIds" parameterType="Long">
- delete from gen_table_column where table_id in
- <foreach collection="array" item="tableId" open="(" separator="," close=")">
- #{tableId}
- </foreach>
- </delete>
-
- <delete id="deleteGenTableColumns">
- delete from gen_table_column where column_id in
- <foreach collection="list" item="item" open="(" separator="," close=")">
- #{item.columnId}
- </foreach>
- </delete>
-
-</mapper>
\ 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
deleted file mode 100644
index f29fcc2..0000000
--- a/ruoyi-generator/src/main/resources/mapper/generator/GenTableMapper.xml
+++ /dev/null
@@ -1,210 +0,0 @@
-<?xml version="1.0" encoding="UTF-8" ?>
-<!DOCTYPE mapper
-PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
-"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
-<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="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="tplWebType" column="tpl_web_type" />
- <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 type="GenTableColumn" id="GenTableColumnResult">
- <id property="columnId" column="column_id" />
- <result property="tableId" column="table_id" />
- <result property="columnName" column="column_name" />
- <result property="columnComment" column="column_comment" />
- <result property="columnType" column="column_type" />
- <result property="javaType" column="java_type" />
- <result property="javaField" column="java_field" />
- <result property="isPk" column="is_pk" />
- <result property="isIncrement" column="is_increment" />
- <result property="isRequired" column="is_required" />
- <result property="isInsert" column="is_insert" />
- <result property="isEdit" column="is_edit" />
- <result property="isList" column="is_list" />
- <result property="isQuery" column="is_query" />
- <result property="queryType" column="query_type" />
- <result property="htmlType" column="html_type" />
- <result property="dictType" column="dict_type" />
- <result property="sort" column="sort" />
- <result property="createBy" column="create_by" />
- <result property="createTime" column="create_time" />
- <result property="updateBy" column="update_by" />
- <result property="updateTime" column="update_time" />
- </resultMap>
-
- <sql id="selectGenTableVo">
- select table_id, table_name, table_comment, sub_table_name, sub_table_fk_name, class_name, tpl_category, tpl_web_type, 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">
- <include refid="selectGenTableVo"/>
- <where>
- <if test="tableName != null and tableName != ''">
- AND lower(table_name) like lower(concat('%', #{tableName}, '%'))
- </if>
- <if test="tableComment != null and tableComment != ''">
- AND lower(table_comment) like lower(concat('%', #{tableComment}, '%'))
- </if>
- <if test="params.beginTime != null and params.beginTime != ''"><!-- 寮�濮嬫椂闂存绱� -->
- AND date_format(create_time,'%Y%m%d') >= date_format(#{params.beginTime},'%Y%m%d')
- </if>
- <if test="params.endTime != null and params.endTime != ''"><!-- 缁撴潫鏃堕棿妫�绱� -->
- AND date_format(create_time,'%Y%m%d') <= date_format(#{params.endTime},'%Y%m%d')
- </if>
- </where>
- </select>
-
- <select id="selectDbTableList" parameterType="GenTable" resultMap="GenTableResult">
- select table_name, table_comment, create_time, update_time from information_schema.tables
- where table_schema = (select database())
- AND table_name NOT LIKE 'qrtz\_%' AND table_name NOT LIKE 'gen\_%'
- AND table_name NOT IN (select table_name from gen_table)
- <if test="tableName != null and tableName != ''">
- AND lower(table_name) like lower(concat('%', #{tableName}, '%'))
- </if>
- <if test="tableComment != null and tableComment != ''">
- AND lower(table_comment) like lower(concat('%', #{tableComment}, '%'))
- </if>
- <if test="params.beginTime != null and params.beginTime != ''"><!-- 寮�濮嬫椂闂存绱� -->
- AND date_format(create_time,'%Y%m%d') >= date_format(#{params.beginTime},'%Y%m%d')
- </if>
- <if test="params.endTime != null and params.endTime != ''"><!-- 缁撴潫鏃堕棿妫�绱� -->
- AND date_format(create_time,'%Y%m%d') <= date_format(#{params.endTime},'%Y%m%d')
- </if>
- order by create_time desc
- </select>
-
- <select id="selectDbTableListByNames" resultMap="GenTableResult">
- select table_name, table_comment, create_time, update_time from information_schema.tables
- where table_name NOT LIKE 'qrtz\_%' and table_name NOT LIKE 'gen\_%' and table_schema = (select database())
- and table_name in
- <foreach collection="array" item="name" open="(" separator="," close=")">
- #{name}
- </foreach>
- </select>
-
- <select id="selectTableByName" parameterType="String" resultMap="GenTableResult">
- select table_name, table_comment, create_time, update_time from information_schema.tables
- where table_comment <![CDATA[ <> ]]> '' and table_schema = (select database())
- and table_name = #{tableName}
- </select>
-
- <select id="selectGenTableById" parameterType="Long" 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.tpl_web_type, 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_id = #{tableId} order by c.sort
- </select>
-
- <select id="selectGenTableByName" 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.tpl_web_type, 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.tpl_web_type, 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>
- <if test="tableComment != null and tableComment != ''">table_comment,</if>
- <if test="className != null and className != ''">class_name,</if>
- <if test="tplCategory != null and tplCategory != ''">tpl_category,</if>
- <if test="tplWebType != null and tplWebType != ''">tpl_web_type,</if>
- <if test="packageName != null and packageName != ''">package_name,</if>
- <if test="moduleName != null and moduleName != ''">module_name,</if>
- <if test="businessName != null and businessName != ''">business_name,</if>
- <if test="functionName != null and functionName != ''">function_name,</if>
- <if test="functionAuthor != null and functionAuthor != ''">function_author,</if>
- <if test="genType != null and genType != ''">gen_type,</if>
- <if test="genPath != null and genPath != ''">gen_path,</if>
- <if test="remark != null and remark != ''">remark,</if>
- <if test="createBy != null and createBy != ''">create_by,</if>
- create_time
- )values(
- <if test="tableName != null">#{tableName},</if>
- <if test="tableComment != null and tableComment != ''">#{tableComment},</if>
- <if test="className != null and className != ''">#{className},</if>
- <if test="tplCategory != null and tplCategory != ''">#{tplCategory},</if>
- <if test="tplWebType != null and tplWebType != ''">#{tplWebType},</if>
- <if test="packageName != null and packageName != ''">#{packageName},</if>
- <if test="moduleName != null and moduleName != ''">#{moduleName},</if>
- <if test="businessName != null and businessName != ''">#{businessName},</if>
- <if test="functionName != null and functionName != ''">#{functionName},</if>
- <if test="functionAuthor != null and functionAuthor != ''">#{functionAuthor},</if>
- <if test="genType != null and genType != ''">#{genType},</if>
- <if test="genPath != null and genPath != ''">#{genPath},</if>
- <if test="remark != null and remark != ''">#{remark},</if>
- <if test="createBy != null and createBy != ''">#{createBy},</if>
- now()
- )
- </insert>
-
- <update id="createTable">
- ${sql}
- </update>
-
- <update id="updateGenTable" parameterType="GenTable">
- update gen_table
- <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>
- <if test="genPath != null and genPath != ''">gen_path = #{genPath},</if>
- <if test="tplCategory != null and tplCategory != ''">tpl_category = #{tplCategory},</if>
- <if test="tplWebType != null and tplWebType != ''">tpl_web_type = #{tplWebType},</if>
- <if test="packageName != null and packageName != ''">package_name = #{packageName},</if>
- <if test="moduleName != null and moduleName != ''">module_name = #{moduleName},</if>
- <if test="businessName != null and businessName != ''">business_name = #{businessName},</if>
- <if test="functionName != null and functionName != ''">function_name = #{functionName},</if>
- <if test="options != null and options != ''">options = #{options},</if>
- <if test="updateBy != null and updateBy != ''">update_by = #{updateBy},</if>
- <if test="remark != null">remark = #{remark},</if>
- update_time = now()
- </set>
- where table_id = #{tableId}
- </update>
-
- <delete id="deleteGenTableByIds" parameterType="Long">
- delete from gen_table where table_id in
- <foreach collection="array" item="tableId" open="(" separator="," close=")">
- #{tableId}
- </foreach>
- </delete>
-
-</mapper>
\ No newline at end of file
diff --git a/ruoyi-generator/src/main/resources/vm/java/controller.java.vm b/ruoyi-generator/src/main/resources/vm/java/controller.java.vm
deleted file mode 100644
index b8457a3..0000000
--- a/ruoyi-generator/src/main/resources/vm/java/controller.java.vm
+++ /dev/null
@@ -1,115 +0,0 @@
-package ${packageName}.controller;
-
-import java.util.List;
-import jakarta.servlet.http.HttpServletResponse;
-import org.springframework.security.access.prepost.PreAuthorize;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.web.bind.annotation.GetMapping;
-import org.springframework.web.bind.annotation.PostMapping;
-import org.springframework.web.bind.annotation.PutMapping;
-import org.springframework.web.bind.annotation.DeleteMapping;
-import org.springframework.web.bind.annotation.PathVariable;
-import org.springframework.web.bind.annotation.RequestBody;
-import org.springframework.web.bind.annotation.RequestMapping;
-import org.springframework.web.bind.annotation.RestController;
-import com.ruoyi.common.annotation.Log;
-import com.ruoyi.common.core.controller.BaseController;
-import com.ruoyi.common.core.domain.AjaxResult;
-import com.ruoyi.common.enums.BusinessType;
-import ${packageName}.domain.${ClassName};
-import ${packageName}.service.I${ClassName}Service;
-import com.ruoyi.common.utils.poi.ExcelUtil;
-#if($table.crud || $table.sub)
-import com.ruoyi.common.core.page.TableDataInfo;
-#elseif($table.tree)
-#end
-
-/**
- * ${functionName}Controller
- *
- * @author ${author}
- * @date ${datetime}
- */
-@RestController
-@RequestMapping("/${moduleName}/${businessName}")
-public class ${ClassName}Controller extends BaseController
-{
- @Autowired
- private I${ClassName}Service ${className}Service;
-
- /**
- * 鏌ヨ${functionName}鍒楄〃
- */
- @PreAuthorize("@ss.hasPermi('${permissionPrefix}:list')")
- @GetMapping("/list")
-#if($table.crud || $table.sub)
- public TableDataInfo list(${ClassName} ${className})
- {
- startPage();
- List<${ClassName}> list = ${className}Service.select${ClassName}List(${className});
- return getDataTable(list);
- }
-#elseif($table.tree)
- public AjaxResult list(${ClassName} ${className})
- {
- List<${ClassName}> list = ${className}Service.select${ClassName}List(${className});
- return success(list);
- }
-#end
-
- /**
- * 瀵煎嚭${functionName}鍒楄〃
- */
- @PreAuthorize("@ss.hasPermi('${permissionPrefix}:export')")
- @Log(title = "${functionName}", businessType = BusinessType.EXPORT)
- @PostMapping("/export")
- public void export(HttpServletResponse response, ${ClassName} ${className})
- {
- List<${ClassName}> list = ${className}Service.select${ClassName}List(${className});
- ExcelUtil<${ClassName}> util = new ExcelUtil<${ClassName}>(${ClassName}.class);
- util.exportExcel(response, list, "${functionName}鏁版嵁");
- }
-
- /**
- * 鑾峰彇${functionName}璇︾粏淇℃伅
- */
- @PreAuthorize("@ss.hasPermi('${permissionPrefix}:query')")
- @GetMapping(value = "/{${pkColumn.javaField}}")
- public AjaxResult getInfo(@PathVariable("${pkColumn.javaField}") ${pkColumn.javaType} ${pkColumn.javaField})
- {
- return success(${className}Service.select${ClassName}By${pkColumn.capJavaField}(${pkColumn.javaField}));
- }
-
- /**
- * 鏂板${functionName}
- */
- @PreAuthorize("@ss.hasPermi('${permissionPrefix}:add')")
- @Log(title = "${functionName}", businessType = BusinessType.INSERT)
- @PostMapping
- public AjaxResult add(@RequestBody ${ClassName} ${className})
- {
- return toAjax(${className}Service.insert${ClassName}(${className}));
- }
-
- /**
- * 淇敼${functionName}
- */
- @PreAuthorize("@ss.hasPermi('${permissionPrefix}:edit')")
- @Log(title = "${functionName}", businessType = BusinessType.UPDATE)
- @PutMapping
- public AjaxResult edit(@RequestBody ${ClassName} ${className})
- {
- return toAjax(${className}Service.update${ClassName}(${className}));
- }
-
- /**
- * 鍒犻櫎${functionName}
- */
- @PreAuthorize("@ss.hasPermi('${permissionPrefix}:remove')")
- @Log(title = "${functionName}", businessType = BusinessType.DELETE)
- @DeleteMapping("/{${pkColumn.javaField}s}")
- public AjaxResult remove(@PathVariable ${pkColumn.javaType}[] ${pkColumn.javaField}s)
- {
- return toAjax(${className}Service.delete${ClassName}By${pkColumn.capJavaField}s(${pkColumn.javaField}s));
- }
-}
diff --git a/ruoyi-generator/src/main/resources/vm/java/domain.java.vm b/ruoyi-generator/src/main/resources/vm/java/domain.java.vm
deleted file mode 100644
index b236ef0..0000000
--- a/ruoyi-generator/src/main/resources/vm/java/domain.java.vm
+++ /dev/null
@@ -1,105 +0,0 @@
-package ${packageName}.domain;
-
-#foreach ($import in $importList)
-import ${import};
-#end
-import org.apache.commons.lang3.builder.ToStringBuilder;
-import org.apache.commons.lang3.builder.ToStringStyle;
-import com.ruoyi.common.annotation.Excel;
-#if($table.crud || $table.sub)
-import com.ruoyi.common.core.domain.BaseEntity;
-#elseif($table.tree)
-import com.ruoyi.common.core.domain.TreeEntity;
-#end
-
-/**
- * ${functionName}瀵硅薄 ${tableName}
- *
- * @author ${author}
- * @date ${datetime}
- */
-#if($table.crud || $table.sub)
-#set($Entity="BaseEntity")
-#elseif($table.tree)
-#set($Entity="TreeEntity")
-#end
-public class ${ClassName} extends ${Entity}
-{
- private static final long serialVersionUID = 1L;
-
-#foreach ($column in $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
-#if($table.sub)
- /** $table.subTable.functionName淇℃伅 */
- private List<${subClassName}> ${subclassName}List;
-
-#end
-#foreach ($column in $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
-#if($table.sub)
- public List<${subClassName}> get${subClassName}List()
- {
- return ${subclassName}List;
- }
-
- public void set${subClassName}List(List<${subClassName}> ${subclassName}List)
- {
- this.${subclassName}List = ${subclassName}List;
- }
-
-#end
- @Override
- public String toString() {
- return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
-#foreach ($column in $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
-#if($table.sub)
- .append("${subclassName}List", get${subClassName}List())
-#end
- .toString();
- }
-}
diff --git a/ruoyi-generator/src/main/resources/vm/java/mapper.java.vm b/ruoyi-generator/src/main/resources/vm/java/mapper.java.vm
deleted file mode 100644
index 7e7d7c2..0000000
--- a/ruoyi-generator/src/main/resources/vm/java/mapper.java.vm
+++ /dev/null
@@ -1,91 +0,0 @@
-package ${packageName}.mapper;
-
-import java.util.List;
-import ${packageName}.domain.${ClassName};
-#if($table.sub)
-import ${packageName}.domain.${subClassName};
-#end
-
-/**
- * ${functionName}Mapper鎺ュ彛
- *
- * @author ${author}
- * @date ${datetime}
- */
-public interface ${ClassName}Mapper
-{
- /**
- * 鏌ヨ${functionName}
- *
- * @param ${pkColumn.javaField} ${functionName}涓婚敭
- * @return ${functionName}
- */
- public ${ClassName} select${ClassName}By${pkColumn.capJavaField}(${pkColumn.javaType} ${pkColumn.javaField});
-
- /**
- * 鏌ヨ${functionName}鍒楄〃
- *
- * @param ${className} ${functionName}
- * @return ${functionName}闆嗗悎
- */
- public List<${ClassName}> select${ClassName}List(${ClassName} ${className});
-
- /**
- * 鏂板${functionName}
- *
- * @param ${className} ${functionName}
- * @return 缁撴灉
- */
- public int insert${ClassName}(${ClassName} ${className});
-
- /**
- * 淇敼${functionName}
- *
- * @param ${className} ${functionName}
- * @return 缁撴灉
- */
- public int update${ClassName}(${ClassName} ${className});
-
- /**
- * 鍒犻櫎${functionName}
- *
- * @param ${pkColumn.javaField} ${functionName}涓婚敭
- * @return 缁撴灉
- */
- public int delete${ClassName}By${pkColumn.capJavaField}(${pkColumn.javaType} ${pkColumn.javaField});
-
- /**
- * 鎵归噺鍒犻櫎${functionName}
- *
- * @param ${pkColumn.javaField}s 闇�瑕佸垹闄ょ殑鏁版嵁涓婚敭闆嗗悎
- * @return 缁撴灉
- */
- public int delete${ClassName}By${pkColumn.capJavaField}s(${pkColumn.javaType}[] ${pkColumn.javaField}s);
-#if($table.sub)
-
- /**
- * 鎵归噺鍒犻櫎${subTable.functionName}
- *
- * @param ${pkColumn.javaField}s 闇�瑕佸垹闄ょ殑鏁版嵁涓婚敭闆嗗悎
- * @return 缁撴灉
- */
- public int delete${subClassName}By${subTableFkClassName}s(${pkColumn.javaType}[] ${pkColumn.javaField}s);
-
- /**
- * 鎵归噺鏂板${subTable.functionName}
- *
- * @param ${subclassName}List ${subTable.functionName}鍒楄〃
- * @return 缁撴灉
- */
- public int batch${subClassName}(List<${subClassName}> ${subclassName}List);
-
-
- /**
- * 閫氳繃${functionName}涓婚敭鍒犻櫎${subTable.functionName}淇℃伅
- *
- * @param ${pkColumn.javaField} ${functionName}ID
- * @return 缁撴灉
- */
- public int delete${subClassName}By${subTableFkClassName}(${pkColumn.javaType} ${pkColumn.javaField});
-#end
-}
diff --git a/ruoyi-generator/src/main/resources/vm/java/service.java.vm b/ruoyi-generator/src/main/resources/vm/java/service.java.vm
deleted file mode 100644
index 264882b..0000000
--- a/ruoyi-generator/src/main/resources/vm/java/service.java.vm
+++ /dev/null
@@ -1,61 +0,0 @@
-package ${packageName}.service;
-
-import java.util.List;
-import ${packageName}.domain.${ClassName};
-
-/**
- * ${functionName}Service鎺ュ彛
- *
- * @author ${author}
- * @date ${datetime}
- */
-public interface I${ClassName}Service
-{
- /**
- * 鏌ヨ${functionName}
- *
- * @param ${pkColumn.javaField} ${functionName}涓婚敭
- * @return ${functionName}
- */
- public ${ClassName} select${ClassName}By${pkColumn.capJavaField}(${pkColumn.javaType} ${pkColumn.javaField});
-
- /**
- * 鏌ヨ${functionName}鍒楄〃
- *
- * @param ${className} ${functionName}
- * @return ${functionName}闆嗗悎
- */
- public List<${ClassName}> select${ClassName}List(${ClassName} ${className});
-
- /**
- * 鏂板${functionName}
- *
- * @param ${className} ${functionName}
- * @return 缁撴灉
- */
- public int insert${ClassName}(${ClassName} ${className});
-
- /**
- * 淇敼${functionName}
- *
- * @param ${className} ${functionName}
- * @return 缁撴灉
- */
- public int update${ClassName}(${ClassName} ${className});
-
- /**
- * 鎵归噺鍒犻櫎${functionName}
- *
- * @param ${pkColumn.javaField}s 闇�瑕佸垹闄ょ殑${functionName}涓婚敭闆嗗悎
- * @return 缁撴灉
- */
- public int delete${ClassName}By${pkColumn.capJavaField}s(${pkColumn.javaType}[] ${pkColumn.javaField}s);
-
- /**
- * 鍒犻櫎${functionName}淇℃伅
- *
- * @param ${pkColumn.javaField} ${functionName}涓婚敭
- * @return 缁撴灉
- */
- public int delete${ClassName}By${pkColumn.capJavaField}(${pkColumn.javaType} ${pkColumn.javaField});
-}
diff --git a/ruoyi-generator/src/main/resources/vm/java/serviceImpl.java.vm b/ruoyi-generator/src/main/resources/vm/java/serviceImpl.java.vm
deleted file mode 100644
index 14746e1..0000000
--- a/ruoyi-generator/src/main/resources/vm/java/serviceImpl.java.vm
+++ /dev/null
@@ -1,169 +0,0 @@
-package ${packageName}.service.impl;
-
-import java.util.List;
-#foreach ($column in $columns)
-#if($column.javaField == 'createTime' || $column.javaField == 'updateTime')
-import com.ruoyi.common.utils.DateUtils;
-#break
-#end
-#end
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.stereotype.Service;
-#if($table.sub)
-import java.util.ArrayList;
-import com.ruoyi.common.utils.StringUtils;
-import org.springframework.transaction.annotation.Transactional;
-import ${packageName}.domain.${subClassName};
-#end
-import ${packageName}.mapper.${ClassName}Mapper;
-import ${packageName}.domain.${ClassName};
-import ${packageName}.service.I${ClassName}Service;
-
-/**
- * ${functionName}Service涓氬姟灞傚鐞�
- *
- * @author ${author}
- * @date ${datetime}
- */
-@Service
-public class ${ClassName}ServiceImpl implements I${ClassName}Service
-{
- @Autowired
- private ${ClassName}Mapper ${className}Mapper;
-
- /**
- * 鏌ヨ${functionName}
- *
- * @param ${pkColumn.javaField} ${functionName}涓婚敭
- * @return ${functionName}
- */
- @Override
- public ${ClassName} select${ClassName}By${pkColumn.capJavaField}(${pkColumn.javaType} ${pkColumn.javaField})
- {
- return ${className}Mapper.select${ClassName}By${pkColumn.capJavaField}(${pkColumn.javaField});
- }
-
- /**
- * 鏌ヨ${functionName}鍒楄〃
- *
- * @param ${className} ${functionName}
- * @return ${functionName}
- */
- @Override
- public List<${ClassName}> select${ClassName}List(${ClassName} ${className})
- {
- return ${className}Mapper.select${ClassName}List(${className});
- }
-
- /**
- * 鏂板${functionName}
- *
- * @param ${className} ${functionName}
- * @return 缁撴灉
- */
-#if($table.sub)
- @Transactional
-#end
- @Override
- public int insert${ClassName}(${ClassName} ${className})
- {
-#foreach ($column in $columns)
-#if($column.javaField == 'createTime')
- ${className}.setCreateTime(DateUtils.getNowDate());
-#end
-#end
-#if($table.sub)
- int rows = ${className}Mapper.insert${ClassName}(${className});
- insert${subClassName}(${className});
- return rows;
-#else
- return ${className}Mapper.insert${ClassName}(${className});
-#end
- }
-
- /**
- * 淇敼${functionName}
- *
- * @param ${className} ${functionName}
- * @return 缁撴灉
- */
-#if($table.sub)
- @Transactional
-#end
- @Override
- public int update${ClassName}(${ClassName} ${className})
- {
-#foreach ($column in $columns)
-#if($column.javaField == 'updateTime')
- ${className}.setUpdateTime(DateUtils.getNowDate());
-#end
-#end
-#if($table.sub)
- ${className}Mapper.delete${subClassName}By${subTableFkClassName}(${className}.get${pkColumn.capJavaField}());
- insert${subClassName}(${className});
-#end
- return ${className}Mapper.update${ClassName}(${className});
- }
-
- /**
- * 鎵归噺鍒犻櫎${functionName}
- *
- * @param ${pkColumn.javaField}s 闇�瑕佸垹闄ょ殑${functionName}涓婚敭
- * @return 缁撴灉
- */
-#if($table.sub)
- @Transactional
-#end
- @Override
- public int delete${ClassName}By${pkColumn.capJavaField}s(${pkColumn.javaType}[] ${pkColumn.javaField}s)
- {
-#if($table.sub)
- ${className}Mapper.delete${subClassName}By${subTableFkClassName}s(${pkColumn.javaField}s);
-#end
- return ${className}Mapper.delete${ClassName}By${pkColumn.capJavaField}s(${pkColumn.javaField}s);
- }
-
- /**
- * 鍒犻櫎${functionName}淇℃伅
- *
- * @param ${pkColumn.javaField} ${functionName}涓婚敭
- * @return 缁撴灉
- */
-#if($table.sub)
- @Transactional
-#end
- @Override
- public int delete${ClassName}By${pkColumn.capJavaField}(${pkColumn.javaType} ${pkColumn.javaField})
- {
-#if($table.sub)
- ${className}Mapper.delete${subClassName}By${subTableFkClassName}(${pkColumn.javaField});
-#end
- return ${className}Mapper.delete${ClassName}By${pkColumn.capJavaField}(${pkColumn.javaField});
- }
-#if($table.sub)
-
- /**
- * 鏂板${subTable.functionName}淇℃伅
- *
- * @param ${className} ${functionName}瀵硅薄
- */
- public void insert${subClassName}(${ClassName} ${className})
- {
- List<${subClassName}> ${subclassName}List = ${className}.get${subClassName}List();
- ${pkColumn.javaType} ${pkColumn.javaField} = ${className}.get${pkColumn.capJavaField}();
- if (StringUtils.isNotNull(${subclassName}List))
- {
- List<${subClassName}> list = new ArrayList<${subClassName}>();
- for (${subClassName} ${subclassName} : ${subclassName}List)
- {
- ${subclassName}.set${subTableFkClassName}(${pkColumn.javaField});
- list.add(${subclassName});
- }
- if (list.size() > 0)
- {
- ${className}Mapper.batch${subClassName}(list);
- }
- }
- }
-#end
-}
diff --git a/ruoyi-generator/src/main/resources/vm/java/sub-domain.java.vm b/ruoyi-generator/src/main/resources/vm/java/sub-domain.java.vm
deleted file mode 100644
index a3f53eb..0000000
--- a/ruoyi-generator/src/main/resources/vm/java/sub-domain.java.vm
+++ /dev/null
@@ -1,76 +0,0 @@
-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();
- }
-}
diff --git a/ruoyi-generator/src/main/resources/vm/js/api.js.vm b/ruoyi-generator/src/main/resources/vm/js/api.js.vm
deleted file mode 100644
index 9295524..0000000
--- a/ruoyi-generator/src/main/resources/vm/js/api.js.vm
+++ /dev/null
@@ -1,44 +0,0 @@
-import request from '@/utils/request'
-
-// 鏌ヨ${functionName}鍒楄〃
-export function list${BusinessName}(query) {
- return request({
- url: '/${moduleName}/${businessName}/list',
- method: 'get',
- params: query
- })
-}
-
-// 鏌ヨ${functionName}璇︾粏
-export function get${BusinessName}(${pkColumn.javaField}) {
- return request({
- url: '/${moduleName}/${businessName}/' + ${pkColumn.javaField},
- method: 'get'
- })
-}
-
-// 鏂板${functionName}
-export function add${BusinessName}(data) {
- return request({
- url: '/${moduleName}/${businessName}',
- method: 'post',
- data: data
- })
-}
-
-// 淇敼${functionName}
-export function update${BusinessName}(data) {
- return request({
- url: '/${moduleName}/${businessName}',
- method: 'put',
- data: data
- })
-}
-
-// 鍒犻櫎${functionName}
-export function del${BusinessName}(${pkColumn.javaField}) {
- return request({
- url: '/${moduleName}/${businessName}/' + ${pkColumn.javaField},
- method: 'delete'
- })
-}
diff --git a/ruoyi-generator/src/main/resources/vm/sql/sql.vm b/ruoyi-generator/src/main/resources/vm/sql/sql.vm
deleted file mode 100644
index f132158..0000000
--- a/ruoyi-generator/src/main/resources/vm/sql/sql.vm
+++ /dev/null
@@ -1,22 +0,0 @@
--- 鑿滃崟 SQL
-insert into sys_menu (menu_name, parent_id, order_num, path, component, is_frame, is_cache, menu_type, visible, status, perms, icon, create_by, create_time, update_by, update_time, remark)
-values('${functionName}', '${parentMenuId}', '1', '${businessName}', '${moduleName}/${businessName}/index', 1, 0, 'C', '0', '0', '${permissionPrefix}:list', '#', 'admin', now(), '', null, '${functionName}鑿滃崟');
-
--- 鎸夐挳鐖惰彍鍗旾D
-SELECT @parentId := LAST_INSERT_ID();
-
--- 鎸夐挳 SQL
-insert into sys_menu (menu_name, parent_id, order_num, path, component, is_frame, is_cache, menu_type, visible, status, perms, icon, create_by, create_time, update_by, update_time, remark)
-values('${functionName}鏌ヨ', @parentId, '1', '#', '', 1, 0, 'F', '0', '0', '${permissionPrefix}:query', '#', 'admin', now(), '', null, '');
-
-insert into sys_menu (menu_name, parent_id, order_num, path, component, is_frame, is_cache, menu_type, visible, status, perms, icon, create_by, create_time, update_by, update_time, remark)
-values('${functionName}鏂板', @parentId, '2', '#', '', 1, 0, 'F', '0', '0', '${permissionPrefix}:add', '#', 'admin', now(), '', null, '');
-
-insert into sys_menu (menu_name, parent_id, order_num, path, component, is_frame, is_cache, menu_type, visible, status, perms, icon, create_by, create_time, update_by, update_time, remark)
-values('${functionName}淇敼', @parentId, '3', '#', '', 1, 0, 'F', '0', '0', '${permissionPrefix}:edit', '#', 'admin', now(), '', null, '');
-
-insert into sys_menu (menu_name, parent_id, order_num, path, component, is_frame, is_cache, menu_type, visible, status, perms, icon, create_by, create_time, update_by, update_time, remark)
-values('${functionName}鍒犻櫎', @parentId, '4', '#', '', 1, 0, 'F', '0', '0', '${permissionPrefix}:remove', '#', 'admin', now(), '', null, '');
-
-insert into sys_menu (menu_name, parent_id, order_num, path, component, is_frame, is_cache, menu_type, visible, status, perms, icon, create_by, create_time, update_by, update_time, remark)
-values('${functionName}瀵煎嚭', @parentId, '5', '#', '', 1, 0, 'F', '0', '0', '${permissionPrefix}:export', '#', 'admin', now(), '', null, '');
\ No newline at end of file
diff --git a/ruoyi-generator/src/main/resources/vm/vue/index-tree.vue.vm b/ruoyi-generator/src/main/resources/vm/vue/index-tree.vue.vm
deleted file mode 100644
index 4e35fc9..0000000
--- a/ruoyi-generator/src/main/resources/vm/vue/index-tree.vue.vm
+++ /dev/null
@@ -1,505 +0,0 @@
-<template>
- <div class="app-container">
- <el-form :model="queryParams" ref="queryForm" size="small" :inline="true" v-show="showSearch" label-width="68px">
-#foreach($column in $columns)
-#if($column.query)
-#set($dictType=$column.dictType)
-#set($AttrName=$column.javaField.substring(0,1).toUpperCase() + ${column.javaField.substring(1)})
-#set($parentheseIndex=$column.columnComment.indexOf("锛�"))
-#if($parentheseIndex != -1)
-#set($comment=$column.columnComment.substring(0, $parentheseIndex))
-#else
-#set($comment=$column.columnComment)
-#end
-#if($column.htmlType == "input")
- <el-form-item label="${comment}" prop="${column.javaField}">
- <el-input
- v-model="queryParams.${column.javaField}"
- placeholder="璇疯緭鍏�${comment}"
- clearable
- @keyup.enter.native="handleQuery"
- />
- </el-form-item>
-#elseif(($column.htmlType == "select" || $column.htmlType == "radio") && "" != $dictType)
- <el-form-item label="${comment}" prop="${column.javaField}">
- <el-select v-model="queryParams.${column.javaField}" placeholder="璇烽�夋嫨${comment}" clearable>
- <el-option
- v-for="dict in dict.type.${dictType}"
- :key="dict.value"
- :label="dict.label"
- :value="dict.value"
- />
- </el-select>
- </el-form-item>
-#elseif(($column.htmlType == "select" || $column.htmlType == "radio") && $dictType)
- <el-form-item label="${comment}" prop="${column.javaField}">
- <el-select v-model="queryParams.${column.javaField}" placeholder="璇烽�夋嫨${comment}" clearable>
- <el-option label="璇烽�夋嫨瀛楀吀鐢熸垚" value="" />
- </el-select>
- </el-form-item>
-#elseif($column.htmlType == "datetime" && $column.queryType != "BETWEEN")
- <el-form-item label="${comment}" prop="${column.javaField}">
- <el-date-picker clearable
- v-model="queryParams.${column.javaField}"
- type="date"
- value-format="yyyy-MM-dd"
- placeholder="閫夋嫨${comment}">
- </el-date-picker>
- </el-form-item>
-#elseif($column.htmlType == "datetime" && $column.queryType == "BETWEEN")
- <el-form-item label="${comment}">
- <el-date-picker
- v-model="daterange${AttrName}"
- style="width: 240px"
- value-format="yyyy-MM-dd"
- type="daterange"
- range-separator="-"
- start-placeholder="寮�濮嬫棩鏈�"
- end-placeholder="缁撴潫鏃ユ湡"
- ></el-date-picker>
- </el-form-item>
-#end
-#end
-#end
- <el-form-item>
- <el-button type="primary" icon="el-icon-search" size="mini" @click="handleQuery">鎼滅储</el-button>
- <el-button icon="el-icon-refresh" size="mini" @click="resetQuery">閲嶇疆</el-button>
- </el-form-item>
- </el-form>
-
- <el-row :gutter="10" class="mb8">
- <el-col :span="1.5">
- <el-button
- type="primary"
- plain
- icon="el-icon-plus"
- size="mini"
- @click="handleAdd"
- v-hasPermi="['${permissionPrefix}:add']"
- >鏂板</el-button>
- </el-col>
- <el-col :span="1.5">
- <el-button
- type="info"
- plain
- icon="el-icon-sort"
- size="mini"
- @click="toggleExpandAll"
- >灞曞紑/鎶樺彔</el-button>
- </el-col>
- <right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
- </el-row>
-
- <el-table
- v-if="refreshTable"
- v-loading="loading"
- :data="${businessName}List"
- row-key="${treeCode}"
- :default-expand-all="isExpandAll"
- :tree-props="{children: 'children', hasChildren: 'hasChildren'}"
- >
-#foreach($column in $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)
-#elseif($column.list && $column.htmlType == "datetime")
- <el-table-column label="${comment}" align="center" prop="${javaField}" width="180">
- <template slot-scope="scope">
- <span>{{ parseTime(scope.row.${javaField}, '{y}-{m}-{d}') }}</span>
- </template>
- </el-table-column>
-#elseif($column.list && $column.htmlType == "imageUpload")
- <el-table-column label="${comment}" align="center" prop="${javaField}" width="100">
- <template slot-scope="scope">
- <image-preview :src="scope.row.${javaField}" :width="50" :height="50"/>
- </template>
- </el-table-column>
-#elseif($column.list && "" != $column.dictType)
- <el-table-column label="${comment}" align="center" prop="${javaField}">
- <template slot-scope="scope">
-#if($column.htmlType == "checkbox")
- <dict-tag :options="dict.type.${column.dictType}" :value="scope.row.${javaField} ? scope.row.${javaField}.split(',') : []"/>
-#else
- <dict-tag :options="dict.type.${column.dictType}" :value="scope.row.${javaField}"/>
-#end
- </template>
- </el-table-column>
-#elseif($column.list && "" != $javaField)
-#if(${foreach.index} == 1)
- <el-table-column label="${comment}" prop="${javaField}" />
-#else
- <el-table-column label="${comment}" align="center" prop="${javaField}" />
-#end
-#end
-#end
- <el-table-column label="鎿嶄綔" align="center" class-name="small-padding fixed-width">
- <template slot-scope="scope">
- <el-button
- size="mini"
- type="text"
- icon="el-icon-edit"
- @click="handleUpdate(scope.row)"
- v-hasPermi="['${permissionPrefix}:edit']"
- >淇敼</el-button>
- <el-button
- size="mini"
- type="text"
- icon="el-icon-plus"
- @click="handleAdd(scope.row)"
- v-hasPermi="['${permissionPrefix}:add']"
- >鏂板</el-button>
- <el-button
- size="mini"
- type="text"
- icon="el-icon-delete"
- @click="handleDelete(scope.row)"
- v-hasPermi="['${permissionPrefix}:remove']"
- >鍒犻櫎</el-button>
- </template>
- </el-table-column>
- </el-table>
-
- <!-- 娣诲姞鎴栦慨鏀�${functionName}瀵硅瘽妗� -->
- <el-dialog :title="title" :visible.sync="open" width="500px" append-to-body>
- <el-form ref="form" :model="form" :rules="rules" label-width="80px">
-#foreach($column in $columns)
-#set($field=$column.javaField)
-#if($column.insert && !$column.pk)
-#if(($column.usableColumn) || (!$column.superColumn))
-#set($parentheseIndex=$column.columnComment.indexOf("锛�"))
-#if($parentheseIndex != -1)
-#set($comment=$column.columnComment.substring(0, $parentheseIndex))
-#else
-#set($comment=$column.columnComment)
-#end
-#set($dictType=$column.dictType)
-#if("" != $treeParentCode && $column.javaField == $treeParentCode)
- <el-form-item label="${comment}" prop="${treeParentCode}">
- <treeselect v-model="form.${treeParentCode}" :options="${businessName}Options" :normalizer="normalizer" placeholder="璇烽�夋嫨${comment}" />
- </el-form-item>
-#elseif($column.htmlType == "input")
- <el-form-item label="${comment}" prop="${field}">
- <el-input v-model="form.${field}" placeholder="璇疯緭鍏�${comment}" />
- </el-form-item>
-#elseif($column.htmlType == "imageUpload")
- <el-form-item label="${comment}" prop="${field}">
- <image-upload v-model="form.${field}"/>
- </el-form-item>
-#elseif($column.htmlType == "fileUpload")
- <el-form-item label="${comment}" prop="${field}">
- <file-upload v-model="form.${field}"/>
- </el-form-item>
-#elseif($column.htmlType == "editor")
- <el-form-item label="${comment}">
- <editor v-model="form.${field}" :min-height="192"/>
- </el-form-item>
-#elseif($column.htmlType == "select" && "" != $dictType)
- <el-form-item label="${comment}" prop="${field}">
- <el-select v-model="form.${field}" placeholder="璇烽�夋嫨${comment}">
- <el-option
- v-for="dict in dict.type.${dictType}"
- :key="dict.value"
- :label="dict.label"
-#if($column.javaType == "Integer" || $column.javaType == "Long")
- :value="parseInt(dict.value)"
-#else
- :value="dict.value"
-#end
- ></el-option>
- </el-select>
- </el-form-item>
-#elseif($column.htmlType == "select" && $dictType)
- <el-form-item label="${comment}" prop="${field}">
- <el-select v-model="form.${field}" placeholder="璇烽�夋嫨${comment}">
- <el-option label="璇烽�夋嫨瀛楀吀鐢熸垚" value="" />
- </el-select>
- </el-form-item>
-#elseif($column.htmlType == "checkbox" && "" != $dictType)
- <el-form-item label="${comment}" prop="${field}">
- <el-checkbox-group v-model="form.${field}">
- <el-checkbox
- v-for="dict in dict.type.${dictType}"
- :key="dict.value"
- :label="dict.value">
- {{dict.label}}
- </el-checkbox>
- </el-checkbox-group>
- </el-form-item>
-#elseif($column.htmlType == "checkbox" && $dictType)
- <el-form-item label="${comment}" prop="${field}">
- <el-checkbox-group v-model="form.${field}">
- <el-checkbox>璇烽�夋嫨瀛楀吀鐢熸垚</el-checkbox>
- </el-checkbox-group>
- </el-form-item>
-#elseif($column.htmlType == "radio" && "" != $dictType)
- <el-form-item label="${comment}" prop="${field}">
- <el-radio-group v-model="form.${field}">
- <el-radio
- v-for="dict in dict.type.${dictType}"
- :key="dict.value"
-#if($column.javaType == "Integer" || $column.javaType == "Long")
- :label="parseInt(dict.value)"
-#else
- :label="dict.value"
-#end
- >{{dict.label}}</el-radio>
- </el-radio-group>
- </el-form-item>
-#elseif($column.htmlType == "radio" && $dictType)
- <el-form-item label="${comment}" prop="${field}">
- <el-radio-group v-model="form.${field}">
- <el-radio label="1">璇烽�夋嫨瀛楀吀鐢熸垚</el-radio>
- </el-radio-group>
- </el-form-item>
-#elseif($column.htmlType == "datetime")
- <el-form-item label="${comment}" prop="${field}">
- <el-date-picker clearable
- v-model="form.${field}"
- type="date"
- value-format="yyyy-MM-dd"
- placeholder="閫夋嫨${comment}">
- </el-date-picker>
- </el-form-item>
-#elseif($column.htmlType == "textarea")
- <el-form-item label="${comment}" prop="${field}">
- <el-input v-model="form.${field}" type="textarea" placeholder="璇疯緭鍏ュ唴瀹�" />
- </el-form-item>
-#end
-#end
-#end
-#end
- </el-form>
- <div slot="footer" class="dialog-footer">
- <el-button type="primary" @click="submitForm">纭� 瀹�</el-button>
- <el-button @click="cancel">鍙� 娑�</el-button>
- </div>
- </el-dialog>
- </div>
-</template>
-
-<script>
-import { list${BusinessName}, get${BusinessName}, del${BusinessName}, add${BusinessName}, update${BusinessName} } from "@/api/${moduleName}/${businessName}"
-import Treeselect from "@riophae/vue-treeselect"
-import "@riophae/vue-treeselect/dist/vue-treeselect.css"
-
-export default {
- name: "${BusinessName}",
-#if(${dicts} != '')
- dicts: [${dicts}],
-#end
- components: {
- Treeselect
- },
- data() {
- return {
- // 閬僵灞�
- loading: true,
- // 鏄剧ず鎼滅储鏉′欢
- showSearch: true,
- // ${functionName}琛ㄦ牸鏁版嵁
- ${businessName}List: [],
- // ${functionName}鏍戦�夐」
- ${businessName}Options: [],
- // 寮瑰嚭灞傛爣棰�
- title: "",
- // 鏄惁鏄剧ず寮瑰嚭灞�
- open: false,
- // 鏄惁灞曞紑锛岄粯璁ゅ叏閮ㄥ睍寮�
- isExpandAll: true,
- // 閲嶆柊娓叉煋琛ㄦ牸鐘舵��
- refreshTable: true,
-#foreach ($column in $columns)
-#if($column.htmlType == "datetime" && $column.queryType == "BETWEEN")
-#set($AttrName=$column.javaField.substring(0,1).toUpperCase() + ${column.javaField.substring(1)})
- // $comment鏃堕棿鑼冨洿
- daterange${AttrName}: [],
-#end
-#end
- // 鏌ヨ鍙傛暟
- queryParams: {
-#foreach ($column in $columns)
-#if($column.query)
- $column.javaField: null#if($foreach.count != $columns.size()),#end
-#end
-#end
- },
- // 琛ㄥ崟鍙傛暟
- form: {},
- // 琛ㄥ崟鏍¢獙
- rules: {
-#foreach ($column in $columns)
-#if($column.required)
-#set($parentheseIndex=$column.columnComment.indexOf("锛�"))
-#if($parentheseIndex != -1)
-#set($comment=$column.columnComment.substring(0, $parentheseIndex))
-#else
-#set($comment=$column.columnComment)
-#end
- $column.javaField: [
- { required: true, message: "$comment涓嶈兘涓虹┖", trigger: #if($column.htmlType == "select" || $column.htmlType == "radio")"change"#else"blur"#end }
- ]#if($foreach.count != $columns.size()),#end
-#end
-#end
- }
- }
- },
- created() {
- this.getList()
- },
- methods: {
- /** 鏌ヨ${functionName}鍒楄〃 */
- getList() {
- this.loading = true
-#foreach ($column in $columns)
-#if($column.htmlType == "datetime" && $column.queryType == "BETWEEN")
- this.queryParams.params = {}
-#break
-#end
-#end
-#foreach ($column in $columns)
-#if($column.htmlType == "datetime" && $column.queryType == "BETWEEN")
-#set($AttrName=$column.javaField.substring(0,1).toUpperCase() + ${column.javaField.substring(1)})
- if (null != this.daterange${AttrName} && '' != this.daterange${AttrName}) {
- this.queryParams.params["begin${AttrName}"] = this.daterange${AttrName}[0]
- this.queryParams.params["end${AttrName}"] = this.daterange${AttrName}[1]
- }
-#end
-#end
- list${BusinessName}(this.queryParams).then(response => {
- this.${businessName}List = this.handleTree(response.data, "${treeCode}", "${treeParentCode}")
- this.loading = false
- })
- },
- /** 杞崲${functionName}鏁版嵁缁撴瀯 */
- normalizer(node) {
- if (node.children && !node.children.length) {
- delete node.children
- }
- return {
- id: node.${treeCode},
- label: node.${treeName},
- children: node.children
- }
- },
- /** 鏌ヨ${functionName}涓嬫媺鏍戠粨鏋� */
- getTreeselect() {
- list${BusinessName}().then(response => {
- this.${businessName}Options = []
- const data = { ${treeCode}: 0, ${treeName}: '椤剁骇鑺傜偣', children: [] }
- data.children = this.handleTree(response.data, "${treeCode}", "${treeParentCode}")
- this.${businessName}Options.push(data)
- })
- },
- // 鍙栨秷鎸夐挳
- cancel() {
- this.open = false
- this.reset()
- },
- // 琛ㄥ崟閲嶇疆
- reset() {
- this.form = {
-#foreach ($column in $columns)
-#if($column.htmlType == "checkbox")
- $column.javaField: []#if($foreach.count != $columns.size()),#end
-#else
- $column.javaField: null#if($foreach.count != $columns.size()),#end
-#end
-#end
- }
- this.resetForm("form")
- },
- /** 鎼滅储鎸夐挳鎿嶄綔 */
- handleQuery() {
- this.getList()
- },
- /** 閲嶇疆鎸夐挳鎿嶄綔 */
- resetQuery() {
-#foreach ($column in $columns)
-#if($column.htmlType == "datetime" && $column.queryType == "BETWEEN")
-#set($AttrName=$column.javaField.substring(0,1).toUpperCase() + ${column.javaField.substring(1)})
- this.daterange${AttrName} = []
-#end
-#end
- this.resetForm("queryForm")
- this.handleQuery()
- },
- /** 鏂板鎸夐挳鎿嶄綔 */
- handleAdd(row) {
- this.reset()
- this.getTreeselect()
- if (row != null && row.${treeCode}) {
- this.form.${treeParentCode} = row.${treeCode}
- } else {
- this.form.${treeParentCode} = 0
- }
- this.open = true
- this.title = "娣诲姞${functionName}"
- },
- /** 灞曞紑/鎶樺彔鎿嶄綔 */
- toggleExpandAll() {
- this.refreshTable = false
- this.isExpandAll = !this.isExpandAll
- this.$nextTick(() => {
- this.refreshTable = true
- })
- },
- /** 淇敼鎸夐挳鎿嶄綔 */
- handleUpdate(row) {
- this.reset()
- this.getTreeselect()
- if (row != null) {
- this.form.${treeParentCode} = row.${treeParentCode}
- }
- get${BusinessName}(row.${pkColumn.javaField}).then(response => {
- this.form = response.data
-#foreach ($column in $columns)
-#if($column.htmlType == "checkbox")
- this.form.$column.javaField = this.form.${column.javaField}.split(",")
-#end
-#end
- this.open = true
- this.title = "淇敼${functionName}"
- })
- },
- /** 鎻愪氦鎸夐挳 */
- submitForm() {
- this.#[[$]]#refs["form"].validate(valid => {
- if (valid) {
-#foreach ($column in $columns)
-#if($column.htmlType == "checkbox")
- this.form.$column.javaField = this.form.${column.javaField}.join(",")
-#end
-#end
- if (this.form.${pkColumn.javaField} != null) {
- update${BusinessName}(this.form).then(response => {
- this.#[[$modal]]#.msgSuccess("淇敼鎴愬姛")
- this.open = false
- this.getList()
- })
- } else {
- add${BusinessName}(this.form).then(response => {
- this.#[[$modal]]#.msgSuccess("鏂板鎴愬姛")
- this.open = false
- this.getList()
- })
- }
- }
- })
- },
- /** 鍒犻櫎鎸夐挳鎿嶄綔 */
- handleDelete(row) {
- this.#[[$modal]]#.confirm('鏄惁纭鍒犻櫎${functionName}缂栧彿涓�"' + row.${pkColumn.javaField} + '"鐨勬暟鎹」锛�').then(function() {
- return del${BusinessName}(row.${pkColumn.javaField})
- }).then(() => {
- this.getList()
- this.#[[$modal]]#.msgSuccess("鍒犻櫎鎴愬姛")
- }).catch(() => {})
- }
- }
-}
-</script>
diff --git a/ruoyi-generator/src/main/resources/vm/vue/index.vue.vm b/ruoyi-generator/src/main/resources/vm/vue/index.vue.vm
deleted file mode 100644
index 04ebe16..0000000
--- a/ruoyi-generator/src/main/resources/vm/vue/index.vue.vm
+++ /dev/null
@@ -1,602 +0,0 @@
-<template>
- <div class="app-container">
- <el-form :model="queryParams" ref="queryForm" size="small" :inline="true" v-show="showSearch" label-width="68px">
-#foreach($column in $columns)
-#if($column.query)
-#set($dictType=$column.dictType)
-#set($AttrName=$column.javaField.substring(0,1).toUpperCase() + ${column.javaField.substring(1)})
-#set($parentheseIndex=$column.columnComment.indexOf("锛�"))
-#if($parentheseIndex != -1)
-#set($comment=$column.columnComment.substring(0, $parentheseIndex))
-#else
-#set($comment=$column.columnComment)
-#end
-#if($column.htmlType == "input")
- <el-form-item label="${comment}" prop="${column.javaField}">
- <el-input
- v-model="queryParams.${column.javaField}"
- placeholder="璇疯緭鍏�${comment}"
- clearable
- @keyup.enter.native="handleQuery"
- />
- </el-form-item>
-#elseif(($column.htmlType == "select" || $column.htmlType == "radio") && "" != $dictType)
- <el-form-item label="${comment}" prop="${column.javaField}">
- <el-select v-model="queryParams.${column.javaField}" placeholder="璇烽�夋嫨${comment}" clearable>
- <el-option
- v-for="dict in dict.type.${dictType}"
- :key="dict.value"
- :label="dict.label"
- :value="dict.value"
- />
- </el-select>
- </el-form-item>
-#elseif(($column.htmlType == "select" || $column.htmlType == "radio") && $dictType)
- <el-form-item label="${comment}" prop="${column.javaField}">
- <el-select v-model="queryParams.${column.javaField}" placeholder="璇烽�夋嫨${comment}" clearable>
- <el-option label="璇烽�夋嫨瀛楀吀鐢熸垚" value="" />
- </el-select>
- </el-form-item>
-#elseif($column.htmlType == "datetime" && $column.queryType != "BETWEEN")
- <el-form-item label="${comment}" prop="${column.javaField}">
- <el-date-picker clearable
- v-model="queryParams.${column.javaField}"
- type="date"
- value-format="yyyy-MM-dd"
- placeholder="璇烽�夋嫨${comment}">
- </el-date-picker>
- </el-form-item>
-#elseif($column.htmlType == "datetime" && $column.queryType == "BETWEEN")
- <el-form-item label="${comment}">
- <el-date-picker
- v-model="daterange${AttrName}"
- style="width: 240px"
- value-format="yyyy-MM-dd"
- type="daterange"
- range-separator="-"
- start-placeholder="寮�濮嬫棩鏈�"
- end-placeholder="缁撴潫鏃ユ湡"
- ></el-date-picker>
- </el-form-item>
-#end
-#end
-#end
- <el-form-item>
- <el-button type="primary" icon="el-icon-search" size="mini" @click="handleQuery">鎼滅储</el-button>
- <el-button icon="el-icon-refresh" size="mini" @click="resetQuery">閲嶇疆</el-button>
- </el-form-item>
- </el-form>
-
- <el-row :gutter="10" class="mb8">
- <el-col :span="1.5">
- <el-button
- type="primary"
- plain
- icon="el-icon-plus"
- size="mini"
- @click="handleAdd"
- v-hasPermi="['${permissionPrefix}:add']"
- >鏂板</el-button>
- </el-col>
- <el-col :span="1.5">
- <el-button
- type="success"
- plain
- icon="el-icon-edit"
- size="mini"
- :disabled="single"
- @click="handleUpdate"
- v-hasPermi="['${permissionPrefix}:edit']"
- >淇敼</el-button>
- </el-col>
- <el-col :span="1.5">
- <el-button
- type="danger"
- plain
- icon="el-icon-delete"
- size="mini"
- :disabled="multiple"
- @click="handleDelete"
- v-hasPermi="['${permissionPrefix}:remove']"
- >鍒犻櫎</el-button>
- </el-col>
- <el-col :span="1.5">
- <el-button
- type="warning"
- plain
- icon="el-icon-download"
- size="mini"
- @click="handleExport"
- v-hasPermi="['${permissionPrefix}:export']"
- >瀵煎嚭</el-button>
- </el-col>
- <right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
- </el-row>
-
- <el-table v-loading="loading" :data="${businessName}List" @selection-change="handleSelectionChange">
- <el-table-column type="selection" width="55" align="center" />
-#foreach($column in $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)
- <el-table-column label="${comment}" align="center" prop="${javaField}" />
-#elseif($column.list && $column.htmlType == "datetime")
- <el-table-column label="${comment}" align="center" prop="${javaField}" width="180">
- <template slot-scope="scope">
- <span>{{ parseTime(scope.row.${javaField}, '{y}-{m}-{d}') }}</span>
- </template>
- </el-table-column>
-#elseif($column.list && $column.htmlType == "imageUpload")
- <el-table-column label="${comment}" align="center" prop="${javaField}" width="100">
- <template slot-scope="scope">
- <image-preview :src="scope.row.${javaField}" :width="50" :height="50"/>
- </template>
- </el-table-column>
-#elseif($column.list && "" != $column.dictType)
- <el-table-column label="${comment}" align="center" prop="${javaField}">
- <template slot-scope="scope">
-#if($column.htmlType == "checkbox")
- <dict-tag :options="dict.type.${column.dictType}" :value="scope.row.${javaField} ? scope.row.${javaField}.split(',') : []"/>
-#else
- <dict-tag :options="dict.type.${column.dictType}" :value="scope.row.${javaField}"/>
-#end
- </template>
- </el-table-column>
-#elseif($column.list && "" != $javaField)
- <el-table-column label="${comment}" align="center" prop="${javaField}" />
-#end
-#end
- <el-table-column label="鎿嶄綔" align="center" class-name="small-padding fixed-width">
- <template slot-scope="scope">
- <el-button
- size="mini"
- type="text"
- icon="el-icon-edit"
- @click="handleUpdate(scope.row)"
- v-hasPermi="['${permissionPrefix}:edit']"
- >淇敼</el-button>
- <el-button
- size="mini"
- type="text"
- icon="el-icon-delete"
- @click="handleDelete(scope.row)"
- v-hasPermi="['${permissionPrefix}:remove']"
- >鍒犻櫎</el-button>
- </template>
- </el-table-column>
- </el-table>
-
- <pagination
- v-show="total>0"
- :total="total"
- :page.sync="queryParams.pageNum"
- :limit.sync="queryParams.pageSize"
- @pagination="getList"
- />
-
- <!-- 娣诲姞鎴栦慨鏀�${functionName}瀵硅瘽妗� -->
- <el-dialog :title="title" :visible.sync="open" width="500px" append-to-body>
- <el-form ref="form" :model="form" :rules="rules" label-width="80px">
-#foreach($column in $columns)
-#set($field=$column.javaField)
-#if($column.insert && !$column.pk)
-#if(($column.usableColumn) || (!$column.superColumn))
-#set($parentheseIndex=$column.columnComment.indexOf("锛�"))
-#if($parentheseIndex != -1)
-#set($comment=$column.columnComment.substring(0, $parentheseIndex))
-#else
-#set($comment=$column.columnComment)
-#end
-#set($dictType=$column.dictType)
-#if($column.htmlType == "input")
- <el-form-item label="${comment}" prop="${field}">
- <el-input v-model="form.${field}" placeholder="璇疯緭鍏�${comment}" />
- </el-form-item>
-#elseif($column.htmlType == "imageUpload")
- <el-form-item label="${comment}" prop="${field}">
- <image-upload v-model="form.${field}"/>
- </el-form-item>
-#elseif($column.htmlType == "fileUpload")
- <el-form-item label="${comment}" prop="${field}">
- <file-upload v-model="form.${field}"/>
- </el-form-item>
-#elseif($column.htmlType == "editor")
- <el-form-item label="${comment}">
- <editor v-model="form.${field}" :min-height="192"/>
- </el-form-item>
-#elseif($column.htmlType == "select" && "" != $dictType)
- <el-form-item label="${comment}" prop="${field}">
- <el-select v-model="form.${field}" placeholder="璇烽�夋嫨${comment}">
- <el-option
- v-for="dict in dict.type.${dictType}"
- :key="dict.value"
- :label="dict.label"
-#if($column.javaType == "Integer" || $column.javaType == "Long")
- :value="parseInt(dict.value)"
-#else
- :value="dict.value"
-#end
- ></el-option>
- </el-select>
- </el-form-item>
-#elseif($column.htmlType == "select" && $dictType)
- <el-form-item label="${comment}" prop="${field}">
- <el-select v-model="form.${field}" placeholder="璇烽�夋嫨${comment}">
- <el-option label="璇烽�夋嫨瀛楀吀鐢熸垚" value="" />
- </el-select>
- </el-form-item>
-#elseif($column.htmlType == "checkbox" && "" != $dictType)
- <el-form-item label="${comment}" prop="${field}">
- <el-checkbox-group v-model="form.${field}">
- <el-checkbox
- v-for="dict in dict.type.${dictType}"
- :key="dict.value"
- :label="dict.value">
- {{dict.label}}
- </el-checkbox>
- </el-checkbox-group>
- </el-form-item>
-#elseif($column.htmlType == "checkbox" && $dictType)
- <el-form-item label="${comment}" prop="${field}">
- <el-checkbox-group v-model="form.${field}">
- <el-checkbox>璇烽�夋嫨瀛楀吀鐢熸垚</el-checkbox>
- </el-checkbox-group>
- </el-form-item>
-#elseif($column.htmlType == "radio" && "" != $dictType)
- <el-form-item label="${comment}" prop="${field}">
- <el-radio-group v-model="form.${field}">
- <el-radio
- v-for="dict in dict.type.${dictType}"
- :key="dict.value"
-#if($column.javaType == "Integer" || $column.javaType == "Long")
- :label="parseInt(dict.value)"
-#else
- :label="dict.value"
-#end
- >{{dict.label}}</el-radio>
- </el-radio-group>
- </el-form-item>
-#elseif($column.htmlType == "radio" && $dictType)
- <el-form-item label="${comment}" prop="${field}">
- <el-radio-group v-model="form.${field}">
- <el-radio label="1">璇烽�夋嫨瀛楀吀鐢熸垚</el-radio>
- </el-radio-group>
- </el-form-item>
-#elseif($column.htmlType == "datetime")
- <el-form-item label="${comment}" prop="${field}">
- <el-date-picker clearable
- v-model="form.${field}"
- type="date"
- value-format="yyyy-MM-dd"
- placeholder="璇烽�夋嫨${comment}">
- </el-date-picker>
- </el-form-item>
-#elseif($column.htmlType == "textarea")
- <el-form-item label="${comment}" prop="${field}">
- <el-input v-model="form.${field}" type="textarea" placeholder="璇疯緭鍏ュ唴瀹�" />
- </el-form-item>
-#end
-#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 && $column.htmlType == "input")
- <el-table-column label="$comment" prop="${javaField}" width="150">
- <template slot-scope="scope">
- <el-input v-model="scope.row.$javaField" placeholder="璇疯緭鍏�$comment" />
- </template>
- </el-table-column>
-#elseif($column.list && $column.htmlType == "datetime")
- <el-table-column label="$comment" prop="${javaField}" width="240">
- <template slot-scope="scope">
- <el-date-picker clearable v-model="scope.row.$javaField" type="date" value-format="yyyy-MM-dd" placeholder="璇烽�夋嫨$comment" />
- </template>
- </el-table-column>
-#elseif($column.list && ($column.htmlType == "select" || $column.htmlType == "radio") && "" != $column.dictType)
- <el-table-column label="$comment" prop="${javaField}" width="150">
- <template slot-scope="scope">
- <el-select v-model="scope.row.$javaField" placeholder="璇烽�夋嫨$comment">
- <el-option
- v-for="dict in dict.type.$column.dictType"
- :key="dict.value"
- :label="dict.label"
- :value="dict.value"
- ></el-option>
- </el-select>
- </template>
- </el-table-column>
-#elseif($column.list && ($column.htmlType == "select" || $column.htmlType == "radio") && "" == $column.dictType)
- <el-table-column label="$comment" prop="${javaField}" width="150">
- <template slot-scope="scope">
- <el-select v-model="scope.row.$javaField" placeholder="璇烽�夋嫨$comment">
- <el-option label="璇烽�夋嫨瀛楀吀鐢熸垚" value="" />
- </el-select>
- </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>
- <el-button @click="cancel">鍙� 娑�</el-button>
- </div>
- </el-dialog>
- </div>
-</template>
-
-<script>
-import { list${BusinessName}, get${BusinessName}, del${BusinessName}, add${BusinessName}, update${BusinessName} } from "@/api/${moduleName}/${businessName}"
-
-export default {
- name: "${BusinessName}",
-#if(${dicts} != '')
- dicts: [${dicts}],
-#end
- data() {
- return {
- // 閬僵灞�
- loading: true,
- // 閫変腑鏁扮粍
- ids: [],
-#if($table.sub)
- // 瀛愯〃閫変腑鏁版嵁
- checked${subClassName}: [],
-#end
- // 闈炲崟涓鐢�
- single: true,
- // 闈炲涓鐢�
- multiple: true,
- // 鏄剧ず鎼滅储鏉′欢
- showSearch: true,
- // 鎬绘潯鏁�
- total: 0,
- // ${functionName}琛ㄦ牸鏁版嵁
- ${businessName}List: [],
-#if($table.sub)
- // ${subTable.functionName}琛ㄦ牸鏁版嵁
- ${subclassName}List: [],
-#end
- // 寮瑰嚭灞傛爣棰�
- title: "",
- // 鏄惁鏄剧ず寮瑰嚭灞�
- open: false,
-#foreach ($column in $columns)
-#if($column.htmlType == "datetime" && $column.queryType == "BETWEEN")
-#set($AttrName=$column.javaField.substring(0,1).toUpperCase() + ${column.javaField.substring(1)})
- // $comment鏃堕棿鑼冨洿
- daterange${AttrName}: [],
-#end
-#end
- // 鏌ヨ鍙傛暟
- queryParams: {
- pageNum: 1,
- pageSize: 10,
-#foreach ($column in $columns)
-#if($column.query)
- $column.javaField: null#if($foreach.count != $columns.size()),#end
-#end
-#end
- },
- // 琛ㄥ崟鍙傛暟
- form: {},
- // 琛ㄥ崟鏍¢獙
- rules: {
-#foreach ($column in $columns)
-#if($column.required)
-#set($parentheseIndex=$column.columnComment.indexOf("锛�"))
-#if($parentheseIndex != -1)
-#set($comment=$column.columnComment.substring(0, $parentheseIndex))
-#else
-#set($comment=$column.columnComment)
-#end
- $column.javaField: [
- { required: true, message: "$comment涓嶈兘涓虹┖", trigger: #if($column.htmlType == "select" || $column.htmlType == "radio")"change"#else"blur"#end }
- ]#if($foreach.count != $columns.size()),#end
-#end
-#end
- }
- }
- },
- created() {
- this.getList()
- },
- methods: {
- /** 鏌ヨ${functionName}鍒楄〃 */
- getList() {
- this.loading = true
-#foreach ($column in $columns)
-#if($column.htmlType == "datetime" && $column.queryType == "BETWEEN")
- this.queryParams.params = {}
-#break
-#end
-#end
-#foreach ($column in $columns)
-#if($column.htmlType == "datetime" && $column.queryType == "BETWEEN")
-#set($AttrName=$column.javaField.substring(0,1).toUpperCase() + ${column.javaField.substring(1)})
- if (null != this.daterange${AttrName} && '' != this.daterange${AttrName}) {
- this.queryParams.params["begin${AttrName}"] = this.daterange${AttrName}[0]
- this.queryParams.params["end${AttrName}"] = this.daterange${AttrName}[1]
- }
-#end
-#end
- list${BusinessName}(this.queryParams).then(response => {
- this.${businessName}List = response.rows
- this.total = response.total
- this.loading = false
- })
- },
- // 鍙栨秷鎸夐挳
- cancel() {
- this.open = false
- this.reset()
- },
- // 琛ㄥ崟閲嶇疆
- reset() {
- this.form = {
-#foreach ($column in $columns)
-#if($column.htmlType == "checkbox")
- $column.javaField: []#if($foreach.count != $columns.size()),#end
-#else
- $column.javaField: null#if($foreach.count != $columns.size()),#end
-#end
-#end
- }
-#if($table.sub)
- this.${subclassName}List = []
-#end
- this.resetForm("form")
- },
- /** 鎼滅储鎸夐挳鎿嶄綔 */
- handleQuery() {
- this.queryParams.pageNum = 1
- this.getList()
- },
- /** 閲嶇疆鎸夐挳鎿嶄綔 */
- resetQuery() {
-#foreach ($column in $columns)
-#if($column.htmlType == "datetime" && $column.queryType == "BETWEEN")
-#set($AttrName=$column.javaField.substring(0,1).toUpperCase() + ${column.javaField.substring(1)})
- this.daterange${AttrName} = []
-#end
-#end
- this.resetForm("queryForm")
- this.handleQuery()
- },
- // 澶氶�夋閫変腑鏁版嵁
- handleSelectionChange(selection) {
- this.ids = selection.map(item => item.${pkColumn.javaField})
- this.single = selection.length!==1
- this.multiple = !selection.length
- },
- /** 鏂板鎸夐挳鎿嶄綔 */
- handleAdd() {
- this.reset()
- this.open = true
- this.title = "娣诲姞${functionName}"
- },
- /** 淇敼鎸夐挳鎿嶄綔 */
- handleUpdate(row) {
- this.reset()
- const ${pkColumn.javaField} = row.${pkColumn.javaField} || this.ids
- get${BusinessName}(${pkColumn.javaField}).then(response => {
- this.form = response.data
-#foreach ($column in $columns)
-#if($column.htmlType == "checkbox")
- 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}"
- })
- },
- /** 鎻愪氦鎸夐挳 */
- submitForm() {
- this.#[[$]]#refs["form"].validate(valid => {
- if (valid) {
-#foreach ($column in $columns)
-#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.#[[$modal]]#.msgSuccess("淇敼鎴愬姛")
- this.open = false
- this.getList()
- })
- } else {
- add${BusinessName}(this.form).then(response => {
- this.#[[$modal]]#.msgSuccess("鏂板鎴愬姛")
- this.open = false
- this.getList()
- })
- }
- }
- })
- },
- /** 鍒犻櫎鎸夐挳鎿嶄綔 */
- handleDelete(row) {
- const ${pkColumn.javaField}s = row.${pkColumn.javaField} || this.ids
- this.#[[$modal]]#.confirm('鏄惁纭鍒犻櫎${functionName}缂栧彿涓�"' + ${pkColumn.javaField}s + '"鐨勬暟鎹」锛�').then(function() {
- return del${BusinessName}(${pkColumn.javaField}s)
- }).then(() => {
- this.getList()
- this.#[[$modal]]#.msgSuccess("鍒犻櫎鎴愬姛")
- }).catch(() => {})
- },
-#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.#[[$modal]]#.msgError("璇峰厛閫夋嫨瑕佸垹闄ょ殑${subTable.functionName}鏁版嵁")
- } else {
- const ${subclassName}List = this.${subclassName}List
- const checked${subClassName} = this.checked${subClassName}
- this.${subclassName}List = ${subclassName}List.filter(function(item) {
- return checked${subClassName}.indexOf(item.index) == -1
- })
- }
- },
- /** 澶嶉�夋閫変腑鏁版嵁 */
- handle${subClassName}SelectionChange(selection) {
- this.checked${subClassName} = selection.map(item => item.index)
- },
-#end
- /** 瀵煎嚭鎸夐挳鎿嶄綔 */
- handleExport() {
- this.download('${moduleName}/${businessName}/export', {
- ...this.queryParams
- }, `${businessName}_#[[${new Date().getTime()}]]#.xlsx`)
- }
- }
-}
-</script>
diff --git a/ruoyi-generator/src/main/resources/vm/vue/v3/index-tree.vue.vm b/ruoyi-generator/src/main/resources/vm/vue/v3/index-tree.vue.vm
deleted file mode 100644
index 765a5e3..0000000
--- a/ruoyi-generator/src/main/resources/vm/vue/v3/index-tree.vue.vm
+++ /dev/null
@@ -1,474 +0,0 @@
-<template>
- <div class="app-container">
- <el-form :model="queryParams" ref="queryRef" :inline="true" v-show="showSearch" label-width="68px">
-#foreach($column in $columns)
-#if($column.query)
-#set($dictType=$column.dictType)
-#set($AttrName=$column.javaField.substring(0,1).toUpperCase() + ${column.javaField.substring(1)})
-#set($parentheseIndex=$column.columnComment.indexOf("锛�"))
-#if($parentheseIndex != -1)
-#set($comment=$column.columnComment.substring(0, $parentheseIndex))
-#else
-#set($comment=$column.columnComment)
-#end
-#if($column.htmlType == "input")
- <el-form-item label="${comment}" prop="${column.javaField}">
- <el-input
- v-model="queryParams.${column.javaField}"
- placeholder="璇疯緭鍏�${comment}"
- clearable
- @keyup.enter="handleQuery"
- />
- </el-form-item>
-#elseif(($column.htmlType == "select" || $column.htmlType == "radio") && "" != $dictType)
- <el-form-item label="${comment}" prop="${column.javaField}">
- <el-select v-model="queryParams.${column.javaField}" placeholder="璇烽�夋嫨${comment}" clearable>
- <el-option
- v-for="dict in ${dictType}"
- :key="dict.value"
- :label="dict.label"
- :value="dict.value"
- />
- </el-select>
- </el-form-item>
-#elseif(($column.htmlType == "select" || $column.htmlType == "radio") && $dictType)
- <el-form-item label="${comment}" prop="${column.javaField}">
- <el-select v-model="queryParams.${column.javaField}" placeholder="璇烽�夋嫨${comment}" clearable>
- <el-option label="璇烽�夋嫨瀛楀吀鐢熸垚" value="" />
- </el-select>
- </el-form-item>
-#elseif($column.htmlType == "datetime" && $column.queryType != "BETWEEN")
- <el-form-item label="${comment}" prop="${column.javaField}">
- <el-date-picker clearable
- v-model="queryParams.${column.javaField}"
- type="date"
- value-format="YYYY-MM-DD"
- placeholder="閫夋嫨${comment}">
- </el-date-picker>
- </el-form-item>
-#elseif($column.htmlType == "datetime" && $column.queryType == "BETWEEN")
- <el-form-item label="${comment}" style="width: 308px">
- <el-date-picker
- v-model="daterange${AttrName}"
- value-format="YYYY-MM-DD"
- type="daterange"
- range-separator="-"
- start-placeholder="寮�濮嬫棩鏈�"
- end-placeholder="缁撴潫鏃ユ湡"
- ></el-date-picker>
- </el-form-item>
-#end
-#end
-#end
- <el-form-item>
- <el-button type="primary" icon="Search" @click="handleQuery">鎼滅储</el-button>
- <el-button icon="Refresh" @click="resetQuery">閲嶇疆</el-button>
- </el-form-item>
- </el-form>
-
- <el-row :gutter="10" class="mb8">
- <el-col :span="1.5">
- <el-button
- type="primary"
- plain
- icon="Plus"
- @click="handleAdd"
- v-hasPermi="['${permissionPrefix}:add']"
- >鏂板</el-button>
- </el-col>
- <el-col :span="1.5">
- <el-button
- type="info"
- plain
- icon="Sort"
- @click="toggleExpandAll"
- >灞曞紑/鎶樺彔</el-button>
- </el-col>
- <right-toolbar v-model:showSearch="showSearch" @queryTable="getList"></right-toolbar>
- </el-row>
-
- <el-table
- v-if="refreshTable"
- v-loading="loading"
- :data="${businessName}List"
- row-key="${treeCode}"
- :default-expand-all="isExpandAll"
- :tree-props="{children: 'children', hasChildren: 'hasChildren'}"
- >
-#foreach($column in $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)
-#elseif($column.list && $column.htmlType == "datetime")
- <el-table-column label="${comment}" align="center" prop="${javaField}" width="180">
- <template #default="scope">
- <span>{{ parseTime(scope.row.${javaField}, '{y}-{m}-{d}') }}</span>
- </template>
- </el-table-column>
-#elseif($column.list && $column.htmlType == "imageUpload")
- <el-table-column label="${comment}" align="center" prop="${javaField}" width="100">
- <template #default="scope">
- <image-preview :src="scope.row.${javaField}" :width="50" :height="50"/>
- </template>
- </el-table-column>
-#elseif($column.list && "" != $column.dictType)
- <el-table-column label="${comment}" align="center" prop="${javaField}">
- <template #default="scope">
-#if($column.htmlType == "checkbox")
- <dict-tag :options="${column.dictType}" :value="scope.row.${javaField} ? scope.row.${javaField}.split(',') : []"/>
-#else
- <dict-tag :options="${column.dictType}" :value="scope.row.${javaField}"/>
-#end
- </template>
- </el-table-column>
-#elseif($column.list && "" != $javaField)
-#if(${foreach.index} == 1)
- <el-table-column label="${comment}" prop="${javaField}" />
-#else
- <el-table-column label="${comment}" align="center" prop="${javaField}" />
-#end
-#end
-#end
- <el-table-column label="鎿嶄綔" align="center" class-name="small-padding fixed-width">
- <template #default="scope">
- <el-button link type="primary" icon="Edit" @click="handleUpdate(scope.row)" v-hasPermi="['${permissionPrefix}:edit']">淇敼</el-button>
- <el-button link type="primary" icon="Plus" @click="handleAdd(scope.row)" v-hasPermi="['${permissionPrefix}:add']">鏂板</el-button>
- <el-button link type="primary" icon="Delete" @click="handleDelete(scope.row)" v-hasPermi="['${permissionPrefix}:remove']">鍒犻櫎</el-button>
- </template>
- </el-table-column>
- </el-table>
-
- <!-- 娣诲姞鎴栦慨鏀�${functionName}瀵硅瘽妗� -->
- <el-dialog :title="title" v-model="open" width="500px" append-to-body>
- <el-form ref="${businessName}Ref" :model="form" :rules="rules" label-width="80px">
-#foreach($column in $columns)
-#set($field=$column.javaField)
-#if($column.insert && !$column.pk)
-#if(($column.usableColumn) || (!$column.superColumn))
-#set($parentheseIndex=$column.columnComment.indexOf("锛�"))
-#if($parentheseIndex != -1)
-#set($comment=$column.columnComment.substring(0, $parentheseIndex))
-#else
-#set($comment=$column.columnComment)
-#end
-#set($dictType=$column.dictType)
-#if("" != $treeParentCode && $column.javaField == $treeParentCode)
- <el-form-item label="${comment}" prop="${treeParentCode}">
- <el-tree-select
- v-model="form.${treeParentCode}"
- :data="${businessName}Options"
- :props="{ value: '${treeCode}', label: '${treeName}', children: 'children' }"
- value-key="${treeCode}"
- placeholder="璇烽�夋嫨${comment}"
- check-strictly
- />
- </el-form-item>
-#elseif($column.htmlType == "input")
- <el-form-item label="${comment}" prop="${field}">
- <el-input v-model="form.${field}" placeholder="璇疯緭鍏�${comment}" />
- </el-form-item>
-#elseif($column.htmlType == "imageUpload")
- <el-form-item label="${comment}" prop="${field}">
- <image-upload v-model="form.${field}"/>
- </el-form-item>
-#elseif($column.htmlType == "fileUpload")
- <el-form-item label="${comment}" prop="${field}">
- <file-upload v-model="form.${field}"/>
- </el-form-item>
-#elseif($column.htmlType == "editor")
- <el-form-item label="${comment}">
- <editor v-model="form.${field}" :min-height="192"/>
- </el-form-item>
-#elseif($column.htmlType == "select" && "" != $dictType)
- <el-form-item label="${comment}" prop="${field}">
- <el-select v-model="form.${field}" placeholder="璇烽�夋嫨${comment}">
- <el-option
- v-for="dict in ${dictType}"
- :key="dict.value"
- :label="dict.label"
-#if($column.javaType == "Integer" || $column.javaType == "Long")
- :value="parseInt(dict.value)"
-#else
- :value="dict.value"
-#end
- ></el-option>
- </el-select>
- </el-form-item>
-#elseif($column.htmlType == "select" && $dictType)
- <el-form-item label="${comment}" prop="${field}">
- <el-select v-model="form.${field}" placeholder="璇烽�夋嫨${comment}">
- <el-option label="璇烽�夋嫨瀛楀吀鐢熸垚" value="" />
- </el-select>
- </el-form-item>
-#elseif($column.htmlType == "checkbox" && "" != $dictType)
- <el-form-item label="${comment}" prop="${field}">
- <el-checkbox-group v-model="form.${field}">
- <el-checkbox
- v-for="dict in ${dictType}"
- :key="dict.value"
- :label="dict.value">
- {{dict.label}}
- </el-checkbox>
- </el-checkbox-group>
- </el-form-item>
-#elseif($column.htmlType == "checkbox" && $dictType)
- <el-form-item label="${comment}" prop="${field}">
- <el-checkbox-group v-model="form.${field}">
- <el-checkbox>璇烽�夋嫨瀛楀吀鐢熸垚</el-checkbox>
- </el-checkbox-group>
- </el-form-item>
-#elseif($column.htmlType == "radio" && "" != $dictType)
- <el-form-item label="${comment}" prop="${field}">
- <el-radio-group v-model="form.${field}">
- <el-radio
- v-for="dict in ${dictType}"
- :key="dict.value"
-#if($column.javaType == "Integer" || $column.javaType == "Long")
- :label="parseInt(dict.value)"
-#else
- :label="dict.value"
-#end
- >{{dict.label}}</el-radio>
- </el-radio-group>
- </el-form-item>
-#elseif($column.htmlType == "radio" && $dictType)
- <el-form-item label="${comment}" prop="${field}">
- <el-radio-group v-model="form.${field}">
- <el-radio label="1">璇烽�夋嫨瀛楀吀鐢熸垚</el-radio>
- </el-radio-group>
- </el-form-item>
-#elseif($column.htmlType == "datetime")
- <el-form-item label="${comment}" prop="${field}">
- <el-date-picker clearable
- v-model="form.${field}"
- type="date"
- value-format="YYYY-MM-DD"
- placeholder="閫夋嫨${comment}">
- </el-date-picker>
- </el-form-item>
-#elseif($column.htmlType == "textarea")
- <el-form-item label="${comment}" prop="${field}">
- <el-input v-model="form.${field}" type="textarea" placeholder="璇疯緭鍏ュ唴瀹�" />
- </el-form-item>
-#end
-#end
-#end
-#end
- </el-form>
- <template #footer>
- <div class="dialog-footer">
- <el-button type="primary" @click="submitForm">纭� 瀹�</el-button>
- <el-button @click="cancel">鍙� 娑�</el-button>
- </div>
- </template>
- </el-dialog>
- </div>
-</template>
-
-<script setup name="${BusinessName}">
-import { list${BusinessName}, get${BusinessName}, del${BusinessName}, add${BusinessName}, update${BusinessName} } from "@/api/${moduleName}/${businessName}"
-
-const { proxy } = getCurrentInstance()
-#if(${dicts} != '')
-#set($dictsNoSymbol=$dicts.replace("'", ""))
-const { ${dictsNoSymbol} } = proxy.useDict(${dicts})
-#end
-
-const ${businessName}List = ref([])
-const ${businessName}Options = ref([])
-const open = ref(false)
-const loading = ref(true)
-const showSearch = ref(true)
-const title = ref("")
-const isExpandAll = ref(true)
-const refreshTable = ref(true)
-#foreach ($column in $columns)
-#if($column.htmlType == "datetime" && $column.queryType == "BETWEEN")
-#set($AttrName=$column.javaField.substring(0,1).toUpperCase() + ${column.javaField.substring(1)})
-const daterange${AttrName} = ref([])
-#end
-#end
-
-const data = reactive({
- form: {},
- queryParams: {
- #foreach ($column in $columns)
-#if($column.query)
- $column.javaField: null#if($foreach.count != $columns.size()),#end
-#end
-#end
- },
- rules: {
- #foreach ($column in $columns)
-#if($column.required)
-#set($parentheseIndex=$column.columnComment.indexOf("锛�"))
-#if($parentheseIndex != -1)
-#set($comment=$column.columnComment.substring(0, $parentheseIndex))
-#else
-#set($comment=$column.columnComment)
-#end
- $column.javaField: [
- { required: true, message: "$comment涓嶈兘涓虹┖", trigger: #if($column.htmlType == "select" || $column.htmlType == "radio")"change"#else"blur"#end }
- ]#if($foreach.count != $columns.size()),#end
-#end
-#end
- }
-})
-
-const { queryParams, form, rules } = toRefs(data)
-
-/** 鏌ヨ${functionName}鍒楄〃 */
-function getList() {
- loading.value = true
-#foreach ($column in $columns)
-#if($column.htmlType == "datetime" && $column.queryType == "BETWEEN")
- queryParams.value.params = {}
-#break
-#end
-#end
-#foreach ($column in $columns)
-#if($column.htmlType == "datetime" && $column.queryType == "BETWEEN")
-#set($AttrName=$column.javaField.substring(0,1).toUpperCase() + ${column.javaField.substring(1)})
- if (null != daterange${AttrName} && '' != daterange${AttrName}) {
- queryParams.value.params["begin${AttrName}"] = daterange${AttrName}.value[0]
- queryParams.value.params["end${AttrName}"] = daterange${AttrName}.value[1]
- }
-#end
-#end
- list${BusinessName}(queryParams.value).then(response => {
- ${businessName}List.value = proxy.handleTree(response.data, "${treeCode}", "${treeParentCode}")
- loading.value = false
- })
-}
-
-/** 鏌ヨ${functionName}涓嬫媺鏍戠粨鏋� */
-function getTreeselect() {
- list${BusinessName}().then(response => {
- ${businessName}Options.value = []
- const data = { ${treeCode}: 0, ${treeName}: '椤剁骇鑺傜偣', children: [] }
- data.children = proxy.handleTree(response.data, "${treeCode}", "${treeParentCode}")
- ${businessName}Options.value.push(data)
- })
-}
-
-// 鍙栨秷鎸夐挳
-function cancel() {
- open.value = false
- reset()
-}
-
-// 琛ㄥ崟閲嶇疆
-function reset() {
- form.value = {
-#foreach ($column in $columns)
-#if($column.htmlType == "checkbox")
- $column.javaField: []#if($foreach.count != $columns.size()),#end
-#else
- $column.javaField: null#if($foreach.count != $columns.size()),#end
-#end
-#end
- }
- proxy.resetForm("${businessName}Ref")
-}
-
-/** 鎼滅储鎸夐挳鎿嶄綔 */
-function handleQuery() {
- getList()
-}
-
-/** 閲嶇疆鎸夐挳鎿嶄綔 */
-function resetQuery() {
-#foreach ($column in $columns)
-#if($column.htmlType == "datetime" && $column.queryType == "BETWEEN")
-#set($AttrName=$column.javaField.substring(0,1).toUpperCase() + ${column.javaField.substring(1)})
- daterange${AttrName}.value = []
-#end
-#end
- proxy.resetForm("queryRef")
- handleQuery()
-}
-
-/** 鏂板鎸夐挳鎿嶄綔 */
-function handleAdd(row) {
- reset()
- getTreeselect()
- if (row != null && row.${treeCode}) {
- form.value.${treeParentCode} = row.${treeCode}
- } else {
- form.value.${treeParentCode} = 0
- }
- open.value = true
- title.value = "娣诲姞${functionName}"
-}
-
-/** 灞曞紑/鎶樺彔鎿嶄綔 */
-function toggleExpandAll() {
- refreshTable.value = false
- isExpandAll.value = !isExpandAll.value
- nextTick(() => {
- refreshTable.value = true
- })
-}
-
-/** 淇敼鎸夐挳鎿嶄綔 */
-async function handleUpdate(row) {
- reset()
- await getTreeselect()
- if (row != null) {
- form.value.${treeParentCode} = row.${treeParentCode}
- }
- get${BusinessName}(row.${pkColumn.javaField}).then(response => {
- form.value = response.data
-#foreach ($column in $columns)
-#if($column.htmlType == "checkbox")
- form.value.$column.javaField = form.value.${column.javaField}.split(",")
-#end
-#end
- open.value = true
- title.value = "淇敼${functionName}"
- })
-}
-
-/** 鎻愪氦鎸夐挳 */
-function submitForm() {
- proxy.#[[$]]#refs["${businessName}Ref"].validate(valid => {
- if (valid) {
-#foreach ($column in $columns)
-#if($column.htmlType == "checkbox")
- form.value.$column.javaField = form.value.${column.javaField}.join(",")
-#end
-#end
- if (form.value.${pkColumn.javaField} != null) {
- update${BusinessName}(form.value).then(response => {
- proxy.#[[$modal]]#.msgSuccess("淇敼鎴愬姛")
- open.value = false
- getList()
- })
- } else {
- add${BusinessName}(form.value).then(response => {
- proxy.#[[$modal]]#.msgSuccess("鏂板鎴愬姛")
- open.value = false
- getList()
- })
- }
- }
- })
-}
-
-/** 鍒犻櫎鎸夐挳鎿嶄綔 */
-function handleDelete(row) {
- proxy.#[[$modal]]#.confirm('鏄惁纭鍒犻櫎${functionName}缂栧彿涓�"' + row.${pkColumn.javaField} + '"鐨勬暟鎹」锛�').then(function() {
- return del${BusinessName}(row.${pkColumn.javaField})
- }).then(() => {
- getList()
- proxy.#[[$modal]]#.msgSuccess("鍒犻櫎鎴愬姛")
- }).catch(() => {})
-}
-
-getList()
-</script>
diff --git a/ruoyi-generator/src/main/resources/vm/vue/v3/index.vue.vm b/ruoyi-generator/src/main/resources/vm/vue/v3/index.vue.vm
deleted file mode 100644
index 936b465..0000000
--- a/ruoyi-generator/src/main/resources/vm/vue/v3/index.vue.vm
+++ /dev/null
@@ -1,590 +0,0 @@
-<template>
- <div class="app-container">
- <el-form :model="queryParams" ref="queryRef" :inline="true" v-show="showSearch" label-width="68px">
-#foreach($column in $columns)
-#if($column.query)
-#set($dictType=$column.dictType)
-#set($AttrName=$column.javaField.substring(0,1).toUpperCase() + ${column.javaField.substring(1)})
-#set($parentheseIndex=$column.columnComment.indexOf("锛�"))
-#if($parentheseIndex != -1)
-#set($comment=$column.columnComment.substring(0, $parentheseIndex))
-#else
-#set($comment=$column.columnComment)
-#end
-#if($column.htmlType == "input")
- <el-form-item label="${comment}" prop="${column.javaField}">
- <el-input
- v-model="queryParams.${column.javaField}"
- placeholder="璇疯緭鍏�${comment}"
- clearable
- @keyup.enter="handleQuery"
- />
- </el-form-item>
-#elseif(($column.htmlType == "select" || $column.htmlType == "radio") && "" != $dictType)
- <el-form-item label="${comment}" prop="${column.javaField}">
- <el-select v-model="queryParams.${column.javaField}" placeholder="璇烽�夋嫨${comment}" clearable>
- <el-option
- v-for="dict in ${dictType}"
- :key="dict.value"
- :label="dict.label"
- :value="dict.value"
- />
- </el-select>
- </el-form-item>
-#elseif(($column.htmlType == "select" || $column.htmlType == "radio") && $dictType)
- <el-form-item label="${comment}" prop="${column.javaField}">
- <el-select v-model="queryParams.${column.javaField}" placeholder="璇烽�夋嫨${comment}" clearable>
- <el-option label="璇烽�夋嫨瀛楀吀鐢熸垚" value="" />
- </el-select>
- </el-form-item>
-#elseif($column.htmlType == "datetime" && $column.queryType != "BETWEEN")
- <el-form-item label="${comment}" prop="${column.javaField}">
- <el-date-picker clearable
- v-model="queryParams.${column.javaField}"
- type="date"
- value-format="YYYY-MM-DD"
- placeholder="璇烽�夋嫨${comment}">
- </el-date-picker>
- </el-form-item>
-#elseif($column.htmlType == "datetime" && $column.queryType == "BETWEEN")
- <el-form-item label="${comment}" style="width: 308px">
- <el-date-picker
- v-model="daterange${AttrName}"
- value-format="YYYY-MM-DD"
- type="daterange"
- range-separator="-"
- start-placeholder="寮�濮嬫棩鏈�"
- end-placeholder="缁撴潫鏃ユ湡"
- ></el-date-picker>
- </el-form-item>
-#end
-#end
-#end
- <el-form-item>
- <el-button type="primary" icon="Search" @click="handleQuery">鎼滅储</el-button>
- <el-button icon="Refresh" @click="resetQuery">閲嶇疆</el-button>
- </el-form-item>
- </el-form>
-
- <el-row :gutter="10" class="mb8">
- <el-col :span="1.5">
- <el-button
- type="primary"
- plain
- icon="Plus"
- @click="handleAdd"
- v-hasPermi="['${permissionPrefix}:add']"
- >鏂板</el-button>
- </el-col>
- <el-col :span="1.5">
- <el-button
- type="success"
- plain
- icon="Edit"
- :disabled="single"
- @click="handleUpdate"
- v-hasPermi="['${permissionPrefix}:edit']"
- >淇敼</el-button>
- </el-col>
- <el-col :span="1.5">
- <el-button
- type="danger"
- plain
- icon="Delete"
- :disabled="multiple"
- @click="handleDelete"
- v-hasPermi="['${permissionPrefix}:remove']"
- >鍒犻櫎</el-button>
- </el-col>
- <el-col :span="1.5">
- <el-button
- type="warning"
- plain
- icon="Download"
- @click="handleExport"
- v-hasPermi="['${permissionPrefix}:export']"
- >瀵煎嚭</el-button>
- </el-col>
- <right-toolbar v-model:showSearch="showSearch" @queryTable="getList"></right-toolbar>
- </el-row>
-
- <el-table v-loading="loading" :data="${businessName}List" @selection-change="handleSelectionChange">
- <el-table-column type="selection" width="55" align="center" />
-#foreach($column in $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)
- <el-table-column label="${comment}" align="center" prop="${javaField}" />
-#elseif($column.list && $column.htmlType == "datetime")
- <el-table-column label="${comment}" align="center" prop="${javaField}" width="180">
- <template #default="scope">
- <span>{{ parseTime(scope.row.${javaField}, '{y}-{m}-{d}') }}</span>
- </template>
- </el-table-column>
-#elseif($column.list && $column.htmlType == "imageUpload")
- <el-table-column label="${comment}" align="center" prop="${javaField}" width="100">
- <template #default="scope">
- <image-preview :src="scope.row.${javaField}" :width="50" :height="50"/>
- </template>
- </el-table-column>
-#elseif($column.list && "" != $column.dictType)
- <el-table-column label="${comment}" align="center" prop="${javaField}">
- <template #default="scope">
-#if($column.htmlType == "checkbox")
- <dict-tag :options="${column.dictType}" :value="scope.row.${javaField} ? scope.row.${javaField}.split(',') : []"/>
-#else
- <dict-tag :options="${column.dictType}" :value="scope.row.${javaField}"/>
-#end
- </template>
- </el-table-column>
-#elseif($column.list && "" != $javaField)
- <el-table-column label="${comment}" align="center" prop="${javaField}" />
-#end
-#end
- <el-table-column label="鎿嶄綔" align="center" class-name="small-padding fixed-width">
- <template #default="scope">
- <el-button link type="primary" icon="Edit" @click="handleUpdate(scope.row)" v-hasPermi="['${permissionPrefix}:edit']">淇敼</el-button>
- <el-button link type="primary" icon="Delete" @click="handleDelete(scope.row)" v-hasPermi="['${permissionPrefix}:remove']">鍒犻櫎</el-button>
- </template>
- </el-table-column>
- </el-table>
-
- <pagination
- v-show="total>0"
- :total="total"
- v-model:page="queryParams.pageNum"
- v-model:limit="queryParams.pageSize"
- @pagination="getList"
- />
-
- <!-- 娣诲姞鎴栦慨鏀�${functionName}瀵硅瘽妗� -->
- <el-dialog :title="title" v-model="open" width="500px" append-to-body>
- <el-form ref="${businessName}Ref" :model="form" :rules="rules" label-width="80px">
-#foreach($column in $columns)
-#set($field=$column.javaField)
-#if($column.insert && !$column.pk)
-#if(($column.usableColumn) || (!$column.superColumn))
-#set($parentheseIndex=$column.columnComment.indexOf("锛�"))
-#if($parentheseIndex != -1)
-#set($comment=$column.columnComment.substring(0, $parentheseIndex))
-#else
-#set($comment=$column.columnComment)
-#end
-#set($dictType=$column.dictType)
-#if($column.htmlType == "input")
- <el-form-item label="${comment}" prop="${field}">
- <el-input v-model="form.${field}" placeholder="璇疯緭鍏�${comment}" />
- </el-form-item>
-#elseif($column.htmlType == "imageUpload")
- <el-form-item label="${comment}" prop="${field}">
- <image-upload v-model="form.${field}"/>
- </el-form-item>
-#elseif($column.htmlType == "fileUpload")
- <el-form-item label="${comment}" prop="${field}">
- <file-upload v-model="form.${field}"/>
- </el-form-item>
-#elseif($column.htmlType == "editor")
- <el-form-item label="${comment}">
- <editor v-model="form.${field}" :min-height="192"/>
- </el-form-item>
-#elseif($column.htmlType == "select" && "" != $dictType)
- <el-form-item label="${comment}" prop="${field}">
- <el-select v-model="form.${field}" placeholder="璇烽�夋嫨${comment}">
- <el-option
- v-for="dict in ${dictType}"
- :key="dict.value"
- :label="dict.label"
-#if($column.javaType == "Integer" || $column.javaType == "Long")
- :value="parseInt(dict.value)"
-#else
- :value="dict.value"
-#end
- ></el-option>
- </el-select>
- </el-form-item>
-#elseif($column.htmlType == "select" && $dictType)
- <el-form-item label="${comment}" prop="${field}">
- <el-select v-model="form.${field}" placeholder="璇烽�夋嫨${comment}">
- <el-option label="璇烽�夋嫨瀛楀吀鐢熸垚" value="" />
- </el-select>
- </el-form-item>
-#elseif($column.htmlType == "checkbox" && "" != $dictType)
- <el-form-item label="${comment}" prop="${field}">
- <el-checkbox-group v-model="form.${field}">
- <el-checkbox
- v-for="dict in ${dictType}"
- :key="dict.value"
- :label="dict.value">
- {{dict.label}}
- </el-checkbox>
- </el-checkbox-group>
- </el-form-item>
-#elseif($column.htmlType == "checkbox" && $dictType)
- <el-form-item label="${comment}" prop="${field}">
- <el-checkbox-group v-model="form.${field}">
- <el-checkbox>璇烽�夋嫨瀛楀吀鐢熸垚</el-checkbox>
- </el-checkbox-group>
- </el-form-item>
-#elseif($column.htmlType == "radio" && "" != $dictType)
- <el-form-item label="${comment}" prop="${field}">
- <el-radio-group v-model="form.${field}">
- <el-radio
- v-for="dict in ${dictType}"
- :key="dict.value"
-#if($column.javaType == "Integer" || $column.javaType == "Long")
- :label="parseInt(dict.value)"
-#else
- :label="dict.value"
-#end
- >{{dict.label}}</el-radio>
- </el-radio-group>
- </el-form-item>
-#elseif($column.htmlType == "radio" && $dictType)
- <el-form-item label="${comment}" prop="${field}">
- <el-radio-group v-model="form.${field}">
- <el-radio label="1">璇烽�夋嫨瀛楀吀鐢熸垚</el-radio>
- </el-radio-group>
- </el-form-item>
-#elseif($column.htmlType == "datetime")
- <el-form-item label="${comment}" prop="${field}">
- <el-date-picker clearable
- v-model="form.${field}"
- type="date"
- value-format="YYYY-MM-DD"
- placeholder="璇烽�夋嫨${comment}">
- </el-date-picker>
- </el-form-item>
-#elseif($column.htmlType == "textarea")
- <el-form-item label="${comment}" prop="${field}">
- <el-input v-model="form.${field}" type="textarea" placeholder="璇疯緭鍏ュ唴瀹�" />
- </el-form-item>
-#end
-#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="Plus" @click="handleAdd${subClassName}">娣诲姞</el-button>
- </el-col>
- <el-col :span="1.5">
- <el-button type="danger" icon="Delete" @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 && $column.htmlType == "input")
- <el-table-column label="$comment" prop="${javaField}" width="150">
- <template #default="scope">
- <el-input v-model="scope.row.$javaField" placeholder="璇疯緭鍏�$comment" />
- </template>
- </el-table-column>
-#elseif($column.list && $column.htmlType == "datetime")
- <el-table-column label="$comment" prop="${javaField}" width="240">
- <template #default="scope">
- <el-date-picker clearable
- v-model="scope.row.$javaField"
- type="date"
- value-format="YYYY-MM-DD"
- placeholder="璇烽�夋嫨$comment">
- </el-date-picker>
- </template>
- </el-table-column>
-#elseif($column.list && ($column.htmlType == "select" || $column.htmlType == "radio") && "" != $column.dictType)
- <el-table-column label="$comment" prop="${javaField}" width="150">
- <template #default="scope">
- <el-select v-model="scope.row.$javaField" placeholder="璇烽�夋嫨$comment">
- <el-option
- v-for="dict in $column.dictType"
- :key="dict.value"
- :label="dict.label"
- :value="dict.value"
- ></el-option>
- </el-select>
- </template>
- </el-table-column>
-#elseif($column.list && ($column.htmlType == "select" || $column.htmlType == "radio") && "" == $column.dictType)
- <el-table-column label="$comment" prop="${javaField}" width="150">
- <template #default="scope">
- <el-select v-model="scope.row.$javaField" placeholder="璇烽�夋嫨$comment">
- <el-option label="璇烽�夋嫨瀛楀吀鐢熸垚" value="" />
- </el-select>
- </template>
- </el-table-column>
-#end
-#end
- </el-table>
-#end
- </el-form>
- <template #footer>
- <div class="dialog-footer">
- <el-button type="primary" @click="submitForm">纭� 瀹�</el-button>
- <el-button @click="cancel">鍙� 娑�</el-button>
- </div>
- </template>
- </el-dialog>
- </div>
-</template>
-
-<script setup name="${BusinessName}">
-import { list${BusinessName}, get${BusinessName}, del${BusinessName}, add${BusinessName}, update${BusinessName} } from "@/api/${moduleName}/${businessName}"
-
-const { proxy } = getCurrentInstance()
-#if(${dicts} != '')
-#set($dictsNoSymbol=$dicts.replace("'", ""))
-const { ${dictsNoSymbol} } = proxy.useDict(${dicts})
-#end
-
-const ${businessName}List = ref([])
-#if($table.sub)
-const ${subclassName}List = ref([])
-#end
-const open = ref(false)
-const loading = ref(true)
-const showSearch = ref(true)
-const ids = ref([])
-#if($table.sub)
-const checked${subClassName} = ref([])
-#end
-const single = ref(true)
-const multiple = ref(true)
-const total = ref(0)
-const title = ref("")
-#foreach ($column in $columns)
-#if($column.htmlType == "datetime" && $column.queryType == "BETWEEN")
-#set($AttrName=$column.javaField.substring(0,1).toUpperCase() + ${column.javaField.substring(1)})
-const daterange${AttrName} = ref([])
-#end
-#end
-
-const data = reactive({
- form: {},
- queryParams: {
- pageNum: 1,
- pageSize: 10,
- #foreach ($column in $columns)
-#if($column.query)
- $column.javaField: null#if($foreach.count != $columns.size()),#end
-#end
-#end
- },
- rules: {
- #foreach ($column in $columns)
-#if($column.required)
-#set($parentheseIndex=$column.columnComment.indexOf("锛�"))
-#if($parentheseIndex != -1)
-#set($comment=$column.columnComment.substring(0, $parentheseIndex))
-#else
-#set($comment=$column.columnComment)
-#end
- $column.javaField: [
- { required: true, message: "$comment涓嶈兘涓虹┖", trigger: #if($column.htmlType == "select" || $column.htmlType == "radio")"change"#else"blur"#end }
- ]#if($foreach.count != $columns.size()),#end
-#end
-#end
- }
-})
-
-const { queryParams, form, rules } = toRefs(data)
-
-/** 鏌ヨ${functionName}鍒楄〃 */
-function getList() {
- loading.value = true
-#foreach ($column in $columns)
-#if($column.htmlType == "datetime" && $column.queryType == "BETWEEN")
- queryParams.value.params = {}
-#break
-#end
-#end
-#foreach ($column in $columns)
-#if($column.htmlType == "datetime" && $column.queryType == "BETWEEN")
-#set($AttrName=$column.javaField.substring(0,1).toUpperCase() + ${column.javaField.substring(1)})
- if (null != daterange${AttrName} && '' != daterange${AttrName}) {
- queryParams.value.params["begin${AttrName}"] = daterange${AttrName}.value[0]
- queryParams.value.params["end${AttrName}"] = daterange${AttrName}.value[1]
- }
-#end
-#end
- list${BusinessName}(queryParams.value).then(response => {
- ${businessName}List.value = response.rows
- total.value = response.total
- loading.value = false
- })
-}
-
-// 鍙栨秷鎸夐挳
-function cancel() {
- open.value = false
- reset()
-}
-
-// 琛ㄥ崟閲嶇疆
-function reset() {
- form.value = {
-#foreach ($column in $columns)
-#if($column.htmlType == "checkbox")
- $column.javaField: []#if($foreach.count != $columns.size()),#end
-#else
- $column.javaField: null#if($foreach.count != $columns.size()),#end
-#end
-#end
- }
-#if($table.sub)
- ${subclassName}List.value = []
-#end
- proxy.resetForm("${businessName}Ref")
-}
-
-/** 鎼滅储鎸夐挳鎿嶄綔 */
-function handleQuery() {
- queryParams.value.pageNum = 1
- getList()
-}
-
-/** 閲嶇疆鎸夐挳鎿嶄綔 */
-function resetQuery() {
-#foreach ($column in $columns)
-#if($column.htmlType == "datetime" && $column.queryType == "BETWEEN")
-#set($AttrName=$column.javaField.substring(0,1).toUpperCase() + ${column.javaField.substring(1)})
- daterange${AttrName}.value = []
-#end
-#end
- proxy.resetForm("queryRef")
- handleQuery()
-}
-
-// 澶氶�夋閫変腑鏁版嵁
-function handleSelectionChange(selection) {
- ids.value = selection.map(item => item.${pkColumn.javaField})
- single.value = selection.length != 1
- multiple.value = !selection.length
-}
-
-/** 鏂板鎸夐挳鎿嶄綔 */
-function handleAdd() {
- reset()
- open.value = true
- title.value = "娣诲姞${functionName}"
-}
-
-/** 淇敼鎸夐挳鎿嶄綔 */
-function handleUpdate(row) {
- reset()
- const _${pkColumn.javaField} = row.${pkColumn.javaField} || ids.value
- get${BusinessName}(_${pkColumn.javaField}).then(response => {
- form.value = response.data
-#foreach ($column in $columns)
-#if($column.htmlType == "checkbox")
- form.value.$column.javaField = form.value.${column.javaField}.split(",")
-#end
-#end
-#if($table.sub)
- ${subclassName}List.value = response.data.${subclassName}List
-#end
- open.value = true
- title.value = "淇敼${functionName}"
- })
-}
-
-/** 鎻愪氦鎸夐挳 */
-function submitForm() {
- proxy.#[[$]]#refs["${businessName}Ref"].validate(valid => {
- if (valid) {
-#foreach ($column in $columns)
-#if($column.htmlType == "checkbox")
- form.value.$column.javaField = form.value.${column.javaField}.join(",")
-#end
-#end
-#if($table.sub)
- form.value.${subclassName}List = ${subclassName}List.value
-#end
- if (form.value.${pkColumn.javaField} != null) {
- update${BusinessName}(form.value).then(response => {
- proxy.#[[$modal]]#.msgSuccess("淇敼鎴愬姛")
- open.value = false
- getList()
- })
- } else {
- add${BusinessName}(form.value).then(response => {
- proxy.#[[$modal]]#.msgSuccess("鏂板鎴愬姛")
- open.value = false
- getList()
- })
- }
- }
- })
-}
-
-/** 鍒犻櫎鎸夐挳鎿嶄綔 */
-function handleDelete(row) {
- const _${pkColumn.javaField}s = row.${pkColumn.javaField} || ids.value
- proxy.#[[$modal]]#.confirm('鏄惁纭鍒犻櫎${functionName}缂栧彿涓�"' + _${pkColumn.javaField}s + '"鐨勬暟鎹」锛�').then(function() {
- return del${BusinessName}(_${pkColumn.javaField}s)
- }).then(() => {
- getList()
- proxy.#[[$modal]]#.msgSuccess("鍒犻櫎鎴愬姛")
- }).catch(() => {})
-}
-
-#if($table.sub)
-/** ${subTable.functionName}搴忓彿 */
-function row${subClassName}Index({ row, rowIndex }) {
- row.index = rowIndex + 1
-}
-
-/** ${subTable.functionName}娣诲姞鎸夐挳鎿嶄綔 */
-function handleAdd${subClassName}() {
- let obj = {}
-#foreach($column in $subTable.columns)
-#if($column.pk || $column.javaField == ${subTableFkclassName})
-#elseif($column.list && "" != $javaField)
- obj.$column.javaField = ""
-#end
-#end
- ${subclassName}List.value.push(obj)
-}
-
-/** ${subTable.functionName}鍒犻櫎鎸夐挳鎿嶄綔 */
-function handleDelete${subClassName}() {
- if (checked${subClassName}.value.length == 0) {
- proxy.#[[$modal]]#.msgError("璇峰厛閫夋嫨瑕佸垹闄ょ殑${subTable.functionName}鏁版嵁")
- } else {
- const ${subclassName}s = ${subclassName}List.value
- const checked${subClassName}s = checked${subClassName}.value
- ${subclassName}List.value = ${subclassName}s.filter(function(item) {
- return checked${subClassName}s.indexOf(item.index) == -1
- })
- }
-}
-
-/** 澶嶉�夋閫変腑鏁版嵁 */
-function handle${subClassName}SelectionChange(selection) {
- checked${subClassName}.value = selection.map(item => item.index)
-}
-
-#end
-/** 瀵煎嚭鎸夐挳鎿嶄綔 */
-function handleExport() {
- proxy.download('${moduleName}/${businessName}/export', {
- ...queryParams.value
- }, `${businessName}_#[[${new Date().getTime()}]]#.xlsx`)
-}
-
-getList()
-</script>
diff --git a/ruoyi-generator/src/main/resources/vm/xml/mapper.xml.vm b/ruoyi-generator/src/main/resources/vm/xml/mapper.xml.vm
deleted file mode 100644
index 456755b..0000000
--- a/ruoyi-generator/src/main/resources/vm/xml/mapper.xml.vm
+++ /dev/null
@@ -1,140 +0,0 @@
-<?xml version="1.0" encoding="UTF-8" ?>
-<!DOCTYPE mapper
-PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
-"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
-<mapper namespace="${packageName}.mapper.${ClassName}Mapper">
-
- <resultMap type="${ClassName}" id="${ClassName}Result">
-#foreach ($column in $columns)
- <result property="${column.javaField}" column="${column.columnName}" />
-#end
- </resultMap>
-#if($table.sub)
-
- <resultMap id="${ClassName}${subClassName}Result" type="${ClassName}" extends="${ClassName}Result">
- <collection property="${subclassName}List" ofType="${subClassName}" column="${pkColumn.columnName}" select="select${subClassName}List" />
- </resultMap>
-
- <resultMap type="${subClassName}" id="${subClassName}Result">
-#foreach ($column in $subTable.columns)
- <result property="${column.javaField}" column="${column.columnName}" />
-#end
- </resultMap>
-#end
-
- <sql id="select${ClassName}Vo">
- select#foreach($column in $columns) $column.columnName#if($foreach.count != $columns.size()),#end#end from ${tableName}
- </sql>
-
- <select id="select${ClassName}List" parameterType="${ClassName}" resultMap="${ClassName}Result">
- <include refid="select${ClassName}Vo"/>
- <where>
-#foreach($column in $columns)
-#set($queryType=$column.queryType)
-#set($javaField=$column.javaField)
-#set($javaType=$column.javaType)
-#set($columnName=$column.columnName)
-#set($AttrName=$column.javaField.substring(0,1).toUpperCase() + ${column.javaField.substring(1)})
-#if($column.query)
-#if($column.queryType == "EQ")
- <if test="$javaField != null #if($javaType == 'String' ) and $javaField.trim() != ''#end"> and $columnName = #{$javaField}</if>
-#elseif($queryType == "NE")
- <if test="$javaField != null #if($javaType == 'String' ) and $javaField.trim() != ''#end"> and $columnName != #{$javaField}</if>
-#elseif($queryType == "GT")
- <if test="$javaField != null #if($javaType == 'String' ) and $javaField.trim() != ''#end"> and $columnName > #{$javaField}</if>
-#elseif($queryType == "GTE")
- <if test="$javaField != null #if($javaType == 'String' ) and $javaField.trim() != ''#end"> and $columnName >= #{$javaField}</if>
-#elseif($queryType == "LT")
- <if test="$javaField != null #if($javaType == 'String' ) and $javaField.trim() != ''#end"> and $columnName < #{$javaField}</if>
-#elseif($queryType == "LTE")
- <if test="$javaField != null #if($javaType == 'String' ) and $javaField.trim() != ''#end"> and $columnName <= #{$javaField}</if>
-#elseif($queryType == "LIKE")
- <if test="$javaField != null #if($javaType == 'String' ) and $javaField.trim() != ''#end"> and $columnName like concat('%', #{$javaField}, '%')</if>
-#elseif($queryType == "BETWEEN")
- <if test="params.begin$AttrName != null and params.begin$AttrName != '' and params.end$AttrName != null and params.end$AttrName != ''"> and $columnName between #{params.begin$AttrName} and #{params.end$AttrName}</if>
-#end
-#end
-#end
- </where>
- </select>
-
- <select id="select${ClassName}By${pkColumn.capJavaField}" parameterType="${pkColumn.javaType}" resultMap="#if($table.sub)${ClassName}${subClassName}Result#else${ClassName}Result#end">
-#if($table.crud || $table.tree)
- <include refid="select${ClassName}Vo"/>
- where ${pkColumn.columnName} = #{${pkColumn.javaField}}
-#elseif($table.sub)
- select#foreach($column in $columns) $column.columnName#if($foreach.count != $columns.size()),#end#end
- from ${tableName}
- where ${pkColumn.columnName} = #{${pkColumn.javaField}}
-#end
- </select>
-#if($table.sub)
-
- <select id="select${subClassName}List" resultMap="${subClassName}Result">
- select#foreach ($column in $subTable.columns) $column.columnName#if($foreach.count != $subTable.columns.size()),#end#end
- from ${subTableName}
- where ${subTableFkName} = #{${subTableFkName}}
- </select>
-#end
-
- <insert id="insert${ClassName}" parameterType="${ClassName}"#if($pkColumn.increment) useGeneratedKeys="true" keyProperty="$pkColumn.javaField"#end>
- insert into ${tableName}
- <trim prefix="(" suffix=")" suffixOverrides=",">
-#foreach($column in $columns)
-#if($column.columnName != $pkColumn.columnName || !$pkColumn.increment)
- <if test="$column.javaField != null#if($column.javaType == 'String' && $column.required) and $column.javaField != ''#end">$column.columnName,</if>
-#end
-#end
- </trim>
- <trim prefix="values (" suffix=")" suffixOverrides=",">
-#foreach($column in $columns)
-#if($column.columnName != $pkColumn.columnName || !$pkColumn.increment)
- <if test="$column.javaField != null#if($column.javaType == 'String' && $column.required) and $column.javaField != ''#end">#{$column.javaField},</if>
-#end
-#end
- </trim>
- </insert>
-
- <update id="update${ClassName}" parameterType="${ClassName}">
- update ${tableName}
- <trim prefix="SET" suffixOverrides=",">
-#foreach($column in $columns)
-#if($column.columnName != $pkColumn.columnName)
- <if test="$column.javaField != null#if($column.javaType == 'String' && $column.required) and $column.javaField != ''#end">$column.columnName = #{$column.javaField},</if>
-#end
-#end
- </trim>
- where ${pkColumn.columnName} = #{${pkColumn.javaField}}
- </update>
-
- <delete id="delete${ClassName}By${pkColumn.capJavaField}" parameterType="${pkColumn.javaType}">
- delete from ${tableName} where ${pkColumn.columnName} = #{${pkColumn.javaField}}
- </delete>
-
- <delete id="delete${ClassName}By${pkColumn.capJavaField}s" parameterType="String">
- delete from ${tableName} where ${pkColumn.columnName} in
- <foreach item="${pkColumn.javaField}" collection="array" open="(" separator="," close=")">
- #{${pkColumn.javaField}}
- </foreach>
- </delete>
-#if($table.sub)
-
- <delete id="delete${subClassName}By${subTableFkClassName}s" parameterType="String">
- delete from ${subTableName} where ${subTableFkName} in
- <foreach item="${subTableFkclassName}" collection="array" open="(" separator="," close=")">
- #{${subTableFkclassName}}
- </foreach>
- </delete>
-
- <delete id="delete${subClassName}By${subTableFkClassName}" parameterType="${pkColumn.javaType}">
- delete from ${subTableName} where ${subTableFkName} = #{${subTableFkclassName}}
- </delete>
-
- <insert id="batch${subClassName}">
- insert into ${subTableName}(#foreach($column in $subTable.columns) $column.columnName#if($foreach.count != $subTable.columns.size()),#end#end) values
- <foreach item="item" index="index" collection="list" separator=",">
- (#foreach($column in $subTable.columns) #{item.$column.javaField}#if($foreach.count != $subTable.columns.size()),#end#end)
- </foreach>
- </insert>
-#end
-</mapper>
\ No newline at end of file
--
Gitblit v1.9.3