package com.xzx.gc.shop.controller;
|
|
|
import com.github.pagehelper.PageInfo;
|
import com.xzx.gc.model.JsonResult;
|
import com.xzx.gc.shop.dto.XcxGoodsListDto;
|
import com.xzx.gc.shop.service.GoodsService;
|
import com.xzx.gc.shop.vo.GoodsCategoryVo;
|
import com.xzx.gc.shop.vo.XcxGoodsListVo;
|
import io.swagger.annotations.Api;
|
import io.swagger.annotations.ApiOperation;
|
import io.swagger.annotations.ApiResponse;
|
import io.swagger.annotations.ApiResponses;
|
import lombok.extern.slf4j.Slf4j;
|
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.web.bind.annotation.GetMapping;
|
import org.springframework.web.bind.annotation.PostMapping;
|
import org.springframework.web.bind.annotation.RequestBody;
|
import org.springframework.web.bind.annotation.RestController;
|
|
import javax.servlet.http.HttpServletRequest;
|
import java.util.List;
|
|
@RestController
|
@Api(tags = {"积分商城--API商品管理"})
|
@Slf4j
|
public class ApiGoodsController {
|
|
@Autowired
|
private GoodsService goodsService;
|
|
@ApiOperation("分类列表")
|
@ApiResponses(
|
@ApiResponse(code = 200, message = "success", response = GoodsCategoryVo.class)
|
)
|
@GetMapping(value = "/goods/goodsCategory")
|
public JsonResult<List<GoodsCategoryVo>> goodsCategory() {
|
return JsonResult.success(goodsService.findCategoryWithChildren());
|
}
|
|
@ApiOperation("商品列表")
|
@ApiResponses(
|
@ApiResponse(code = 200, message = "success", response = XcxGoodsListVo.class)
|
)
|
@PostMapping(value = "/goods/goodsList")
|
public JsonResult<PageInfo<XcxGoodsListVo>> goodsList(@RequestBody XcxGoodsListDto xcxGoodsListDto, HttpServletRequest request) {
|
return JsonResult.success(goodsService.findGoodsListInPage(xcxGoodsListDto));
|
}
|
|
}
|