Project

General

Profile

« Previous | Next » 

Revision 50840

1. API to find divhelpcontents by div
2. API to find div by name

View differences:

DivIdController.java
31 31

  
32 32
    @RequestMapping(value = "/div", method = RequestMethod.GET)
33 33
    public List<DivId> getDivIds(@RequestParam(required = false) String community,
34
                                    @RequestParam(required = false) String page) {
34
                                 @RequestParam(required = false) String page,
35
                                 @RequestParam(required = false) String name) {
35 36
        List<DivId> divIds = null;
36
        if(community != null && page != null) {
37
            String communityId = communityDAO.findByPid(community).getId();
37
        String communityId = null;
38
        if(community != null) {
39
            communityId = communityDAO.findByPid(community).getId();
40
        }
41

  
42
        if(community != null && page != null && name != null) {
43
            divIds = divIdDAO.findByCommunityAndPageAndName(communityId, page, name);
44
        } else if(community != null && page != null) {
38 45
            divIds = divIdDAO.findByCommunityAndPage(communityId, page);
46
        } else if(community != null && name != null) {
47
            divIds = divIdDAO.findByCommunityAndName(communityId, name);
48
        } else if(page != null && name != null) {
49
            divIds = divIdDAO.findByPageAndName(page, name);
39 50
        } else if(community != null) {
40
            String communityId = communityDAO.findByPid(community).getId();
41 51
            divIds = divIdDAO.findByCommunity(communityId);
52
        } else if(page != null) {
53
            divIds = divIdDAO.findByPage(page);
54
        } else if(name != null) {
55
            divIds = divIdDAO.findByName(name);
42 56
        } else {
43 57
            divIds = divIdDAO.findAll();
44 58
        }
......
47 61

  
48 62
    @RequestMapping(value = "/divFull", method = RequestMethod.GET)
49 63
    public List<DivIdResponse> getDivIdsFull(@RequestParam(required = false) String community,
50
                                             @RequestParam(required = false) String page) {
64
                                             @RequestParam(required = false) String page,
65
                                             @RequestParam(required = false) String name) {
51 66

  
52
        List<DivId> divIds = this.getDivIds(community, page);
67
        List<DivId> divIds = this.getDivIds(community, page, name);
53 68

  
54 69
        List<DivIdResponse> divIdResponses = new ArrayList<>();
55 70
        for(DivId divId : divIds) {

Also available in: Unified diff