@Test @Sql(scripts = { "/sql/clearBoundary.sql", "/sql/createBoundary.sql" }) public void testShouldGetAllBoundaryByTenantIdAndTypeIds(){ List<Long> list = new ArrayList<Long>(); list.add(1l); List<Boundary> boundarys = boundaryRepository.getAllBoundaryByTenantIdAndTypeIds("default",list); assertTrue(boundarys.size() == 1); assertTrue(boundarys!=null); assertTrue(boundarys.get(0).getId() == 1); assertTrue(boundarys.get(0).getName().equals("Srikakulam Municipality")); assertTrue(boundarys.get(0).getBoundaryNum().equals(1l)); assertTrue(boundarys.get(0).getBoundaryType().getId().equals("1")); assertTrue(boundarys.get(0).getLocalName().equals("Srikakulam Municipality")); assertTrue(boundarys.get(0).isHistory() == false); }
public List<Boundary> getAllBoundaryByTenantIdAndTypeIds(String tenantId, List<Long> boundaryTypeIds) { Map<String, Object> parametersMap = new HashMap<String, Object>(); parametersMap.put("tenantId", tenantId); parametersMap.put("boundaryTypeIds", boundaryTypeIds); List<Boundary> boundaryList = namedParameterJdbcTemplate.query( BoundaryQueryBuilder.getAllBoundaryByTenantIdAndTypeIds(), parametersMap, new BoundaryRowMapper()); boundaryList = setBoundariesWithParents(boundaryList); if (boundaryList != null && !boundaryList.isEmpty()) { boundaryList = boundaryList.stream() .filter(i -> boundaryTypeIds.contains(Long.valueOf(i.getBoundaryType().getId()))) .collect(Collectors.toList()); } return boundaryList; }
BoundaryRepository { public List<Boundary> getAllBoundaryByTenantIdAndTypeIds(String tenantId, List<Long> boundaryTypeIds) { Map<String, Object> parametersMap = new HashMap<String, Object>(); parametersMap.put("tenantId", tenantId); parametersMap.put("boundaryTypeIds", boundaryTypeIds); List<Boundary> boundaryList = namedParameterJdbcTemplate.query( BoundaryQueryBuilder.getAllBoundaryByTenantIdAndTypeIds(), parametersMap, new BoundaryRowMapper()); boundaryList = setBoundariesWithParents(boundaryList); if (boundaryList != null && !boundaryList.isEmpty()) { boundaryList = boundaryList.stream() .filter(i -> boundaryTypeIds.contains(Long.valueOf(i.getBoundaryType().getId()))) .collect(Collectors.toList()); } return boundaryList; } }
BoundaryRepository { public List<Boundary> getAllBoundaryByTenantIdAndTypeIds(String tenantId, List<Long> boundaryTypeIds) { Map<String, Object> parametersMap = new HashMap<String, Object>(); parametersMap.put("tenantId", tenantId); parametersMap.put("boundaryTypeIds", boundaryTypeIds); List<Boundary> boundaryList = namedParameterJdbcTemplate.query( BoundaryQueryBuilder.getAllBoundaryByTenantIdAndTypeIds(), parametersMap, new BoundaryRowMapper()); boundaryList = setBoundariesWithParents(boundaryList); if (boundaryList != null && !boundaryList.isEmpty()) { boundaryList = boundaryList.stream() .filter(i -> boundaryTypeIds.contains(Long.valueOf(i.getBoundaryType().getId()))) .collect(Collectors.toList()); } return boundaryList; } @Autowired  BoundaryRepository(NamedParameterJdbcTemplate namedParameterJdbcTemplate, JdbcTemplate jdbcTemplate,
			MdmsRepository mdmsRepository); }
