@Test public void test() { ArrayList<Long> longs = new ArrayList<>(); longs.add(1000002L); List<ProblemFullData> fullDataByIds = problemDataServiceImpl.getFullDataByIds(longs); System.out.println("--------------------------------------"); System.out.println(fullDataByIds); System.out.println("--------------------------------------"); }
@Override public List<ProblemFullData> getFullDataByIds(List<Long> problemIds) { if (problemIds == null || problemIds.size() <= 0) { return new ArrayList<>(); } List<ProblemFullData> problemFullDataList = new ArrayList<>(); Map<Long, Problem> problemIdProblemMap = getProblemIdProblemMap(problemIds); Map<Long, Answer> problemIdAnswerMap = getProblemIdAnswerMap(problemIdProblemMap); Map<Long, Status> problemIdStatusMap = getProblemIdStatusMap(problemIds); Map<Long, Map<String, String>> problemIdExtDataMap = getProblemIdExtDataMap(problemIds); Map<Long, List<Tag>> problemIdTagMap = getProblemIdTagMap(problemIds); for (Long problemId : problemIds) { ProblemFullData problemFullData = new ProblemFullData(); problemFullData.setProblem(problemIdProblemMap.get(problemId)); problemFullData.setAnswer(problemIdAnswerMap.get(problemId)); problemFullData.setStatus(problemIdStatusMap.get(problemId)); problemFullData.setExtData(problemIdExtDataMap.get(problemId)); problemFullData.setTags(problemIdTagMap.get(problemId)); problemFullDataList.add(problemFullData); } return problemFullDataList; }
ProblemDataServiceImpl implements ProblemDataService { @Override public List<ProblemFullData> getFullDataByIds(List<Long> problemIds) { if (problemIds == null || problemIds.size() <= 0) { return new ArrayList<>(); } List<ProblemFullData> problemFullDataList = new ArrayList<>(); Map<Long, Problem> problemIdProblemMap = getProblemIdProblemMap(problemIds); Map<Long, Answer> problemIdAnswerMap = getProblemIdAnswerMap(problemIdProblemMap); Map<Long, Status> problemIdStatusMap = getProblemIdStatusMap(problemIds); Map<Long, Map<String, String>> problemIdExtDataMap = getProblemIdExtDataMap(problemIds); Map<Long, List<Tag>> problemIdTagMap = getProblemIdTagMap(problemIds); for (Long problemId : problemIds) { ProblemFullData problemFullData = new ProblemFullData(); problemFullData.setProblem(problemIdProblemMap.get(problemId)); problemFullData.setAnswer(problemIdAnswerMap.get(problemId)); problemFullData.setStatus(problemIdStatusMap.get(problemId)); problemFullData.setExtData(problemIdExtDataMap.get(problemId)); problemFullData.setTags(problemIdTagMap.get(problemId)); problemFullDataList.add(problemFullData); } return problemFullDataList; } }
ProblemDataServiceImpl implements ProblemDataService { @Override public List<ProblemFullData> getFullDataByIds(List<Long> problemIds) { if (problemIds == null || problemIds.size() <= 0) { return new ArrayList<>(); } List<ProblemFullData> problemFullDataList = new ArrayList<>(); Map<Long, Problem> problemIdProblemMap = getProblemIdProblemMap(problemIds); Map<Long, Answer> problemIdAnswerMap = getProblemIdAnswerMap(problemIdProblemMap); Map<Long, Status> problemIdStatusMap = getProblemIdStatusMap(problemIds); Map<Long, Map<String, String>> problemIdExtDataMap = getProblemIdExtDataMap(problemIds); Map<Long, List<Tag>> problemIdTagMap = getProblemIdTagMap(problemIds); for (Long problemId : problemIds) { ProblemFullData problemFullData = new ProblemFullData(); problemFullData.setProblem(problemIdProblemMap.get(problemId)); problemFullData.setAnswer(problemIdAnswerMap.get(problemId)); problemFullData.setStatus(problemIdStatusMap.get(problemId)); problemFullData.setExtData(problemIdExtDataMap.get(problemId)); problemFullData.setTags(problemIdTagMap.get(problemId)); problemFullDataList.add(problemFullData); } return problemFullDataList; } ProblemDataServiceImpl(ProblemRepository problemRepository, StatusRepository statusRepository, ExtDataRepository extDataRepository, ProblemTagRepository problemTagRepository, TagRepository tagRepository, AnswerRepository answerRepository); }
ProblemDataServiceImpl implements ProblemDataService { @Override public List<ProblemFullData> getFullDataByIds(List<Long> problemIds) { if (problemIds == null || problemIds.size() <= 0) { return new ArrayList<>(); } List<ProblemFullData> problemFullDataList = new ArrayList<>(); Map<Long, Problem> problemIdProblemMap = getProblemIdProblemMap(problemIds); Map<Long, Answer> problemIdAnswerMap = getProblemIdAnswerMap(problemIdProblemMap); Map<Long, Status> problemIdStatusMap = getProblemIdStatusMap(problemIds); Map<Long, Map<String, String>> problemIdExtDataMap = getProblemIdExtDataMap(problemIds); Map<Long, List<Tag>> problemIdTagMap = getProblemIdTagMap(problemIds); for (Long problemId : problemIds) { ProblemFullData problemFullData = new ProblemFullData(); problemFullData.setProblem(problemIdProblemMap.get(problemId)); problemFullData.setAnswer(problemIdAnswerMap.get(problemId)); problemFullData.setStatus(problemIdStatusMap.get(problemId)); problemFullData.setExtData(problemIdExtDataMap.get(problemId)); problemFullData.setTags(problemIdTagMap.get(problemId)); problemFullDataList.add(problemFullData); } return problemFullDataList; } ProblemDataServiceImpl(ProblemRepository problemRepository, StatusRepository statusRepository, ExtDataRepository extDataRepository, ProblemTagRepository problemTagRepository, TagRepository tagRepository, AnswerRepository answerRepository); @Override List<ProblemFullData> getFullDataByIds(List<Long> problemIds); Map<Long, Problem> getProblemIdProblemMap(List<Long> problemIds); Map<Long, Status> getProblemIdStatusMap(List<Long> problemIds); Map<Long, Map<String, String>> getProblemIdExtDataMap(List<Long> problemIds); Map<Long, List<Tag>> getProblemIdTagMap(List<Long> problemIds); Map<Long, Answer> getProblemIdAnswerMap(Map<Long, Problem> problemIdProblemMap); }
ProblemDataServiceImpl implements ProblemDataService { @Override public List<ProblemFullData> getFullDataByIds(List<Long> problemIds) { if (problemIds == null || problemIds.size() <= 0) { return new ArrayList<>(); } List<ProblemFullData> problemFullDataList = new ArrayList<>(); Map<Long, Problem> problemIdProblemMap = getProblemIdProblemMap(problemIds); Map<Long, Answer> problemIdAnswerMap = getProblemIdAnswerMap(problemIdProblemMap); Map<Long, Status> problemIdStatusMap = getProblemIdStatusMap(problemIds); Map<Long, Map<String, String>> problemIdExtDataMap = getProblemIdExtDataMap(problemIds); Map<Long, List<Tag>> problemIdTagMap = getProblemIdTagMap(problemIds); for (Long problemId : problemIds) { ProblemFullData problemFullData = new ProblemFullData(); problemFullData.setProblem(problemIdProblemMap.get(problemId)); problemFullData.setAnswer(problemIdAnswerMap.get(problemId)); problemFullData.setStatus(problemIdStatusMap.get(problemId)); problemFullData.setExtData(problemIdExtDataMap.get(problemId)); problemFullData.setTags(problemIdTagMap.get(problemId)); problemFullDataList.add(problemFullData); } return problemFullDataList; } ProblemDataServiceImpl(ProblemRepository problemRepository, StatusRepository statusRepository, ExtDataRepository extDataRepository, ProblemTagRepository problemTagRepository, TagRepository tagRepository, AnswerRepository answerRepository); @Override List<ProblemFullData> getFullDataByIds(List<Long> problemIds); Map<Long, Problem> getProblemIdProblemMap(List<Long> problemIds); Map<Long, Status> getProblemIdStatusMap(List<Long> problemIds); Map<Long, Map<String, String>> getProblemIdExtDataMap(List<Long> problemIds); Map<Long, List<Tag>> getProblemIdTagMap(List<Long> problemIds); Map<Long, Answer> getProblemIdAnswerMap(Map<Long, Problem> problemIdProblemMap);  }