lihang
2023-07-04 aedc56b3c034ef33811ca873debee68d6f963a88
Source/UBCS/ubcs-service/ubcs-omd/src/main/java/com/vci/ubcs/omd/feign/BtmTypeClient.java
@@ -1,6 +1,7 @@
package com.vci.ubcs.omd.feign;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.core.toolkit.CollectionUtils;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.vci.ubcs.omd.entity.BtmType;
@@ -62,7 +63,7 @@
    */
   @Override
   @PostMapping(GET_REF_PAGE)
   public R<IPage<BtmTypeVO>> getRefPage(BaseQueryObject baseQueryObject) {
   public R<Page<BtmTypeVO>> getRefPage(BaseQueryObject baseQueryObject) {
      Map<String, String> conditionMap = baseQueryObject.getConditionMap();
      if (conditionMap == null){
         conditionMap = new HashMap<>(16);
@@ -77,16 +78,20 @@
      String domainValue = conditionMap.get(DOMAIN);
      VciBaseUtil.alertNotNull(domainValue,"领域值");
      conditionMap.remove(DOMAIN);
      BtmType queryObj = new BtmType();
      BeanMap.create(queryObj).putAll(conditionMap);
//      BtmType queryObj = new BtmType();
//      BeanMap.create(queryObj).putAll(conditionMap);
      Map<String, Object> condition = new HashMap<>(conditionMap);
      Query query = new Query();
      query.setSize(pageHelper.getLimit());
      query.setCurrent(pageHelper.getPage());
      IPage<BtmType> page = btmTypeService.page(Condition.getPage(query), Condition.getQueryWrapper(queryObj).lambda().eq(BtmType::getDomain, domainValue).orderByAsc(BtmType::getId));
      IPage<BtmTypeVO> pageVO = new Page<>();
      IPage<BtmType> page = btmTypeService.page(Condition.getPage(query), Condition.getQueryWrapper(condition,BtmType.class).lambda().eq(BtmType::getBizDomain, domainValue).orderByAsc(BtmType::getId));
      if (CollectionUtils.isEmpty(page.getRecords())){
         return R.data(null);
      }
      Page<BtmTypeVO> pageVO = new Page<>();
      BeanUtil.copy(page,pageVO);
      pageVO.setRecords(BtmTypeWrapper.build().listEntityVO(page.getRecords()));
      R<IPage<BtmTypeVO>> r = R.data(pageVO);
      R<Page<BtmTypeVO>> r = R.data(pageVO);
      r.setSuccess(true);
      return r;
   }
@@ -111,7 +116,10 @@
      conditionMap.remove(DOMAIN);
      BtmType queryObj = new BtmType();
      BeanMap.create(queryObj).putAll(conditionMap);
      List<BtmType> list = btmTypeService.list(Condition.getQueryWrapper(queryObj).lambda().eq(BtmType::getDomain, domainValue).orderByAsc(BtmType::getId));
      List<BtmType> list = btmTypeService.list(Condition.getQueryWrapper(queryObj).lambda().eq(BtmType::getBizDomain, domainValue).orderByAsc(BtmType::getId));
      if (CollectionUtils.isEmpty(list)){
         return R.data(null);
      }
      return R.data(BtmTypeWrapper.build().listEntityVO(list));
   }
@@ -131,6 +139,9 @@
            )
         ).orElseGet(ArrayList::new)
      );
      if (CollectionUtils.isEmpty(voList)){
         return R.data(null);
      }
      return R.data(voList);
   }
@@ -150,6 +161,42 @@
            )
         ).orElseGet(ArrayList::new)
      );
      if (CollectionUtils.isEmpty(voList)){
         return R.data(null);
      }
      return R.data(voList);
   }
   /**
    * 获取业务类型,只有默认字段
    *
    * @param btmTypeId 业务类型id
    * @return 默认字段属性
    */
   @Override
   public R<BtmTypeVO> getDefaultAttrByBtmId(String btmTypeId) {
      return R.data(Optional.ofNullable(btmTypeService.getDefaultAttrByBtmId(btmTypeId)).orElseGet(BtmTypeVO::new));
   }
   /**
    * 获取业务类型,有所有的字段
    *
    * @param btmTypeId 业务类型id
    * @return 所有字段
    */
   @Override
   public R<BtmTypeVO> getAllAttributeByBtmId(String btmTypeId) {
      return R.data(Optional.ofNullable(btmTypeService.getAllAttributeByBtmId(btmTypeId)).orElseGet(BtmTypeVO::new));
   }
   /**
    * 获取业务类型,有所有的字段
    *
    * @param btmTypeOid 业务类型主键
    * @return 所有字段
    */
   @Override
   public R<BtmTypeVO> getAllAttributeByBtmOid(String btmTypeOid) {
      return R.data(Optional.ofNullable(btmTypeService.getAllAttributeByBtmOid(btmTypeOid)).orElseGet(BtmTypeVO::new));
   }
}