refactor: 简化 ModelParamSaveDTO,移除冗余字段
- 移除外层 modelName 字段 - 将 ParamItem 重命名为 ParamValueItem - 内部类只保留 paramCode 和 paramValue 字段 - 同步更新 Service 层类型引用
This commit is contained in:
@@ -18,35 +18,19 @@ public class ModelParamSaveDTO {
|
|||||||
@NotBlank(message = "模型编码不能为空")
|
@NotBlank(message = "模型编码不能为空")
|
||||||
private String modelCode;
|
private String modelCode;
|
||||||
|
|
||||||
/** 模型名称 */
|
|
||||||
@NotBlank(message = "模型名称不能为空")
|
|
||||||
private String modelName;
|
|
||||||
|
|
||||||
/** 参数列表 */
|
/** 参数列表 */
|
||||||
@NotNull(message = "参数列表不能为空")
|
@NotNull(message = "参数列表不能为空")
|
||||||
private List<ParamItem> params;
|
private List<ParamValueItem> params;
|
||||||
|
|
||||||
@Data
|
@Data
|
||||||
public static class ParamItem {
|
public static class ParamValueItem {
|
||||||
|
|
||||||
/** 参数编码 */
|
/** 参数编码 */
|
||||||
@NotBlank(message = "参数编码不能为空")
|
@NotBlank(message = "参数编码不能为空")
|
||||||
private String paramCode;
|
private String paramCode;
|
||||||
|
|
||||||
/** 监测项名称 */
|
|
||||||
private String paramName;
|
|
||||||
|
|
||||||
/** 参数描述 */
|
|
||||||
private String paramDesc;
|
|
||||||
|
|
||||||
/** 参数值 - 唯一可修改字段 */
|
/** 参数值 - 唯一可修改字段 */
|
||||||
@NotBlank(message = "参数值不能为空")
|
@NotBlank(message = "参数值不能为空")
|
||||||
private String paramValue;
|
private String paramValue;
|
||||||
|
|
||||||
/** 参数单位 */
|
|
||||||
private String paramUnit;
|
|
||||||
|
|
||||||
/** 排序号 */
|
|
||||||
private Integer sortOrder;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -102,7 +102,7 @@ public class CcdiModelParamServiceImpl implements ICcdiModelParamService {
|
|||||||
|
|
||||||
// 准备更新列表 - 只更新 param_value 字段
|
// 准备更新列表 - 只更新 param_value 字段
|
||||||
List<CcdiModelParam> updateList = new ArrayList<>();
|
List<CcdiModelParam> updateList = new ArrayList<>();
|
||||||
for (ModelParamSaveDTO.ParamItem item : saveDTO.getParams()) {
|
for (ModelParamSaveDTO.ParamValueItem item : saveDTO.getParams()) {
|
||||||
CcdiModelParam existing = existingMap.get(item.getParamCode());
|
CcdiModelParam existing = existingMap.get(item.getParamCode());
|
||||||
|
|
||||||
if (existing != null) {
|
if (existing != null) {
|
||||||
|
|||||||
Reference in New Issue
Block a user