Search in sources :

Example 1 with Collection

use of com.topcom.cms.yuqing.domain.Collection in project topcom-cloud by 545314690.

the class CollectionController method isCollected.

/**
 * 根据输入,返回分页结果中的当前页,包括当前页信息和其中的实体对象集合
 *
 * @param request
 * @param response
 * @return
 */
@RequestMapping(value = "/isCollected.json", method = RequestMethod.GET, produces = "application/json")
@ResponseBody
public boolean isCollected(HttpServletRequest request, HttpServletResponse response, String oId) {
    boolean isCollected = false;
    Collection collection = this.collectionManager.findByOId(oId);
    if (collection != null) {
        isCollected = true;
    }
    return isCollected;
}
Also used : Collection(com.topcom.cms.yuqing.domain.Collection) RequestMapping(org.springframework.web.bind.annotation.RequestMapping) ResponseBody(org.springframework.web.bind.annotation.ResponseBody)

Example 2 with Collection

use of com.topcom.cms.yuqing.domain.Collection in project topcom-cloud by 545314690.

the class CollectionController method findByType.

/**
 * 根据输入,返回分页结果中的当前页,包括当前页信息和其中的实体对象集合
 *
 * @param request
 * @param response
 * @param type
 * @return
 */
@RequestMapping(value = "/findByType.json", method = RequestMethod.GET, produces = "application/json")
@ResponseBody
public Page<Collection> findByType(HttpServletRequest request, HttpServletResponse response, MediaType type) {
    String page = request.getParameter("page");
    String limit = request.getParameter("limit");
    String keywords = request.getParameter("keywords");
    Page<Collection> cPage = null;
    if (StringUtils.isNotBlank(page)) {
        this.pageNumber = Integer.valueOf(page) - 1;
    } else {
        this.pageNumber = 0;
    }
    if (StringUtils.isNotBlank(limit)) {
        this.pageSize = Integer.valueOf(limit);
    }
    this.pageable = new PageRequest(this.pageNumber, this.pageSize, new Sort(Direction.DESC, "dateCreated"));
    if (StringUtils.isBlank(keywords)) {
        keywords = "";
    }
    cPage = this.manager.findByType(this.pageable, type, keywords);
    logger.info(cPage);
    return cPage;
}
Also used : PageRequest(org.springframework.data.domain.PageRequest) Collection(com.topcom.cms.yuqing.domain.Collection) Sort(org.springframework.data.domain.Sort) RequestMapping(org.springframework.web.bind.annotation.RequestMapping) ResponseBody(org.springframework.web.bind.annotation.ResponseBody)

Aggregations

Collection (com.topcom.cms.yuqing.domain.Collection)2 RequestMapping (org.springframework.web.bind.annotation.RequestMapping)2 ResponseBody (org.springframework.web.bind.annotation.ResponseBody)2 PageRequest (org.springframework.data.domain.PageRequest)1 Sort (org.springframework.data.domain.Sort)1