mirror of
https://gitee.com/yudaocode/yudao-boot-mini.git
synced 2025-12-26 07:06:22 +08:00
Merge branch 'master-jdk17' of https://gitee.com/zhijiantianya/ruoyi-vue-pro into feature/iot
# Conflicts: # yudao-module-iot/yudao-module-iot-biz/src/main/java/cn/iocoder/yudao/module/iot/service/device/IotDeviceServiceImpl.java
This commit is contained in:
commit
4e3cfd83bd
7
pom.xml
7
pom.xml
@ -32,7 +32,7 @@
|
||||
<url>https://github.com/YunaiV/ruoyi-vue-pro</url>
|
||||
|
||||
<properties>
|
||||
<revision>2.5.0-SNAPSHOT</revision>
|
||||
<revision>2.6.0-SNAPSHOT</revision>
|
||||
<!-- Maven 相关 -->
|
||||
<java.version>17</java.version>
|
||||
<maven.compiler.source>${java.version}</maven.compiler.source>
|
||||
@ -40,9 +40,6 @@
|
||||
<maven-surefire-plugin.version>3.2.2</maven-surefire-plugin.version>
|
||||
<maven-compiler-plugin.version>3.14.0</maven-compiler-plugin.version>
|
||||
<flatten-maven-plugin.version>1.6.0</flatten-maven-plugin.version>
|
||||
<!-- 看看咋放到 bom 里 -->
|
||||
<lombok.version>1.18.36</lombok.version>
|
||||
<spring.boot.version>3.4.5</spring.boot.version>
|
||||
<mapstruct.version>1.6.3</mapstruct.version>
|
||||
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
||||
</properties>
|
||||
@ -80,12 +77,10 @@
|
||||
<path>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-configuration-processor</artifactId>
|
||||
<version>${spring.boot.version}</version>
|
||||
</path>
|
||||
<path>
|
||||
<groupId>org.projectlombok</groupId>
|
||||
<artifactId>lombok</artifactId>
|
||||
<version>${lombok.version}</version>
|
||||
</path>
|
||||
<path>
|
||||
<groupId>org.mapstruct</groupId>
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@ -4,6 +4,14 @@
|
||||
Author: dhb52 (https://gitee.com/dhb52)
|
||||
|
||||
pip install simple-ddl-parser
|
||||
|
||||
or with uv
|
||||
uv run --with simple-ddl-parser convertor.py postgres > ../postgresql/ruoyi-vue-pro.sql 239ms 四 5/22 21:03:16 2025
|
||||
uv run --with simple-ddl-parser convertor.py sqlserver > ../sqlserver/ruoyi-vue-pro.sql
|
||||
uv run --with simple-ddl-parser convertor.py kingbase > ../kingbase/ruoyi-vue-pro.sql
|
||||
uv run --with simple-ddl-parser convertor.py opengauss > ../opengauss/ruoyi-vue-pro.sql
|
||||
uv run --with simple-ddl-parser convertor.py oracle > ../oracle/ruoyi-vue-pro.sql
|
||||
uv run --with simple-ddl-parser convertor.py dm8 > ../dm/ruoyi-vue-pro-dm8.sql
|
||||
"""
|
||||
|
||||
import argparse
|
||||
@ -38,6 +46,7 @@ def load_and_clean(sql_file: str) -> str:
|
||||
str: 清理后的sql文件内容
|
||||
"""
|
||||
REPLACE_PAIR_LIST = (
|
||||
(")\nVALUES ", ") VALUES "),
|
||||
(" CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci ", " "),
|
||||
(" KEY `", " INDEX `"),
|
||||
("UNIQUE INDEX", "UNIQUE KEY"),
|
||||
@ -45,7 +54,7 @@ def load_and_clean(sql_file: str) -> str:
|
||||
("b'1'", "'1'"),
|
||||
)
|
||||
|
||||
content = open(sql_file).read()
|
||||
content = open(sql_file, encoding="utf-8").read()
|
||||
for replace_pair in REPLACE_PAIR_LIST:
|
||||
content = content.replace(*replace_pair)
|
||||
content = re.sub(r"ENGINE.*COMMENT", "COMMENT", content)
|
||||
@ -110,18 +119,28 @@ class Convertor(ABC):
|
||||
pass
|
||||
|
||||
@abstractmethod
|
||||
def gen_comment(self, table_sql: str, table_name: str) -> str:
|
||||
def gen_comment(self, table_ddl: Dict) -> str:
|
||||
"""生成字段/表注释
|
||||
|
||||
Args:
|
||||
table_sql (str): 原始表SQL
|
||||
table_name (str): 表名
|
||||
table_ddl (Dict): 表DDL
|
||||
|
||||
Returns:
|
||||
str: 生成脚本
|
||||
"""
|
||||
pass
|
||||
|
||||
@abstractmethod
|
||||
def gen_uk(self, table_ddl: Dict) -> str:
|
||||
"""生成
|
||||
|
||||
Args:
|
||||
table_ddl (Dict): 表DDL
|
||||
|
||||
Returns:
|
||||
str: 生成脚本
|
||||
"""
|
||||
|
||||
@abstractmethod
|
||||
def gen_insert(self, table_name: str) -> str:
|
||||
"""生成 insert 语句块
|
||||
@ -178,6 +197,16 @@ class Convertor(ABC):
|
||||
table_name = ddl["table_name"].lower()
|
||||
yield f"CREATE INDEX idx_{table_name}_{no:02d} ON {table_name} ({columns})"
|
||||
|
||||
@staticmethod
|
||||
def unique_index(ddl: Dict) -> Generator:
|
||||
if "constraints" in ddl and "uniques" in ddl["constraints"]:
|
||||
uk_list = ddl["constraints"]["uniques"]
|
||||
for uk in uk_list:
|
||||
table_name = ddl["table_name"]
|
||||
uk_name = uk["constraint_name"]
|
||||
uk_columns = uk["columns"]
|
||||
yield table_name, uk_name, uk_columns
|
||||
|
||||
@staticmethod
|
||||
def filed_comments(table_sql: str) -> Generator:
|
||||
for line in table_sql.split("\n"):
|
||||
@ -188,7 +217,7 @@ class Convertor(ABC):
|
||||
yield field, comment_string
|
||||
|
||||
def table_comment(self, table_sql: str) -> str:
|
||||
match = re.search(r"COMMENT \= '([^']+)';", table_sql)
|
||||
match = re.search(r"COMMENT \='([^']+)';", table_sql)
|
||||
return match.group(1) if match else None
|
||||
|
||||
def print(self):
|
||||
@ -226,11 +255,21 @@ class Convertor(ABC):
|
||||
if table_name.lower().startswith("qrtz"):
|
||||
continue
|
||||
|
||||
# 为每个表生成个5个基本部分
|
||||
# 解析注释
|
||||
for column in table_ddl["columns"]:
|
||||
column["comment"] = bytes(column["comment"], "utf-8").decode(
|
||||
"unicode_escape"
|
||||
)[1:-1]
|
||||
table_ddl["comment"] = bytes(table_ddl["comment"], "utf-8").decode(
|
||||
"unicode_escape"
|
||||
)[1:-1]
|
||||
|
||||
# 为每个表生成个6个基本部分
|
||||
create = self.gen_create(table_ddl)
|
||||
pk = self.gen_pk(table_name)
|
||||
uk = self.gen_uk(table_ddl)
|
||||
index = self.gen_index(table_ddl)
|
||||
comment = self.gen_comment(table_sql, table_name)
|
||||
comment = self.gen_comment(table_ddl)
|
||||
inserts = self.gen_insert(table_name)
|
||||
|
||||
# 组合当前表的DDL脚本
|
||||
@ -238,6 +277,8 @@ class Convertor(ABC):
|
||||
|
||||
{pk}
|
||||
|
||||
{uk}
|
||||
|
||||
{index}
|
||||
|
||||
{comment}
|
||||
@ -267,17 +308,19 @@ class PostgreSQLConvertor(Convertor):
|
||||
|
||||
if type == "varchar":
|
||||
return f"varchar({size})"
|
||||
if type == "int":
|
||||
if type in ("int", "int unsigned"):
|
||||
return "int4"
|
||||
if type == "bigint" or type == "bigint unsigned":
|
||||
if type in ("bigint", "bigint unsigned"):
|
||||
return "int8"
|
||||
if type == "datetime":
|
||||
return "timestamp"
|
||||
if type == "timestamp":
|
||||
return f"timestamp({size})"
|
||||
if type == "bit":
|
||||
return "bool"
|
||||
if type in ("tinyint", "smallint"):
|
||||
return "int2"
|
||||
if type == "text":
|
||||
if type in ("text", "longtext"):
|
||||
return "text"
|
||||
if type in ("blob", "mediumblob"):
|
||||
return "bytea"
|
||||
@ -316,18 +359,22 @@ CREATE TABLE {table_name} (
|
||||
def gen_index(self, ddl: Dict) -> str:
|
||||
return "\n".join(f"{script};" for script in self.index(ddl))
|
||||
|
||||
def gen_comment(self, table_sql: str, table_name: str) -> str:
|
||||
def gen_comment(self, table_ddl: Dict) -> str:
|
||||
"""生成字段及表的注释"""
|
||||
|
||||
script = ""
|
||||
for field, comment_string in self.filed_comments(table_sql):
|
||||
for column in table_ddl["columns"]:
|
||||
table_comment = column["comment"]
|
||||
script += (
|
||||
f"COMMENT ON COLUMN {table_name}.{field} IS '{comment_string}';" + "\n"
|
||||
f"COMMENT ON COLUMN {table_ddl['table_name']}.{column['name']} IS '{table_comment}';"
|
||||
+ "\n"
|
||||
)
|
||||
|
||||
table_comment = self.table_comment(table_sql)
|
||||
table_comment = table_ddl["comment"]
|
||||
if table_comment:
|
||||
script += f"COMMENT ON TABLE {table_name} IS '{table_comment}';\n"
|
||||
script += (
|
||||
f"COMMENT ON TABLE {table_ddl['table_name']} IS '{table_comment}';\n"
|
||||
)
|
||||
|
||||
return script
|
||||
|
||||
@ -335,6 +382,15 @@ CREATE TABLE {table_name} (
|
||||
"""生成主键定义"""
|
||||
return f"ALTER TABLE {table_name} ADD CONSTRAINT pk_{table_name} PRIMARY KEY (id);\n"
|
||||
|
||||
def gen_uk(self, table_ddl: Dict) -> str:
|
||||
script = ""
|
||||
uk_list = list(Convertor.unique_index(table_ddl))
|
||||
for idx, (table_name, _, uk_columns) in enumerate(uk_list, 1):
|
||||
uk_name = f"uk_{table_name}_{idx:02d}"
|
||||
script += f"CREATE UNIQUE INDEX {uk_name} ON {table_name} ({', '.join(uk_columns)});\n"
|
||||
|
||||
return script
|
||||
|
||||
def gen_insert(self, table_name: str) -> str:
|
||||
"""生成 insert 语句,以及根据最后的 insert id+1 生成 Sequence"""
|
||||
|
||||
@ -393,17 +449,19 @@ class OracleConvertor(Convertor):
|
||||
|
||||
if type == "varchar":
|
||||
return f"varchar2({size if size < 4000 else 4000})"
|
||||
if type == "int":
|
||||
if type in ("int", "int unsigned"):
|
||||
return "number"
|
||||
if type == "bigint" or type == "bigint unsigned":
|
||||
return "number"
|
||||
if type == "datetime":
|
||||
return "date"
|
||||
if type == "timestamp":
|
||||
return f"timestamp({size})"
|
||||
if type == "bit":
|
||||
return "number(1,0)"
|
||||
if type in ("tinyint", "smallint"):
|
||||
return "smallint"
|
||||
if type == "text":
|
||||
if type in ("text", "longtext"):
|
||||
return "clob"
|
||||
if type in ("blob", "mediumblob"):
|
||||
return "blob"
|
||||
@ -423,6 +481,8 @@ class OracleConvertor(Convertor):
|
||||
type = col["type"].lower()
|
||||
full_type = self.translate_type(type, col["size"])
|
||||
nullable = "NULL" if col["nullable"] else "NOT NULL"
|
||||
# Oracle的 INSERT '' 不能通过NOT NULL校验,因此对文字类型字段覆写为 NULL
|
||||
nullable = "NULL" if type in ("varchar", "text", "longtext") else nullable
|
||||
default = f"DEFAULT {col['default']}" if col["default"] is not None else ""
|
||||
# Oracle 中 size 不能作为字段名
|
||||
field_name = '"size"' if name == "size" else name
|
||||
@ -447,16 +507,20 @@ CREATE TABLE {table_name} (
|
||||
def gen_index(self, ddl: Dict) -> str:
|
||||
return "\n".join(f"{script};" for script in self.index(ddl))
|
||||
|
||||
def gen_comment(self, table_sql: str, table_name: str) -> str:
|
||||
def gen_comment(self, table_ddl: Dict) -> str:
|
||||
script = ""
|
||||
for field, comment_string in self.filed_comments(table_sql):
|
||||
for column in table_ddl["columns"]:
|
||||
table_comment = column["comment"]
|
||||
script += (
|
||||
f"COMMENT ON COLUMN {table_name}.{field} IS '{comment_string}';" + "\n"
|
||||
f"COMMENT ON COLUMN {table_ddl['table_name']}.{column['name']} IS '{table_comment}';"
|
||||
+ "\n"
|
||||
)
|
||||
|
||||
table_comment = self.table_comment(table_sql)
|
||||
table_comment = table_ddl["comment"]
|
||||
if table_comment:
|
||||
script += f"COMMENT ON TABLE {table_name} IS '{table_comment}';\n"
|
||||
script += (
|
||||
f"COMMENT ON TABLE {table_ddl['table_name']} IS '{table_comment}';\n"
|
||||
)
|
||||
|
||||
return script
|
||||
|
||||
@ -464,6 +528,15 @@ CREATE TABLE {table_name} (
|
||||
"""生成主键定义"""
|
||||
return f"ALTER TABLE {table_name} ADD CONSTRAINT pk_{table_name} PRIMARY KEY (id);\n"
|
||||
|
||||
def gen_uk(self, table_ddl: Dict) -> str:
|
||||
script = ""
|
||||
uk_list = list(Convertor.unique_index(table_ddl))
|
||||
for idx, (table_name, _, uk_columns) in enumerate(uk_list, 1):
|
||||
uk_name = f"uk_{table_name}_{idx:02d}"
|
||||
script += f"CREATE UNIQUE INDEX {uk_name} ON {table_name} ({', '.join(uk_columns)});\n"
|
||||
|
||||
return script
|
||||
|
||||
def gen_index(self, ddl: Dict) -> str:
|
||||
return "\n".join(f"{script};" for script in self.index(ddl))
|
||||
|
||||
@ -521,17 +594,17 @@ class SQLServerConvertor(Convertor):
|
||||
|
||||
if type == "varchar":
|
||||
return f"nvarchar({size if size < 4000 else 4000})"
|
||||
if type == "int":
|
||||
if type in ("int", "int unsigned"):
|
||||
return "int"
|
||||
if type == "bigint" or type == "bigint unsigned":
|
||||
if type in ("bigint", "bigint unsigned"):
|
||||
return "bigint"
|
||||
if type == "datetime":
|
||||
if type in ("datetime", "timestamp"):
|
||||
return "datetime2"
|
||||
if type == "bit":
|
||||
return "varchar(1)"
|
||||
if type in ("tinyint", "smallint"):
|
||||
return "tinyint"
|
||||
if type == "text":
|
||||
if type in ("text", "longtext"):
|
||||
return "nvarchar(max)"
|
||||
if type in ("blob", "mediumblob"):
|
||||
return "varbinary(max)"
|
||||
@ -571,14 +644,18 @@ GO"""
|
||||
|
||||
return script
|
||||
|
||||
def gen_comment(self, table_sql: str, table_name: str) -> str:
|
||||
def gen_comment(self, table_ddl: Dict) -> str:
|
||||
"""生成字段及表的注释"""
|
||||
|
||||
script = ""
|
||||
table_name = table_ddl["table_name"]
|
||||
|
||||
for column in table_ddl["columns"]:
|
||||
column_comment = column["comment"]
|
||||
field = column["name"]
|
||||
|
||||
for field, comment_string in self.filed_comments(table_sql):
|
||||
script += f"""EXEC sp_addextendedproperty
|
||||
'MS_Description', N'{comment_string}',
|
||||
'MS_Description', N'{column_comment}',
|
||||
'SCHEMA', N'dbo',
|
||||
'TABLE', N'{table_name}',
|
||||
'COLUMN', N'{field}'
|
||||
@ -586,7 +663,7 @@ GO
|
||||
|
||||
"""
|
||||
|
||||
table_comment = self.table_comment(table_sql)
|
||||
table_comment = table_ddl["comment"]
|
||||
if table_comment:
|
||||
script += f"""EXEC sp_addextendedproperty
|
||||
'MS_Description', N'{table_comment}',
|
||||
@ -601,6 +678,15 @@ GO
|
||||
"""生成主键定义"""
|
||||
return ""
|
||||
|
||||
def gen_uk(self, table_ddl: Dict) -> str:
|
||||
script = ""
|
||||
uk_list = list(Convertor.unique_index(table_ddl))
|
||||
for idx, (table_name, _, uk_columns) in enumerate(uk_list, 1):
|
||||
uk_name = f"uk_{table_name}_{idx:02d}"
|
||||
script += f"CREATE UNIQUE INDEX {uk_name} ON {table_name} ({', '.join(uk_columns)})\nGO"
|
||||
|
||||
return script
|
||||
|
||||
def gen_index(self, ddl: Dict) -> str:
|
||||
"""生成 index"""
|
||||
return "\n".join(f"{script}\nGO" for script in self.index(ddl))
|
||||
@ -674,22 +760,22 @@ class DM8Convertor(Convertor):
|
||||
|
||||
if type == "varchar":
|
||||
return f"varchar({size})"
|
||||
if type == "int":
|
||||
if type in ("int", "int unsigned"):
|
||||
return "int"
|
||||
if type == "bigint" or type == "bigint unsigned":
|
||||
if type in ("bigint", "bigint unsigned"):
|
||||
return "bigint"
|
||||
if type == "datetime":
|
||||
return "datetime"
|
||||
if type == "timestamp":
|
||||
return f"timestamp({size})"
|
||||
if type == "bit":
|
||||
return "bit"
|
||||
if type in ("tinyint", "smallint"):
|
||||
return "smallint"
|
||||
if type == "text":
|
||||
if type in ("text", "longtext"):
|
||||
return "text"
|
||||
if type == "blob":
|
||||
if type in ("blob", "mediumblob"):
|
||||
return "blob"
|
||||
if type == "mediumblob":
|
||||
return "varchar(10240)"
|
||||
if type == "decimal":
|
||||
return (
|
||||
f"decimal({','.join(str(s) for s in size)})" if len(size) else "decimal"
|
||||
@ -724,19 +810,20 @@ CREATE TABLE {table_name} (
|
||||
|
||||
return script
|
||||
|
||||
def gen_index(self, ddl: Dict) -> str:
|
||||
return "\n".join(f"{script};" for script in self.index(ddl))
|
||||
|
||||
def gen_comment(self, table_sql: str, table_name: str) -> str:
|
||||
def gen_comment(self, table_ddl: Dict) -> str:
|
||||
script = ""
|
||||
for field, comment_string in self.filed_comments(table_sql):
|
||||
for column in table_ddl["columns"]:
|
||||
table_comment = column["comment"]
|
||||
script += (
|
||||
f"COMMENT ON COLUMN {table_name}.{field} IS '{comment_string}';" + "\n"
|
||||
f"COMMENT ON COLUMN {table_ddl['table_name']}.{column['name']} IS '{table_comment}';"
|
||||
+ "\n"
|
||||
)
|
||||
|
||||
table_comment = self.table_comment(table_sql)
|
||||
table_comment = table_ddl["comment"]
|
||||
if table_comment:
|
||||
script += f"COMMENT ON TABLE {table_name} IS '{table_comment}';\n"
|
||||
script += (
|
||||
f"COMMENT ON TABLE {table_ddl['table_name']} IS '{table_comment}';\n"
|
||||
)
|
||||
|
||||
return script
|
||||
|
||||
@ -744,6 +831,15 @@ CREATE TABLE {table_name} (
|
||||
"""生成主键定义"""
|
||||
return ""
|
||||
|
||||
def gen_uk(self, table_ddl: Dict) -> str:
|
||||
script = ""
|
||||
uk_list = list(Convertor.unique_index(table_ddl))
|
||||
for idx, (table_name, _, uk_columns) in enumerate(uk_list, 1):
|
||||
uk_name = f"uk_{table_name}_{idx:02d}"
|
||||
script += f"CREATE UNIQUE INDEX {uk_name} ON {table_name} ({', '.join(uk_columns)});\n"
|
||||
|
||||
return script
|
||||
|
||||
def gen_index(self, ddl: Dict) -> str:
|
||||
return "\n".join(f"{script};" for script in self.index(ddl))
|
||||
|
||||
@ -784,6 +880,8 @@ class KingbaseConvertor(PostgreSQLConvertor):
|
||||
type = col["type"].lower()
|
||||
full_type = self.translate_type(type, col["size"])
|
||||
nullable = "NULL" if col["nullable"] else "NOT NULL"
|
||||
if full_type == "text":
|
||||
nullable = "NULL"
|
||||
default = f"DEFAULT {col['default']}" if col["default"] is not None else ""
|
||||
return f"{name} {full_type} {nullable} {default}"
|
||||
|
||||
|
||||
@ -14,7 +14,7 @@
|
||||
<url>https://github.com/YunaiV/ruoyi-vue-pro</url>
|
||||
|
||||
<properties>
|
||||
<revision>2.5.0-SNAPSHOT</revision>
|
||||
<revision>2.6.0-SNAPSHOT</revision>
|
||||
<flatten-maven-plugin.version>1.6.0</flatten-maven-plugin.version>
|
||||
<!-- 统一依赖管理 -->
|
||||
<spring.boot.version>3.4.5</spring.boot.version>
|
||||
@ -64,7 +64,7 @@
|
||||
<tika-core.version>3.1.0</tika-core.version>
|
||||
<ip2region.version>2.7.0</ip2region.version>
|
||||
<bizlog-sdk.version>3.0.6</bizlog-sdk.version>
|
||||
<netty.version>4.1.116.Final</netty.version>
|
||||
<netty.version>4.1.118.Final</netty.version>
|
||||
<mqtt.version>1.2.5</mqtt.version>
|
||||
<pf4j-spring.version>0.9.0</pf4j-spring.version>
|
||||
<vertx.version>4.5.13</vertx.version>
|
||||
|
||||
@ -20,7 +20,7 @@ import java.util.List;
|
||||
import static cn.hutool.core.date.DatePattern.*;
|
||||
|
||||
/**
|
||||
* 时间工具类,用于 {@link java.time.LocalDateTime}
|
||||
* 时间工具类,用于 {@link LocalDateTime}
|
||||
*
|
||||
* @author 芋道源码
|
||||
*/
|
||||
|
||||
@ -3,6 +3,7 @@ package cn.iocoder.yudao.framework.excel.core.handler;
|
||||
import cn.hutool.core.collection.CollUtil;
|
||||
import cn.hutool.core.lang.Assert;
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
import cn.hutool.core.util.ReflectUtil;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import cn.hutool.extra.spring.SpringUtil;
|
||||
import cn.hutool.poi.excel.ExcelUtil;
|
||||
@ -10,6 +11,8 @@ import cn.iocoder.yudao.framework.common.core.KeyValue;
|
||||
import cn.iocoder.yudao.framework.dict.core.DictFrameworkUtils;
|
||||
import cn.iocoder.yudao.framework.excel.core.annotations.ExcelColumnSelect;
|
||||
import cn.iocoder.yudao.framework.excel.core.function.ExcelColumnSelectFunction;
|
||||
import com.alibaba.excel.annotation.ExcelIgnore;
|
||||
import com.alibaba.excel.annotation.ExcelIgnoreUnannotated;
|
||||
import com.alibaba.excel.annotation.ExcelProperty;
|
||||
import com.alibaba.excel.write.handler.SheetWriteHandler;
|
||||
import com.alibaba.excel.write.metadata.holder.WriteSheetHolder;
|
||||
@ -20,6 +23,7 @@ import org.apache.poi.ss.usermodel.*;
|
||||
import org.apache.poi.ss.util.CellRangeAddressList;
|
||||
|
||||
import java.lang.reflect.Field;
|
||||
import java.lang.reflect.Modifier;
|
||||
import java.util.Comparator;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
@ -56,7 +60,20 @@ public class SelectSheetWriteHandler implements SheetWriteHandler {
|
||||
public SelectSheetWriteHandler(Class<?> head) {
|
||||
// 解析下拉数据
|
||||
int colIndex = 0;
|
||||
boolean ignoreUnannotated = head.isAnnotationPresent(ExcelIgnoreUnannotated.class);
|
||||
for (Field field : head.getDeclaredFields()) {
|
||||
// 关联 https://github.com/YunaiV/ruoyi-vue-pro/pull/853
|
||||
// 1.1 忽略 static final 或 transient 的字段
|
||||
if (isStaticFinalOrTransient(field) ) {
|
||||
continue;
|
||||
}
|
||||
// 1.2 忽略的字段跳过
|
||||
if ((ignoreUnannotated && !field.isAnnotationPresent(ExcelProperty.class))
|
||||
|| field.isAnnotationPresent(ExcelIgnore.class)) {
|
||||
continue;
|
||||
}
|
||||
|
||||
// 2. 核心:处理有 ExcelColumnSelect 注解的字段
|
||||
if (field.isAnnotationPresent(ExcelColumnSelect.class)) {
|
||||
ExcelProperty excelProperty = field.getAnnotation(ExcelProperty.class);
|
||||
if (excelProperty != null && excelProperty.index() != -1) {
|
||||
@ -68,6 +85,19 @@ public class SelectSheetWriteHandler implements SheetWriteHandler {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 判断字段是否是静态的、最终的、 transient 的
|
||||
* 原因:EasyExcel 默认是忽略 static final 或 transient 的字段,所以需要判断
|
||||
*
|
||||
* @param field 字段
|
||||
* @return 是否是静态的、最终的、transient 的
|
||||
*/
|
||||
private boolean isStaticFinalOrTransient(Field field) {
|
||||
return (Modifier.isStatic(field.getModifiers()) && Modifier.isFinal(field.getModifiers()))
|
||||
|| Modifier.isTransient(field.getModifiers());
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 获得下拉数据,并添加到 {@link #selectMap} 中
|
||||
*
|
||||
|
||||
@ -1,6 +1,8 @@
|
||||
package cn.iocoder.yudao.framework.mybatis.core.util;
|
||||
|
||||
import cn.hutool.core.collection.CollectionUtil;
|
||||
import cn.hutool.core.lang.func.Func1;
|
||||
import cn.hutool.core.lang.func.LambdaUtil;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import cn.iocoder.yudao.framework.common.pojo.PageParam;
|
||||
import cn.iocoder.yudao.framework.common.pojo.SortingField;
|
||||
@ -103,4 +105,18 @@ public class MyBatisUtils {
|
||||
.replace("#{value}", StrUtil.toString(value));
|
||||
}
|
||||
|
||||
/**
|
||||
* 将驼峰命名转换为下划线命名
|
||||
*
|
||||
* 使用场景:
|
||||
* 1. <a href="https://gitee.com/zhijiantianya/ruoyi-vue-pro/pulls/1357/files">fix:修复"商品统计聚合函数的别名与排序字段不符"导致的 SQL 异常</a>
|
||||
*
|
||||
* @param func 字段名函数(驼峰命名)
|
||||
* @return 字段名(下划线命名)
|
||||
*/
|
||||
public static <T> String toUnderlineCase(Func1<T, ?> func) {
|
||||
String fieldName = LambdaUtil.getFieldName(func);
|
||||
return StrUtil.toUnderlineCase(fieldName);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@ -3,6 +3,7 @@ package cn.iocoder.yudao.framework.ratelimiter.core.redis;
|
||||
import lombok.AllArgsConstructor;
|
||||
import org.redisson.api.*;
|
||||
|
||||
import java.time.Duration;
|
||||
import java.util.Objects;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
|
||||
@ -40,11 +41,13 @@ public class RateLimiterRedisDAO {
|
||||
String redisKey = formatKey(key);
|
||||
RRateLimiter rateLimiter = redissonClient.getRateLimiter(redisKey);
|
||||
long rateInterval = timeUnit.toSeconds(time);
|
||||
Duration duration = Duration.ofSeconds(rateInterval);
|
||||
// 1. 如果不存在,设置 rate 速率
|
||||
RateLimiterConfig config = rateLimiter.getConfig();
|
||||
if (config == null) {
|
||||
rateLimiter.trySetRate(RateType.OVERALL, count, rateInterval, RateIntervalUnit.SECONDS);
|
||||
rateLimiter.expire(rateInterval, TimeUnit.SECONDS); // 原因参见 https://t.zsxq.com/lcR0W
|
||||
rateLimiter.trySetRate(RateType.OVERALL, count, duration);
|
||||
// 原因参见 https://t.zsxq.com/lcR0W
|
||||
rateLimiter.expire(duration);
|
||||
return rateLimiter;
|
||||
}
|
||||
// 2. 如果存在,并且配置相同,则直接返回
|
||||
@ -54,8 +57,9 @@ public class RateLimiterRedisDAO {
|
||||
return rateLimiter;
|
||||
}
|
||||
// 3. 如果存在,并且配置不同,则进行新建
|
||||
rateLimiter.setRate(RateType.OVERALL, count, rateInterval, RateIntervalUnit.SECONDS);
|
||||
rateLimiter.expire(rateInterval, TimeUnit.SECONDS); // 原因参见 https://t.zsxq.com/lcR0W
|
||||
rateLimiter.setRate(RateType.OVERALL, count, duration);
|
||||
// 原因参见 https://t.zsxq.com/lcR0W
|
||||
rateLimiter.expire(duration);
|
||||
return rateLimiter;
|
||||
}
|
||||
|
||||
|
||||
@ -84,7 +84,7 @@ public class StringDesensitizeSerializer extends StdSerializer<String> implement
|
||||
*/
|
||||
private Field getField(JsonGenerator generator) {
|
||||
String currentName = generator.getOutputContext().getCurrentName();
|
||||
Object currentValue = generator.getCurrentValue();
|
||||
Object currentValue = generator.currentValue();
|
||||
Class<?> currentValueClass = currentValue.getClass();
|
||||
return ReflectUtil.getField(currentValueClass, currentName);
|
||||
}
|
||||
|
||||
@ -162,7 +162,7 @@ public class AiChatConversationServiceImpl implements AiChatConversationService
|
||||
if (CollUtil.isEmpty(list)) {
|
||||
return;
|
||||
}
|
||||
chatConversationMapper.deleteBatchIds(convertList(list, AiChatConversationDO::getId));
|
||||
chatConversationMapper.deleteByIds(convertList(list, AiChatConversationDO::getId));
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@ -339,7 +339,7 @@ public class AiChatMessageServiceImpl implements AiChatMessageService {
|
||||
throw exception(CHAT_MESSAGE_NOT_EXIST);
|
||||
}
|
||||
// 2. 执行删除
|
||||
chatMessageMapper.deleteBatchIds(convertList(messages, AiChatMessageDO::getId));
|
||||
chatMessageMapper.deleteByIds(convertList(messages, AiChatMessageDO::getId));
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@ -89,7 +89,7 @@ public class AiImageServiceImpl implements AiImageService {
|
||||
if (CollUtil.isEmpty(ids)) {
|
||||
return Collections.emptyList();
|
||||
}
|
||||
return imageMapper.selectBatchIds(ids);
|
||||
return imageMapper.selectByIds(ids);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@ -200,7 +200,7 @@ public class AiKnowledgeDocumentServiceImpl implements AiKnowledgeDocumentServic
|
||||
if (CollUtil.isEmpty(ids)) {
|
||||
return Collections.emptyList();
|
||||
}
|
||||
return knowledgeDocumentMapper.selectBatchIds(ids);
|
||||
return knowledgeDocumentMapper.selectByIds(ids);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@ -351,7 +351,7 @@ public class AiKnowledgeSegmentServiceImpl implements AiKnowledgeSegmentService
|
||||
if (CollUtil.isEmpty(ids)) {
|
||||
return Collections.emptyList();
|
||||
}
|
||||
return segmentMapper.selectBatchIds(ids);
|
||||
return segmentMapper.selectByIds(ids);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@ -163,7 +163,7 @@ public class AiChatRoleServiceImpl implements AiChatRoleService {
|
||||
if (CollUtil.isEmpty(ids)) {
|
||||
return Collections.emptyList();
|
||||
}
|
||||
return chatRoleMapper.selectBatchIds(ids);
|
||||
return chatRoleMapper.selectByIds(ids);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@ -84,7 +84,7 @@ public class AiToolServiceImpl implements AiToolService {
|
||||
|
||||
@Override
|
||||
public List<AiToolDO> getToolList(Collection<Long> ids) {
|
||||
return toolMapper.selectBatchIds(ids);
|
||||
return toolMapper.selectByIds(ids);
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -97,4 +97,4 @@ public class AiToolServiceImpl implements AiToolService {
|
||||
return toolMapper.selectListByStatus(status);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@ -80,7 +80,7 @@ public class BpmFormServiceImpl implements BpmFormService {
|
||||
if (CollUtil.isEmpty(ids)) {
|
||||
return Collections.emptyList();
|
||||
}
|
||||
return formMapper.selectBatchIds(ids);
|
||||
return formMapper.selectByIds(ids);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@ -70,7 +70,7 @@ public class BpmUserGroupServiceImpl implements BpmUserGroupService {
|
||||
|
||||
@Override
|
||||
public List<BpmUserGroupDO> getUserGroupList(Collection<Long> ids) {
|
||||
return userGroupMapper.selectBatchIds(ids);
|
||||
return userGroupMapper.selectByIds(ids);
|
||||
}
|
||||
|
||||
|
||||
@ -90,7 +90,7 @@ public class BpmUserGroupServiceImpl implements BpmUserGroupService {
|
||||
return;
|
||||
}
|
||||
// 获得用户组信息
|
||||
List<BpmUserGroupDO> userGroups = userGroupMapper.selectBatchIds(ids);
|
||||
List<BpmUserGroupDO> userGroups = userGroupMapper.selectByIds(ids);
|
||||
Map<Long, BpmUserGroupDO> userGroupMap = convertMap(userGroups, BpmUserGroupDO::getId);
|
||||
// 校验
|
||||
ids.forEach(id -> {
|
||||
|
||||
@ -270,7 +270,7 @@ public class BpmProcessInstanceServiceImpl implements BpmProcessInstanceService
|
||||
.setCandidateStrategy(BpmnModelUtils.parseCandidateStrategy(node))
|
||||
.setCandidateUserIds(getTaskCandidateUserList(bpmnModel, node.getId(),
|
||||
loginUserId, historicProcessInstance.getProcessDefinitionId(), processVariables)));
|
||||
if (CollUtil.isNotEmpty(nextActivityNodes)) {
|
||||
if (CollUtil.isEmpty(nextActivityNodes)) {
|
||||
return nextActivityNodes;
|
||||
}
|
||||
|
||||
|
||||
@ -147,7 +147,7 @@ public class CrmBusinessServiceImpl implements CrmBusinessService {
|
||||
}
|
||||
|
||||
@Override
|
||||
@LogRecord(type = CRM_BUSINESS_TYPE, subType = CRM_BUSINESS_FOLLOW_UP_SUB_TYPE, bizNo = "{{#id}",
|
||||
@LogRecord(type = CRM_BUSINESS_TYPE, subType = CRM_BUSINESS_FOLLOW_UP_SUB_TYPE, bizNo = "{{#id}}",
|
||||
success = CRM_BUSINESS_FOLLOW_UP_SUCCESS)
|
||||
@CrmPermission(bizType = CrmBizTypeEnum.CRM_BUSINESS, bizId = "#id", level = CrmPermissionLevelEnum.WRITE)
|
||||
public void updateBusinessFollowUp(Long id, LocalDateTime contactNextTime, String contactLastContent) {
|
||||
@ -180,7 +180,7 @@ public class CrmBusinessServiceImpl implements CrmBusinessService {
|
||||
businessProductMapper.updateBatch(diffList.get(1));
|
||||
}
|
||||
if (CollUtil.isNotEmpty(diffList.get(2))) {
|
||||
businessProductMapper.deleteBatchIds(convertSet(diffList.get(2), CrmBusinessProductDO::getId));
|
||||
businessProductMapper.deleteByIds(convertSet(diffList.get(2), CrmBusinessProductDO::getId));
|
||||
}
|
||||
}
|
||||
|
||||
@ -328,7 +328,7 @@ public class CrmBusinessServiceImpl implements CrmBusinessService {
|
||||
if (CollUtil.isEmpty(ids)) {
|
||||
return ListUtil.empty();
|
||||
}
|
||||
return businessMapper.selectBatchIds(ids);
|
||||
return businessMapper.selectByIds(ids);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@ -100,7 +100,7 @@ public class CrmBusinessStatusServiceImpl implements CrmBusinessStatusService {
|
||||
businessStatusMapper.updateBatch(diffList.get(1));
|
||||
}
|
||||
if (CollUtil.isNotEmpty(diffList.get(2))) {
|
||||
businessStatusMapper.deleteBatchIds(convertSet(diffList.get(2), CrmBusinessStatusDO::getId));
|
||||
businessStatusMapper.deleteByIds(convertSet(diffList.get(2), CrmBusinessStatusDO::getId));
|
||||
}
|
||||
}
|
||||
|
||||
@ -160,7 +160,7 @@ public class CrmBusinessStatusServiceImpl implements CrmBusinessStatusService {
|
||||
if (CollUtil.isEmpty(ids)) {
|
||||
return Collections.emptyList();
|
||||
}
|
||||
return businessStatusTypeMapper.selectBatchIds(ids);
|
||||
return businessStatusTypeMapper.selectByIds(ids);
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -175,7 +175,7 @@ public class CrmBusinessStatusServiceImpl implements CrmBusinessStatusService {
|
||||
if (CollUtil.isEmpty(ids)) {
|
||||
return Collections.emptyList();
|
||||
}
|
||||
return businessStatusMapper.selectBatchIds(ids);
|
||||
return businessStatusMapper.selectByIds(ids);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@ -262,7 +262,7 @@ public class CrmContactServiceImpl implements CrmContactService {
|
||||
if (CollUtil.isEmpty(ids)) {
|
||||
return ListUtil.empty();
|
||||
}
|
||||
return contactMapper.selectBatchIds(ids);
|
||||
return contactMapper.selectByIds(ids);
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -303,4 +303,4 @@ public class CrmContactServiceImpl implements CrmContactService {
|
||||
return contactMapper.selectListByCustomerIdOwnerUserId(customerId, ownerUserId);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@ -175,7 +175,7 @@ public class CrmContractServiceImpl implements CrmContractService {
|
||||
contractProductMapper.updateBatch(diffList.get(1));
|
||||
}
|
||||
if (CollUtil.isNotEmpty(diffList.get(2))) {
|
||||
contractProductMapper.deleteBatchIds(convertSet(diffList.get(2), CrmContractProductDO::getId));
|
||||
contractProductMapper.deleteByIds(convertSet(diffList.get(2), CrmContractProductDO::getId));
|
||||
}
|
||||
}
|
||||
|
||||
@ -341,7 +341,7 @@ public class CrmContractServiceImpl implements CrmContractService {
|
||||
if (CollUtil.isEmpty(ids)) {
|
||||
return ListUtil.empty();
|
||||
}
|
||||
return contractMapper.selectBatchIds(ids);
|
||||
return contractMapper.selectByIds(ids);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@ -47,7 +47,6 @@ import java.time.LocalDateTime;
|
||||
import java.util.*;
|
||||
|
||||
import static cn.iocoder.yudao.framework.common.exception.util.ServiceExceptionUtil.exception;
|
||||
import static cn.iocoder.yudao.framework.common.util.collection.CollectionUtils.convertSet;
|
||||
import static cn.iocoder.yudao.framework.common.util.collection.CollectionUtils.filterList;
|
||||
import static cn.iocoder.yudao.module.crm.enums.ErrorCodeConstants.*;
|
||||
import static cn.iocoder.yudao.module.crm.enums.LogRecordConstants.*;
|
||||
@ -163,7 +162,7 @@ public class CrmCustomerServiceImpl implements CrmCustomerService {
|
||||
}
|
||||
|
||||
@Override
|
||||
@LogRecord(type = CRM_CUSTOMER_TYPE, subType = CRM_CUSTOMER_FOLLOW_UP_SUB_TYPE, bizNo = "{{#id}",
|
||||
@LogRecord(type = CRM_CUSTOMER_TYPE, subType = CRM_CUSTOMER_FOLLOW_UP_SUB_TYPE, bizNo = "{{#id}}",
|
||||
success = CRM_CUSTOMER_FOLLOW_UP_SUCCESS)
|
||||
@CrmPermission(bizType = CrmBizTypeEnum.CRM_CUSTOMER, bizId = "#id", level = CrmPermissionLevelEnum.WRITE)
|
||||
public void updateCustomerFollowUp(Long id, LocalDateTime contactNextTime, String contactLastContent) {
|
||||
@ -233,24 +232,18 @@ public class CrmCustomerServiceImpl implements CrmCustomerService {
|
||||
private void transfer(CrmCustomerTransferReqVO reqVO, Long userId) {
|
||||
if (reqVO.getToBizTypes().contains(CrmBizTypeEnum.CRM_CONTACT.getType())) {
|
||||
List<CrmContactDO> contactList = contactService.getContactListByCustomerIdOwnerUserId(reqVO.getId(), userId);
|
||||
contactList.forEach(item -> {
|
||||
contactService.transferContact(new CrmContactTransferReqVO(item.getId(), reqVO.getNewOwnerUserId(),
|
||||
reqVO.getOldOwnerPermissionLevel()), userId);
|
||||
});
|
||||
contactList.forEach(item -> contactService.transferContact(new CrmContactTransferReqVO(item.getId(), reqVO.getNewOwnerUserId(),
|
||||
reqVO.getOldOwnerPermissionLevel()), userId));
|
||||
}
|
||||
if (reqVO.getToBizTypes().contains(CrmBizTypeEnum.CRM_BUSINESS.getType())) {
|
||||
List<CrmBusinessDO> businessList = businessService.getBusinessListByCustomerIdOwnerUserId(reqVO.getId(), userId);
|
||||
businessList.forEach(item -> {
|
||||
businessService.transferBusiness(new CrmBusinessTransferReqVO(item.getId(), reqVO.getNewOwnerUserId(),
|
||||
reqVO.getOldOwnerPermissionLevel()), userId);
|
||||
});
|
||||
businessList.forEach(item -> businessService.transferBusiness(new CrmBusinessTransferReqVO(item.getId(), reqVO.getNewOwnerUserId(),
|
||||
reqVO.getOldOwnerPermissionLevel()), userId));
|
||||
}
|
||||
if (reqVO.getToBizTypes().contains(CrmBizTypeEnum.CRM_CONTRACT.getType())) {
|
||||
List<CrmContractDO> contractList = contractService.getContractListByCustomerIdOwnerUserId(reqVO.getId(), userId);
|
||||
contractList.forEach(item -> {
|
||||
contractService.transferContract(new CrmContractTransferReqVO(item.getId(), reqVO.getNewOwnerUserId(),
|
||||
reqVO.getOldOwnerPermissionLevel()), userId);
|
||||
});
|
||||
contractList.forEach(item -> contractService.transferContract(new CrmContractTransferReqVO(item.getId(), reqVO.getNewOwnerUserId(),
|
||||
reqVO.getOldOwnerPermissionLevel()), userId));
|
||||
}
|
||||
}
|
||||
|
||||
@ -392,7 +385,7 @@ public class CrmCustomerServiceImpl implements CrmCustomerService {
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public void receiveCustomer(List<Long> ids, Long ownerUserId, Boolean isReceive) {
|
||||
// 1.1 校验存在
|
||||
List<CrmCustomerDO> customers = customerMapper.selectBatchIds(ids);
|
||||
List<CrmCustomerDO> customers = customerMapper.selectByIds(ids);
|
||||
if (customers.size() != ids.size()) {
|
||||
throw exception(CUSTOMER_NOT_EXISTS);
|
||||
}
|
||||
@ -496,7 +489,7 @@ public class CrmCustomerServiceImpl implements CrmCustomerService {
|
||||
if (CollUtil.isEmpty(ids)) {
|
||||
return Collections.emptyList();
|
||||
}
|
||||
return customerMapper.selectBatchIds(ids);
|
||||
return customerMapper.selectByIds(ids);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@ -187,7 +187,7 @@ public class CrmPermissionServiceImpl implements CrmPermissionService {
|
||||
}
|
||||
|
||||
private void validatePermissionExists(Collection<Long> ids) {
|
||||
List<CrmPermissionDO> permissionList = permissionMapper.selectBatchIds(ids);
|
||||
List<CrmPermissionDO> permissionList = permissionMapper.selectByIds(ids);
|
||||
if (ObjUtil.notEqual(permissionList.size(), ids.size())) {
|
||||
throw exception(CRM_PERMISSION_NOT_EXISTS);
|
||||
}
|
||||
@ -255,7 +255,7 @@ public class CrmPermissionServiceImpl implements CrmPermissionService {
|
||||
}
|
||||
|
||||
// 删除数据权限
|
||||
permissionMapper.deleteBatchIds(convertSet(permissions, CrmPermissionDO::getId));
|
||||
permissionMapper.deleteByIds(convertSet(permissions, CrmPermissionDO::getId));
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -268,7 +268,7 @@ public class CrmPermissionServiceImpl implements CrmPermissionService {
|
||||
|
||||
@Override
|
||||
public void deletePermissionBatch(Collection<Long> ids, Long userId) {
|
||||
List<CrmPermissionDO> permissions = permissionMapper.selectBatchIds(ids);
|
||||
List<CrmPermissionDO> permissions = permissionMapper.selectByIds(ids);
|
||||
if (CollUtil.isEmpty(permissions)) {
|
||||
throw exception(CRM_PERMISSION_NOT_EXISTS);
|
||||
}
|
||||
@ -286,7 +286,7 @@ public class CrmPermissionServiceImpl implements CrmPermissionService {
|
||||
}
|
||||
|
||||
// 删除数据权限
|
||||
permissionMapper.deleteBatchIds(ids);
|
||||
permissionMapper.deleteByIds(ids);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@ -132,7 +132,7 @@ public class CrmProductCategoryServiceImpl implements CrmProductCategoryService
|
||||
|
||||
@Override
|
||||
public List<CrmProductCategoryDO> getProductCategoryList(Collection<Long> ids) {
|
||||
return productCategoryMapper.selectBatchIds(ids);
|
||||
return productCategoryMapper.selectByIds(ids);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@ -158,7 +158,7 @@ public class CrmProductServiceImpl implements CrmProductService {
|
||||
if (CollUtil.isEmpty(ids)) {
|
||||
return Collections.emptyList();
|
||||
}
|
||||
List<CrmProductDO> list = productMapper.selectBatchIds(ids);
|
||||
List<CrmProductDO> list = productMapper.selectByIds(ids);
|
||||
Map<Long, CrmProductDO> productMap = convertMap(list, CrmProductDO::getId);
|
||||
for (Long id : ids) {
|
||||
CrmProductDO product = productMap.get(id);
|
||||
@ -177,7 +177,7 @@ public class CrmProductServiceImpl implements CrmProductService {
|
||||
if (CollUtil.isEmpty(ids)) {
|
||||
return Collections.emptyList();
|
||||
}
|
||||
return productMapper.selectBatchIds(ids);
|
||||
return productMapper.selectByIds(ids);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@ -165,7 +165,7 @@ public class CrmReceivablePlanServiceImpl implements CrmReceivablePlanService {
|
||||
if (CollUtil.isEmpty(ids)) {
|
||||
return ListUtil.empty();
|
||||
}
|
||||
return receivablePlanMapper.selectBatchIds(ids);
|
||||
return receivablePlanMapper.selectByIds(ids);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@ -277,7 +277,7 @@ public class CrmReceivableServiceImpl implements CrmReceivableService {
|
||||
if (CollUtil.isEmpty(ids)) {
|
||||
return ListUtil.empty();
|
||||
}
|
||||
return receivableMapper.selectBatchIds(ids);
|
||||
return receivableMapper.selectByIds(ids);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@ -101,7 +101,7 @@ public class ErpAccountServiceImpl implements ErpAccountService {
|
||||
|
||||
@Override
|
||||
public List<ErpAccountDO> getAccountList(Collection<Long> ids) {
|
||||
return accountMapper.selectBatchIds(ids);
|
||||
return accountMapper.selectByIds(ids);
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -109,4 +109,4 @@ public class ErpAccountServiceImpl implements ErpAccountService {
|
||||
return accountMapper.selectPage(pageReqVO);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@ -189,7 +189,7 @@ public class ErpFinancePaymentServiceImpl implements ErpFinancePaymentService {
|
||||
financePaymentItemMapper.updateBatch(diffList.get(1));
|
||||
}
|
||||
if (CollUtil.isNotEmpty(diffList.get(2))) {
|
||||
financePaymentItemMapper.deleteBatchIds(convertList(diffList.get(2), ErpFinancePaymentItemDO::getId));
|
||||
financePaymentItemMapper.deleteByIds(convertList(diffList.get(2), ErpFinancePaymentItemDO::getId));
|
||||
}
|
||||
|
||||
// 第三步,更新采购入库、退货的付款金额情况
|
||||
@ -214,7 +214,7 @@ public class ErpFinancePaymentServiceImpl implements ErpFinancePaymentService {
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public void deleteFinancePayment(List<Long> ids) {
|
||||
// 1. 校验不处于已审批
|
||||
List<ErpFinancePaymentDO> payments = financePaymentMapper.selectBatchIds(ids);
|
||||
List<ErpFinancePaymentDO> payments = financePaymentMapper.selectByIds(ids);
|
||||
if (CollUtil.isEmpty(payments)) {
|
||||
return;
|
||||
}
|
||||
@ -230,7 +230,7 @@ public class ErpFinancePaymentServiceImpl implements ErpFinancePaymentService {
|
||||
financePaymentMapper.deleteById(payment.getId());
|
||||
// 2.2 删除付款单项
|
||||
List<ErpFinancePaymentItemDO> paymentItems = financePaymentItemMapper.selectListByPaymentId(payment.getId());
|
||||
financePaymentItemMapper.deleteBatchIds(convertSet(paymentItems, ErpFinancePaymentItemDO::getId));
|
||||
financePaymentItemMapper.deleteByIds(convertSet(paymentItems, ErpFinancePaymentItemDO::getId));
|
||||
|
||||
// 2.3 更新采购入库、退货的付款金额情况
|
||||
updatePurchasePrice(paymentItems);
|
||||
@ -270,4 +270,4 @@ public class ErpFinancePaymentServiceImpl implements ErpFinancePaymentService {
|
||||
return financePaymentItemMapper.selectListByPaymentIds(paymentIds);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@ -189,7 +189,7 @@ public class ErpFinanceReceiptServiceImpl implements ErpFinanceReceiptService {
|
||||
financeReceiptItemMapper.updateBatch(diffList.get(1));
|
||||
}
|
||||
if (CollUtil.isNotEmpty(diffList.get(2))) {
|
||||
financeReceiptItemMapper.deleteBatchIds(convertList(diffList.get(2), ErpFinanceReceiptItemDO::getId));
|
||||
financeReceiptItemMapper.deleteByIds(convertList(diffList.get(2), ErpFinanceReceiptItemDO::getId));
|
||||
}
|
||||
|
||||
// 第三步,更新销售出库、退货的收款金额情况
|
||||
@ -214,7 +214,7 @@ public class ErpFinanceReceiptServiceImpl implements ErpFinanceReceiptService {
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public void deleteFinanceReceipt(List<Long> ids) {
|
||||
// 1. 校验不处于已审批
|
||||
List<ErpFinanceReceiptDO> receipts = financeReceiptMapper.selectBatchIds(ids);
|
||||
List<ErpFinanceReceiptDO> receipts = financeReceiptMapper.selectByIds(ids);
|
||||
if (CollUtil.isEmpty(receipts)) {
|
||||
return;
|
||||
}
|
||||
@ -230,7 +230,7 @@ public class ErpFinanceReceiptServiceImpl implements ErpFinanceReceiptService {
|
||||
financeReceiptMapper.deleteById(receipt.getId());
|
||||
// 2.2 删除收款单项
|
||||
List<ErpFinanceReceiptItemDO> receiptItems = financeReceiptItemMapper.selectListByReceiptId(receipt.getId());
|
||||
financeReceiptItemMapper.deleteBatchIds(convertSet(receiptItems, ErpFinanceReceiptItemDO::getId));
|
||||
financeReceiptItemMapper.deleteByIds(convertSet(receiptItems, ErpFinanceReceiptItemDO::getId));
|
||||
|
||||
// 2.3 更新销售出库、退货的收款金额情况
|
||||
updateSalePrice(receiptItems);
|
||||
@ -270,4 +270,4 @@ public class ErpFinanceReceiptServiceImpl implements ErpFinanceReceiptService {
|
||||
return financeReceiptItemMapper.selectListByReceiptIds(receiptIds);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@ -143,7 +143,7 @@ public class ErpProductCategoryServiceImpl implements ErpProductCategoryService
|
||||
|
||||
@Override
|
||||
public List<ErpProductCategoryDO> getProductCategoryList(Collection<Long> ids) {
|
||||
return erpProductCategoryMapper.selectBatchIds(ids);
|
||||
return erpProductCategoryMapper.selectByIds(ids);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@ -72,7 +72,7 @@ public class ErpProductServiceImpl implements ErpProductService {
|
||||
if (CollUtil.isEmpty(ids)) {
|
||||
return Collections.emptyList();
|
||||
}
|
||||
List<ErpProductDO> list = productMapper.selectBatchIds(ids);
|
||||
List<ErpProductDO> list = productMapper.selectByIds(ids);
|
||||
Map<Long, ErpProductDO> productMap = convertMap(list, ErpProductDO::getId);
|
||||
for (Long id : ids) {
|
||||
ErpProductDO product = productMap.get(id);
|
||||
@ -108,7 +108,7 @@ public class ErpProductServiceImpl implements ErpProductService {
|
||||
if (CollUtil.isEmpty(ids)) {
|
||||
return Collections.emptyList();
|
||||
}
|
||||
List<ErpProductDO> list = productMapper.selectBatchIds(ids);
|
||||
List<ErpProductDO> list = productMapper.selectByIds(ids);
|
||||
return buildProductVOList(list);
|
||||
}
|
||||
|
||||
@ -144,4 +144,4 @@ public class ErpProductServiceImpl implements ErpProductService {
|
||||
return productMapper.selectCountByUnitId(unitId);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@ -105,7 +105,7 @@ public class ErpProductUnitServiceImpl implements ErpProductUnitService {
|
||||
|
||||
@Override
|
||||
public List<ErpProductUnitDO> getProductUnitList(Collection<Long> ids) {
|
||||
return productUnitMapper.selectBatchIds(ids);
|
||||
return productUnitMapper.selectByIds(ids);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@ -232,7 +232,7 @@ public class ErpPurchaseInServiceImpl implements ErpPurchaseInService {
|
||||
purchaseInItemMapper.updateBatch(diffList.get(1));
|
||||
}
|
||||
if (CollUtil.isNotEmpty(diffList.get(2))) {
|
||||
purchaseInItemMapper.deleteBatchIds(convertList(diffList.get(2), ErpPurchaseInItemDO::getId));
|
||||
purchaseInItemMapper.deleteByIds(convertList(diffList.get(2), ErpPurchaseInItemDO::getId));
|
||||
}
|
||||
}
|
||||
|
||||
@ -240,7 +240,7 @@ public class ErpPurchaseInServiceImpl implements ErpPurchaseInService {
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public void deletePurchaseIn(List<Long> ids) {
|
||||
// 1. 校验不处于已审批
|
||||
List<ErpPurchaseInDO> purchaseIns = purchaseInMapper.selectBatchIds(ids);
|
||||
List<ErpPurchaseInDO> purchaseIns = purchaseInMapper.selectByIds(ids);
|
||||
if (CollUtil.isEmpty(purchaseIns)) {
|
||||
return;
|
||||
}
|
||||
@ -305,4 +305,4 @@ public class ErpPurchaseInServiceImpl implements ErpPurchaseInService {
|
||||
return purchaseInItemMapper.selectListByInIds(inIds);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@ -183,7 +183,7 @@ public class ErpPurchaseOrderServiceImpl implements ErpPurchaseOrderService {
|
||||
purchaseOrderItemMapper.updateBatch(diffList.get(1));
|
||||
}
|
||||
if (CollUtil.isNotEmpty(diffList.get(2))) {
|
||||
purchaseOrderItemMapper.deleteBatchIds(convertList(diffList.get(2), ErpPurchaseOrderItemDO::getId));
|
||||
purchaseOrderItemMapper.deleteByIds(convertList(diffList.get(2), ErpPurchaseOrderItemDO::getId));
|
||||
}
|
||||
}
|
||||
|
||||
@ -231,7 +231,7 @@ public class ErpPurchaseOrderServiceImpl implements ErpPurchaseOrderService {
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public void deletePurchaseOrder(List<Long> ids) {
|
||||
// 1. 校验不处于已审批
|
||||
List<ErpPurchaseOrderDO> purchaseOrders = purchaseOrderMapper.selectBatchIds(ids);
|
||||
List<ErpPurchaseOrderDO> purchaseOrders = purchaseOrderMapper.selectByIds(ids);
|
||||
if (CollUtil.isEmpty(purchaseOrders)) {
|
||||
return;
|
||||
}
|
||||
@ -292,4 +292,4 @@ public class ErpPurchaseOrderServiceImpl implements ErpPurchaseOrderService {
|
||||
return purchaseOrderItemMapper.selectListByOrderIds(orderIds);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@ -228,7 +228,7 @@ public class ErpPurchaseReturnServiceImpl implements ErpPurchaseReturnService {
|
||||
purchaseReturnItemMapper.updateBatch(diffList.get(1));
|
||||
}
|
||||
if (CollUtil.isNotEmpty(diffList.get(2))) {
|
||||
purchaseReturnItemMapper.deleteBatchIds(convertList(diffList.get(2), ErpPurchaseReturnItemDO::getId));
|
||||
purchaseReturnItemMapper.deleteByIds(convertList(diffList.get(2), ErpPurchaseReturnItemDO::getId));
|
||||
}
|
||||
}
|
||||
|
||||
@ -236,7 +236,7 @@ public class ErpPurchaseReturnServiceImpl implements ErpPurchaseReturnService {
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public void deletePurchaseReturn(List<Long> ids) {
|
||||
// 1. 校验不处于已审批
|
||||
List<ErpPurchaseReturnDO> purchaseReturns = purchaseReturnMapper.selectBatchIds(ids);
|
||||
List<ErpPurchaseReturnDO> purchaseReturns = purchaseReturnMapper.selectByIds(ids);
|
||||
if (CollUtil.isEmpty(purchaseReturns)) {
|
||||
return;
|
||||
}
|
||||
@ -301,4 +301,4 @@ public class ErpPurchaseReturnServiceImpl implements ErpPurchaseReturnService {
|
||||
return purchaseReturnItemMapper.selectListByReturnIds(returnIds);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@ -78,7 +78,7 @@ public class ErpSupplierServiceImpl implements ErpSupplierService {
|
||||
|
||||
@Override
|
||||
public List<ErpSupplierDO> getSupplierList(Collection<Long> ids) {
|
||||
return supplierMapper.selectBatchIds(ids);
|
||||
return supplierMapper.selectByIds(ids);
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -91,4 +91,4 @@ public class ErpSupplierServiceImpl implements ErpSupplierService {
|
||||
return supplierMapper.selectListByStatus(status);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@ -81,7 +81,7 @@ public class ErpCustomerServiceImpl implements ErpCustomerService {
|
||||
|
||||
@Override
|
||||
public List<ErpCustomerDO> getCustomerList(Collection<Long> ids) {
|
||||
return customerMapper.selectBatchIds(ids);
|
||||
return customerMapper.selectByIds(ids);
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -94,4 +94,4 @@ public class ErpCustomerServiceImpl implements ErpCustomerService {
|
||||
return customerMapper.selectListByStatus(status);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@ -195,7 +195,7 @@ public class ErpSaleOrderServiceImpl implements ErpSaleOrderService {
|
||||
saleOrderItemMapper.updateBatch(diffList.get(1));
|
||||
}
|
||||
if (CollUtil.isNotEmpty(diffList.get(2))) {
|
||||
saleOrderItemMapper.deleteBatchIds(convertList(diffList.get(2), ErpSaleOrderItemDO::getId));
|
||||
saleOrderItemMapper.deleteByIds(convertList(diffList.get(2), ErpSaleOrderItemDO::getId));
|
||||
}
|
||||
}
|
||||
|
||||
@ -243,7 +243,7 @@ public class ErpSaleOrderServiceImpl implements ErpSaleOrderService {
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public void deleteSaleOrder(List<Long> ids) {
|
||||
// 1. 校验不处于已审批
|
||||
List<ErpSaleOrderDO> saleOrders = saleOrderMapper.selectBatchIds(ids);
|
||||
List<ErpSaleOrderDO> saleOrders = saleOrderMapper.selectByIds(ids);
|
||||
if (CollUtil.isEmpty(saleOrders)) {
|
||||
return;
|
||||
}
|
||||
@ -304,4 +304,4 @@ public class ErpSaleOrderServiceImpl implements ErpSaleOrderService {
|
||||
return saleOrderItemMapper.selectListByOrderIds(orderIds);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@ -240,7 +240,7 @@ public class ErpSaleOutServiceImpl implements ErpSaleOutService {
|
||||
saleOutItemMapper.updateBatch(diffList.get(1));
|
||||
}
|
||||
if (CollUtil.isNotEmpty(diffList.get(2))) {
|
||||
saleOutItemMapper.deleteBatchIds(convertList(diffList.get(2), ErpSaleOutItemDO::getId));
|
||||
saleOutItemMapper.deleteByIds(convertList(diffList.get(2), ErpSaleOutItemDO::getId));
|
||||
}
|
||||
}
|
||||
|
||||
@ -248,7 +248,7 @@ public class ErpSaleOutServiceImpl implements ErpSaleOutService {
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public void deleteSaleOut(List<Long> ids) {
|
||||
// 1. 校验不处于已审批
|
||||
List<ErpSaleOutDO> saleOuts = saleOutMapper.selectBatchIds(ids);
|
||||
List<ErpSaleOutDO> saleOuts = saleOutMapper.selectByIds(ids);
|
||||
if (CollUtil.isEmpty(saleOuts)) {
|
||||
return;
|
||||
}
|
||||
@ -313,4 +313,4 @@ public class ErpSaleOutServiceImpl implements ErpSaleOutService {
|
||||
return saleOutItemMapper.selectListByOutIds(outIds);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@ -240,7 +240,7 @@ public class ErpSaleReturnServiceImpl implements ErpSaleReturnService {
|
||||
saleReturnItemMapper.updateBatch(diffList.get(1));
|
||||
}
|
||||
if (CollUtil.isNotEmpty(diffList.get(2))) {
|
||||
saleReturnItemMapper.deleteBatchIds(convertList(diffList.get(2), ErpSaleReturnItemDO::getId));
|
||||
saleReturnItemMapper.deleteByIds(convertList(diffList.get(2), ErpSaleReturnItemDO::getId));
|
||||
}
|
||||
}
|
||||
|
||||
@ -248,7 +248,7 @@ public class ErpSaleReturnServiceImpl implements ErpSaleReturnService {
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public void deleteSaleReturn(List<Long> ids) {
|
||||
// 1. 校验不处于已审批
|
||||
List<ErpSaleReturnDO> saleReturns = saleReturnMapper.selectBatchIds(ids);
|
||||
List<ErpSaleReturnDO> saleReturns = saleReturnMapper.selectByIds(ids);
|
||||
if (CollUtil.isEmpty(saleReturns)) {
|
||||
return;
|
||||
}
|
||||
@ -313,4 +313,4 @@ public class ErpSaleReturnServiceImpl implements ErpSaleReturnService {
|
||||
return saleReturnItemMapper.selectListByReturnIds(returnIds);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@ -169,7 +169,7 @@ public class ErpStockCheckServiceImpl implements ErpStockCheckService {
|
||||
stockCheckItemMapper.updateBatch(diffList.get(1));
|
||||
}
|
||||
if (CollUtil.isNotEmpty(diffList.get(2))) {
|
||||
stockCheckItemMapper.deleteBatchIds(convertList(diffList.get(2), ErpStockCheckItemDO::getId));
|
||||
stockCheckItemMapper.deleteByIds(convertList(diffList.get(2), ErpStockCheckItemDO::getId));
|
||||
}
|
||||
}
|
||||
|
||||
@ -177,7 +177,7 @@ public class ErpStockCheckServiceImpl implements ErpStockCheckService {
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public void deleteStockCheck(List<Long> ids) {
|
||||
// 1. 校验不处于已审批
|
||||
List<ErpStockCheckDO> stockChecks = stockCheckMapper.selectBatchIds(ids);
|
||||
List<ErpStockCheckDO> stockChecks = stockCheckMapper.selectByIds(ids);
|
||||
if (CollUtil.isEmpty(stockChecks)) {
|
||||
return;
|
||||
}
|
||||
@ -229,4 +229,4 @@ public class ErpStockCheckServiceImpl implements ErpStockCheckService {
|
||||
return stockCheckItemMapper.selectListByCheckIds(checkIds);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@ -165,7 +165,7 @@ public class ErpStockInServiceImpl implements ErpStockInService {
|
||||
stockInItemMapper.updateBatch(diffList.get(1));
|
||||
}
|
||||
if (CollUtil.isNotEmpty(diffList.get(2))) {
|
||||
stockInItemMapper.deleteBatchIds(convertList(diffList.get(2), ErpStockInItemDO::getId));
|
||||
stockInItemMapper.deleteByIds(convertList(diffList.get(2), ErpStockInItemDO::getId));
|
||||
}
|
||||
}
|
||||
|
||||
@ -173,7 +173,7 @@ public class ErpStockInServiceImpl implements ErpStockInService {
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public void deleteStockIn(List<Long> ids) {
|
||||
// 1. 校验不处于已审批
|
||||
List<ErpStockInDO> stockIns = stockInMapper.selectBatchIds(ids);
|
||||
List<ErpStockInDO> stockIns = stockInMapper.selectByIds(ids);
|
||||
if (CollUtil.isEmpty(stockIns)) {
|
||||
return;
|
||||
}
|
||||
@ -225,4 +225,4 @@ public class ErpStockInServiceImpl implements ErpStockInService {
|
||||
return stockInItemMapper.selectListByInIds(inIds);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@ -166,7 +166,7 @@ public class ErpStockMoveServiceImpl implements ErpStockMoveService {
|
||||
stockMoveItemMapper.updateBatch(diffList.get(1));
|
||||
}
|
||||
if (CollUtil.isNotEmpty(diffList.get(2))) {
|
||||
stockMoveItemMapper.deleteBatchIds(convertList(diffList.get(2), ErpStockMoveItemDO::getId));
|
||||
stockMoveItemMapper.deleteByIds(convertList(diffList.get(2), ErpStockMoveItemDO::getId));
|
||||
}
|
||||
}
|
||||
|
||||
@ -174,7 +174,7 @@ public class ErpStockMoveServiceImpl implements ErpStockMoveService {
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public void deleteStockMove(List<Long> ids) {
|
||||
// 1. 校验不处于已审批
|
||||
List<ErpStockMoveDO> stockMoves = stockMoveMapper.selectBatchIds(ids);
|
||||
List<ErpStockMoveDO> stockMoves = stockMoveMapper.selectByIds(ids);
|
||||
if (CollUtil.isEmpty(stockMoves)) {
|
||||
return;
|
||||
}
|
||||
@ -226,4 +226,4 @@ public class ErpStockMoveServiceImpl implements ErpStockMoveService {
|
||||
return stockMoveItemMapper.selectListByMoveIds(moveIds);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@ -165,7 +165,7 @@ public class ErpStockOutServiceImpl implements ErpStockOutService {
|
||||
stockOutItemMapper.updateBatch(diffList.get(1));
|
||||
}
|
||||
if (CollUtil.isNotEmpty(diffList.get(2))) {
|
||||
stockOutItemMapper.deleteBatchIds(convertList(diffList.get(2), ErpStockOutItemDO::getId));
|
||||
stockOutItemMapper.deleteByIds(convertList(diffList.get(2), ErpStockOutItemDO::getId));
|
||||
}
|
||||
}
|
||||
|
||||
@ -173,7 +173,7 @@ public class ErpStockOutServiceImpl implements ErpStockOutService {
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public void deleteStockOut(List<Long> ids) {
|
||||
// 1. 校验不处于已审批
|
||||
List<ErpStockOutDO> stockOuts = stockOutMapper.selectBatchIds(ids);
|
||||
List<ErpStockOutDO> stockOuts = stockOutMapper.selectByIds(ids);
|
||||
if (CollUtil.isEmpty(stockOuts)) {
|
||||
return;
|
||||
}
|
||||
@ -225,4 +225,4 @@ public class ErpStockOutServiceImpl implements ErpStockOutService {
|
||||
return stockOutItemMapper.selectListByOutIds(outIds);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@ -93,7 +93,7 @@ public class ErpWarehouseServiceImpl implements ErpWarehouseService {
|
||||
if (CollUtil.isEmpty(ids)) {
|
||||
return Collections.emptyList();
|
||||
}
|
||||
List<ErpWarehouseDO> list = warehouseMapper.selectBatchIds(ids);
|
||||
List<ErpWarehouseDO> list = warehouseMapper.selectByIds(ids);
|
||||
Map<Long, ErpWarehouseDO> warehouseMap = convertMap(list, ErpWarehouseDO::getId);
|
||||
for (Long id : ids) {
|
||||
ErpWarehouseDO warehouse = warehouseMap.get(id);
|
||||
@ -114,7 +114,7 @@ public class ErpWarehouseServiceImpl implements ErpWarehouseService {
|
||||
|
||||
@Override
|
||||
public List<ErpWarehouseDO> getWarehouseList(Collection<Long> ids) {
|
||||
return warehouseMapper.selectBatchIds(ids);
|
||||
return warehouseMapper.selectByIds(ids);
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -122,4 +122,4 @@ public class ErpWarehouseServiceImpl implements ErpWarehouseService {
|
||||
return warehouseMapper.selectPage(pageReqVO);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@ -122,6 +122,15 @@ public class CodegenController {
|
||||
return success(true);
|
||||
}
|
||||
|
||||
@Operation(summary = "批量删除数据库的表和字段定义")
|
||||
@DeleteMapping("/delete-list")
|
||||
@Parameter(name = "tableIds", description = "表编号列表", required = true)
|
||||
@PreAuthorize("@ss.hasPermission('infra:codegen:delete')")
|
||||
public CommonResult<Boolean> deleteCodegenList(@RequestParam("tableIds") List<Long> tableIds) {
|
||||
codegenService.deleteCodegenList(tableIds);
|
||||
return success(true);
|
||||
}
|
||||
|
||||
@Operation(summary = "预览生成代码")
|
||||
@GetMapping("/preview")
|
||||
@Parameter(name = "tableId", description = "表编号", required = true, example = "1024")
|
||||
|
||||
@ -62,6 +62,15 @@ public class ConfigController {
|
||||
return success(true);
|
||||
}
|
||||
|
||||
@DeleteMapping("/delete-list")
|
||||
@Operation(summary = "批量删除参数配置")
|
||||
@Parameter(name = "ids", description = "编号列表", required = true)
|
||||
@PreAuthorize("@ss.hasPermission('infra:config:delete')")
|
||||
public CommonResult<Boolean> deleteConfigList(@RequestParam("ids") List<Long> ids) {
|
||||
configService.deleteConfigList(ids);
|
||||
return success(true);
|
||||
}
|
||||
|
||||
@GetMapping(value = "/get")
|
||||
@Operation(summary = "获得参数配置")
|
||||
@Parameter(name = "id", description = "编号", required = true, example = "1024")
|
||||
|
||||
@ -52,6 +52,15 @@ public class DataSourceConfigController {
|
||||
return success(true);
|
||||
}
|
||||
|
||||
@DeleteMapping("/delete-list")
|
||||
@Operation(summary = "批量删除数据源配置")
|
||||
@Parameter(name = "ids", description = "编号列表", required = true)
|
||||
@PreAuthorize("@ss.hasPermission('infra:data-source-config:delete')")
|
||||
public CommonResult<Boolean> deleteDataSourceConfigList(@RequestParam("ids") List<Long> ids) {
|
||||
dataSourceConfigService.deleteDataSourceConfigList(ids);
|
||||
return success(true);
|
||||
}
|
||||
|
||||
@GetMapping("/get")
|
||||
@Operation(summary = "获得数据源配置")
|
||||
@Parameter(name = "id", description = "编号", required = true, example = "1024")
|
||||
|
||||
@ -10,7 +10,7 @@ import java.time.LocalDateTime;
|
||||
public class DataSourceConfigRespVO {
|
||||
|
||||
@Schema(description = "主键编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "1024")
|
||||
private Integer id;
|
||||
private Long id;
|
||||
|
||||
@Schema(description = "数据源名称", requiredMode = Schema.RequiredMode.REQUIRED, example = "test")
|
||||
private String name;
|
||||
|
||||
@ -65,7 +65,7 @@ public class Demo01ContactController {
|
||||
@Operation(summary = "批量删除示例联系人")
|
||||
@PreAuthorize("@ss.hasPermission('infra:demo01-contact:delete')")
|
||||
public CommonResult<Boolean> deleteDemo0iContactList(@RequestParam("ids") List<Long> ids) {
|
||||
demo01ContactService.deleteDemo0iContactListByIds(ids);
|
||||
demo01ContactService.deleteDemo0iContactList(ids);
|
||||
return success(true);
|
||||
}
|
||||
|
||||
|
||||
@ -67,8 +67,7 @@ public class Demo03StudentErpController {
|
||||
@Operation(summary = "批量删除学生")
|
||||
@PreAuthorize("@ss.hasPermission('infra:demo03-student:delete')")
|
||||
public CommonResult<Boolean> deleteDemo03StudentList(@RequestParam("ids") List<Long> ids) {
|
||||
// TODO @puhui999:deleteDemo03StudentList
|
||||
demo03StudentErpService.deleteDemo03StudentListByIds(ids);
|
||||
demo03StudentErpService.deleteDemo03StudentList(ids);
|
||||
return success(true);
|
||||
}
|
||||
|
||||
@ -142,7 +141,7 @@ public class Demo03StudentErpController {
|
||||
@Operation(summary = "批量删除学生课程")
|
||||
@PreAuthorize("@ss.hasPermission('infra:demo03-student:delete')")
|
||||
public CommonResult<Boolean> deleteDemo03CourseList(@RequestParam("ids") List<Long> ids) {
|
||||
demo03StudentErpService.deleteDemo03CourseListByIds(ids);
|
||||
demo03StudentErpService.deleteDemo03CourseList(ids);
|
||||
return success(true);
|
||||
}
|
||||
|
||||
@ -194,7 +193,7 @@ public class Demo03StudentErpController {
|
||||
@Operation(summary = "批量删除学生班级")
|
||||
@PreAuthorize("@ss.hasPermission('infra:demo03-student:delete')")
|
||||
public CommonResult<Boolean> deleteDemo03GradeList(@RequestParam("ids") List<Long> ids) {
|
||||
demo03StudentErpService.deleteDemo03GradeListByIds(ids);
|
||||
demo03StudentErpService.deleteDemo03GradeList(ids);
|
||||
return success(true);
|
||||
}
|
||||
|
||||
|
||||
@ -67,7 +67,7 @@ public class Demo03StudentInnerController {
|
||||
@Operation(summary = "批量删除学生")
|
||||
@PreAuthorize("@ss.hasPermission('infra:demo03-student:delete')")
|
||||
public CommonResult<Boolean> deleteDemo03StudentList(@RequestParam("ids") List<Long> ids) {
|
||||
demo03StudentInnerService.deleteDemo03StudentListByIds(ids);
|
||||
demo03StudentInnerService.deleteDemo03StudentList(ids);
|
||||
return success(true);
|
||||
}
|
||||
|
||||
|
||||
@ -67,7 +67,7 @@ public class Demo03StudentNormalController {
|
||||
@Operation(summary = "批量删除学生")
|
||||
@PreAuthorize("@ss.hasPermission('infra:demo03-student:delete')")
|
||||
public CommonResult<Boolean> deleteDemo03StudentList(@RequestParam("ids") List<Long> ids) {
|
||||
demo03StudentNormalService.deleteDemo03StudentListByIds(ids);
|
||||
demo03StudentNormalService.deleteDemo03StudentList(ids);
|
||||
return success(true);
|
||||
}
|
||||
|
||||
|
||||
@ -17,6 +17,8 @@ import org.springframework.security.access.prepost.PreAuthorize;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success;
|
||||
|
||||
@Tag(name = "管理后台 - 文件配置")
|
||||
@ -60,6 +62,15 @@ public class FileConfigController {
|
||||
return success(true);
|
||||
}
|
||||
|
||||
@DeleteMapping("/delete-list")
|
||||
@Operation(summary = "批量删除文件配置")
|
||||
@Parameter(name = "ids", description = "编号列表", required = true)
|
||||
@PreAuthorize("@ss.hasPermission('infra:file-config:delete')")
|
||||
public CommonResult<Boolean> deleteFileConfigList(@RequestParam("ids") List<Long> ids) {
|
||||
fileConfigService.deleteFileConfigList(ids);
|
||||
return success(true);
|
||||
}
|
||||
|
||||
@GetMapping("/get")
|
||||
@Operation(summary = "获得文件配置")
|
||||
@Parameter(name = "id", description = "编号", required = true, example = "1024")
|
||||
|
||||
@ -26,6 +26,8 @@ import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
import org.springframework.web.multipart.MultipartFile;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success;
|
||||
import static cn.iocoder.yudao.module.infra.framework.file.core.utils.FileTypeUtils.writeAttachment;
|
||||
|
||||
@ -75,6 +77,15 @@ public class FileController {
|
||||
return success(true);
|
||||
}
|
||||
|
||||
@DeleteMapping("/delete-list")
|
||||
@Operation(summary = "批量删除文件")
|
||||
@Parameter(name = "ids", description = "编号列表", required = true)
|
||||
@PreAuthorize("@ss.hasPermission('infra:file:delete')")
|
||||
public CommonResult<Boolean> deleteFileList(@RequestParam("ids") List<Long> ids) throws Exception {
|
||||
fileService.deleteFileList(ids);
|
||||
return success(true);
|
||||
}
|
||||
|
||||
@GetMapping("/{configId}/get/**")
|
||||
@PermitAll
|
||||
@TenantIgnore
|
||||
|
||||
@ -81,6 +81,16 @@ public class JobController {
|
||||
return success(true);
|
||||
}
|
||||
|
||||
@DeleteMapping("/delete-list")
|
||||
@Operation(summary = "批量删除定时任务")
|
||||
@Parameter(name = "ids", description = "编号列表", required = true)
|
||||
@PreAuthorize("@ss.hasPermission('infra:job:delete')")
|
||||
public CommonResult<Boolean> deleteJobList(@RequestParam("ids") List<Long> ids)
|
||||
throws SchedulerException {
|
||||
jobService.deleteJobList(ids);
|
||||
return success(true);
|
||||
}
|
||||
|
||||
@PutMapping("/trigger")
|
||||
@Operation(summary = "触发定时任务")
|
||||
@Parameter(name = "id", description = "编号", required = true, example = "1024")
|
||||
|
||||
@ -5,6 +5,7 @@ import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX;
|
||||
import cn.iocoder.yudao.module.infra.dal.dataobject.codegen.CodegenColumnDO;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
|
||||
import java.util.Collection;
|
||||
import java.util.List;
|
||||
|
||||
@Mapper
|
||||
@ -17,8 +18,12 @@ public interface CodegenColumnMapper extends BaseMapperX<CodegenColumnDO> {
|
||||
}
|
||||
|
||||
default void deleteListByTableId(Long tableId) {
|
||||
delete(CodegenColumnDO::getTableId, tableId);
|
||||
}
|
||||
|
||||
default void deleteListByTableId(Collection<Long> tableIds) {
|
||||
delete(new LambdaQueryWrapperX<CodegenColumnDO>()
|
||||
.eq(CodegenColumnDO::getTableId, tableId));
|
||||
.in(CodegenColumnDO::getTableId, tableIds));
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@ -19,8 +19,11 @@ public enum CodegenFrontTypeEnum {
|
||||
VUE3_VBEN2_ANTD_SCHEMA(30), // Vue3 VBEN2 + ANTD + Schema 模版
|
||||
|
||||
VUE3_VBEN5_ANTD_SCHEMA(40), // Vue3 VBEN5 + ANTD + schema 模版
|
||||
|
||||
VUE3_VBEN5_ANTD_GENERAL(41), // Vue3 VBEN5 + ANTD 标准模版
|
||||
|
||||
// TODO @puhui999::50、51 会好点;
|
||||
VUE3_VBEN5_EP_SCHEMA(42), // Vue3 VBEN5 + EP + schema 模版
|
||||
VUE3_VBEN5_EP_GENERAL(43), // Vue3 VBEN5 + EP 标准模版
|
||||
;
|
||||
|
||||
/**
|
||||
|
||||
@ -48,6 +48,13 @@ public interface CodegenService {
|
||||
*/
|
||||
void deleteCodegen(Long tableId);
|
||||
|
||||
/**
|
||||
* 批量删除数据库的表和字段定义
|
||||
*
|
||||
* @param tableIds 数据编号列表
|
||||
*/
|
||||
void deleteCodegenList(List<Long> tableIds);
|
||||
|
||||
/**
|
||||
* 获得表定义列表
|
||||
*
|
||||
|
||||
@ -204,7 +204,7 @@ public class CodegenServiceImpl implements CodegenService {
|
||||
codegenColumnMapper.insertBatch(columns);
|
||||
// 4.2 删除不存在的字段
|
||||
if (CollUtil.isNotEmpty(deleteColumnIds)) {
|
||||
codegenColumnMapper.deleteBatchIds(deleteColumnIds);
|
||||
codegenColumnMapper.deleteByIds(deleteColumnIds);
|
||||
}
|
||||
}
|
||||
|
||||
@ -222,6 +222,15 @@ public class CodegenServiceImpl implements CodegenService {
|
||||
codegenColumnMapper.deleteListByTableId(tableId);
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public void deleteCodegenList(List<Long> tableIds) {
|
||||
// 批量删除 table 表定义
|
||||
codegenTableMapper.deleteByIds(tableIds);
|
||||
// 批量删除 column 字段定义
|
||||
codegenColumnMapper.deleteListByTableId(tableIds);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<CodegenTableDO> getCodegenTableList(Long dataSourceConfigId) {
|
||||
return codegenTableMapper.selectListByDataSourceConfigId(dataSourceConfigId);
|
||||
|
||||
@ -182,6 +182,42 @@ public class CodegenEngine {
|
||||
vue3FilePath("views/${table.moduleName}/${table.businessName}/modules/${subSimpleClassName_strikeCase}-list.vue"))
|
||||
.put(CodegenFrontTypeEnum.VUE3_VBEN5_ANTD_GENERAL.getType(), vue3Vben5AntdGeneralTemplatePath("views/modules/list_sub_erp.vue"), // 特殊:主子表专属逻辑
|
||||
vue3FilePath("views/${table.moduleName}/${table.businessName}/modules/${subSimpleClassName_strikeCase}-list.vue"))
|
||||
// VUE3_VBEN5_EP_SCHEMA
|
||||
.put(CodegenFrontTypeEnum.VUE3_VBEN5_EP_SCHEMA.getType(), vue3Vben5EpSchemaTemplatePath("views/data.ts"),
|
||||
vue3FilePath("views/${table.moduleName}/${table.businessName}/data.ts"))
|
||||
.put(CodegenFrontTypeEnum.VUE3_VBEN5_EP_SCHEMA.getType(), vue3Vben5EpSchemaTemplatePath("views/index.vue"),
|
||||
vue3FilePath("views/${table.moduleName}/${table.businessName}/index.vue"))
|
||||
.put(CodegenFrontTypeEnum.VUE3_VBEN5_EP_SCHEMA.getType(), vue3Vben5EpSchemaTemplatePath("views/form.vue"),
|
||||
vue3FilePath("views/${table.moduleName}/${table.businessName}/modules/form.vue"))
|
||||
.put(CodegenFrontTypeEnum.VUE3_VBEN5_EP_SCHEMA.getType(), vue3Vben5EpSchemaTemplatePath("api/api.ts"),
|
||||
vue3FilePath("api/${table.moduleName}/${table.businessName}/index.ts"))
|
||||
.put(CodegenFrontTypeEnum.VUE3_VBEN5_EP_SCHEMA.getType(), vue3Vben5EpSchemaTemplatePath("views/modules/form_sub_normal.vue"), // 特殊:主子表专属逻辑
|
||||
vue3FilePath("views/${table.moduleName}/${table.businessName}/modules/${subSimpleClassName_strikeCase}-form.vue"))
|
||||
.put(CodegenFrontTypeEnum.VUE3_VBEN5_EP_SCHEMA.getType(), vue3Vben5EpSchemaTemplatePath("views/modules/form_sub_inner.vue"), // 特殊:主子表专属逻辑
|
||||
vue3FilePath("views/${table.moduleName}/${table.businessName}/modules/${subSimpleClassName_strikeCase}-form.vue"))
|
||||
.put(CodegenFrontTypeEnum.VUE3_VBEN5_EP_SCHEMA.getType(), vue3Vben5EpSchemaTemplatePath("views/modules/form_sub_erp.vue"), // 特殊:主子表专属逻辑
|
||||
vue3FilePath("views/${table.moduleName}/${table.businessName}/modules/${subSimpleClassName_strikeCase}-form.vue"))
|
||||
.put(CodegenFrontTypeEnum.VUE3_VBEN5_EP_SCHEMA.getType(), vue3Vben5EpSchemaTemplatePath("views/modules/list_sub_inner.vue"), // 特殊:主子表专属逻辑
|
||||
vue3FilePath("views/${table.moduleName}/${table.businessName}/modules/${subSimpleClassName_strikeCase}-list.vue"))
|
||||
.put(CodegenFrontTypeEnum.VUE3_VBEN5_EP_SCHEMA.getType(), vue3Vben5EpSchemaTemplatePath("views/modules/list_sub_erp.vue"), // 特殊:主子表专属逻辑
|
||||
vue3FilePath("views/${table.moduleName}/${table.businessName}/modules/${subSimpleClassName_strikeCase}-list.vue"))
|
||||
// VUE3_VBEN5_EP
|
||||
.put(CodegenFrontTypeEnum.VUE3_VBEN5_EP_GENERAL.getType(), vue3Vben5EpGeneralTemplatePath("views/index.vue"),
|
||||
vue3FilePath("views/${table.moduleName}/${table.businessName}/index.vue"))
|
||||
.put(CodegenFrontTypeEnum.VUE3_VBEN5_EP_GENERAL.getType(), vue3Vben5EpGeneralTemplatePath("views/form.vue"),
|
||||
vue3FilePath("views/${table.moduleName}/${table.businessName}/modules/form.vue"))
|
||||
.put(CodegenFrontTypeEnum.VUE3_VBEN5_EP_GENERAL.getType(), vue3Vben5EpGeneralTemplatePath("api/api.ts"),
|
||||
vue3FilePath("api/${table.moduleName}/${table.businessName}/index.ts"))
|
||||
.put(CodegenFrontTypeEnum.VUE3_VBEN5_EP_GENERAL.getType(), vue3Vben5EpGeneralTemplatePath("views/modules/form_sub_normal.vue"), // 特殊:主子表专属逻辑
|
||||
vue3FilePath("views/${table.moduleName}/${table.businessName}/modules/${subSimpleClassName_strikeCase}-form.vue"))
|
||||
.put(CodegenFrontTypeEnum.VUE3_VBEN5_EP_GENERAL.getType(), vue3Vben5EpGeneralTemplatePath("views/modules/form_sub_inner.vue"), // 特殊:主子表专属逻辑
|
||||
vue3FilePath("views/${table.moduleName}/${table.businessName}/modules/${subSimpleClassName_strikeCase}-form.vue"))
|
||||
.put(CodegenFrontTypeEnum.VUE3_VBEN5_EP_GENERAL.getType(), vue3Vben5EpGeneralTemplatePath("views/modules/form_sub_erp.vue"), // 特殊:主子表专属逻辑
|
||||
vue3FilePath("views/${table.moduleName}/${table.businessName}/modules/${subSimpleClassName_strikeCase}-form.vue"))
|
||||
.put(CodegenFrontTypeEnum.VUE3_VBEN5_EP_GENERAL.getType(), vue3Vben5EpGeneralTemplatePath("views/modules/list_sub_inner.vue"), // 特殊:主子表专属逻辑
|
||||
vue3FilePath("views/${table.moduleName}/${table.businessName}/modules/${subSimpleClassName_strikeCase}-list.vue"))
|
||||
.put(CodegenFrontTypeEnum.VUE3_VBEN5_EP_GENERAL.getType(), vue3Vben5EpGeneralTemplatePath("views/modules/list_sub_erp.vue"), // 特殊:主子表专属逻辑
|
||||
vue3FilePath("views/${table.moduleName}/${table.businessName}/modules/${subSimpleClassName_strikeCase}-list.vue"))
|
||||
.build();
|
||||
|
||||
@Resource
|
||||
@ -590,6 +626,14 @@ public class CodegenEngine {
|
||||
return "codegen/vue3_vben5_antd/general/" + path + ".vm";
|
||||
}
|
||||
|
||||
private static String vue3Vben5EpSchemaTemplatePath(String path) {
|
||||
return "codegen/vue3_vben5_ele/schema/" + path + ".vm";
|
||||
}
|
||||
|
||||
private static String vue3Vben5EpGeneralTemplatePath(String path) {
|
||||
return "codegen/vue3_vben5_ele/general/" + path + ".vm";
|
||||
}
|
||||
|
||||
private static boolean isSubTemplate(String path) {
|
||||
return path.contains("_sub");
|
||||
}
|
||||
|
||||
@ -6,6 +6,8 @@ import cn.iocoder.yudao.module.infra.controller.admin.config.vo.ConfigSaveReqVO;
|
||||
import cn.iocoder.yudao.module.infra.dal.dataobject.config.ConfigDO;
|
||||
import jakarta.validation.Valid;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 参数配置 Service 接口
|
||||
*
|
||||
@ -35,6 +37,13 @@ public interface ConfigService {
|
||||
*/
|
||||
void deleteConfig(Long id);
|
||||
|
||||
/**
|
||||
* 批量删除参数配置
|
||||
*
|
||||
* @param ids 配置编号列表
|
||||
*/
|
||||
void deleteConfigList(List<Long> ids);
|
||||
|
||||
/**
|
||||
* 获得参数配置
|
||||
*
|
||||
|
||||
@ -13,6 +13,8 @@ import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import static cn.iocoder.yudao.framework.common.exception.util.ServiceExceptionUtil.exception;
|
||||
import static cn.iocoder.yudao.module.infra.enums.ErrorCodeConstants.*;
|
||||
|
||||
@ -63,6 +65,20 @@ public class ConfigServiceImpl implements ConfigService {
|
||||
configMapper.deleteById(id);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void deleteConfigList(List<Long> ids) {
|
||||
// 校验是否有内置配置
|
||||
List<ConfigDO> configs = configMapper.selectByIds(ids);
|
||||
configs.forEach(config -> {
|
||||
if (ConfigTypeEnum.SYSTEM.getType().equals(config.getType())) {
|
||||
throw exception(CONFIG_CAN_NOT_DELETE_SYSTEM_TYPE);
|
||||
}
|
||||
});
|
||||
|
||||
// 批量删除
|
||||
configMapper.deleteByIds(ids);
|
||||
}
|
||||
|
||||
@Override
|
||||
public ConfigDO getConfig(Long id) {
|
||||
return configMapper.selectById(id);
|
||||
|
||||
@ -35,6 +35,13 @@ public interface DataSourceConfigService {
|
||||
*/
|
||||
void deleteDataSourceConfig(Long id);
|
||||
|
||||
/**
|
||||
* 批量删除数据源配置
|
||||
*
|
||||
* @param ids 编号列表
|
||||
*/
|
||||
void deleteDataSourceConfigList(List<Long> ids);
|
||||
|
||||
/**
|
||||
* 获得数据源配置
|
||||
*
|
||||
|
||||
@ -63,6 +63,11 @@ public class DataSourceConfigServiceImpl implements DataSourceConfigService {
|
||||
dataSourceConfigMapper.deleteById(id);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void deleteDataSourceConfigList(List<Long> ids) {
|
||||
dataSourceConfigMapper.deleteByIds(ids);
|
||||
}
|
||||
|
||||
private void validateDataSourceConfigExists(Long id) {
|
||||
if (dataSourceConfigMapper.selectById(id) == null) {
|
||||
throw exception(DATA_SOURCE_CONFIG_NOT_EXISTS);
|
||||
|
||||
@ -42,7 +42,7 @@ public interface Demo01ContactService {
|
||||
*
|
||||
* @param ids 编号
|
||||
*/
|
||||
void deleteDemo0iContactListByIds(List<Long> ids);
|
||||
void deleteDemo0iContactList(List<Long> ids);
|
||||
|
||||
/**
|
||||
* 获得示例联系人
|
||||
|
||||
@ -55,7 +55,7 @@ public class Demo01ContactServiceImpl implements Demo01ContactService {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void deleteDemo0iContactListByIds(List<Long> ids) {
|
||||
public void deleteDemo0iContactList(List<Long> ids) {
|
||||
// 校验存在
|
||||
validateDemo01ContactExists(ids);
|
||||
// 删除
|
||||
|
||||
@ -45,7 +45,7 @@ public interface Demo03StudentErpService {
|
||||
*
|
||||
* @param ids 编号
|
||||
*/
|
||||
void deleteDemo03StudentListByIds(List<Long> ids);
|
||||
void deleteDemo03StudentList(List<Long> ids);
|
||||
|
||||
/**
|
||||
* 获得学生
|
||||
@ -101,7 +101,7 @@ public interface Demo03StudentErpService {
|
||||
*
|
||||
* @param ids 编号
|
||||
*/
|
||||
void deleteDemo03CourseListByIds(List<Long> ids);
|
||||
void deleteDemo03CourseList(List<Long> ids);
|
||||
|
||||
/**
|
||||
* 获得学生课程
|
||||
@ -149,7 +149,7 @@ public interface Demo03StudentErpService {
|
||||
*
|
||||
* @param ids 编号
|
||||
*/
|
||||
void deleteDemo03GradeListByIds(List<Long> ids);
|
||||
void deleteDemo03GradeList(List<Long> ids);
|
||||
|
||||
/**
|
||||
* 获得学生班级
|
||||
|
||||
@ -71,7 +71,7 @@ public class Demo03StudentErpServiceImpl implements Demo03StudentErpService {
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public void deleteDemo03StudentListByIds(List<Long> ids) {
|
||||
public void deleteDemo03StudentList(List<Long> ids) {
|
||||
// 校验存在
|
||||
validateDemo03StudentExists(ids);
|
||||
// 删除
|
||||
@ -134,7 +134,7 @@ public class Demo03StudentErpServiceImpl implements Demo03StudentErpService {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void deleteDemo03CourseListByIds(List<Long> ids) {
|
||||
public void deleteDemo03CourseList(List<Long> ids) {
|
||||
// 删除
|
||||
demo03CourseErpMapper.deleteByIds(ids);
|
||||
}
|
||||
@ -192,7 +192,7 @@ public class Demo03StudentErpServiceImpl implements Demo03StudentErpService {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void deleteDemo03GradeListByIds(List<Long> ids) {
|
||||
public void deleteDemo03GradeList(List<Long> ids) {
|
||||
// 删除
|
||||
demo03GradeErpMapper.deleteByIds(ids);
|
||||
}
|
||||
|
||||
@ -44,7 +44,7 @@ public interface Demo03StudentInnerService {
|
||||
*
|
||||
* @param ids 编号
|
||||
*/
|
||||
void deleteDemo03StudentListByIds(List<Long> ids);
|
||||
void deleteDemo03StudentList(List<Long> ids);
|
||||
|
||||
/**
|
||||
* 获得学生
|
||||
|
||||
@ -83,7 +83,7 @@ public class Demo03StudentInnerServiceImpl implements Demo03StudentInnerService
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public void deleteDemo03StudentListByIds(List<Long> ids) {
|
||||
public void deleteDemo03StudentList(List<Long> ids) {
|
||||
// 校验存在
|
||||
validateDemo03StudentExists(ids);
|
||||
// 删除
|
||||
|
||||
@ -44,7 +44,7 @@ public interface Demo03StudentNormalService {
|
||||
*
|
||||
* @param ids 编号
|
||||
*/
|
||||
void deleteDemo03StudentListByIds(List<Long> ids);
|
||||
void deleteDemo03StudentList(List<Long> ids);
|
||||
|
||||
/**
|
||||
* 获得学生
|
||||
|
||||
@ -83,7 +83,7 @@ public class Demo03StudentNormalServiceImpl implements Demo03StudentNormalServic
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public void deleteDemo03StudentListByIds(List<Long> ids) {
|
||||
public void deleteDemo03StudentList(List<Long> ids) {
|
||||
// 校验存在
|
||||
validateDemo03StudentExists(ids);
|
||||
// 删除
|
||||
|
||||
@ -7,6 +7,8 @@ import cn.iocoder.yudao.module.infra.dal.dataobject.file.FileConfigDO;
|
||||
import cn.iocoder.yudao.module.infra.framework.file.core.client.FileClient;
|
||||
import jakarta.validation.Valid;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 文件配置 Service 接口
|
||||
*
|
||||
@ -43,6 +45,13 @@ public interface FileConfigService {
|
||||
*/
|
||||
void deleteFileConfig(Long id);
|
||||
|
||||
/**
|
||||
* 批量删除文件配置
|
||||
*
|
||||
* @param ids 编号列表
|
||||
*/
|
||||
void deleteFileConfigList(List<Long> ids);
|
||||
|
||||
/**
|
||||
* 获得文件配置
|
||||
*
|
||||
|
||||
@ -25,6 +25,7 @@ import org.springframework.transaction.annotation.Transactional;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
|
||||
import java.time.Duration;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Objects;
|
||||
|
||||
@ -134,6 +135,23 @@ public class FileConfigServiceImpl implements FileConfigService {
|
||||
clearCache(id, null);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void deleteFileConfigList(List<Long> ids) {
|
||||
// 校验是否有主配置
|
||||
List<FileConfigDO> configs = fileConfigMapper.selectByIds(ids);
|
||||
for (FileConfigDO config : configs) {
|
||||
if (Boolean.TRUE.equals(config.getMaster())) {
|
||||
throw exception(FILE_CONFIG_DELETE_FAIL_MASTER);
|
||||
}
|
||||
}
|
||||
|
||||
// 批量删除
|
||||
fileConfigMapper.deleteByIds(ids);
|
||||
|
||||
// 清空缓存
|
||||
ids.forEach(id -> clearCache(id, null));
|
||||
}
|
||||
|
||||
/**
|
||||
* 清空指定文件配置
|
||||
*
|
||||
|
||||
@ -7,6 +7,8 @@ import cn.iocoder.yudao.module.infra.controller.admin.file.vo.file.FilePresigned
|
||||
import cn.iocoder.yudao.module.infra.dal.dataobject.file.FileDO;
|
||||
import jakarta.validation.constraints.NotEmpty;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 文件 Service 接口
|
||||
*
|
||||
@ -59,6 +61,13 @@ public interface FileService {
|
||||
*/
|
||||
void deleteFile(Long id) throws Exception;
|
||||
|
||||
/**
|
||||
* 批量删除文件
|
||||
*
|
||||
* @param ids 编号列表
|
||||
*/
|
||||
void deleteFileList(List<Long> ids) throws Exception;
|
||||
|
||||
/**
|
||||
* 获得文件内容
|
||||
*
|
||||
|
||||
@ -20,6 +20,8 @@ import jakarta.annotation.Resource;
|
||||
import lombok.SneakyThrows;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import static cn.hutool.core.date.DatePattern.PURE_DATE_PATTERN;
|
||||
import static cn.iocoder.yudao.framework.common.exception.util.ServiceExceptionUtil.exception;
|
||||
import static cn.iocoder.yudao.module.infra.enums.ErrorCodeConstants.FILE_NOT_EXISTS;
|
||||
@ -156,6 +158,23 @@ public class FileServiceImpl implements FileService {
|
||||
fileMapper.deleteById(id);
|
||||
}
|
||||
|
||||
@Override
|
||||
@SneakyThrows
|
||||
public void deleteFileList(List<Long> ids) {
|
||||
// 删除文件
|
||||
List<FileDO> files = fileMapper.selectByIds(ids);
|
||||
for (FileDO file : files) {
|
||||
// 获取客户端
|
||||
FileClient client = fileConfigService.getFileClient(file.getConfigId());
|
||||
Assert.notNull(client, "客户端({}) 不能为空", file.getPath());
|
||||
// 删除文件
|
||||
client.delete(file.getPath());
|
||||
}
|
||||
|
||||
// 删除记录
|
||||
fileMapper.deleteByIds(ids);
|
||||
}
|
||||
|
||||
private FileDO validateFileExists(Long id) {
|
||||
FileDO fileDO = fileMapper.selectById(id);
|
||||
if (fileDO == null) {
|
||||
|
||||
@ -7,6 +7,8 @@ import cn.iocoder.yudao.module.infra.dal.dataobject.job.JobDO;
|
||||
import jakarta.validation.Valid;
|
||||
import org.quartz.SchedulerException;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 定时任务 Service 接口
|
||||
*
|
||||
@ -58,6 +60,13 @@ public interface JobService {
|
||||
*/
|
||||
void deleteJob(Long id) throws SchedulerException;
|
||||
|
||||
/**
|
||||
* 批量删除定时任务
|
||||
*
|
||||
* @param ids 编号列表
|
||||
*/
|
||||
void deleteJobList(List<Long> ids) throws SchedulerException;
|
||||
|
||||
/**
|
||||
* 获得定时任务
|
||||
*
|
||||
|
||||
@ -169,6 +169,19 @@ public class JobServiceImpl implements JobService {
|
||||
schedulerManager.deleteJob(job.getHandlerName());
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public void deleteJobList(List<Long> ids) throws SchedulerException {
|
||||
// 批量删除
|
||||
List<JobDO> jobs = jobMapper.selectByIds(ids);
|
||||
jobMapper.deleteByIds(ids);
|
||||
|
||||
// 删除 Job 到 Quartz 中
|
||||
for (JobDO job : jobs) {
|
||||
schedulerManager.deleteJob(job.getHandlerName());
|
||||
}
|
||||
}
|
||||
|
||||
private JobDO validateJobExists(Long id) {
|
||||
JobDO job = jobMapper.selectById(id);
|
||||
if (job == null) {
|
||||
|
||||
@ -65,10 +65,13 @@ public class ${table.className}ServiceImpl implements ${table.className}Service
|
||||
#end
|
||||
// 插入
|
||||
#if ($voType == 10)
|
||||
## TODO @puhui999:insert 也要加下 clean。万一前端乱传递,哈哈哈。这个就是 do 模式的缺点;(只在 do 模式下);看看主子表,是不是也可能存在,insert 的时候;
|
||||
${table.className}DO ${classNameVar} = BeanUtils.toBean(createReqVO, ${table.className}DO.class);
|
||||
#end
|
||||
${classNameVar}Mapper.insert(${classNameVar});
|
||||
#else
|
||||
${saveReqVOVar}.clean() // 清理掉创建、更新时间等相关属性值
|
||||
${classNameVar}Mapper.insert(${saveReqVOVar});
|
||||
#end
|
||||
|
||||
## 特殊:主子表专属逻辑(非 ERP 模式)
|
||||
#if ( $subTables && $subTables.size() > 0 && $table.templateType != 11 )
|
||||
|
||||
@ -112,6 +115,7 @@ public class ${table.className}ServiceImpl implements ${table.className}Service
|
||||
${table.className}DO updateObj = BeanUtils.toBean(updateReqVO, ${table.className}DO.class);
|
||||
${classNameVar}Mapper.updateById(updateObj);
|
||||
#else
|
||||
${updateReqVOVar}.clean() // 清理掉创建、更新时间等相关属性值
|
||||
${classNameVar}Mapper.updateById(${updateReqVOVar});
|
||||
#end
|
||||
## 特殊:主子表专属逻辑(非 ERP 模式)
|
||||
@ -171,8 +175,6 @@ public class ${table.className}ServiceImpl implements ${table.className}Service
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
#end
|
||||
public void delete${simpleClassName}ListByIds(List<${primaryColumn.javaType}> ids) {
|
||||
// 校验存在
|
||||
validate${simpleClassName}Exists(ids);
|
||||
// 删除
|
||||
${classNameVar}Mapper.deleteByIds(ids);
|
||||
## 特殊:主子表专属逻辑
|
||||
@ -189,12 +191,6 @@ public class ${table.className}ServiceImpl implements ${table.className}Service
|
||||
#end
|
||||
}
|
||||
|
||||
private void validate${simpleClassName}Exists(List<${primaryColumn.javaType}> ids) {
|
||||
List<${table.className}DO> list = ${classNameVar}Mapper.selectByIds(ids);
|
||||
if (CollUtil.isEmpty(list) || list.size() != ids.size()) {
|
||||
throw exception(${simpleClassName_underlineCase.toUpperCase()}_NOT_EXISTS);
|
||||
}
|
||||
}
|
||||
#end
|
||||
|
||||
private void validate${simpleClassName}Exists(${primaryColumn.javaType} id) {
|
||||
@ -320,6 +316,7 @@ public class ${table.className}ServiceImpl implements ${table.className}Service
|
||||
}
|
||||
// 插入
|
||||
#end
|
||||
${subClassNameVar}.clean() // 清理掉创建、更新时间等相关属性值
|
||||
${subClassNameVars.get($index)}Mapper.insert(${subClassNameVar});
|
||||
return ${subClassNameVar}.getId();
|
||||
}
|
||||
|
||||
@ -27,6 +27,16 @@ export function delete${simpleClassName}(id) {
|
||||
})
|
||||
}
|
||||
|
||||
#if ( $table.templateType != 2 && $deleteBatchEnable)
|
||||
/** 批量删除${table.classComment} */
|
||||
export function delete${simpleClassName}List(ids) {
|
||||
return request({
|
||||
url: `${baseURL}/delete-list?ids=${ids.join(',')}`,
|
||||
method: 'delete'
|
||||
})
|
||||
}
|
||||
#end
|
||||
|
||||
// 获得${table.classComment}
|
||||
export function get${simpleClassName}(id) {
|
||||
return request({
|
||||
@ -130,6 +140,15 @@ export function export${simpleClassName}Excel(params) {
|
||||
method: 'delete'
|
||||
})
|
||||
}
|
||||
#if ($deleteBatchEnable)
|
||||
/** 批量删除${subTable.classComment} */
|
||||
export function delete${subSimpleClassName}List(ids) {
|
||||
return request({
|
||||
url: `${baseURL}/${subSimpleClassName_strikeCase}/delete-list?ids=${ids.join(',')}`,
|
||||
method: 'delete'
|
||||
})
|
||||
}
|
||||
#end
|
||||
// 获得${subTable.classComment}
|
||||
export function get${subSimpleClassName}(id) {
|
||||
return request({
|
||||
|
||||
@ -13,10 +13,36 @@
|
||||
<el-button type="primary" plain icon="el-icon-plus" size="mini" @click="openForm(undefined)"
|
||||
v-hasPermi="['${permissionPrefix}:create']">新增</el-button>
|
||||
</el-col>
|
||||
#if ($deleteBatchEnable)
|
||||
<el-col :span="1.5">
|
||||
<el-button
|
||||
type="danger"
|
||||
plain
|
||||
icon="el-icon-delete"
|
||||
size="mini"
|
||||
:disabled="isEmpty(checkedIds)"
|
||||
@click="handleDeleteBatch"
|
||||
v-hasPermi="['${permissionPrefix}:delete']"
|
||||
>
|
||||
批量删除
|
||||
</el-button>
|
||||
</el-col>
|
||||
#end
|
||||
</el-row>
|
||||
#end
|
||||
## 列表
|
||||
<el-table v-loading="loading" :data="list" :stripe="true" :show-overflow-tooltip="true">
|
||||
<el-table
|
||||
v-loading="loading"
|
||||
:data="list"
|
||||
:stripe="true"
|
||||
:show-overflow-tooltip="true"
|
||||
#if ($table.templateType == 11 && $deleteBatchEnable)
|
||||
@selection-change="handleRowCheckboxChange"
|
||||
#end
|
||||
>
|
||||
#if ($table.templateType == 11 && $deleteBatchEnable)
|
||||
<el-table-column type="selection" width="55" />
|
||||
#end
|
||||
#foreach($column in $subColumns)
|
||||
#if ($column.listOperationResult)
|
||||
#set ($dictType=$column.dictType)
|
||||
@ -82,6 +108,9 @@
|
||||
// 列表的数据
|
||||
list: [],
|
||||
#if ($table.templateType == 11)
|
||||
#if ($deleteBatchEnable)
|
||||
checkedIds: [],
|
||||
#end
|
||||
// 列表的总页数
|
||||
total: 0,
|
||||
// 查询参数
|
||||
@ -135,12 +164,27 @@
|
||||
this.loading = false;
|
||||
}
|
||||
},
|
||||
/** 搜索按钮操作 */
|
||||
handleQuery() {
|
||||
this.queryParams.pageNo = 1;
|
||||
this.getList();
|
||||
},
|
||||
#if ($table.templateType == 11 && $deleteBatchEnable)
|
||||
/** 批量删除${table.classComment} */
|
||||
async handleDeleteBatch() {
|
||||
await this.#[[$modal]]#.confirm('是否确认删除?')
|
||||
try {
|
||||
await ${simpleClassName}Api.delete${subSimpleClassName}List(this.checkedIds);
|
||||
await this.getList();
|
||||
this.#[[$modal]]#.msgSuccess("删除成功");
|
||||
} catch {}
|
||||
},
|
||||
handleRowCheckboxChange(records) {
|
||||
this.checkedIds = records.map((item) => item.id);
|
||||
},
|
||||
#end
|
||||
|
||||
#if ($table.templateType == 11)
|
||||
/** 搜索按钮操作 */
|
||||
handleQuery() {
|
||||
this.queryParams.pageNo = 1;
|
||||
this.getList();
|
||||
},
|
||||
/** 添加/修改操作 */
|
||||
openForm(id) {
|
||||
if (!this.${subJoinColumn.javaField}) {
|
||||
|
||||
@ -53,26 +53,45 @@
|
||||
<el-button type="warning" plain icon="el-icon-download" size="mini" @click="handleExport" :loading="exportLoading"
|
||||
v-hasPermi="['${permissionPrefix}:export']">导出</el-button>
|
||||
</el-col>
|
||||
## 特殊:树表专属逻辑
|
||||
#if ( $table.templateType == 2 )
|
||||
<el-col :span="1.5">
|
||||
<el-button type="danger" plain icon="el-icon-sort" size="mini" @click="toggleExpandAll">
|
||||
展开/折叠
|
||||
</el-button>
|
||||
</el-col>
|
||||
#end
|
||||
## 特殊:树表专属逻辑
|
||||
#if ( $table.templateType == 2 )
|
||||
<el-col :span="1.5">
|
||||
<el-button type="danger" plain icon="el-icon-sort" size="mini" @click="toggleExpandAll">
|
||||
展开/折叠
|
||||
</el-button>
|
||||
</el-col>
|
||||
#end
|
||||
#if ($table.templateType != 2 && $deleteBatchEnable)
|
||||
<el-col :span="1.5">
|
||||
<el-button
|
||||
type="danger"
|
||||
plain
|
||||
icon="el-icon-delete"
|
||||
size="mini"
|
||||
:disabled="isEmpty(checkedIds)"
|
||||
@click="handleDeleteBatch"
|
||||
v-hasPermi="['${permissionPrefix}:delete']"
|
||||
>
|
||||
批量删除
|
||||
</el-button>
|
||||
</el-col>
|
||||
#end
|
||||
<right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
|
||||
</el-row>
|
||||
|
||||
## 特殊:主子表专属逻辑
|
||||
#if ( $table.templateType == 11 && $subTables && $subTables.size() > 0 )
|
||||
<el-table
|
||||
row-key="id"
|
||||
v-loading="loading"
|
||||
:data="list"
|
||||
:stripe="true"
|
||||
:highlight-current-row="true"
|
||||
:show-overflow-tooltip="true"
|
||||
@current-change="handleCurrentChange"
|
||||
#if ($deleteBatchEnable)
|
||||
@selection-change="handleRowCheckboxChange"
|
||||
#end
|
||||
>
|
||||
## 特殊:树表专属逻辑
|
||||
#elseif ( $table.templateType == 2 )
|
||||
@ -87,7 +106,18 @@
|
||||
:tree-props="{children: 'children', hasChildren: 'hasChildren'}"
|
||||
>
|
||||
#else
|
||||
<el-table v-loading="loading" :data="list" :stripe="true" :show-overflow-tooltip="true">
|
||||
<el-table
|
||||
v-loading="loading"
|
||||
:data="list"
|
||||
:stripe="true"
|
||||
:show-overflow-tooltip="true"
|
||||
#if ($deleteBatchEnable)
|
||||
@selection-change="handleRowCheckboxChange"
|
||||
#end
|
||||
>
|
||||
#end
|
||||
#if ($table.templateType != 2 && $deleteBatchEnable)
|
||||
<el-table-column type="selection" width="55" />
|
||||
#end
|
||||
## 特殊:主子表专属逻辑
|
||||
#if ( $table.templateType == 12 && $subTables && $subTables.size() > 0 )
|
||||
@ -229,6 +259,7 @@ export default {
|
||||
refreshTable: true,
|
||||
// 选中行
|
||||
currentRow: {},
|
||||
checkedIds: [],
|
||||
// 查询参数
|
||||
queryParams: {
|
||||
## 特殊:树表专属逻辑(树不需要分页接口)
|
||||
@ -301,6 +332,20 @@ export default {
|
||||
this.#[[$modal]]#.msgSuccess("删除成功");
|
||||
} catch {}
|
||||
},
|
||||
#if ($table.templateType != 2 && $deleteBatchEnable)
|
||||
/** 批量删除${table.classComment} */
|
||||
async handleDeleteBatch() {
|
||||
await this.#[[$modal]]#.confirm('是否确认删除?')
|
||||
try {
|
||||
await ${simpleClassName}Api.delete${simpleClassName}List(this.checkedIds);
|
||||
await this.getList();
|
||||
this.#[[$modal]]#.msgSuccess("删除成功");
|
||||
} catch {}
|
||||
},
|
||||
handleRowCheckboxChange(records) {
|
||||
this.checkedIds = records.map((item) => item.id);
|
||||
},
|
||||
#end
|
||||
/** 导出按钮操作 */
|
||||
async handleExport() {
|
||||
await this.#[[$modal]]#.confirm('是否确认导出所有${table.classComment}数据项?');
|
||||
|
||||
@ -1,19 +1,56 @@
|
||||
import request from '@/config/axios'
|
||||
import type { Dayjs } from 'dayjs';
|
||||
#set ($baseURL = "/${table.moduleName}/${simpleClassName_strikeCase}")
|
||||
|
||||
// ${table.classComment} VO
|
||||
export interface ${simpleClassName}VO {
|
||||
#foreach ($column in $columns)
|
||||
#if ($column.createOperation || $column.updateOperation)
|
||||
#if(${column.javaType.toLowerCase()} == "long" || ${column.javaType.toLowerCase()} == "integer" || ${column.javaType.toLowerCase()} == "short" || ${column.javaType.toLowerCase()} == "double" || ${column.javaType.toLowerCase()} == "bigdecimal")
|
||||
${column.javaField}: number // ${column.columnComment}
|
||||
#elseif(${column.javaType.toLowerCase()} == "date" || ${column.javaType.toLowerCase()} == "localdate" || ${column.javaType.toLowerCase()} == "localdatetime")
|
||||
${column.javaField}: Date // ${column.columnComment}
|
||||
#else
|
||||
${column.javaField}: ${column.javaType.toLowerCase()} // ${column.columnComment}
|
||||
#end
|
||||
#end
|
||||
## 特殊:主子表专属逻辑
|
||||
#foreach ($subTable in $subTables)
|
||||
#set ($index = $foreach.count - 1)
|
||||
#set ($subSimpleClassName = $subSimpleClassNames.get($index))
|
||||
#set ($subColumns = $subColumnsList.get($index))##当前字段数组
|
||||
/** ${subTable.classComment}信息 */
|
||||
export interface ${subSimpleClassName} {
|
||||
#foreach ($column in $subColumns)
|
||||
#if ($column.createOperation || $column.updateOperation)
|
||||
#if(${column.javaType.toLowerCase()} == "long" || ${column.javaType.toLowerCase()} == "integer" || ${column.javaType.toLowerCase()} == "short" || ${column.javaType.toLowerCase()} == "double" || ${column.javaType.toLowerCase()} == "bigdecimal")
|
||||
${column.javaField}#if($column.updateOperation && !$column.primaryKey && !$column.nullable)?#end: number; // ${column.columnComment}
|
||||
#elseif(${column.javaType.toLowerCase()} == "date" || ${column.javaType.toLowerCase()} == "localdate" || ${column.javaType.toLowerCase()} == "localdatetime")
|
||||
${column.javaField}#if($column.updateOperation && !$column.primaryKey && !$column.nullable)?#end: string | Dayjs; // ${column.columnComment}
|
||||
#else
|
||||
${column.javaField}#if($column.updateOperation && !$column.primaryKey && !$column.nullable)?#end: ${column.javaType.toLowerCase()}; // ${column.columnComment}
|
||||
#end
|
||||
#end
|
||||
#end
|
||||
}
|
||||
|
||||
#end
|
||||
/** ${table.classComment}信息 */
|
||||
export interface ${simpleClassName} {
|
||||
#foreach ($column in $columns)
|
||||
#if ($column.createOperation || $column.updateOperation)
|
||||
#if(${column.javaType.toLowerCase()} == "long" || ${column.javaType.toLowerCase()} == "integer" || ${column.javaType.toLowerCase()} == "short" || ${column.javaType.toLowerCase()} == "double" || ${column.javaType.toLowerCase()} == "bigdecimal")
|
||||
${column.javaField}#if($column.updateOperation && !$column.primaryKey && !$column.nullable)?#end: number; // ${column.columnComment}
|
||||
#elseif(${column.javaType.toLowerCase()} == "date" || ${column.javaType.toLowerCase()} == "localdate" || ${column.javaType.toLowerCase()} == "localdatetime")
|
||||
${column.javaField}#if($column.updateOperation && !$column.primaryKey && !$column.nullable)?#end: string | Dayjs; // ${column.columnComment}
|
||||
#else
|
||||
${column.javaField}#if($column.updateOperation && !$column.primaryKey && !$column.nullable)?#end: ${column.javaType.toLowerCase()}; // ${column.columnComment}
|
||||
#end
|
||||
#end
|
||||
#end
|
||||
#if ( $table.templateType == 2 )
|
||||
children?: ${simpleClassName}[];
|
||||
#end
|
||||
## 特殊:主子表专属逻辑
|
||||
#if ( $table.templateType == 10 || $table.templateType == 12 )
|
||||
#foreach ($subTable in $subTables)
|
||||
#set ($index = $foreach.count - 1)
|
||||
#set ($subSimpleClassName = $subSimpleClassNames.get($index))
|
||||
#if ( $subTable.subJoinMany )
|
||||
${subSimpleClassName.toLowerCase()}s?: ${subSimpleClassName}[]
|
||||
#else
|
||||
${subSimpleClassName.toLowerCase()}?: ${subSimpleClassName}
|
||||
#end
|
||||
#end
|
||||
#end
|
||||
}
|
||||
|
||||
// ${table.classComment} API
|
||||
@ -36,12 +73,12 @@ export const ${simpleClassName}Api = {
|
||||
},
|
||||
|
||||
// 新增${table.classComment}
|
||||
create${simpleClassName}: async (data: ${simpleClassName}VO) => {
|
||||
create${simpleClassName}: async (data: ${simpleClassName}) => {
|
||||
return await request.post({ url: `${baseURL}/create`, data })
|
||||
},
|
||||
|
||||
// 修改${table.classComment}
|
||||
update${simpleClassName}: async (data: ${simpleClassName}VO) => {
|
||||
update${simpleClassName}: async (data: ${simpleClassName}) => {
|
||||
return await request.put({ url: `${baseURL}/update`, data })
|
||||
},
|
||||
|
||||
@ -50,6 +87,13 @@ export const ${simpleClassName}Api = {
|
||||
return await request.delete({ url: `${baseURL}/delete?id=` + id })
|
||||
},
|
||||
|
||||
#if ( $table.templateType != 2 && $deleteBatchEnable)
|
||||
/** 批量删除${table.classComment} */
|
||||
delete${simpleClassName}List: async (ids: number[]) => {
|
||||
return await request.delete({ url: `${baseURL}/delete-list?ids=${ids.join(',')}` })
|
||||
},
|
||||
#end
|
||||
|
||||
// 导出${table.classComment} Excel
|
||||
export${simpleClassName}: async (params) => {
|
||||
return await request.download({ url: `${baseURL}/export-excel`, params })
|
||||
@ -92,12 +136,12 @@ export const ${simpleClassName}Api = {
|
||||
## 特殊:MASTER_ERP 时,支持单个的新增、修改、删除操作
|
||||
#if ( $table.templateType == 11 )
|
||||
// 新增${subTable.classComment}
|
||||
create${subSimpleClassName}: async (data) => {
|
||||
create${subSimpleClassName}: async (data: ${subSimpleClassName}) => {
|
||||
return await request.post({ url: `${baseURL}/${subSimpleClassName_strikeCase}/create`, data })
|
||||
},
|
||||
|
||||
// 修改${subTable.classComment}
|
||||
update${subSimpleClassName}: async (data) => {
|
||||
update${subSimpleClassName}: async (data: ${subSimpleClassName}) => {
|
||||
return await request.put({ url: `${baseURL}/${subSimpleClassName_strikeCase}/update`, data })
|
||||
},
|
||||
|
||||
@ -106,6 +150,13 @@ export const ${simpleClassName}Api = {
|
||||
return await request.delete({ url: `${baseURL}/${subSimpleClassName_strikeCase}/delete?id=` + id })
|
||||
},
|
||||
|
||||
#if ($deleteBatchEnable)
|
||||
/** 批量删除${subTable.classComment} */
|
||||
delete${subSimpleClassName}List: async (ids: number[]) => {
|
||||
return await request.delete({ url: `${baseURL}/${subSimpleClassName_strikeCase}/delete-list?ids=${ids.join(',')}` })
|
||||
},
|
||||
#end
|
||||
|
||||
// 获得${subTable.classComment}
|
||||
get${subSimpleClassName}: async (id: number) => {
|
||||
return await request.get({ url: `${baseURL}/${subSimpleClassName_strikeCase}/get?id=` + id })
|
||||
|
||||
@ -113,7 +113,7 @@
|
||||
</template>
|
||||
<script setup lang="ts">
|
||||
import { getIntDictOptions, getStrDictOptions, getBoolDictOptions, DICT_TYPE } from '@/utils/dict'
|
||||
import { ${simpleClassName}Api } from '@/api/${table.moduleName}/${table.businessName}'
|
||||
import { ${simpleClassName}Api, ${subSimpleClassName} } from '@/api/${table.moduleName}/${table.businessName}'
|
||||
|
||||
const { t } = useI18n() // 国际化
|
||||
const message = useMessage() // 消息弹窗
|
||||
@ -144,12 +144,12 @@ const formRules = reactive({
|
||||
const formRef = ref() // 表单 Ref
|
||||
|
||||
/** 打开弹窗 */
|
||||
const open = async (type: string, id?: number, ${subJoinColumn.javaField}: number) => {
|
||||
const open = async (type: string, id?: number, ${subJoinColumn.javaField}?: number) => {
|
||||
dialogVisible.value = true
|
||||
dialogTitle.value = t('action.' + type)
|
||||
formType.value = type
|
||||
resetForm()
|
||||
formData.value.${subJoinColumn.javaField} = ${subJoinColumn.javaField}
|
||||
formData.value.${subJoinColumn.javaField} = ${subJoinColumn.javaField} as any
|
||||
// 修改时,设置数据
|
||||
if (id) {
|
||||
formLoading.value = true
|
||||
@ -170,7 +170,7 @@ const submitForm = async () => {
|
||||
// 提交请求
|
||||
formLoading.value = true
|
||||
try {
|
||||
const data = formData.value
|
||||
const data = formData.value as unknown as ${subSimpleClassName}
|
||||
if (formType.value === 'create') {
|
||||
await ${simpleClassName}Api.create${subSimpleClassName}(data)
|
||||
message.success(t('common.createSuccess'))
|
||||
|
||||
@ -266,10 +266,10 @@ import { getIntDictOptions, getStrDictOptions, getBoolDictOptions, DICT_TYPE } f
|
||||
import { ${simpleClassName}Api } from '@/api/${table.moduleName}/${table.businessName}'
|
||||
|
||||
const props = defineProps<{
|
||||
${subJoinColumn.javaField}: undefined // ${subJoinColumn.columnComment}(主表的关联字段)
|
||||
${subJoinColumn.javaField}: number // ${subJoinColumn.columnComment}(主表的关联字段)
|
||||
}>()
|
||||
const formLoading = ref(false) // 表单的加载中
|
||||
const formData = ref([])
|
||||
const formData = ref<any#if ( $subTable.subJoinMany )[]#end>(#if ( $subTable.subJoinMany )[]#else{}#end)
|
||||
const formRules = reactive({
|
||||
#foreach ($column in $subColumns)
|
||||
#if (($column.createOperation || $column.updateOperation) && !$column.nullable && !${column.primaryKey})## 创建或者更新操作 && 要求非空 && 非主键
|
||||
@ -336,7 +336,7 @@ const handleAdd = () => {
|
||||
#end
|
||||
#end
|
||||
}
|
||||
row.${subJoinColumn.javaField} = props.${subJoinColumn.javaField}
|
||||
row.${subJoinColumn.javaField} = props.${subJoinColumn.javaField} as any
|
||||
formData.value.push(row)
|
||||
}
|
||||
|
||||
|
||||
@ -16,8 +16,31 @@
|
||||
>
|
||||
<Icon icon="ep:plus" class="mr-5px" /> 新增
|
||||
</el-button>
|
||||
#if ($deleteBatchEnable)
|
||||
<el-button
|
||||
type="danger"
|
||||
plain
|
||||
:disabled="isEmpty(checkedIds)"
|
||||
@click="handleDeleteBatch"
|
||||
v-hasPermi="['${permissionPrefix}:delete']"
|
||||
>
|
||||
<Icon icon="ep:delete" class="mr-5px" /> 批量删除
|
||||
</el-button>
|
||||
#end
|
||||
#end
|
||||
<el-table v-loading="loading" :data="list" :stripe="true" :show-overflow-tooltip="true">
|
||||
<el-table
|
||||
row-key="id"
|
||||
v-loading="loading"
|
||||
:data="list"
|
||||
:stripe="true"
|
||||
:show-overflow-tooltip="true"
|
||||
#if ($table.templateType == 11 && $deleteBatchEnable)
|
||||
@selection-change="handleRowCheckboxChange"
|
||||
#end
|
||||
>
|
||||
#if ($table.templateType == 11 && $deleteBatchEnable)
|
||||
<el-table-column type="selection" width="55" />
|
||||
#end
|
||||
#foreach($column in $subColumns)
|
||||
#if ($column.listOperationResult)
|
||||
#set ($dictType=$column.dictType)
|
||||
@ -85,14 +108,18 @@
|
||||
<script setup lang="ts">
|
||||
import { getIntDictOptions, getStrDictOptions, getBoolDictOptions, DICT_TYPE } from '@/utils/dict'
|
||||
import { dateFormatter } from '@/utils/formatTime'
|
||||
import { ${simpleClassName}Api } from '@/api/${table.moduleName}/${table.businessName}'
|
||||
#if ($deleteBatchEnable)
|
||||
import { isEmpty } from '@/utils/is'
|
||||
#end
|
||||
import { ${simpleClassName}Api, ${subSimpleClassName} } from '@/api/${table.moduleName}/${table.businessName}'
|
||||
#if ($table.templateType == 11)
|
||||
import ${subSimpleClassName}Form from './${subSimpleClassName}Form.vue'
|
||||
#end
|
||||
|
||||
#if ($table.templateType == 11)
|
||||
const { t } = useI18n() // 国际化
|
||||
const message = useMessage() // 消息弹窗
|
||||
|
||||
#end
|
||||
const props = defineProps<{
|
||||
${subJoinColumn.javaField}?: number // ${subJoinColumn.columnComment}(主表的关联字段)
|
||||
}>()
|
||||
@ -144,12 +171,12 @@ const getList = async () => {
|
||||
}
|
||||
}
|
||||
|
||||
#if ($table.templateType == 11)
|
||||
/** 搜索按钮操作 */
|
||||
const handleQuery = () => {
|
||||
queryParams.pageNo = 1
|
||||
getList()
|
||||
}
|
||||
#if ($table.templateType == 11)
|
||||
|
||||
/** 添加/修改操作 */
|
||||
const formRef = ref()
|
||||
@ -173,6 +200,24 @@ const handleDelete = async (id: number) => {
|
||||
await getList()
|
||||
} catch {}
|
||||
}
|
||||
|
||||
#if ($table.templateType == 11 && $deleteBatchEnable)
|
||||
/** 批量删除${subTable.classComment} */
|
||||
const handleDeleteBatch = async () => {
|
||||
try {
|
||||
// 删除的二次确认
|
||||
await message.delConfirm()
|
||||
await ${simpleClassName}Api.delete${subSimpleClassName}List(checkedIds.value);
|
||||
message.success(t('common.delSuccess'))
|
||||
await getList();
|
||||
} catch {}
|
||||
}
|
||||
|
||||
const checkedIds = ref<number[]>([])
|
||||
const handleRowCheckboxChange = (records: ${subSimpleClassName}[]) => {
|
||||
checkedIds.value = records.map((item) => item.id);
|
||||
}
|
||||
#end
|
||||
#end
|
||||
#if ($table.templateType != 11)
|
||||
|
||||
|
||||
@ -139,7 +139,7 @@
|
||||
</template>
|
||||
<script setup lang="ts">
|
||||
import { getIntDictOptions, getStrDictOptions, getBoolDictOptions, DICT_TYPE } from '@/utils/dict'
|
||||
import { ${simpleClassName}Api, ${simpleClassName}VO } from '@/api/${table.moduleName}/${table.businessName}'
|
||||
import { ${simpleClassName}Api, ${simpleClassName} } from '@/api/${table.moduleName}/${table.businessName}'
|
||||
## 特殊:树表专属逻辑
|
||||
#if ( $table.templateType == 2 )
|
||||
import { defaultProps, handleTree } from '@/utils/tree'
|
||||
@ -243,7 +243,7 @@ const submitForm = async () => {
|
||||
// 提交请求
|
||||
formLoading.value = true
|
||||
try {
|
||||
const data = formData.value as unknown as ${simpleClassName}VO
|
||||
const data = formData.value as unknown as ${simpleClassName}
|
||||
## 特殊:主子表专属逻辑
|
||||
#if ( $table.templateType == 10 || $table.templateType == 12 )
|
||||
#if ( $subTables && $subTables.size() > 0 )
|
||||
|
||||
@ -107,6 +107,17 @@
|
||||
<Icon icon="ep:sort" class="mr-5px" /> 展开/折叠
|
||||
</el-button>
|
||||
#end
|
||||
#if ($table.templateType != 2 && $deleteBatchEnable)
|
||||
<el-button
|
||||
type="danger"
|
||||
plain
|
||||
:disabled="isEmpty(checkedIds)"
|
||||
@click="handleDeleteBatch"
|
||||
v-hasPermi="['${table.moduleName}:${simpleClassName_strikeCase}:delete']"
|
||||
>
|
||||
<Icon icon="ep:delete" class="mr-5px" /> 批量删除
|
||||
</el-button>
|
||||
#end
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
</ContentWrap>
|
||||
@ -116,12 +127,16 @@
|
||||
## 特殊:主子表专属逻辑
|
||||
#if ( $table.templateType == 11 && $subTables && $subTables.size() > 0 )
|
||||
<el-table
|
||||
row-key="id"
|
||||
v-loading="loading"
|
||||
:data="list"
|
||||
:stripe="true"
|
||||
:show-overflow-tooltip="true"
|
||||
highlight-current-row
|
||||
@current-change="handleCurrentChange"
|
||||
#if ($deleteBatchEnable)
|
||||
@selection-change="handleRowCheckboxChange"
|
||||
#end
|
||||
>
|
||||
## 特殊:树表专属逻辑
|
||||
#elseif ( $table.templateType == 2 )
|
||||
@ -135,7 +150,19 @@
|
||||
v-if="refreshTable"
|
||||
>
|
||||
#else
|
||||
<el-table v-loading="loading" :data="list" :stripe="true" :show-overflow-tooltip="true">
|
||||
<el-table
|
||||
row-key="id"
|
||||
v-loading="loading"
|
||||
:data="list"
|
||||
:stripe="true"
|
||||
:show-overflow-tooltip="true"
|
||||
#if ($deleteBatchEnable)
|
||||
@selection-change="handleRowCheckboxChange"
|
||||
#end
|
||||
>
|
||||
#end
|
||||
#if ($table.templateType != 2 && $deleteBatchEnable)
|
||||
<el-table-column type="selection" width="55" />
|
||||
#end
|
||||
## 特殊:主子表专属逻辑
|
||||
#if ( $table.templateType == 12 && $subTables && $subTables.size() > 0 )
|
||||
@ -234,13 +261,14 @@
|
||||
|
||||
<script setup lang="ts">
|
||||
import { getIntDictOptions, getStrDictOptions, getBoolDictOptions, DICT_TYPE } from '@/utils/dict'
|
||||
import { isEmpty } from '@/utils/is'
|
||||
import { dateFormatter } from '@/utils/formatTime'
|
||||
## 特殊:树表专属逻辑
|
||||
#if ( $table.templateType == 2 )
|
||||
import { handleTree } from '@/utils/tree'
|
||||
#end
|
||||
import download from '@/utils/download'
|
||||
import { ${simpleClassName}Api, ${simpleClassName}VO } from '@/api/${table.moduleName}/${table.businessName}'
|
||||
import { ${simpleClassName}Api, ${simpleClassName} } from '@/api/${table.moduleName}/${table.businessName}'
|
||||
import ${simpleClassName}Form from './${simpleClassName}Form.vue'
|
||||
## 特殊:主子表专属逻辑
|
||||
#if ( $table.templateType != 10 )
|
||||
@ -256,7 +284,7 @@ const message = useMessage() // 消息弹窗
|
||||
const { t } = useI18n() // 国际化
|
||||
|
||||
const loading = ref(true) // 列表的加载中
|
||||
const list = ref<${simpleClassName}VO[]>([]) // 列表的数据
|
||||
const list = ref<${simpleClassName}[]>([]) // 列表的数据
|
||||
## 特殊:树表专属逻辑(树不需要分页接口)
|
||||
#if ( $table.templateType != 2 )
|
||||
const total = ref(0) // 列表的总页数
|
||||
@ -330,6 +358,24 @@ const handleDelete = async (id: number) => {
|
||||
} catch {}
|
||||
}
|
||||
|
||||
#if ($table.templateType != 2 && $deleteBatchEnable)
|
||||
/** 批量删除${table.classComment} */
|
||||
const handleDeleteBatch = async () => {
|
||||
try {
|
||||
// 删除的二次确认
|
||||
await message.delConfirm()
|
||||
await ${simpleClassName}Api.delete${simpleClassName}List(checkedIds.value);
|
||||
message.success(t('common.delSuccess'))
|
||||
await getList();
|
||||
} catch {}
|
||||
}
|
||||
|
||||
const checkedIds = ref<number[]>([])
|
||||
const handleRowCheckboxChange = (records: ${simpleClassName}[]) => {
|
||||
checkedIds.value = records.map((item) => item.id);
|
||||
}
|
||||
#end
|
||||
|
||||
/** 导出按钮操作 */
|
||||
const handleExport = async () => {
|
||||
try {
|
||||
|
||||
@ -91,7 +91,7 @@ export function delete${simpleClassName}(id: number) {
|
||||
|
||||
#if ( $table.templateType != 2 && $deleteBatchEnable)
|
||||
/** 批量删除${table.classComment} */
|
||||
export function delete${simpleClassName}ListByIds(ids: number[]) {
|
||||
export function delete${simpleClassName}List(ids: number[]) {
|
||||
return requestClient.delete(`${baseURL}/delete-list?ids=${ids.join(',')}`)
|
||||
}
|
||||
#end
|
||||
@ -102,7 +102,6 @@ export function export${simpleClassName}(params: any) {
|
||||
}
|
||||
|
||||
## 特殊:主子表专属逻辑
|
||||
## TODO @puhui999:下面这块缩进调整了,会乱掉么?
|
||||
#foreach ($subTable in $subTables)
|
||||
#set ($index = $foreach.count - 1)
|
||||
#set ($subSimpleClassName = $subSimpleClassNames.get($index))
|
||||
@ -115,54 +114,54 @@ export function export${simpleClassName}(params: any) {
|
||||
|
||||
// ==================== 子表($subTable.classComment) ====================
|
||||
|
||||
## 情况一:MASTER_ERP 时,需要分查询页子表
|
||||
#if ( $table.templateType == 11 )
|
||||
/** 获得${subTable.classComment}分页 */
|
||||
export function get${subSimpleClassName}Page(params: PageParam) {
|
||||
return requestClient.get<PageResult<${simpleClassName}Api.${subSimpleClassName}>>(`${baseURL}/${subSimpleClassName_strikeCase}/page`, { params });
|
||||
}
|
||||
## 情况二:非 MASTER_ERP 时,需要列表查询子表
|
||||
#else
|
||||
#if ( $subTable.subJoinMany )
|
||||
/** 获得${subTable.classComment}列表 */
|
||||
export function get${subSimpleClassName}ListBy${SubJoinColumnName}(${subJoinColumn.javaField}: number) {
|
||||
return requestClient.get<${simpleClassName}Api.${subSimpleClassName}[]>(`${baseURL}/${subSimpleClassName_strikeCase}/list-by-${subJoinColumn_strikeCase}?${subJoinColumn.javaField}=${${subJoinColumn.javaField}}`);
|
||||
}
|
||||
#else
|
||||
/** 获得${subTable.classComment} */
|
||||
export function get${subSimpleClassName}By${SubJoinColumnName}(${subJoinColumn.javaField}: number) {
|
||||
return requestClient.get<${simpleClassName}Api.${subSimpleClassName}>(`${baseURL}/${subSimpleClassName_strikeCase}/get-by-${subJoinColumn_strikeCase}?${subJoinColumn.javaField}=${${subJoinColumn.javaField}}`);
|
||||
}
|
||||
#end
|
||||
#end
|
||||
## 特殊:MASTER_ERP 时,支持单个的新增、修改、删除操作
|
||||
#if ( $table.templateType == 11 )
|
||||
/** 新增${subTable.classComment} */
|
||||
export function create${subSimpleClassName}(data: ${simpleClassName}Api.${subSimpleClassName}) {
|
||||
return requestClient.post(`${baseURL}/${subSimpleClassName_strikeCase}/create`, data);
|
||||
}
|
||||
## 情况一:MASTER_ERP 时,需要分查询页子表
|
||||
#if ( $table.templateType == 11 )
|
||||
/** 获得${subTable.classComment}分页 */
|
||||
export function get${subSimpleClassName}Page(params: PageParam) {
|
||||
return requestClient.get<PageResult<${simpleClassName}Api.${subSimpleClassName}>>(`${baseURL}/${subSimpleClassName_strikeCase}/page`, { params });
|
||||
}
|
||||
## 情况二:非 MASTER_ERP 时,需要列表查询子表
|
||||
#else
|
||||
#if ( $subTable.subJoinMany )
|
||||
/** 获得${subTable.classComment}列表 */
|
||||
export function get${subSimpleClassName}ListBy${SubJoinColumnName}(${subJoinColumn.javaField}: number) {
|
||||
return requestClient.get<${simpleClassName}Api.${subSimpleClassName}[]>(`${baseURL}/${subSimpleClassName_strikeCase}/list-by-${subJoinColumn_strikeCase}?${subJoinColumn.javaField}=${${subJoinColumn.javaField}}`);
|
||||
}
|
||||
#else
|
||||
/** 获得${subTable.classComment} */
|
||||
export function get${subSimpleClassName}By${SubJoinColumnName}(${subJoinColumn.javaField}: number) {
|
||||
return requestClient.get<${simpleClassName}Api.${subSimpleClassName}>(`${baseURL}/${subSimpleClassName_strikeCase}/get-by-${subJoinColumn_strikeCase}?${subJoinColumn.javaField}=${${subJoinColumn.javaField}}`);
|
||||
}
|
||||
#end
|
||||
#end
|
||||
## 特殊:MASTER_ERP 时,支持单个的新增、修改、删除操作
|
||||
#if ( $table.templateType == 11 )
|
||||
/** 新增${subTable.classComment} */
|
||||
export function create${subSimpleClassName}(data: ${simpleClassName}Api.${subSimpleClassName}) {
|
||||
return requestClient.post(`${baseURL}/${subSimpleClassName_strikeCase}/create`, data);
|
||||
}
|
||||
|
||||
/** 修改${subTable.classComment} */
|
||||
export function update${subSimpleClassName}(data: ${simpleClassName}Api.${subSimpleClassName}) {
|
||||
return requestClient.put(`${baseURL}/${subSimpleClassName_strikeCase}/update`, data);
|
||||
}
|
||||
/** 修改${subTable.classComment} */
|
||||
export function update${subSimpleClassName}(data: ${simpleClassName}Api.${subSimpleClassName}) {
|
||||
return requestClient.put(`${baseURL}/${subSimpleClassName_strikeCase}/update`, data);
|
||||
}
|
||||
|
||||
/** 删除${subTable.classComment} */
|
||||
export function delete${subSimpleClassName}(id: number) {
|
||||
return requestClient.delete(`${baseURL}/${subSimpleClassName_strikeCase}/delete?id=${id}`);
|
||||
}
|
||||
/** 删除${subTable.classComment} */
|
||||
export function delete${subSimpleClassName}(id: number) {
|
||||
return requestClient.delete(`${baseURL}/${subSimpleClassName_strikeCase}/delete?id=${id}`);
|
||||
}
|
||||
|
||||
#if ($deleteBatchEnable)
|
||||
/** 批量删除${subTable.classComment} */
|
||||
export function delete${subSimpleClassName}ListByIds(ids: number[]) {
|
||||
return requestClient.delete(`${baseURL}/${subSimpleClassName_strikeCase}/delete-list?ids=${ids.join(',')}`)
|
||||
}
|
||||
#end
|
||||
|
||||
/** 获得${subTable.classComment} */
|
||||
export function get${subSimpleClassName}(id: number) {
|
||||
return requestClient.get<${simpleClassName}Api.${subSimpleClassName}>(`${baseURL}/${subSimpleClassName_strikeCase}/get?id=${id}`);
|
||||
}
|
||||
#end
|
||||
#if ($deleteBatchEnable)
|
||||
/** 批量删除${subTable.classComment} */
|
||||
export function delete${subSimpleClassName}List(ids: number[]) {
|
||||
return requestClient.delete(`${baseURL}/${subSimpleClassName_strikeCase}/delete-list?ids=${ids.join(',')}`)
|
||||
}
|
||||
#end
|
||||
|
||||
/** 获得${subTable.classComment} */
|
||||
export function get${subSimpleClassName}(id: number) {
|
||||
return requestClient.get<${simpleClassName}Api.${subSimpleClassName}>(`${baseURL}/${subSimpleClassName_strikeCase}/get?id=${id}`);
|
||||
}
|
||||
#end
|
||||
#end
|
||||
|
||||
|
||||
@ -8,7 +8,7 @@ import { ImageUpload, FileUpload } from "#/components/upload";
|
||||
import { message, Tabs, Form, Input, Textarea, Select, RadioGroup, Radio, CheckboxGroup, Checkbox, DatePicker, TreeSelect } from 'ant-design-vue';
|
||||
import { DICT_TYPE, getDictOptions } from '#/utils';
|
||||
#if($table.templateType == 2)## 树表需要导入这些
|
||||
import { get${simpleClassName}List } from '#/api/${table.moduleName}/${table.businessName}';
|
||||
import { get${simpleClassName}List } from '#/api/${table.moduleName}/${simpleClassName_strikeCase}';
|
||||
import { handleTree } from '@vben/utils'
|
||||
#end
|
||||
## 特殊:主子表专属逻辑
|
||||
@ -22,7 +22,7 @@ import { handleTree } from '@vben/utils'
|
||||
|
||||
import { computed, ref } from 'vue';
|
||||
import { $t } from '#/locales';
|
||||
import { get${simpleClassName}, create${simpleClassName}, update${simpleClassName} } from '#/api/${table.moduleName}/${table.businessName}';
|
||||
import { get${simpleClassName}, create${simpleClassName}, update${simpleClassName} } from '#/api/${table.moduleName}/${simpleClassName_strikeCase}';
|
||||
|
||||
const emit = defineEmits(['success']);
|
||||
|
||||
|
||||
@ -30,7 +30,7 @@ import { handleTree,isEmpty } from '@vben/utils'
|
||||
import { get${simpleClassName}List, delete${simpleClassName}, export${simpleClassName} } from '#/api/${table.moduleName}/${simpleClassName_strikeCase}';
|
||||
#else## 标准表接口
|
||||
import { isEmpty } from '@vben/utils';
|
||||
import { get${simpleClassName}Page, delete${simpleClassName},#if ($deleteBatchEnable) delete${simpleClassName}ListByIds,#end export${simpleClassName} } from '#/api/${table.moduleName}/${table.businessName}';
|
||||
import { get${simpleClassName}Page, delete${simpleClassName},#if ($deleteBatchEnable) delete${simpleClassName}List,#end export${simpleClassName} } from '#/api/${table.moduleName}/${simpleClassName_strikeCase}';
|
||||
#end
|
||||
import { downloadFileFromBlobPart } from '@vben/utils';
|
||||
|
||||
@ -123,24 +123,24 @@ const [FormModal, formModalApi] = useVbenModal({
|
||||
});
|
||||
|
||||
/** 创建${table.classComment} */
|
||||
function onCreate() {
|
||||
function handleCreate() {
|
||||
formModalApi.setData({}).open();
|
||||
}
|
||||
|
||||
/** 编辑${table.classComment} */
|
||||
function onEdit(row: ${simpleClassName}Api.${simpleClassName}) {
|
||||
function handleEdit(row: ${simpleClassName}Api.${simpleClassName}) {
|
||||
formModalApi.setData(row).open();
|
||||
}
|
||||
|
||||
#if (${table.templateType} == 2)## 树表特有:新增下级
|
||||
/** 新增下级${table.classComment} */
|
||||
function onAppend(row: ${simpleClassName}Api.${simpleClassName}) {
|
||||
function handleAppend(row: ${simpleClassName}Api.${simpleClassName}) {
|
||||
formModalApi.setData({ ${treeParentColumn.javaField}: row.id }).open();
|
||||
}
|
||||
#end
|
||||
|
||||
/** 删除${table.classComment} */
|
||||
async function onDelete(row: ${simpleClassName}Api.${simpleClassName}) {
|
||||
async function handleDelete(row: ${simpleClassName}Api.${simpleClassName}) {
|
||||
const hideLoading = message.loading({
|
||||
content: $t('ui.actionMessage.deleting', [row.id]),
|
||||
duration: 0,
|
||||
@ -160,14 +160,14 @@ async function onDelete(row: ${simpleClassName}Api.${simpleClassName}) {
|
||||
|
||||
#if ($table.templateType != 2 && $deleteBatchEnable)
|
||||
/** 批量删除${table.classComment} */
|
||||
async function onDeleteBatch() {
|
||||
async function handleDeleteBatch() {
|
||||
const hideLoading = message.loading({
|
||||
content: $t('ui.actionMessage.deleting'),
|
||||
duration: 0,
|
||||
key: 'action_process_msg',
|
||||
});
|
||||
try {
|
||||
await delete${simpleClassName}ListByIds(deleteIds.value);
|
||||
await delete${simpleClassName}List(checkedIds.value);
|
||||
message.success( $t('ui.actionMessage.deleteSuccess') );
|
||||
await getList();
|
||||
} finally {
|
||||
@ -175,13 +175,13 @@ async function onDeleteBatch() {
|
||||
}
|
||||
}
|
||||
|
||||
const deleteIds = ref<number[]>([]) // 待删除${table.classComment} ID
|
||||
function setDeleteIds({
|
||||
const checkedIds = ref<number[]>([])
|
||||
function handleRowCheckboxChange({
|
||||
records,
|
||||
}: {
|
||||
records: ${simpleClassName}Api.${simpleClassName}[];
|
||||
}) {
|
||||
deleteIds.value = records.map((item) => item.id);
|
||||
checkedIds.value = records.map((item) => item.id);
|
||||
}
|
||||
#end
|
||||
|
||||
@ -315,7 +315,7 @@ onMounted(() => {
|
||||
class="ml-2"
|
||||
:icon="h(Plus)"
|
||||
type="primary"
|
||||
@click="onCreate"
|
||||
@click="handleCreate"
|
||||
v-access:code="['${permissionPrefix}:create']"
|
||||
>
|
||||
{{ $t('ui.actionTitle.create', ['${table.classComment}']) }}
|
||||
@ -336,8 +336,8 @@ onMounted(() => {
|
||||
type="primary"
|
||||
danger
|
||||
class="ml-2"
|
||||
:disabled="isEmpty(deleteIds)"
|
||||
@click="onDeleteBatch"
|
||||
:disabled="isEmpty(checkedIds)"
|
||||
@click="handleDeleteBatch"
|
||||
v-access:code="['${table.moduleName}:${simpleClassName_strikeCase}:delete']"
|
||||
>
|
||||
批量删除
|
||||
@ -368,8 +368,8 @@ onMounted(() => {
|
||||
show-overflow
|
||||
:loading="loading"
|
||||
#if ($table.templateType != 2 && $deleteBatchEnable)
|
||||
@checkboxAll="setDeleteIds"
|
||||
@checkboxChange="setDeleteIds"
|
||||
@checkboxAll="handleRowCheckboxChange"
|
||||
@checkboxChange="handleRowCheckboxChange"
|
||||
#end
|
||||
>
|
||||
#if ($table.templateType != 2 && $deleteBatchEnable)
|
||||
@ -426,7 +426,7 @@ onMounted(() => {
|
||||
<Button
|
||||
size="small"
|
||||
type="link"
|
||||
@click="onAppend(row as any)"
|
||||
@click="handleAppend(row as any)"
|
||||
v-access:code="['${permissionPrefix}:create']"
|
||||
>
|
||||
新增下级
|
||||
@ -435,7 +435,7 @@ onMounted(() => {
|
||||
<Button
|
||||
size="small"
|
||||
type="link"
|
||||
@click="onEdit(row as any)"
|
||||
@click="handleEdit(row as any)"
|
||||
v-access:code="['${permissionPrefix}:update']"
|
||||
>
|
||||
{{ $t('ui.actionTitle.edit') }}
|
||||
@ -448,7 +448,7 @@ onMounted(() => {
|
||||
#if ( $table.templateType == 2 )
|
||||
:disabled="!isEmpty(row?.children)"
|
||||
#end
|
||||
@click="onDelete(row as any)"
|
||||
@click="handleDelete(row as any)"
|
||||
v-access:code="['${permissionPrefix}:delete']"
|
||||
>
|
||||
{{ $t('ui.actionTitle.delete') }}
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Loading…
x
Reference in New Issue
Block a user