Commit 1783d68d by zhouhaibao

refactor(sop): 优化SOP条件变量操作符数据结构

- 将SopConditionVariableDTO中的operators字段类型从SopStrategyMetaDTO.SopMetaItemDTO改为SopStrategyMetaDTO.SopMetaItemDTOInt
- 在SopStrategyMetaDTO中新增SopMetaItemDTOInt内部类用于操作符定义
- 修改buildOperatorsByVariableType方法返回类型为SopMetaItemDTOInt列表
- 更新createMetaItemInt方法创建整数类型操作符项
- 修改Mapper XML文件增加valueSource和variableRefCode字段映射
1 parent 36430a9b
...@@ -43,7 +43,7 @@ public class SopConditionVariableDTO implements Serializable { ...@@ -43,7 +43,7 @@ public class SopConditionVariableDTO implements Serializable {
private List<SopEnumValueDTO> enumValues; private List<SopEnumValueDTO> enumValues;
@ApiModelProperty(notes = "可用操作符列表") @ApiModelProperty(notes = "可用操作符列表")
private List<SopStrategyMetaDTO.SopMetaItemDTO> operators; private List<SopStrategyMetaDTO.SopMetaItemDTOInt> operators;
@ApiModelProperty(notes = "可选的变量列表") @ApiModelProperty(notes = "可选的变量列表")
private List<SopConditionVariableDTO> sopConditionVariableDTOList; private List<SopConditionVariableDTO> sopConditionVariableDTOList;
......
...@@ -45,4 +45,23 @@ public class SopStrategyMetaDTO implements Serializable { ...@@ -45,4 +45,23 @@ public class SopStrategyMetaDTO implements Serializable {
@ApiModelProperty(notes = "描述") @ApiModelProperty(notes = "描述")
private String description; private String description;
} }
/**
* 元数据项DTO
*/
@Data
public static class SopMetaItemDTOInt implements Serializable{
@ApiModelProperty(notes = "编码")
private Integer code;
@ApiModelProperty(notes = "名称")
private String name;
@ApiModelProperty(notes = "类型")
private Integer type;
@ApiModelProperty(notes = "描述")
private String description;
}
} }
\ No newline at end of file \ No newline at end of file
...@@ -358,8 +358,8 @@ public class StrategySopQueryService { ...@@ -358,8 +358,8 @@ public class StrategySopQueryService {
* @param variableType 变量类型 * @param variableType 变量类型
* @return 可用操作符列表 * @return 可用操作符列表
*/ */
private List<SopStrategyMetaDTO.SopMetaItemDTO> buildOperatorsByVariableType(Integer variableType) { private List<SopStrategyMetaDTO.SopMetaItemDTOInt> buildOperatorsByVariableType(Integer variableType) {
List<SopStrategyMetaDTO.SopMetaItemDTO> items = new ArrayList<>(); List<SopStrategyMetaDTO.SopMetaItemDTOInt> items = new ArrayList<>();
if (variableType == null) { if (variableType == null) {
return items; return items;
...@@ -372,45 +372,45 @@ public class StrategySopQueryService { ...@@ -372,45 +372,45 @@ public class StrategySopQueryService {
switch (typeEnum) { switch (typeEnum) {
case DATE: case DATE:
items.add(createMetaItem(String.valueOf(SopOperatorTypeEnum.LESS_THAN.getValue()), items.add(createMetaItemInt(SopOperatorTypeEnum.LESS_THAN.getValue(),
SopOperatorTypeEnum.LESS_THAN.getDisplayName(), 4, SopOperatorTypeEnum.LESS_THAN.getDisplayName())); SopOperatorTypeEnum.LESS_THAN.getDisplayName(), 4, SopOperatorTypeEnum.LESS_THAN.getDisplayName()));
items.add(createMetaItem(String.valueOf(SopOperatorTypeEnum.EQUAL_TO.getValue()), items.add(createMetaItemInt(SopOperatorTypeEnum.EQUAL_TO.getValue(),
SopOperatorTypeEnum.EQUAL_TO.getDisplayName(), 4, SopOperatorTypeEnum.EQUAL_TO.getDisplayName())); SopOperatorTypeEnum.EQUAL_TO.getDisplayName(), 4, SopOperatorTypeEnum.EQUAL_TO.getDisplayName()));
items.add(createMetaItem(String.valueOf(SopOperatorTypeEnum.GREATER_THAN.getValue()), items.add(createMetaItemInt(SopOperatorTypeEnum.GREATER_THAN.getValue(),
SopOperatorTypeEnum.GREATER_THAN.getDisplayName(), 4, SopOperatorTypeEnum.GREATER_THAN.getDisplayName())); SopOperatorTypeEnum.GREATER_THAN.getDisplayName(), 4, SopOperatorTypeEnum.GREATER_THAN.getDisplayName()));
break; break;
case NUMBER: case NUMBER:
items.add(createMetaItem(String.valueOf(SopOperatorTypeEnum.EQUAL_TO.getValue()), items.add(createMetaItemInt(SopOperatorTypeEnum.EQUAL_TO.getValue(),
SopOperatorTypeEnum.EQUAL_TO.getDisplayName(), 4, SopOperatorTypeEnum.EQUAL_TO.getDisplayName())); SopOperatorTypeEnum.EQUAL_TO.getDisplayName(), 4, SopOperatorTypeEnum.EQUAL_TO.getDisplayName()));
items.add(createMetaItem(String.valueOf(SopOperatorTypeEnum.NOT_EQUAL_TO.getValue()), items.add(createMetaItemInt(SopOperatorTypeEnum.NOT_EQUAL_TO.getValue(),
SopOperatorTypeEnum.NOT_EQUAL_TO.getDisplayName(), 4, SopOperatorTypeEnum.NOT_EQUAL_TO.getDisplayName())); SopOperatorTypeEnum.NOT_EQUAL_TO.getDisplayName(), 4, SopOperatorTypeEnum.NOT_EQUAL_TO.getDisplayName()));
items.add(createMetaItem(String.valueOf(SopOperatorTypeEnum.GREATER.getValue()), items.add(createMetaItemInt(SopOperatorTypeEnum.GREATER.getValue(),
SopOperatorTypeEnum.GREATER.getDisplayName(), 4, SopOperatorTypeEnum.GREATER.getDisplayName())); SopOperatorTypeEnum.GREATER.getDisplayName(), 4, SopOperatorTypeEnum.GREATER.getDisplayName()));
items.add(createMetaItem(String.valueOf(SopOperatorTypeEnum.GREATER_EQUAL.getValue()), items.add(createMetaItemInt(SopOperatorTypeEnum.GREATER_EQUAL.getValue(),
SopOperatorTypeEnum.GREATER_EQUAL.getDisplayName(), 4, SopOperatorTypeEnum.GREATER_EQUAL.getDisplayName())); SopOperatorTypeEnum.GREATER_EQUAL.getDisplayName(), 4, SopOperatorTypeEnum.GREATER_EQUAL.getDisplayName()));
items.add(createMetaItem(String.valueOf(SopOperatorTypeEnum.LESS.getValue()), items.add(createMetaItemInt(SopOperatorTypeEnum.LESS.getValue(),
SopOperatorTypeEnum.LESS.getDisplayName(), 4, SopOperatorTypeEnum.LESS.getDisplayName())); SopOperatorTypeEnum.LESS.getDisplayName(), 4, SopOperatorTypeEnum.LESS.getDisplayName()));
items.add(createMetaItem(String.valueOf(SopOperatorTypeEnum.LESS_EQUAL.getValue()), items.add(createMetaItemInt(SopOperatorTypeEnum.LESS_EQUAL.getValue(),
SopOperatorTypeEnum.LESS_EQUAL.getDisplayName(), 4, SopOperatorTypeEnum.LESS_EQUAL.getDisplayName())); SopOperatorTypeEnum.LESS_EQUAL.getDisplayName(), 4, SopOperatorTypeEnum.LESS_EQUAL.getDisplayName()));
break; break;
case TEXT: case TEXT:
items.add(createMetaItem(String.valueOf(SopOperatorTypeEnum.CONTAINS.getValue()), items.add(createMetaItemInt(SopOperatorTypeEnum.CONTAINS.getValue(),
SopOperatorTypeEnum.CONTAINS.getDisplayName(), 4, SopOperatorTypeEnum.CONTAINS.getDisplayName())); SopOperatorTypeEnum.CONTAINS.getDisplayName(), 4, SopOperatorTypeEnum.CONTAINS.getDisplayName()));
items.add(createMetaItem(String.valueOf(SopOperatorTypeEnum.NOT_CONTAINS.getValue()), items.add(createMetaItemInt(SopOperatorTypeEnum.NOT_CONTAINS.getValue(),
SopOperatorTypeEnum.NOT_CONTAINS.getDisplayName(), 4, SopOperatorTypeEnum.NOT_CONTAINS.getDisplayName())); SopOperatorTypeEnum.NOT_CONTAINS.getDisplayName(), 4, SopOperatorTypeEnum.NOT_CONTAINS.getDisplayName()));
items.add(createMetaItem(String.valueOf(SopOperatorTypeEnum.EQUAL_TO.getValue()), items.add(createMetaItemInt(SopOperatorTypeEnum.EQUAL_TO.getValue(),
SopOperatorTypeEnum.EQUAL_TO.getDisplayName(), 4, SopOperatorTypeEnum.EQUAL_TO.getDisplayName())); SopOperatorTypeEnum.EQUAL_TO.getDisplayName(), 4, SopOperatorTypeEnum.EQUAL_TO.getDisplayName()));
items.add(createMetaItem(String.valueOf(SopOperatorTypeEnum.NOT_EQUAL_TO.getValue()), items.add(createMetaItemInt(SopOperatorTypeEnum.NOT_EQUAL_TO.getValue(),
SopOperatorTypeEnum.NOT_EQUAL_TO.getDisplayName(), 4, SopOperatorTypeEnum.NOT_EQUAL_TO.getDisplayName())); SopOperatorTypeEnum.NOT_EQUAL_TO.getDisplayName(), 4, SopOperatorTypeEnum.NOT_EQUAL_TO.getDisplayName()));
break; break;
case ENUM: case ENUM:
items.add(createMetaItem(String.valueOf(SopOperatorTypeEnum.CONTAINS.getValue()), items.add(createMetaItemInt(SopOperatorTypeEnum.CONTAINS.getValue(),
SopOperatorTypeEnum.CONTAINS.getDisplayName(), 4, SopOperatorTypeEnum.CONTAINS.getDisplayName())); SopOperatorTypeEnum.CONTAINS.getDisplayName(), 4, SopOperatorTypeEnum.CONTAINS.getDisplayName()));
items.add(createMetaItem(String.valueOf(SopOperatorTypeEnum.NOT_CONTAINS.getValue()), items.add(createMetaItemInt(SopOperatorTypeEnum.NOT_CONTAINS.getValue(),
SopOperatorTypeEnum.NOT_CONTAINS.getDisplayName(), 4, SopOperatorTypeEnum.NOT_CONTAINS.getDisplayName())); SopOperatorTypeEnum.NOT_CONTAINS.getDisplayName(), 4, SopOperatorTypeEnum.NOT_CONTAINS.getDisplayName()));
items.add(createMetaItem(String.valueOf(SopOperatorTypeEnum.EQUAL_TO.getValue()), items.add(createMetaItemInt(SopOperatorTypeEnum.EQUAL_TO.getValue(),
SopOperatorTypeEnum.EQUAL_TO.getDisplayName(), 4, SopOperatorTypeEnum.EQUAL_TO.getDisplayName())); SopOperatorTypeEnum.EQUAL_TO.getDisplayName(), 4, SopOperatorTypeEnum.EQUAL_TO.getDisplayName()));
items.add(createMetaItem(String.valueOf(SopOperatorTypeEnum.NOT_EQUAL_TO.getValue()), items.add(createMetaItemInt(SopOperatorTypeEnum.NOT_EQUAL_TO.getValue(),
SopOperatorTypeEnum.NOT_EQUAL_TO.getDisplayName(), 4, SopOperatorTypeEnum.NOT_EQUAL_TO.getDisplayName())); SopOperatorTypeEnum.NOT_EQUAL_TO.getDisplayName(), 4, SopOperatorTypeEnum.NOT_EQUAL_TO.getDisplayName()));
break; break;
default: default:
...@@ -485,6 +485,24 @@ public class StrategySopQueryService { ...@@ -485,6 +485,24 @@ public class StrategySopQueryService {
} }
/** /**
* 创建元数据项DTO
*
* @param code 编码
* @param name 名称
* @param type 类型
* @param description 描述
* @return 元数据项DTO
*/
private SopStrategyMetaDTO.SopMetaItemDTOInt createMetaItemInt(Integer code, String name, Integer type, String description) {
SopStrategyMetaDTO.SopMetaItemDTOInt item = new SopStrategyMetaDTO.SopMetaItemDTOInt();
item.setCode(code);
item.setName(name);
item.setType(type);
item.setDescription(description);
return item;
}
/**
* 根据记录ID查询策略执行记录详情 * 根据记录ID查询策略执行记录详情
* *
* @param recordId 执行记录ID * @param recordId 执行记录ID
......
...@@ -12,6 +12,8 @@ ...@@ -12,6 +12,8 @@
<result column="variable_name" property="variableName"/> <result column="variable_name" property="variableName"/>
<result column="value_type" property="valueType"/> <result column="value_type" property="valueType"/>
<result column="operator" property="operator"/> <result column="operator" property="operator"/>
<result column="value_source" property="valueSource"/>
<result column="variable_ref_code" property="variableRefCode"/>
<result column="text_value" property="textValue"/> <result column="text_value" property="textValue"/>
<result column="number_value" property="numberValue"/> <result column="number_value" property="numberValue"/>
<result column="date_value" property="dateValue"/> <result column="date_value" property="dateValue"/>
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!