ludc
2023-08-04 9d96f11fb1de77d1ad4fb0be04a10ae8eb7f46c9
Source/UBCS/ubcs-service/ubcs-code/src/main/java/com/vci/ubcs/code/service/impl/MdmIOServiceImpl.java
@@ -34,7 +34,6 @@
import com.vci.ubcs.starter.revision.model.BaseModel;
import com.vci.ubcs.starter.util.DefaultAttrAssimtUtil;
import com.vci.ubcs.starter.util.LocalFileUtil;
import com.vci.ubcs.starter.util.UBCSSqlKeyword;
import com.vci.ubcs.starter.web.constant.QueryOptionConstant;
import com.vci.ubcs.starter.web.enumpck.BooleanEnum;
import com.vci.ubcs.starter.web.enumpck.UserSecretEnum;
@@ -53,6 +52,7 @@
import org.apache.poi.ss.usermodel.Workbook;
import org.springblade.core.redis.cache.BladeRedis;
import org.springblade.core.tool.api.R;
import org.springblade.core.tool.utils.Func;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
@@ -1474,7 +1474,7 @@
      CodeClassifyTemplateVO templateVO = engineService.getUsedTemplateByClassifyOid(exportAttrDTO.getCodeClassifyOid());
      //先查询数据
      String btmTypeId = classifyFullInfo.getTopClassifyVO().getBtmTypeId();
      Map<String, Object> conditionMap = exportAttrDTO.getConditionMap();
      Map<String, String> conditionMap = exportAttrDTO.getConditionMap();
      if(conditionMap == null){
         conditionMap = new HashMap<>();
      }
@@ -1490,7 +1490,20 @@
      conditionMap.put("codeclsfpath","*" + exportAttrDTO.getCodeClassifyOid() + "*");
      conditionMap.put("lastr", "1");
      conditionMap.put("lastv", "1");
      UBCSSqlKeyword.buildSqlwhere(conditionMap);
      R<List<BtmTypeVO>> listR = btmTypeClient.selectByIdCollection(Arrays.asList(btmTypeId));
      String tableName = "";
      if(listR.isSuccess() && !listR.getData().isEmpty()){
         tableName = Func.isNotBlank(listR.getData().get(0).getTableName()) ? listR.getData().get(0).getTableName():VciBaseUtil.getTableName(btmTypeId);
      }else{
         tableName = VciBaseUtil.getTableName(btmTypeId);
      }
      String countSql = "select count(*) from " + tableName +" where 1=1" +
         " and lastr = '1'" +
         " and lastv='1'" +
         " and codeclsfpath like '%" + exportAttrDTO.getCodeClassifyOid() + "%'";
      //先查询总数
      int total = 0;
      if(exportAttrDTO.getEndPage()!=null && exportAttrDTO.getEndPage()>0
@@ -1504,11 +1517,11 @@
            thisPage.setOrder(exportAttrDTO.getOrder());
            thisPage.addDefaultDesc("createTime");
            total += boService.queryCount(btmTypeId, conditionMap);
            total += commonsMapper.queryCountBySql(countSql);
         }
      }else{
         total=boService.queryCount(btmTypeId, conditionMap);
         total = commonsMapper.queryCountBySql(countSql);
      }
      List<String> selectFieldList = new ArrayList<>();
      if(!CollectionUtils.isEmpty(exportAttrDTO.getAttrIdIndexMap())){
@@ -1581,9 +1594,6 @@
      LocalFileUtil.deleteTempFile(file,true);
      return zipFileName;
   }
   private
   /**
    * 查询数据并导出到excel
@@ -2190,7 +2200,7 @@
      String tableName ="";
      try {
         R<BtmTypeVO> r = btmTypeClient.getAllAttributeByBtmId(templateVO.getBtmTypeId());
         if(r.getCode()!=200) {
         if(!r.isSuccess()) {
            throw new Throwable(r.getMsg());
         }
         BtmTypeVO btmTypeVO = r.getData();
@@ -3298,7 +3308,7 @@
      String tableName ="";
      try {
         R<BtmTypeVO> r = btmTypeClient.getAllAttributeByBtmId(templateVO.getBtmTypeId());
         if(r.getCode()!=200) {
         if(!r.isSuccess()) {
            throw new Throwable(r.getMsg());
         }
         BtmTypeVO btmTypeVO = r.getData();