|
@@ -130,15 +130,16 @@ public class QcTypeFacade extends QcTypeServiceImpl {
|
|
|
if (qcType == null) { //校验
|
|
|
throw new CommonException(CommonErrorCode.SERVER_IS_ERROR, "当前质控类型不存在【id=" + id + "】");
|
|
|
}
|
|
|
+ param.setInsertOrUpdate(InsertOrUpdateEnum.Update.getKey());
|
|
|
}
|
|
|
BeanUtil.copyProperties(qcTypeSaveVO, qcType);
|
|
|
- List<QcType> qcTypeList = this.list(new QueryWrapper<QcType>()
|
|
|
+ Integer count = this.count(new QueryWrapper<QcType>()
|
|
|
.eq("name", qcTypeSaveVO.getName())
|
|
|
.eq("is_deleted", IsDeleteEnum.N.getKey())
|
|
|
.eq("hospital_id", qcTypeSaveVO.getHospitalId())
|
|
|
.ne("id", id == null ? -1 : id));
|
|
|
// 质控类型hospitalId、name唯一
|
|
|
- if (ListUtil.isNotEmpty(qcTypeList)) {
|
|
|
+ if (count > 0) {
|
|
|
throw new CommonException(CommonErrorCode.SERVER_IS_ERROR, "质控类型已存在");
|
|
|
}
|
|
|
if (InsertOrUpdateEnum.Insert.getKey() == param.getInsertOrUpdate()) {
|
|
@@ -195,7 +196,7 @@ public class QcTypeFacade extends QcTypeServiceImpl {
|
|
|
*/
|
|
|
public QcTypeDTO getById(QcTypeVO qcTypeVO) {
|
|
|
QcTypeDTO qcTypeDTO = new QcTypeDTO();
|
|
|
- qcTypeDTO.setHospitalId(Long.valueOf(SysUserUtils.getCurrentHospitalID()));
|
|
|
+ qcTypeVO.setHospitalId(Long.valueOf(SysUserUtils.getCurrentHospitalID()));
|
|
|
QcType qcType = this.getOne(new QueryWrapper<QcType>()
|
|
|
.eq("is_deleted", IsDeleteEnum.N.getKey())
|
|
|
.eq("hospital_id", qcTypeVO.getHospitalId())
|
|
@@ -232,11 +233,10 @@ public class QcTypeFacade extends QcTypeServiceImpl {
|
|
|
.set("modifier", person)
|
|
|
);
|
|
|
|
|
|
- if (!res){
|
|
|
+ if (!res) {
|
|
|
throw new CommonException(CommonErrorCode.UPDATE_INFO_FAIL);
|
|
|
}
|
|
|
// 删除明细表
|
|
|
- qcTypeCasesEntryService.removeByIds(deleteQcTypeVO.getIds());
|
|
|
if (ListUtil.isNotEmpty(deleteQcTypeVO.getIds())) {
|
|
|
qcTypeCasesEntryService.remove(new QueryWrapper<QcTypeCasesEntry>()
|
|
|
.in("type_id", deleteQcTypeVO.getIds())
|