BoundaryRepository { public List<Boundary> getAllBoundaryByTenantIdAndTypeIds(String tenantId, List<Long> boundaryTypeIds) { Map<String, Object> parametersMap = new HashMap<String, Object>(); parametersMap.put("tenantId", tenantId); parametersMap.put("boundaryTypeIds", boundaryTypeIds); List<Boundary> boundaryList = namedParameterJdbcTemplate.query( BoundaryQueryBuilder.getAllBoundaryByTenantIdAndTypeIds(), parametersMap, new BoundaryRowMapper()); boundaryList = setBoundariesWithParents(boundaryList); if (boundaryList != null && !boundaryList.isEmpty()) { boundaryList = boundaryList.stream() .filter(i -> boundaryTypeIds.contains(Long.valueOf(i.getBoundaryType().getId()))) .collect(Collectors.toList()); } return boundaryList; } @Autowired  BoundaryRepository(NamedParameterJdbcTemplate namedParameterJdbcTemplate, JdbcTemplate jdbcTemplate,
			MdmsRepository mdmsRepository); Boundary save(Boundary boundary); Boundary update(Boundary boundary); Boundary findByTenantIdAndId(String tenantId, Long id); List<Boundary> findByTenantIdAndCodes(String tenantId, List<String> codes); Boundary findByTenantIdAndCode(String tenantId, String code); List<Boundary> findAllByTenantId(String tenantId); Boundary findBoundarieByBoundaryTypeAndBoundaryNum(Long boundaryTypeId, Long boundaryNum, String tenantId); List<Boundary> getAllBoundariesByBoundaryTypeIdAndTenantId(final Long boundaryTypeId,
			final String tenantId); List<Boundary> getBoundariesByBndryTypeNameAndHierarchyTypeNameAndTenantId(final String boundaryTypeName,
			final String hierarchyTypeName, final String tenantId); List<Boundary> getBoundaryByTypeAndNumber(final long boundaryNumber, final long boundaryType); List<Boundary> getAllBoundaryByTenantIdAndTypeIds(String tenantId, List<Long> boundaryTypeIds); List<Boundary> findAllBoundariesByIdsAndTenant(final String tenantId, final List<Long> boundaryIds); List<Boundary> getAllBoundariesByIdsAndTypeAndNumberAndCodeAndTenant(
			BoundarySearchRequest boundarySearchRequest); List<Boundary> findAllParents(); List<Boundary> findActiveImmediateChildrenWithOutParent(Long parentId); List<Boundary> setBoundariesWithParents(List<Boundary> boundaryList); List<MdmsTenantBoundary> getBoundariesByTenantAndHierarchyType(BoundarySearchRequest boundarySearchRequest,
			RequestInfo requestInfo); }
BoundaryRepository { public List<Boundary> getAllBoundaryByTenantIdAndTypeIds(String tenantId, List<Long> boundaryTypeIds) { Map<String, Object> parametersMap = new HashMap<String, Object>(); parametersMap.put("tenantId", tenantId); parametersMap.put("boundaryTypeIds", boundaryTypeIds); List<Boundary> boundaryList = namedParameterJdbcTemplate.query( BoundaryQueryBuilder.getAllBoundaryByTenantIdAndTypeIds(), parametersMap, new BoundaryRowMapper()); boundaryList = setBoundariesWithParents(boundaryList); if (boundaryList != null && !boundaryList.isEmpty()) { boundaryList = boundaryList.stream() .filter(i -> boundaryTypeIds.contains(Long.valueOf(i.getBoundaryType().getId()))) .collect(Collectors.toList()); } return boundaryList; } @Autowired  BoundaryRepository(NamedParameterJdbcTemplate namedParameterJdbcTemplate, JdbcTemplate jdbcTemplate,
			MdmsRepository mdmsRepository); Boundary save(Boundary boundary); Boundary update(Boundary boundary); Boundary findByTenantIdAndId(String tenantId, Long id); List<Boundary> findByTenantIdAndCodes(String tenantId, List<String> codes); Boundary findByTenantIdAndCode(String tenantId, String code); List<Boundary> findAllByTenantId(String tenantId); Boundary findBoundarieByBoundaryTypeAndBoundaryNum(Long boundaryTypeId, Long boundaryNum, String tenantId); List<Boundary> getAllBoundariesByBoundaryTypeIdAndTenantId(final Long boundaryTypeId,
			final String tenantId); List<Boundary> getBoundariesByBndryTypeNameAndHierarchyTypeNameAndTenantId(final String boundaryTypeName,
			final String hierarchyTypeName, final String tenantId); List<Boundary> getBoundaryByTypeAndNumber(final long boundaryNumber, final long boundaryType); List<Boundary> getAllBoundaryByTenantIdAndTypeIds(String tenantId, List<Long> boundaryTypeIds); List<Boundary> findAllBoundariesByIdsAndTenant(final String tenantId, final List<Long> boundaryIds); List<Boundary> getAllBoundariesByIdsAndTypeAndNumberAndCodeAndTenant(
			BoundarySearchRequest boundarySearchRequest); List<Boundary> findAllParents(); List<Boundary> findActiveImmediateChildrenWithOutParent(Long parentId); List<Boundary> setBoundariesWithParents(List<Boundary> boundaryList); List<MdmsTenantBoundary> getBoundariesByTenantAndHierarchyType(BoundarySearchRequest boundarySearchRequest,
			RequestInfo requestInfo); static final Logger logger; }