修改:机型常用添加整机参数
This commit is contained in:
parent
8eeea683e9
commit
d2da60badc
@ -1,5 +1,6 @@
|
|||||||
package com.xdap.self_development.controller.form;
|
package com.xdap.self_development.controller.form;
|
||||||
|
|
||||||
|
import com.xdap.self_development.pojo.view.ParameterItem;
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
|
|
||||||
import javax.validation.constraints.NotBlank;
|
import javax.validation.constraints.NotBlank;
|
||||||
@ -14,5 +15,5 @@ public class ModelCommonParameterInsertForm {
|
|||||||
@NotBlank(message = "常用名不能为空")
|
@NotBlank(message = "常用名不能为空")
|
||||||
private String commonName;
|
private String commonName;
|
||||||
@NotEmpty(message = "参数不能为空")
|
@NotEmpty(message = "参数不能为空")
|
||||||
private List<String> parameters;
|
private List<ParameterItem> parameters;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1,5 +1,6 @@
|
|||||||
package com.xdap.self_development.controller.form;
|
package com.xdap.self_development.controller.form;
|
||||||
|
|
||||||
|
import com.xdap.self_development.pojo.view.ParameterItem;
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
|
|
||||||
import javax.validation.constraints.NotBlank;
|
import javax.validation.constraints.NotBlank;
|
||||||
@ -14,5 +15,5 @@ public class ModelCommonParameterUpdateForm {
|
|||||||
@NotBlank(message = "常用不能为空")
|
@NotBlank(message = "常用不能为空")
|
||||||
private String commonId;
|
private String commonId;
|
||||||
@NotEmpty(message = "参数不能为空")
|
@NotEmpty(message = "参数不能为空")
|
||||||
private List<String> parameters;
|
private List<ParameterItem> parameters;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -0,0 +1,27 @@
|
|||||||
|
package com.xdap.self_development.pojo;
|
||||||
|
|
||||||
|
import com.alibaba.excel.annotation.ExcelProperty;
|
||||||
|
import com.definesys.mpaas.query.annotation.RowID;
|
||||||
|
import com.definesys.mpaas.query.annotation.RowIDType;
|
||||||
|
import com.definesys.mpaas.query.annotation.Table;
|
||||||
|
import com.definesys.mpaas.query.model.MpaasBasePojo;
|
||||||
|
import lombok.Data;
|
||||||
|
import lombok.EqualsAndHashCode;
|
||||||
|
import lombok.NoArgsConstructor;
|
||||||
|
|
||||||
|
@EqualsAndHashCode(callSuper = true)
|
||||||
|
@Data
|
||||||
|
@Table("yfsjglpt_model_global_parameter")
|
||||||
|
@NoArgsConstructor
|
||||||
|
public class GlobalParameter extends MpaasBasePojo {
|
||||||
|
@RowID(sequence = "global_parameter_s", type = RowIDType.UUID)
|
||||||
|
private String id;
|
||||||
|
@ExcelProperty("子系统")
|
||||||
|
private String subsystemName;
|
||||||
|
@ExcelProperty("类型")
|
||||||
|
private String parameterType;
|
||||||
|
@ExcelProperty("零部件名称")
|
||||||
|
private String partsName;
|
||||||
|
@ExcelProperty("参数名称")
|
||||||
|
private String parameterName;
|
||||||
|
}
|
||||||
@ -6,8 +6,10 @@ import lombok.Data;
|
|||||||
import lombok.EqualsAndHashCode;
|
import lombok.EqualsAndHashCode;
|
||||||
|
|
||||||
@SQLQuery(value = {
|
@SQLQuery(value = {
|
||||||
|
@SQL(view = "getCommonAndGlobalParameters",
|
||||||
|
sql = "SELECT ymcp.*, ymgp.parameter_name as 'parameterName', ymgp.parameter_type as 'parameterType', ymgp.subsystem_name as 'subsystemName', ymgp.parts_name as 'partsName' FROM yfsjglpt_model_common_parameters ymcp LEFT JOIN yfsjglpt_model_global_parameter ymgp ON ymcp.parameter_id = ymgp.id WHERE ymcp.common_id IN (#ids) AND ymcp.is_global = 1"),
|
||||||
@SQL(view = "getCommonAndParameters",
|
@SQL(view = "getCommonAndParameters",
|
||||||
sql = "SELECT ymcp.*, ymp.parameter_name as 'parameterName', ymp.parameter_type as 'parameterType', ymp.subsystem_name as 'subsystemName', ymp.parts_name as 'partsName' FROM yfsjglpt_model_common_parameters ymcp LEFT JOIN yfsjglpt_model_parameter ymp ON ymcp.parameter_id = ymp.id WHERE ymcp.common_id IN (#ids)"),
|
sql = "SELECT ymcp.*, ymp.parameter_name as 'parameterName', ymp.parameter_type as 'parameterType', ymp.subsystem_name as 'subsystemName', ymp.parts_name as 'partsName' FROM yfsjglpt_model_common_parameters ymcp LEFT JOIN yfsjglpt_model_parameter ymp ON ymcp.parameter_id = ymp.id WHERE ymcp.common_id IN (#ids) AND ymcp.is_global = 0"),
|
||||||
@SQL(view = "getCommonById",
|
@SQL(view = "getCommonById",
|
||||||
sql = "SELECT ymcp.*, ymp.parameter_name as 'parameterName', ymp.parameter_type as 'parameterType', ymp.subsystem_name as 'subsystemName' FROM yfsjglpt_model_common_parameters ymcp LEFT JOIN yfsjglpt_model_parameter ymp ON ymcp.parameter_id = ymp.id WHERE ymcp.user_id = #userId")
|
sql = "SELECT ymcp.*, ymp.parameter_name as 'parameterName', ymp.parameter_type as 'parameterType', ymp.subsystem_name as 'subsystemName' FROM yfsjglpt_model_common_parameters ymcp LEFT JOIN yfsjglpt_model_parameter ymp ON ymcp.parameter_id = ymp.id WHERE ymcp.user_id = #userId")
|
||||||
})
|
})
|
||||||
@ -19,6 +21,7 @@ public class ModelCommonParameters extends MpaasBasePojo {
|
|||||||
private String id;
|
private String id;
|
||||||
private String parameterId;
|
private String parameterId;
|
||||||
private String commonId;
|
private String commonId;
|
||||||
|
private Integer isGlobal;
|
||||||
|
|
||||||
@Column(type = ColumnType.CALCULATE)
|
@Column(type = ColumnType.CALCULATE)
|
||||||
private String parameterName;
|
private String parameterName;
|
||||||
|
|||||||
@ -0,0 +1,9 @@
|
|||||||
|
package com.xdap.self_development.pojo.view;
|
||||||
|
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
@Data
|
||||||
|
public class ParameterItem {
|
||||||
|
private String parameterId;
|
||||||
|
private Integer isGlobal;
|
||||||
|
}
|
||||||
@ -4,10 +4,8 @@ import com.xdap.self_development.common.UserPermissionGetter;
|
|||||||
import com.xdap.self_development.config.BusinessDatabase;
|
import com.xdap.self_development.config.BusinessDatabase;
|
||||||
import com.xdap.self_development.controller.form.*;
|
import com.xdap.self_development.controller.form.*;
|
||||||
import com.xdap.self_development.exception.CommonException;
|
import com.xdap.self_development.exception.CommonException;
|
||||||
import com.xdap.self_development.pojo.AnalysisCommonParameters;
|
import com.xdap.self_development.pojo.*;
|
||||||
import com.xdap.self_development.pojo.CommonParameter;
|
import com.xdap.self_development.pojo.view.ParameterItem;
|
||||||
import com.xdap.self_development.pojo.ModelCommonParameters;
|
|
||||||
import com.xdap.self_development.pojo.Parameter;
|
|
||||||
import com.xdap.self_development.pojo.view.ParametersView;
|
import com.xdap.self_development.pojo.view.ParametersView;
|
||||||
import com.xdap.self_development.service.CommonParameterService;
|
import com.xdap.self_development.service.CommonParameterService;
|
||||||
import org.springframework.beans.BeanUtils;
|
import org.springframework.beans.BeanUtils;
|
||||||
@ -30,6 +28,13 @@ public class CommonParameterServiceImpl implements CommonParameterService {
|
|||||||
.view("getAllSubsystemAndPara")
|
.view("getAllSubsystemAndPara")
|
||||||
.doQuery(Parameter.class);
|
.doQuery(Parameter.class);
|
||||||
|
|
||||||
|
List<GlobalParameter> globalParameters = bd.getBusinessDatabase().doQuery(GlobalParameter.class);
|
||||||
|
globalParameters.forEach(globalParameter -> {
|
||||||
|
Parameter parameter = new Parameter();
|
||||||
|
BeanUtils.copyProperties(globalParameter, parameter);
|
||||||
|
parameters.add(parameter);
|
||||||
|
});
|
||||||
|
|
||||||
return convertToModelCommonItemList(parameters);
|
return convertToModelCommonItemList(parameters);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -50,6 +55,10 @@ public class CommonParameterServiceImpl implements CommonParameterService {
|
|||||||
List<ModelCommonParameters> modelCommonParameters = bd.getBusinessDatabase()
|
List<ModelCommonParameters> modelCommonParameters = bd.getBusinessDatabase()
|
||||||
.viewQueryMode(true).view("getCommonAndParameters")
|
.viewQueryMode(true).view("getCommonAndParameters")
|
||||||
.setVar("ids", ids).doQuery(ModelCommonParameters.class);
|
.setVar("ids", ids).doQuery(ModelCommonParameters.class);
|
||||||
|
modelCommonParameters.addAll(
|
||||||
|
bd.getBusinessDatabase().viewQueryMode(true).view("getCommonAndGlobalParameters")
|
||||||
|
.setVar("ids", ids).doQuery(ModelCommonParameters.class)
|
||||||
|
);
|
||||||
return convertToModelCommonList(modelCommonParameters, commonParameters);
|
return convertToModelCommonList(modelCommonParameters, commonParameters);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -252,13 +261,29 @@ public class CommonParameterServiceImpl implements CommonParameterService {
|
|||||||
* 将List 转换为 ModelCommonParameters 列表
|
* 将List 转换为 ModelCommonParameters 列表
|
||||||
*/
|
*/
|
||||||
private List<ModelCommonParameters> convertToModelCommonParameters(
|
private List<ModelCommonParameters> convertToModelCommonParameters(
|
||||||
List<String> parameters, String commonId) {
|
List<ParameterItem> parameters, String commonId) {
|
||||||
List<ModelCommonParameters> result = new ArrayList<>();
|
List<ModelCommonParameters> result = new ArrayList<>();
|
||||||
|
|
||||||
if (parameters != null) {
|
if (parameters != null) {
|
||||||
for (String parameterId : parameters) {
|
// 筛选整车参数
|
||||||
|
List<String> globalParameters = parameters.stream().filter(item -> item.getIsGlobal() == 1)
|
||||||
|
.map(ParameterItem::getParameterId).collect(Collectors.toList());
|
||||||
|
List<String> localParameters = parameters.stream().filter(item -> item.getIsGlobal() != 1)
|
||||||
|
.map(ParameterItem::getParameterId).collect(Collectors.toList());
|
||||||
|
|
||||||
|
for (String parameterId : globalParameters) {
|
||||||
ModelCommonParameters param = new ModelCommonParameters();
|
ModelCommonParameters param = new ModelCommonParameters();
|
||||||
param.setParameterId(parameterId);
|
param.setParameterId(parameterId);
|
||||||
param.setCommonId(commonId);
|
param.setCommonId(commonId);
|
||||||
|
param.setIsGlobal(1);
|
||||||
|
result.add(param);
|
||||||
|
}
|
||||||
|
|
||||||
|
for (String parameterId : localParameters) {
|
||||||
|
ModelCommonParameters param = new ModelCommonParameters();
|
||||||
|
param.setParameterId(parameterId);
|
||||||
|
param.setCommonId(commonId);
|
||||||
|
param.setIsGlobal(0);
|
||||||
result.add(param);
|
result.add(param);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user