|
@@ -22,6 +22,7 @@ import com.google.common.collect.Lists;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
import org.springframework.beans.factory.annotation.Qualifier;
|
|
|
import org.springframework.stereotype.Component;
|
|
|
+import org.springframework.util.CollectionUtils;
|
|
|
import org.springframework.web.bind.annotation.RequestBody;
|
|
|
|
|
|
import java.util.*;
|
|
@@ -68,28 +69,21 @@ public class QcTypeFacade extends QcTypeServiceImpl {
|
|
|
parTypelist.forEach(qcType -> {
|
|
|
parTypeIdSet.add(qcType.getParentTypeId());
|
|
|
});
|
|
|
- //修改
|
|
|
- if(null != qcTypeVO.getId()){
|
|
|
- list = this.list(new QueryWrapper<QcType>()
|
|
|
- .eq("hospital_id", qcTypeVO.getHospitalId())
|
|
|
- .eq("is_deleted", IsDeleteEnum.N.getKey())
|
|
|
- .notIn("id",parTypeIdSet)
|
|
|
- .ne("id",qcTypeVO.getId())
|
|
|
- .isNull("parent_type_id")
|
|
|
- .orderByAsc("name"));
|
|
|
- }else{
|
|
|
- //新增操作
|
|
|
- //未质控的质控id包含了父类
|
|
|
+ };
|
|
|
|
|
|
- list = this.list(new QueryWrapper<QcType>()
|
|
|
- .eq("hospital_id", qcTypeVO.getHospitalId())
|
|
|
- .eq("is_deleted", IsDeleteEnum.N.getKey())
|
|
|
- .notIn("id",parTypeIdSet)
|
|
|
- .isNull("parent_type_id")
|
|
|
- .orderByAsc("name"));
|
|
|
+ QueryWrapper<QcType> qcTypeQueryWrapper = new QueryWrapper<>();
|
|
|
+ qcTypeQueryWrapper.eq("hospital_id", qcTypeVO.getHospitalId());
|
|
|
+ qcTypeQueryWrapper.eq("is_deleted", IsDeleteEnum.N.getKey());
|
|
|
+ if(!CollectionUtils.isEmpty(parTypeIdSet)){
|
|
|
+ qcTypeQueryWrapper.notIn("id",parTypeIdSet);
|
|
|
}
|
|
|
+ qcTypeQueryWrapper.isNull("parent_type_id");
|
|
|
+ //修改 非此判断为新增
|
|
|
+ if(null != qcTypeVO.getId()) {
|
|
|
+ qcTypeQueryWrapper.ne("id", qcTypeVO.getId());
|
|
|
}
|
|
|
-
|
|
|
+ qcTypeQueryWrapper.orderByAsc("name");
|
|
|
+ list = this.list(qcTypeQueryWrapper);
|
|
|
return RespDTO.onSuc(list);
|
|
|
}
|
|
|
/**
|
|
@@ -118,16 +112,16 @@ public class QcTypeFacade extends QcTypeServiceImpl {
|
|
|
.eq("id", qcType.getParentTypeId()));
|
|
|
RespDTO respDTO = new RespDTO();
|
|
|
respDTO.code = "00000005";
|
|
|
- respDTO.msg = "该类型已被" + "\"" + qcTypeMain.getName() + "\"" + "类型绑定,确定需要解绑?";
|
|
|
+ respDTO.msg = "该质控类型已被" + "\"" + qcTypeMain.getName() + "\"" + "类型绑定,需先将其解绑";
|
|
|
return respDTO;
|
|
|
//父类存在关联 一对多给出提示
|
|
|
- }else if(ListUtil.isNotEmpty(parentList)){
|
|
|
+ }else if(ListUtil.isNotEmpty(parentList)&&1==cancelTypeVO.getOper()){
|
|
|
RespDTO respDTO = new RespDTO();
|
|
|
- respDTO.code = "00000006";
|
|
|
- respDTO.msg = "该质控类型已被关联,删除将解绑其关联类型,是否删除?";
|
|
|
+ respDTO.code = "00000005";
|
|
|
+ respDTO.msg = "该质控类型存在绑定的子类型,需先将其解绑";
|
|
|
return respDTO;
|
|
|
}
|
|
|
- //如果父类关联子类,同样提示
|
|
|
+
|
|
|
}
|
|
|
//删除关联状态
|
|
|
if(cancelTypeVO.getCancel() != null && 1 == cancelTypeVO.getCancel()){
|
|
@@ -149,7 +143,7 @@ public class QcTypeFacade extends QcTypeServiceImpl {
|
|
|
);
|
|
|
}
|
|
|
RespDTO respDTO = new RespDTO();
|
|
|
- respDTO.code = "00000005";
|
|
|
+ respDTO.code = "0";
|
|
|
respDTO.msg = "解绑成功";
|
|
|
return respDTO;
|
|
|
|