| | |
| | | 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; |
| | |
| | | * @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()); |
| | |
| | | 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("传入业务类型未查询到相应表单,请检查!"); |
| | | } |
| | |
| | | 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<>(); |
| | |
| | | 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; |
| | | } |