|
@@ -5,17 +5,21 @@ import com.baomidou.mybatisplus.core.metadata.IPage;
|
|
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
|
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
|
|
import com.ims.common.utils.StringUtils;
|
|
|
+import com.ims.eval.dao.IndicatorDictionaryMapper;
|
|
|
import com.ims.eval.dao.IndicatorMapper;
|
|
|
-import com.ims.eval.entity.DataDictionary;
|
|
|
import com.ims.eval.entity.Indicator;
|
|
|
+import com.ims.eval.entity.IndicatorDictionary;
|
|
|
import com.ims.eval.service.IIndicatorService;
|
|
|
import org.springframework.stereotype.Service;
|
|
|
|
|
|
+import javax.annotation.Resource;
|
|
|
+import java.io.Serializable;
|
|
|
+import java.util.Collection;
|
|
|
import java.util.List;
|
|
|
|
|
|
/**
|
|
|
* <p>
|
|
|
- * 服务实现类
|
|
|
+ * 服务实现类
|
|
|
* </p>
|
|
|
*
|
|
|
* @author wang
|
|
@@ -24,8 +28,11 @@ import java.util.List;
|
|
|
@Service
|
|
|
public class IndicatorServiceImpl extends ServiceImpl<IndicatorMapper, Indicator> implements IIndicatorService {
|
|
|
|
|
|
+ @Resource
|
|
|
+ private IndicatorDictionaryMapper indicatorDictionaryMapper;
|
|
|
+
|
|
|
@Override
|
|
|
- public IPage<Indicator> list(Integer pageNum, Integer pageSize,String id, String indicatorName, String indicatorCede, String binSection, String binStage, String dept, String company) {
|
|
|
+ public IPage<Indicator> list(Integer pageNum, Integer pageSize, String id, String indicatorName, String indicatorCede, String binSection, String binStage, String dept, String company) {
|
|
|
|
|
|
QueryWrapper<Indicator> qw = new QueryWrapper<>();
|
|
|
//构造分页构造器
|
|
@@ -60,7 +67,7 @@ public class IndicatorServiceImpl extends ServiceImpl<IndicatorMapper, Indicator
|
|
|
|
|
|
qw.lambda().orderByAsc(Indicator::getOrderNum);
|
|
|
|
|
|
- IPage<Indicator> list = baseMapper.selectPage(page,qw);
|
|
|
+ IPage<Indicator> list = baseMapper.selectPage(page, qw);
|
|
|
|
|
|
return list;
|
|
|
}
|
|
@@ -68,18 +75,34 @@ public class IndicatorServiceImpl extends ServiceImpl<IndicatorMapper, Indicator
|
|
|
@Override
|
|
|
public boolean saveOrUpdate(Indicator entity) {
|
|
|
|
|
|
-
|
|
|
- if (null != entity && (null == entity.getId() || "".equals(entity.getId().trim()))){
|
|
|
- QueryWrapper<Indicator> qw = new QueryWrapper<>();
|
|
|
- qw.lambda().eq(Indicator::getIndicatorCode, entity.getIndicatorCode());
|
|
|
- qw.lambda().eq(Indicator::getBinSection, entity.getBinSection());
|
|
|
- qw.lambda().eq(Indicator::getBinStage, entity.getBinStage());
|
|
|
- List<Indicator> list = baseMapper.selectList(qw);
|
|
|
- if (null !=list && list.size()>0){
|
|
|
- throw new RuntimeException("当前指标code已存在");
|
|
|
- }
|
|
|
+ QueryWrapper<Indicator> qw = new QueryWrapper<>();
|
|
|
+ qw.lambda().eq(Indicator::getIndicatorCode, entity.getIndicatorCode());
|
|
|
+ qw.lambda().eq(Indicator::getBinSection, entity.getBinSection());
|
|
|
+ qw.lambda().eq(Indicator::getBinStage, entity.getBinStage());
|
|
|
+ List<Indicator> list = baseMapper.selectList(qw);
|
|
|
+ if (null != list && list.size() > 0) {
|
|
|
+ throw new RuntimeException("当前指标code已存在");
|
|
|
}
|
|
|
|
|
|
return super.saveOrUpdate(entity);
|
|
|
}
|
|
|
+
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public boolean removeByIds(Collection<? extends Serializable> idList) {
|
|
|
+ idList.stream().forEach(i -> {
|
|
|
+ QueryWrapper<IndicatorDictionary> qw = new QueryWrapper<>();
|
|
|
+ qw.lambda().eq(IndicatorDictionary::getIndicatorId, i);
|
|
|
+ List<IndicatorDictionary> list = indicatorDictionaryMapper.selectList(qw);
|
|
|
+ if (null != list && list.size() > 0) {
|
|
|
+ Indicator indicator = baseMapper.selectById(i);
|
|
|
+ throw new RuntimeException(indicator.getIndicatorName() + "指标存在关联属性");
|
|
|
+ }
|
|
|
+ });
|
|
|
+ int code = baseMapper.deleteBatchIds(idList);
|
|
|
+ if (code > 0) {
|
|
|
+ return true;
|
|
|
+ }
|
|
|
+ return false;
|
|
|
+ }
|
|
|
}
|