| | |
| | | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
| | | import com.ruoyi.common.core.domain.R; |
| | | import com.ruoyi.common.security.utils.SecurityUtils; |
| | | import com.ruoyi.goods.domain.dto.MerGoodsPageDto; |
| | | import com.ruoyi.goods.domain.vo.MerGoodsPageVo; |
| | | import com.ruoyi.goods.domain.dto.MgtGoodsEditDto; |
| | | import com.ruoyi.goods.domain.dto.MgtGoodsPageDto; |
| | | import com.ruoyi.goods.domain.dto.MgtGoodsRecommendDto; |
| | | import com.ruoyi.goods.domain.dto.MgtGoodsUpDownDto; |
| | | import com.ruoyi.goods.domain.vo.MgtGoodsPageVo; |
| | | import com.ruoyi.goods.domain.vo.MgtGoodsTotalVo; |
| | | import com.ruoyi.goods.service.goods.GoodsService; |
| | | import com.ruoyi.system.api.domain.dto.MgtBaseDto; |
| | | import com.ruoyi.system.api.domain.dto.MgtBaseGetDto; |
| | | import io.swagger.annotations.Api; |
| | | import io.swagger.annotations.ApiOperation; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.web.bind.annotation.RequestBody; |
| | | import org.springframework.web.bind.annotation.RequestMapping; |
| | | import org.springframework.web.bind.annotation.RequestMethod; |
| | |
| | | @Resource |
| | | private GoodsService goodsService; |
| | | |
| | | /*@RequestMapping(value = "/pageMgtGoods", method = RequestMethod.POST) |
| | | @RequestMapping(value = "/pageMgtGoods", method = RequestMethod.POST) |
| | | @ApiOperation(value = "分页获取商品列表") |
| | | public R<Page<MerGoodsPageVo>> pageMgtGoods(@RequestBody MerGoodsPageDto merGoodsPageDto) { |
| | | Long userId = SecurityUtils.getUserId(); |
| | | Page<MerGoodsPageVo> page = new Page<>(); |
| | | page.setSize(merGoodsPageDto.getPageSize()); |
| | | page.setCurrent(merGoodsPageDto.getPageNum()); |
| | | public R<Page<MgtGoodsPageVo>> pageMgtGoods(@RequestBody MgtGoodsPageDto mgtGoodsPageDto) { |
| | | Page<MgtGoodsPageVo> page = new Page<>(); |
| | | page.setSize(mgtGoodsPageDto.getPageSize()); |
| | | page.setCurrent(mgtGoodsPageDto.getPageNum()); |
| | | page.setOptimizeCountSql(false); |
| | | List<MerGoodsPageVo> merGoodsPageVoList = goodsService.pageMgtGoods(page,merGoodsPageDto); |
| | | List<MgtGoodsPageVo> merGoodsPageVoList = goodsService.pageMgtGoods(page,mgtGoodsPageDto); |
| | | return R.ok(page.setRecords(merGoodsPageVoList)); |
| | | }*/ |
| | | } |
| | | |
| | | @RequestMapping(value = "/getMgtGoodsTotal", method = RequestMethod.POST) |
| | | @ApiOperation(value = "获取商品统计") |
| | | public R<MgtGoodsTotalVo> getMgtGoodsTotal(@RequestBody MgtBaseDto mgtBaseDto) { |
| | | Long userId = SecurityUtils.getUserId(); |
| | | mgtBaseDto.setUserId(userId); |
| | | MgtGoodsTotalVo mgtGoodsTotalVo = goodsService.getMgtGoodsTotal(); |
| | | return R.ok(mgtGoodsTotalVo); |
| | | } |
| | | |
| | | @RequestMapping(value = "/editMgtGoods", method = RequestMethod.POST) |
| | | @ApiOperation(value = "平台编辑商品") |
| | | public R editMgtGoods(@RequestBody MgtGoodsEditDto mgtGoodsEditDto) { |
| | | Long userId = SecurityUtils.getUserId(); |
| | | mgtGoodsEditDto.setUserId(userId); |
| | | goodsService.editMgtGoods(mgtGoodsEditDto); |
| | | return R.ok(); |
| | | } |
| | | |
| | | @RequestMapping(value = "/upDownMgtGoods", method = RequestMethod.POST) |
| | | @ApiOperation(value = "平台上下架商品") |
| | | public R upDownMgtGoods(@RequestBody MgtGoodsUpDownDto mgtGoodsUpDownDto) { |
| | | Long userId = SecurityUtils.getUserId(); |
| | | mgtGoodsUpDownDto.setUserId(userId); |
| | | goodsService.upDownMgtGoods(mgtGoodsUpDownDto); |
| | | return R.ok(); |
| | | } |
| | | |
| | | @RequestMapping(value = "/recommendMgtGoods", method = RequestMethod.POST) |
| | | @ApiOperation(value = "平台推荐商品") |
| | | public R recommendMgtGoods(@RequestBody MgtGoodsRecommendDto mgtGoodsRecommendDto) { |
| | | Long userId = SecurityUtils.getUserId(); |
| | | mgtGoodsRecommendDto.setUserId(userId); |
| | | goodsService.recommendMgtGoods(mgtGoodsRecommendDto); |
| | | return R.ok(); |
| | | } |
| | | |
| | | @RequestMapping(value = "/deleteMgtGoods", method = RequestMethod.POST) |
| | | @ApiOperation(value = "平台推荐商品") |
| | | public R deleteMgtGoods(@RequestBody MgtBaseGetDto mgtBaseGetDto) { |
| | | Long userId = SecurityUtils.getUserId(); |
| | | mgtBaseGetDto.setUserId(userId); |
| | | goodsService.deleteMgtGoods(mgtBaseGetDto.getId(),userId); |
| | | return R.ok(); |
| | | } |
| | | } |