feat: 增加系统变量功能

This commit is contained in:
taojinlong 2024-05-16 18:54:36 +08:00
parent 25d138f359
commit 98cbba3e68
5 changed files with 17 additions and 14 deletions

View File

@ -220,13 +220,15 @@ public class PermissionManage {
private String handleSysVariable(UserFormVO userEntity, String sysVariable) {
String value = null;
System.out.println(sysVariable);
System.out.println(JsonUtil.toJSONString(userEntity));
if (StringUtils.isNotBlank(sysVariable) && sysVariable.startsWith("${") && sysVariable.endsWith("}")) {
String variableId = sysVariable.substring(2, sysVariable.length() - 1);
for (SysVariableValueItem variable : userEntity.getVariables()) {
if (variableId.equalsIgnoreCase(variable.getVariableId())) {
if (variableId.equalsIgnoreCase(variable.getVariableId().toString())) {
if (variable.getSysVariableDto().getType().equalsIgnoreCase("text")) {
for (SysVariableValueDto sysVariableValueDto : variable.getValueList()) {
if (sysVariableValueDto.getId().toString().equals(variable.getVariableValueId())) {
if (sysVariableValueDto.getId().equals(variable.getVariableValueId())) {
value = sysVariableValueDto.getValue();
}
}

View File

@ -44,9 +44,6 @@ public class UserFormVO implements Serializable {
@Schema(description = "模式")
private String model;
@Schema(description = "系统变量")
private String sysVariable;
@Schema(description = "系统变量")
private List<SysVariableValueItem> variables;
}

View File

@ -2,7 +2,6 @@ package io.dataease.api.permissions.user.vo;
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
import com.fasterxml.jackson.databind.ser.std.ToStringSerializer;
import io.dataease.api.permissions.variable.dto.SysVariableValueItem;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
@ -28,5 +27,5 @@ public class UserGridVO {
@Schema(description = "创建时间")
private Long createTime;
@Schema(description = "系统变量")
private List<SysVariableValueItem> variables;
private String sysVariable;
}

View File

@ -36,7 +36,7 @@ public interface SysVariablesApi {
@Operation(summary = "详细信息")
@GetMapping("/detail/{id}")
SysVariableDto detail(@PathVariable String id);
SysVariableDto detail(@PathVariable Long id);
@Operation(summary = "查询")
@PostMapping("/query")
@ -55,7 +55,7 @@ public interface SysVariablesApi {
void deleteValue(@PathVariable String id);
@GetMapping("/value/selected/{id}")
List<SysVariableValueDto> selectVariableValue(@PathVariable("id") String id);
List<SysVariableValueDto> selectVariableValue(@PathVariable("id") Long id);
@PostMapping("/value/selected/{goPage}/{pageSize}")
IPage<SysVariableValueDto> selectPage(@PathVariable("goPage") int goPage, @PathVariable("pageSize") int pageSize, @RequestBody SysVariableValueDto sysVariableValueDto);

View File

@ -8,12 +8,17 @@ import java.util.List;
@Data
public class SysVariableValueItem {
private SysVariableDto sysVariableDto;
@JsonSerialize(using = ToStringSerializer.class)
private String variableId;
@JsonSerialize(using = ToStringSerializer.class)
private String variableValueId;
@JsonSerialize(using = ToStringSerializer.class)
private String variableValue;
@JsonSerialize(using = ToStringSerializer.class)
private String variableValue2;
private String variableType;
@JsonSerialize(using = ToStringSerializer.class)
private Long variableId;
@JsonSerialize(using = ToStringSerializer.class)
private Long variableValueId;
private String variableName;
private List<SysVariableValueDto> valueList;
private SysVariableDto sysVariableDto;
}