修改:常用参数确实导致的空列表问题
This commit is contained in:
parent
54d8a3e2e1
commit
d8c331f7d6
@ -11,7 +11,7 @@ import java.sql.Timestamp;
|
||||
|
||||
@SQLQuery(value = {
|
||||
@SQL(view = "getReportById",
|
||||
sql = "SELECT ymbr.series, ymbr.id, ymbr.title, ymbr.manufacturer_name, ymbr.model_name, ymbr.module , ymbr.manufacturer_abbreviation, ymbr.model_abbreviation, ymbr.product_number, ymbr.plate, ymbr.platform , ymbr.market_segment, ymbr.project_name, ymbr.project_number, ymbr.upload_time, ymbr.file_path , ymbr.status, xu.username AS create_by FROM yfsjglpt_model_benchmarking_report ymbr LEFT JOIN xdap_users xu ON xu.id = ymbr.create_by where ymbr.id = #reportId")
|
||||
sql = "SELECT ymbr.series, ymbr.id, ymbr.title, ymbr.manufacturer_name, ymbr.model_name, ymbr.module , ymbr.manufacturer_abbreviation, ymbr.model_abbreviation, ymbr.product_number, ymbr.plate, ymbr.platform , ymbr.market_segment, ymbr.project_name, ymbr.project_number, ymbr.upload_time, ymbr.file_path , ymbr.status, ymbr.file_name, xu.username AS create_by FROM yfsjglpt_model_benchmarking_report ymbr LEFT JOIN xdap_users xu ON xu.id = ymbr.create_by where ymbr.id = #reportId")
|
||||
})
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@Data
|
||||
|
||||
@ -198,12 +198,13 @@ public class CommonParameterServiceImpl implements CommonParameterService {
|
||||
private List<ModelCommon> convertToModelCommonList(
|
||||
List<ModelCommonParameters> paramsList, List<CommonParameter> commonParameters
|
||||
) {
|
||||
if (paramsList == null || paramsList.isEmpty()) {
|
||||
return new ArrayList<>();
|
||||
Map<String, List<ModelCommonParameters>> groupedByCommonId = new HashMap<>();
|
||||
if (paramsList != null && !paramsList.isEmpty()) {
|
||||
groupedByCommonId = paramsList.stream()
|
||||
.filter(param -> param.getCommonId() != null) // 过滤掉 commonId 为 null 的参数
|
||||
.collect(Collectors.groupingBy(ModelCommonParameters::getCommonId));
|
||||
}
|
||||
Map<String, List<ModelCommonParameters>> groupedByCommonId = paramsList.stream()
|
||||
.filter(param -> param.getCommonId() != null) // 过滤掉 commonId 为 null 的参数
|
||||
.collect(Collectors.groupingBy(ModelCommonParameters::getCommonId));
|
||||
|
||||
List<ModelCommon> result = new ArrayList<>();
|
||||
for (CommonParameter commonParameter : commonParameters) {
|
||||
String commonId = commonParameter.getId();
|
||||
@ -211,35 +212,37 @@ public class CommonParameterServiceImpl implements CommonParameterService {
|
||||
continue;
|
||||
}
|
||||
List<ModelCommonParameters> commonParams = groupedByCommonId.get(commonId);
|
||||
if (commonParams == null || commonParams.isEmpty()) {
|
||||
continue;
|
||||
}
|
||||
|
||||
ModelCommon modelCommon = new ModelCommon();
|
||||
modelCommon.setCommonName(commonParameter.getCommonName());
|
||||
modelCommon.setCommonId(commonId);
|
||||
Map<String, List<ModelCommonParameters>> groupedBySubsystem = commonParams.stream()
|
||||
.filter(param -> param.getSubsystemName() != null) // 过滤掉 subsystemName 为 null 的参数
|
||||
.collect(Collectors.groupingBy(ModelCommonParameters::getSubsystemName));
|
||||
if (groupedBySubsystem.isEmpty()) {
|
||||
continue;
|
||||
|
||||
if (commonParams == null || commonParams.isEmpty()) {
|
||||
// 即使没有参数,也返回一个空的子系统列表
|
||||
modelCommon.setSubsystems(new ArrayList<>());
|
||||
} else {
|
||||
Map<String, List<ModelCommonParameters>> groupedBySubsystem = commonParams.stream()
|
||||
.filter(param -> param.getSubsystemName() != null) // 过滤掉 subsystemName 为 null 的参数
|
||||
.collect(Collectors.groupingBy(ModelCommonParameters::getSubsystemName));
|
||||
|
||||
List<ModelCommonItem> items = new ArrayList<>();
|
||||
for (Map.Entry<String, List<ModelCommonParameters>> subsystemEntry : groupedBySubsystem.entrySet()) {
|
||||
ModelCommonItem item = new ModelCommonItem();
|
||||
item.setSubsystem(subsystemEntry.getKey());
|
||||
List<ParametersView> parameters = subsystemEntry.getValue().stream()
|
||||
.map(param -> new ParametersView(
|
||||
param.getParameterId(),
|
||||
param.getParameterName(),
|
||||
param.getParameterType(),
|
||||
param.getSubsystemName(),
|
||||
param.getPartsName()
|
||||
))
|
||||
.collect(Collectors.toList());
|
||||
item.setParameters(parameters);
|
||||
items.add(item);
|
||||
}
|
||||
modelCommon.setSubsystems(items);
|
||||
}
|
||||
List<ModelCommonItem> items = new ArrayList<>();
|
||||
for (Map.Entry<String, List<ModelCommonParameters>> subsystemEntry : groupedBySubsystem.entrySet()) {
|
||||
ModelCommonItem item = new ModelCommonItem();
|
||||
item.setSubsystem(subsystemEntry.getKey());
|
||||
List<ParametersView> parameters = subsystemEntry.getValue().stream()
|
||||
.map(param -> new ParametersView(
|
||||
param.getParameterId(),
|
||||
param.getParameterName(),
|
||||
param.getParameterType(),
|
||||
param.getSubsystemName(),
|
||||
param.getPartsName()
|
||||
))
|
||||
.collect(Collectors.toList());
|
||||
item.setParameters(parameters);
|
||||
items.add(item);
|
||||
}
|
||||
modelCommon.setSubsystems(items);
|
||||
result.add(modelCommon);
|
||||
}
|
||||
return result;
|
||||
|
||||
@ -83,45 +83,45 @@ public class TemplateServiceImpl implements TemplateService {
|
||||
.doQueryFirst(Template.class);
|
||||
|
||||
if (template != null) {
|
||||
if (Objects.equals(form.getTemplateName(), template.getTemplateName()) && form.getOrderNum() != null) {
|
||||
List<Long> sorted = bd.getBusinessDatabase()
|
||||
.groupBy("order_num")
|
||||
.orderBy("order_num", "desc")
|
||||
.doQuery(Template.class)
|
||||
.stream().map(Template::getOrderNum)
|
||||
.collect(Collectors.toList());
|
||||
|
||||
Long num = sorted.get(form.getOrderNum() - 1);
|
||||
if (num == null) {
|
||||
num = sorted.get(sorted.size() - 1);
|
||||
}
|
||||
|
||||
List<String> originalTemplateId = bd.getBusinessDatabase()
|
||||
.eq("order_num", template.getOrderNum())
|
||||
.doQuery(Template.class).stream().map(Template::getId)
|
||||
.collect(Collectors.toList());
|
||||
List<String> updateTemplateId = bd.getBusinessDatabase()
|
||||
.eq("order_num", num)
|
||||
.doQuery(Template.class).stream().map(Template::getId)
|
||||
.collect(Collectors.toList());
|
||||
|
||||
if (updateTemplateId.isEmpty()) {
|
||||
bd.getBusinessDatabase()
|
||||
.in("id", originalTemplateId)
|
||||
.update("order_num", System.currentTimeMillis())
|
||||
.doUpdate(Template.class);
|
||||
} else {
|
||||
bd.getBusinessDatabase()
|
||||
.in("id", updateTemplateId)
|
||||
.update("order_num", template.getOrderNum())
|
||||
.doUpdate(Template.class);
|
||||
bd.getBusinessDatabase()
|
||||
.in("id", originalTemplateId)
|
||||
.update("order_num", num)
|
||||
.doUpdate(Template.class);
|
||||
}
|
||||
return;
|
||||
}
|
||||
// if (Objects.equals(form.getTemplateName(), template.getTemplateName()) && form.getOrderNum() != null) {
|
||||
// List<Long> sorted = bd.getBusinessDatabase()
|
||||
// .groupBy("order_num")
|
||||
// .orderBy("order_num", "desc")
|
||||
// .doQuery(Template.class)
|
||||
// .stream().map(Template::getOrderNum)
|
||||
// .collect(Collectors.toList());
|
||||
//
|
||||
// Long num = sorted.get(form.getOrderNum() - 1);
|
||||
// if (num == null) {
|
||||
// num = sorted.get(sorted.size() - 1);
|
||||
// }
|
||||
//
|
||||
// List<String> originalTemplateId = bd.getBusinessDatabase()
|
||||
// .eq("order_num", template.getOrderNum())
|
||||
// .doQuery(Template.class).stream().map(Template::getId)
|
||||
// .collect(Collectors.toList());
|
||||
// List<String> updateTemplateId = bd.getBusinessDatabase()
|
||||
// .eq("order_num", num)
|
||||
// .doQuery(Template.class).stream().map(Template::getId)
|
||||
// .collect(Collectors.toList());
|
||||
//
|
||||
// if (updateTemplateId.isEmpty()) {
|
||||
// bd.getBusinessDatabase()
|
||||
// .in("id", originalTemplateId)
|
||||
// .update("order_num", System.currentTimeMillis())
|
||||
// .doUpdate(Template.class);
|
||||
// } else {
|
||||
// bd.getBusinessDatabase()
|
||||
// .in("id", updateTemplateId)
|
||||
// .update("order_num", template.getOrderNum())
|
||||
// .doUpdate(Template.class);
|
||||
// bd.getBusinessDatabase()
|
||||
// .in("id", originalTemplateId)
|
||||
// .update("order_num", num)
|
||||
// .doUpdate(Template.class);
|
||||
// }
|
||||
// return;
|
||||
// }
|
||||
throw new CommonException("不可修改为已有模板");
|
||||
}
|
||||
|
||||
|
||||
@ -385,6 +385,14 @@ FROM yfsjglpt_model_approval_record;
|
||||
DELETE
|
||||
FROM yfsjglpt_model_responsible_person;
|
||||
|
||||
DELETE
|
||||
FROM yfsjglpt_model_common_parameters;
|
||||
|
||||
DELETE
|
||||
FROM yfsjglpt_common_parameter;
|
||||
DELETE
|
||||
FROM yfsjglpt_analysis_common_parameters;
|
||||
|
||||
|
||||
|
||||
delete
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user