mirror of
https://github.com/dromara/RuoYi-Vue-Plus.git
synced 2026-04-26 21:14:28 +08:00
Compare commits
2 Commits
ddff4ae38d
...
cf006a47da
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
cf006a47da | ||
|
|
14df8e0d9a |
@@ -46,6 +46,24 @@ public class DataBaseHelper {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取指定数据源对应的数据库类型
|
||||
*
|
||||
* @param dsName 数据源名称
|
||||
* @return 指定数据库对应的 DataBaseType 枚举,找不到时默认返回 MY_SQL
|
||||
* @throws ServiceException 当获取数据库连接或元数据出现异常时抛出业务异常
|
||||
*/
|
||||
public static DataBaseType getDataBaseType(String dsName) {
|
||||
DataSource dataSource = DS.getDataSource(dsName);
|
||||
try (Connection conn = dataSource.getConnection()) {
|
||||
DatabaseMetaData metaData = conn.getMetaData();
|
||||
String databaseProductName = metaData.getDatabaseProductName();
|
||||
return DataBaseType.find(databaseProductName);
|
||||
} catch (SQLException e) {
|
||||
throw new RuntimeException("获取数据库类型失败", e);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据当前数据库类型,生成兼容的 FIND_IN_SET 语句片段
|
||||
* <p>
|
||||
|
||||
@@ -331,7 +331,7 @@ public class GenTableServiceImpl implements IGenTableService {
|
||||
VelocityContext context = VelocityUtils.prepareContext(table);
|
||||
|
||||
// 获取模板列表
|
||||
List<String> templates = VelocityUtils.getTemplateList(table.getTplCategory());
|
||||
List<String> templates = VelocityUtils.getTemplateList(table.getTplCategory(), table.getDataName());
|
||||
for (String template : templates) {
|
||||
// 渲染模板
|
||||
StringWriter sw = new StringWriter();
|
||||
@@ -374,7 +374,7 @@ public class GenTableServiceImpl implements IGenTableService {
|
||||
VelocityContext context = VelocityUtils.prepareContext(table);
|
||||
|
||||
// 获取模板列表
|
||||
List<String> templates = VelocityUtils.getTemplateList(table.getTplCategory());
|
||||
List<String> templates = VelocityUtils.getTemplateList(table.getTplCategory(), table.getDataName());
|
||||
for (String template : templates) {
|
||||
if (!StringUtils.containsAny(template, "sql.vm", "api.ts.vm", "types.ts.vm", "index.vue.vm", "index-tree.vue.vm")) {
|
||||
// 渲染模板
|
||||
@@ -478,7 +478,7 @@ public class GenTableServiceImpl implements IGenTableService {
|
||||
VelocityContext context = VelocityUtils.prepareContext(table);
|
||||
|
||||
// 获取模板列表
|
||||
List<String> templates = VelocityUtils.getTemplateList(table.getTplCategory());
|
||||
List<String> templates = VelocityUtils.getTemplateList(table.getTplCategory(), table.getDataName());
|
||||
for (String template : templates) {
|
||||
// 渲染模板
|
||||
StringWriter sw = new StringWriter();
|
||||
|
||||
@@ -109,7 +109,7 @@ public class VelocityUtils {
|
||||
*
|
||||
* @return 模板列表
|
||||
*/
|
||||
public static List<String> getTemplateList(String tplCategory) {
|
||||
public static List<String> getTemplateList(String tplCategory, String dsName) {
|
||||
List<String> templates = new ArrayList<>();
|
||||
templates.add("vm/java/domain.java.vm");
|
||||
templates.add("vm/java/vo.java.vm");
|
||||
@@ -119,7 +119,7 @@ public class VelocityUtils {
|
||||
templates.add("vm/java/serviceImpl.java.vm");
|
||||
templates.add("vm/java/controller.java.vm");
|
||||
templates.add("vm/xml/mapper.xml.vm");
|
||||
DataBaseType dataBaseType = DataBaseHelper.getDataBaseType();
|
||||
DataBaseType dataBaseType = DataBaseHelper.getDataBaseType(dsName);
|
||||
if (dataBaseType.isOracle()) {
|
||||
templates.add("vm/sql/oracle/sql.vm");
|
||||
} else if (dataBaseType.isPostgreSql()) {
|
||||
|
||||
@@ -232,8 +232,9 @@ public class FlwTaskServiceImpl implements IFlwTaskService {
|
||||
if (BusinessStatusEnum.isDraftOrCancelOrBack(ins.getFlowStatus())) {
|
||||
variables.put(SUBMIT, true);
|
||||
}
|
||||
Map<String, Object> insVariableMap = ins.getVariableMap();
|
||||
// 设置弹窗处理人
|
||||
Map<String, Object> assigneeMap = setPopAssigneeMap(completeTaskBo.getAssigneeMap(), ins.getVariableMap());
|
||||
Map<String, Object> assigneeMap = setPopAssigneeMap(completeTaskBo.getAssigneeMap(), insVariableMap);
|
||||
if (CollUtil.isNotEmpty(assigneeMap)) {
|
||||
variables.putAll(assigneeMap);
|
||||
}
|
||||
@@ -249,7 +250,7 @@ public class FlwTaskServiceImpl implements IFlwTaskService {
|
||||
.flowStatus(BusinessStatusEnum.WAITING.getStatus())
|
||||
.hisStatus(TaskStatusEnum.PASS.getStatus())
|
||||
.hisTaskExt(completeTaskBo.getFileId());
|
||||
Boolean autoPass = Convert.toBool(variables.getOrDefault(AUTO_PASS, false));
|
||||
Boolean autoPass = Convert.toBool(insVariableMap.getOrDefault(AUTO_PASS, false));
|
||||
skipTask(taskId, flowParams, flowTask.getInstanceId(), autoPass);
|
||||
return true;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user