From e146bc181625aee75624f8364654721cfd886254 Mon Sep 17 00:00:00 2001
From: ludc
Date: 星期五, 30 六月 2023 17:39:53 +0800
Subject: [PATCH] 修改部分空指针报错

---
 Source/UBCS/ubcs-service/ubcs-code/src/main/java/com/vci/ubcs/code/service/impl/MdmEngineServiceImpl.java |   29 ++++++++++++++---------------
 1 files changed, 14 insertions(+), 15 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 8cf14fa..9b1cac9 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;
@@ -3368,7 +3369,7 @@
      * @return 鍒楄〃鏁版嵁
      */
     @Override
-    public DataGrid<BaseModel> referDataGrid(UIFormReferVO referConfigVO, BaseQueryObject baseQueryObject) {
+    public IPage<BaseModel> referDataGrid(UIFormReferVO referConfigVO, BaseQueryObject baseQueryObject) {
 //		checkReferConfig(referConfigVO);
         //浣跨敤涓氬姟绫诲瀷鏌ヨ
         R<BtmTypeVO> allAttributeByBtmId = btmTypeClient.getAllAttributeByBtmId(referConfigVO.getReferType());
@@ -3386,14 +3387,11 @@
                 BtmTypeLcStatusConstant.RELEASE_LIFE_CYCLE.equalsIgnoreCase(btmTypeVO.getLifeCycleId())) {
             baseQueryObject.getConditionMap().put(VciQueryWrapperForDO.LC_STATUS_FIELD, CodeDefaultLC.RELEASED.getValue());
         }
-//        baseQueryObject.getConditionMap().put("domain", AppConstant.APPLICATION_NAME_CODE);
-//        R<Page<BtmTypeVO>> refPage = btmTypeClient.getRefPage(baseQueryObject);
-//
-//        if (refPage.getCode() != 200) {
-//            throw new ServiceException("涓氬姟绫诲瀷feign鎺ュ彛璋冪敤閿欒");
-//        }
 
         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("浼犲叆涓氬姟绫诲瀷鏈煡璇㈠埌鐩稿簲琛ㄥ崟锛岃妫�鏌ワ紒");
         }
@@ -3420,8 +3418,8 @@
         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())
+                + (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())):"")
                 + lcstatusSql + namesql + codesql + ") t where rownum <=" + num1 + ") where rn >=" + num2
         );
         List<BaseModel> baseModels = new ArrayList<>();
@@ -3464,15 +3462,16 @@
             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())
+                + (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())):"")
                 + lcstatusSql + namesql + codesql
         );
 
-        DataGrid<BaseModel> objectDataGrid = new DataGrid<>();
-        objectDataGrid.setPage(baseQueryObject.getPage());
-        objectDataGrid.setData(baseModels);
-        objectDataGrid.setLimit(baseQueryObject.getLimit());
+		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