From 100bdd6595cc5c7a447ea6fedd6827f311b37f48 Mon Sep 17 00:00:00 2001
From: xiejun <xj@2023>
Date: 星期二, 04 七月 2023 00:18:20 +0800
Subject: [PATCH] Merge remote-tracking branch 'origin/master'

---
 Source/UBCS/ubcs-service/ubcs-code/src/main/java/com/vci/ubcs/code/service/impl/MdmEngineServiceImpl.java |   35 ++++++++++++++++++++++-------------
 1 files changed, 22 insertions(+), 13 deletions(-)

diff --git a/Source/UBCS/ubcs-service/ubcs-code/src/main/java/com/vci/ubcs/code/service/impl/MdmEngineServiceImpl.java b/Source/UBCS/ubcs-service/ubcs-code/src/main/java/com/vci/ubcs/code/service/impl/MdmEngineServiceImpl.java
index 834bb02..6640c45 100644
--- a/Source/UBCS/ubcs-service/ubcs-code/src/main/java/com/vci/ubcs/code/service/impl/MdmEngineServiceImpl.java
+++ b/Source/UBCS/ubcs-service/ubcs-code/src/main/java/com/vci/ubcs/code/service/impl/MdmEngineServiceImpl.java
@@ -3,6 +3,7 @@
 import com.alibaba.fastjson.JSONObject;
 import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
 import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
+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.baomidou.mybatisplus.extension.toolkit.SqlHelper;
@@ -55,6 +56,7 @@
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 import org.springblade.core.cache.utils.CacheUtil;
+import org.springblade.core.log.exception.ServiceException;
 import org.springblade.core.secure.utils.AuthUtil;
 import org.springblade.core.tool.api.R;
 import org.springblade.core.tool.utils.DateUtil;
@@ -3345,8 +3347,8 @@
      * @return 鍒楄〃鏁版嵁
      */
     @Override
-    public Page<BaseModel>referDataGrid(UIFormReferVO referConfigVO, BaseQueryObject baseQueryObject) {
-//		checkReferConfig(referConfigVO);
+    public IPage<BaseModel> referDataGrid(UIFormReferVO referConfigVO, BaseQueryObject baseQueryObject) throws VciBaseException{
+		//checkReferConfig(referConfigVO);
         //浣跨敤涓氬姟绫诲瀷鏌ヨ
         R<BtmTypeVO> allAttributeByBtmId = btmTypeClient.getAllAttributeByBtmId(referConfigVO.getReferType());
         BtmTypeVO btmTypeVO = allAttributeByBtmId.getData();
@@ -3363,7 +3365,11 @@
                 BtmTypeLcStatusConstant.RELEASE_LIFE_CYCLE.equalsIgnoreCase(btmTypeVO.getLifeCycleId())) {
             baseQueryObject.getConditionMap().put(VciQueryWrapperForDO.LC_STATUS_FIELD, CodeDefaultLC.RELEASED.getValue());
         }
+
         R<List<BtmTypeVO>> listR = btmTypeClient.selectByIdCollection(Collections.singletonList(referConfigVO.getReferType()));
+        if (listR.getCode() != 200) {
+            throw new ServiceException("涓氬姟绫诲瀷feign鎺ュ彛璋冪敤閿欒");
+        }
         if (listR.getData().size() == 0) {
             throw new VciBaseException("浼犲叆涓氬姟绫诲瀷鏈煡璇㈠埌鐩稿簲琛ㄥ崟锛岃妫�鏌ワ紒");
         }
@@ -3383,15 +3389,15 @@
 
         String lcstatusSql = "";
         if (StringUtils.isNotBlank(baseQueryObject.getConditionMap().get("lcstatus"))) {
-            lcstatusSql = "and lcstatus =" + VciBaseUtil.toInSql(baseQueryObject.getConditionMap().get("lcstatus"));
+            lcstatusSql = "lcstatus =" + VciBaseUtil.toInSql(baseQueryObject.getConditionMap().get("lcstatus"));
         }
 
         String num1 = baseQueryObject.getPage() * baseQueryObject.getLimit() + "";
         String num2 = ((baseQueryObject.getPage()) - 1) * baseQueryObject.getLimit() + 1 + "";
 
-        List<Map> maps = commonsMapper.selectBySql("select * from ( select rownum rn, t.* from (select * from " + listR.getData().get(0).getTableName()
-                + " where lastr = " + VciBaseUtil.toInSql(baseQueryObject.getConditionMap().get("lastr").toString())
-                + "and lastv =" + VciBaseUtil.toInSql(baseQueryObject.getConditionMap().get("lastv").toString())
+        List<Map> maps = commonsMapper.selectBySql("select * from ( select rownum rn, t.* from (select * from " + listR.getData().get(0).getTableName() + SPACE
+                + (StringUtils.isNotBlank(listR.getData().get(0).getRevisionRuleId()) ? (" where lastr = " + VciBaseUtil.toInSql(baseQueryObject.getConditionMap().get("lastr").toString())
+				+ " and lastv =" + VciBaseUtil.toInSql(baseQueryObject.getConditionMap().get("lastv").toString())) + " and":" where") + SPACE
                 + lcstatusSql + namesql + codesql + ") t where rownum <=" + num1 + ") where rn >=" + num2
         );
         List<BaseModel> baseModels = new ArrayList<>();
@@ -3433,15 +3439,18 @@
         } catch (Exception e) {
             throw new VciBaseException("鏌ヨ澶辫触锛�" + e.getMessage());
         }
-        int total = commonsMapper.queryCountBySql("select count(*) from " + listR.getData().get(0).getTableName()
-                + " where lastr = " + VciBaseUtil.toInSql(baseQueryObject.getConditionMap().get("lastr").toString())
-                + "and lastv =" + VciBaseUtil.toInSql(baseQueryObject.getConditionMap().get("lastv").toString())
+        int total = commonsMapper.queryCountBySql("select count(*) from " + listR.getData().get(0).getTableName() + SPACE
+                + (StringUtils.isNotBlank(listR.getData().get(0).getRevisionRuleId()) ? (" where lastr = " + VciBaseUtil.toInSql(baseQueryObject.getConditionMap().get("lastr").toString())
+                + "and lastv = " + VciBaseUtil.toInSql(baseQueryObject.getConditionMap().get("lastv").toString())) + " and":" where") + SPACE
                 + lcstatusSql + namesql + codesql
         );
-        Page<BaseModel>page=new Page<>();
-        page.setRecords(baseModels);
-        page.setTotal(total);
-        return page;
+		IPage<BaseModel> objectDataGrid = new Page<>();
+        objectDataGrid.setPages(baseQueryObject.getPage());
+		objectDataGrid.setCurrent(baseQueryObject.getPage());
+        objectDataGrid.setRecords(baseModels);
+        objectDataGrid.setSize(baseQueryObject.getLimit());
+        objectDataGrid.setTotal(total);
+        return objectDataGrid;
     }
 
     /**

--
Gitblit v1.9.3