Commit f6a70f9b by xub

标签分页

parent 1d187edd
package com.gic.plug.web.controller.goods;
import com.gic.api.base.commons.Page;
import com.gic.api.base.commons.ServiceResponse;
import com.gic.commons.util.EntityUtil;
import com.gic.commons.util.PageHelperUtils;
import com.gic.commons.webapi.reponse.RestResponse;
import com.gic.goods.api.dto.ErrorCode;
import com.gic.goods.api.dto.GoodsTagDTO;
import com.gic.goods.api.dto.StandardDTO;
import com.gic.goods.api.service.TagApiService;
import com.gic.plug.web.vo.goods.GoodsTagVO;
import org.apache.commons.collections.CollectionUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import java.util.List;
......@@ -31,16 +35,16 @@ public class GoodsTagController {
* @author xub
*/
@GetMapping("list-tag")
public RestResponse findList(Long goodsDomainId) {
public RestResponse findList(@RequestParam(value = "currentPage", defaultValue = "1") Integer currentPage,
@RequestParam(value = "pageSize", defaultValue = "20") Integer pageSize, Long goodsDomainId) {
if (goodsDomainId == null) {
return RestResponse.failure(ErrorCode.UNKNOW_ERROR.getCode(), "参数不全");
}
ServiceResponse<List<GoodsTagDTO>> serviceResponse = tagApiService.listAll(goodsDomainId);
List<GoodsTagDTO> result = serviceResponse.getResult();
if (CollectionUtils.isEmpty(result)) {
return RestResponse.success();
}
List<GoodsTagVO> list = EntityUtil.changeEntityListByOrika(GoodsTagVO.class, result);
return RestResponse.success(list);
ServiceResponse<Page<GoodsTagDTO>> serviceResponse = tagApiService.listByPage(currentPage, pageSize,
goodsDomainId);
Page<GoodsTagVO> voPage = PageHelperUtils.changePageToCurrentPage(serviceResponse.getResult(),
GoodsTagVO.class);
return RestResponse.success(voPage);
}
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment