|
|
@ -2,11 +2,15 @@ package com.supervision.service.impl;
|
|
|
|
|
|
|
|
|
|
|
|
import cn.hutool.core.collection.CollUtil;
|
|
|
|
import cn.hutool.core.collection.CollUtil;
|
|
|
|
import cn.hutool.core.util.StrUtil;
|
|
|
|
import cn.hutool.core.util.StrUtil;
|
|
|
|
|
|
|
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
|
|
|
|
|
|
|
import com.baomidou.mybatisplus.extension.conditions.query.LambdaQueryChainWrapper;
|
|
|
|
|
|
|
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
|
|
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
|
|
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
|
|
|
import com.supervision.exception.BusinessException;
|
|
|
|
import com.supervision.exception.BusinessException;
|
|
|
|
import com.supervision.model.Disease;
|
|
|
|
import com.supervision.model.Disease;
|
|
|
|
import com.supervision.service.DiseaseService;
|
|
|
|
import com.supervision.service.DiseaseService;
|
|
|
|
import com.supervision.mapper.DiseaseMapper;
|
|
|
|
import com.supervision.mapper.DiseaseMapper;
|
|
|
|
|
|
|
|
import com.supervision.vo.manage.DiseaseVo;
|
|
|
|
import org.springframework.stereotype.Service;
|
|
|
|
import org.springframework.stereotype.Service;
|
|
|
|
|
|
|
|
|
|
|
|
import java.util.List;
|
|
|
|
import java.util.List;
|
|
|
@ -34,6 +38,52 @@ public class DiseaseServiceImpl extends ServiceImpl<DiseaseMapper, Disease>
|
|
|
|
return super.listByIds(disease.getContainDiseaseIds());
|
|
|
|
return super.listByIds(disease.getContainDiseaseIds());
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
|
|
|
public Disease saveDisease(Disease disease) {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (StrUtil.isEmpty(disease.getDiseaseName())){
|
|
|
|
|
|
|
|
throw new BusinessException("diseaseName is not allow empty");
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
if (CollUtil.isNotEmpty(this.queryByCode(disease.getCode()))){
|
|
|
|
|
|
|
|
throw new BusinessException("类目编码: "+disease.getCode()+" 已存在");
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
disease.setId(null);
|
|
|
|
|
|
|
|
disease.setStatus(0);
|
|
|
|
|
|
|
|
super.save(disease);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
return disease;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
|
|
|
public boolean updateDisease(Disease disease) {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (StrUtil.isEmpty(disease.getId())){
|
|
|
|
|
|
|
|
throw new BusinessException("id is not allow empty");
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
return super.updateById(disease);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
|
|
|
public Page<Disease> queryPageList(Integer pageNum, Integer pageSize, DiseaseVo diseaseVo) {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
LambdaQueryChainWrapper<Disease> wrapper = this.lambdaQuery()
|
|
|
|
|
|
|
|
.like(StrUtil.isNotEmpty(diseaseVo.getDiseaseName()), Disease::getDiseaseName, diseaseVo.getDiseaseName());
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
return super.page(new Page<>(pageNum, pageSize), wrapper);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
private List<Disease> queryByCode(String code){
|
|
|
|
|
|
|
|
if (Objects.isNull(code)){
|
|
|
|
|
|
|
|
throw new BusinessException("code is not allow empty");
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
return super.lambdaQuery().eq(Disease::getCode,code).list();
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
private boolean isCompositeDisease(Disease disease){
|
|
|
|
private boolean isCompositeDisease(Disease disease){
|
|
|
|
|
|
|
|
|
|
|
|