| | |
| | | } |
| | | |
| | | for (String id : ids) { |
| | | if (StringHelper.isEmpty(id)) { |
| | | continue; |
| | | } |
| | | if (!rs.contains(id)) { |
| | | rs.add(id); |
| | | } |
| | |
| | | * 请求DB数据下载 |
| | | */ |
| | | public String downloadDbReq(UserEntity ue, DownloadReqEntity dr) { |
| | | Map<String, String> annexMap = new HashMap<>(3); |
| | | Map<String, List<?>> dataMap = new HashMap<>(3); |
| | | Map<String, List<?>> dataMap = new HashMap<>(2); |
| | | Map<String, List<AttachEntity>> annexMap = new HashMap<>(2); |
| | | |
| | | queryData(dr, dataMap, annexMap); |
| | | if (dataMap.size() == 0) { |
| | | return null; |
| | | } |
| | | |
| | | // |
| | | |
| | | |
| | | return null; |
| | | } |
| | | |
| | | /** |
| | | * 查询数据 |
| | | * 查询数据+附件 |
| | | */ |
| | | private void queryData(DownloadReqEntity dr, Map<String, List<?>> dataMap , Map<String, String> annexMap) { |
| | | private void queryData(DownloadReqEntity dr, Map<String, List<?>> dataMap, Map<String, List<AttachEntity>> annexMap) { |
| | | for (String enity : dr.getEntities()) { |
| | | try { |
| | | BasicMapper baseMapper = ClassHelper.getBasicMapper(enity); |
| | |
| | | } |
| | | |
| | | QueryWrapper wrapper = createQueryWrapper(baseMapper, dr); |
| | | List<?> list = baseMapper.selectList(wrapper); |
| | | List list = baseMapper.selectList(wrapper); |
| | | if (null == list || list.size() == 0) { |
| | | continue; |
| | | } |
| | | |
| | | // SQL片段 |
| | | String sqlSegment = wrapper.getSqlSegment(); |
| | | |
| | | String tab = BaseQueryService.getTabName(baseMapper); |
| | | if (!dataMap.containsKey(enity)) { |
| | | dataMap.put(enity, list); |
| | | } else { |
| | | dataMap.get(enity).addAll(list); |
| | | } |
| | | if ("bborehole".equals(enity)){ |
| | | continue; |
| | | } |
| | | if (wrapper.isEmptyOfWhere()) { |
| | | wrapper.apply("1 = 1"); |
| | | } |
| | | |
| | | List<AttachEntity> annex = baseMapper.selectAnnex(tab, wrapper); |
| | | if (null == annex || annex.isEmpty()) { |
| | | continue; |
| | | } |
| | | |
| | | if (!annexMap.containsKey(enity)) { |
| | | annexMap.put(enity, annex); |
| | | } else { |
| | | annexMap.get(enity).addAll(annex); |
| | | } |
| | | } catch (Exception ex) { |
| | | log.error(ex.getMessage(), ex); |
| | |
| | | wrapper.apply(dirs); |
| | | } |
| | | if (!StringHelper.isEmpty(dr.getDepcode())) { |
| | | // wrapper.apply(String.format("depid like '%s'", StringHelper.getRightLike(dr.getDepcode()))) |
| | | wrapper.likeRight("depid", dr.getDepcode()); |
| | | } |
| | | if (baseMapper instanceof GeomBaseMapper && !StringHelper.isEmpty(dr.getWkt())) { |
| | |
| | | removeDuplicate(list); |
| | | setRightLike(list, field); |
| | | |
| | | return StringHelper.join(list, " or "); |
| | | return "(" + StringHelper.join(list, " or ") + ")"; |
| | | } |
| | | |
| | | /** |