检测方案修改

master
shaoyong 1 year ago
parent 76fbd2a09b
commit 5976bb34b4

@ -76,6 +76,14 @@ public class QcProjectTypeController extends BaseController {
return toAjax(qcProjectTypeService.insertQcProjectType(qcProjectType));
}
/**
*
*/
@GetMapping("/projectTypeTree")
public AjaxResult projectTypeTree (QcProjectType qcProjectType) {
return success(qcProjectTypeService.selectProjectTypeTree(qcProjectType));
}
/**
*
*/

@ -5,6 +5,9 @@ import org.apache.commons.lang3.builder.ToStringStyle;
import com.op.common.core.annotation.Excel;
import com.op.common.core.web.domain.BaseEntity;
import java.util.ArrayList;
import java.util.List;
/**
* qc_project_type
*
@ -57,6 +60,8 @@ public class QcProjectType extends BaseEntity {
private String productGroupName;
private String productGroup;
private List<QcProjectType> children = new ArrayList<>();
public String getProductGroupName() {
return productGroupName;
}
@ -145,6 +150,14 @@ public class QcProjectType extends BaseEntity {
this.version = version;
}
public List<QcProjectType> getChildren() {
return children;
}
public void setChildren(List<QcProjectType> children) {
this.children = children;
}
@Override
public String toString() {
return new ToStringBuilder(this, ToStringStyle.MULTI_LINE_STYLE)

@ -3,6 +3,7 @@ package com.op.quality.domain.vo;
import com.fasterxml.jackson.annotation.JsonInclude;
import com.op.quality.domain.QcGoal;
import com.op.quality.domain.QcMaterialGroup;
import com.op.quality.domain.QcProjectType;
import javax.xml.bind.annotation.XmlEnum;
@ -50,6 +51,12 @@ public class TreeSelect implements Serializable {
this.children = qcGoal.getChildren().stream().map(TreeSelect::new).collect(Collectors.toList());
}
public TreeSelect(QcProjectType projectType) {
this.id = projectType.getProjectTypeCode();
this.label = projectType.getProjectTypeName();
this.children = projectType.getChildren().stream().map(TreeSelect::new).collect(Collectors.toList());
}
public String getId() {
return id;
}

@ -3,6 +3,7 @@ package com.op.quality.service;
import java.util.List;
import com.op.quality.domain.QcProjectType;
import com.op.quality.domain.vo.TreeSelect;
/**
* Service
@ -58,4 +59,6 @@ public interface IQcProjectTypeService {
* @return
*/
public int deleteQcProjectTypeById(String id);
List<TreeSelect> selectProjectTypeTree(QcProjectType qcProjectType);
}

@ -1,11 +1,15 @@
package com.op.quality.service.impl;
import java.util.ArrayList;
import java.util.List;
import java.util.stream.Collectors;
import com.baomidou.dynamic.datasource.annotation.DS;
import com.op.common.core.utils.DateUtils;
import com.op.common.core.utils.SpringUtils;
import com.op.common.core.utils.uuid.IdUtils;
import com.op.common.security.utils.SecurityUtils;
import com.op.quality.domain.vo.TreeSelect;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.op.quality.mapper.QcProjectTypeMapper;
@ -106,4 +110,23 @@ public class QcProjectTypeServiceImpl implements IQcProjectTypeService {
public int deleteQcProjectTypeById(String id) {
return qcProjectTypeMapper.deleteQcProjectTypeById(id);
}
@Override
public List<TreeSelect> selectProjectTypeTree(QcProjectType qcProjectType) {
List<QcProjectType> qcProjectTypeList = SpringUtils.getAopProxy(this).selectQcProjectTypeList(qcProjectType);
return buildProjectTreeSelect(qcProjectTypeList);
}
private List<TreeSelect> buildProjectTreeSelect(List<QcProjectType> qcProjectTypeList) {
// 根节点
QcProjectType rootTree = new QcProjectType();
rootTree.setProjectTypeCode("projectType0");
rootTree.setProjectTypeName("检验方案");
// 设置二级节点
rootTree.setChildren(qcProjectTypeList);
// 因为只有二层,直接构造树
List<QcProjectType> projectTypeTree = new ArrayList<>();
projectTypeTree.add(rootTree);
return projectTypeTree.stream().map(TreeSelect::new).collect(Collectors.toList());
}
}

@ -50,7 +50,7 @@
<if test="attr1 != null and attr1 != ''">and attr1 = #{attr1}</if>
<if test="factoryCode != null and factoryCode != ''">and factory_code = #{factoryCode}</if>
<if test="judge != null and judge != ''">and judge = #{judge}</if>
<if test="projectType != null and projectType != ''">project_type = #{projectType}</if>
<if test="projectType != null and projectType != ''">and project_type = #{projectType}</if>
and del_flag = '0'
</where>
order by create_time

Loading…
Cancel
Save