yuxc
2023-05-19 029b101d319812460441d3d706c0654d8b0dcda6
Source/UBCS/ubcs-service/ubcs-code/src/main/java/com/vci/ubcs/code/service/impl/CodeClassifyValueServiceImpl.java
@@ -1,6 +1,7 @@
package com.vci.ubcs.code.service.impl;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.toolkit.StringUtils;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
@@ -24,6 +25,7 @@
import com.vci.ubcs.starter.web.util.VciBaseUtil;
import org.springblade.core.secure.utils.AuthUtil;
import org.springblade.core.tool.api.R;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Lazy;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
@@ -349,4 +351,78 @@
      return codeClassifyValueMapper.selectList(wrapper);
   }
   /**
    * 使用码段的主键获取分类的码值内容
    *
    * @param classifySecOid         码段的主键
    * @param parentClassifyValueOid 上级分类的主键
    * @return 分类码值的内容
    */
   @Override
   public List<CodeClassifyValueVO> listCodeClassifyValueBySecOid(String classifySecOid, String parentClassifyValueOid) {
      if(StringUtils.isBlank(classifySecOid)){
         return new ArrayList<>();
      }
      CodeBasicSec secDO = codeBasicSecService.getById(classifySecOid);
      if(secDO == null || StringUtils.isBlank(secDO.getOid())){
         throw new VciBaseException("码段的内容在系统中不存在");
      }
      if(StringUtils.isNotBlank(secDO.getParentClassifySecOid()) && StringUtils.isBlank(parentClassifyValueOid)){
         return new ArrayList<>();
         //因为有上级分类的时候,必须先选择上级分类的内容
      }
//      Map<String,String> conditionMap = new HashMap<>();
//      conditionMap.put("codeClassifySecOid",classifySecOid);
//      if(StringUtils.isNotBlank(parentClassifyValueOid)){
//         conditionMap.put("parentClassifyValueOid",parentClassifyValueOid);
//      }
//      PageHelper pageHelper = new PageHelper(-1);
//      pageHelper.addDefaultAsc("ordernum");
      QueryWrapper<CodeClassifyValue> wrapper = new QueryWrapper<>();
      wrapper.eq("codeClassifySecOid",classifySecOid);
      if(StringUtils.isNotBlank(parentClassifyValueOid)){
         wrapper.eq("parentClassifyValueOid",parentClassifyValueOid);
      }
      wrapper.orderByAsc("ordernum");
      List<CodeClassifyValue> valueDOList = codeClassifyValueMapper.selectList(wrapper);
      return codeClassifyValueDO2VOs(valueDOList);
   }
   /**
    * 批量数据对象转换为显示对象
    * @param codeClassifyValueDOs 数据对象列表
    * @return 显示对象
    * @throws VciBaseException 参数为空或者不存在的时候会抛出异常
    */
   @Override
   public List<CodeClassifyValueVO> codeClassifyValueDO2VOs(Collection<CodeClassifyValue>  codeClassifyValueDOs) throws VciBaseException{
      List<CodeClassifyValueVO> voList = new ArrayList<CodeClassifyValueVO>();
      if(!CollectionUtils.isEmpty(codeClassifyValueDOs)){
         for(CodeClassifyValue s: codeClassifyValueDOs){
            CodeClassifyValueVO vo =  codeClassifyValueDO2VO(s);
            if(vo != null){
               voList.add(vo);
            }
         }
      }
      return voList;
   }
   /**
    * 数据对象转换为显示对象
    * @param  codeClassifyValueDO 数据对象
    * @return 显示对象
    * @throws VciBaseException 拷贝属性出错的时候会抛出异常
    */
   @Override
   public  CodeClassifyValueVO codeClassifyValueDO2VO(CodeClassifyValue codeClassifyValueDO) throws VciBaseException{
      CodeClassifyValueVO vo = new CodeClassifyValueVO();
      if(codeClassifyValueDO != null){
         BeanUtilForVCI.copyPropertiesIgnoreCase(codeClassifyValueDO,vo);
         //如果有lcstatus的类的话
      }
      return vo;
   }
}