ludc
2023-06-30 e146bc181625aee75624f8364654721cfd886254
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;
    }