| | |
| | | import com.ruoyi.common.log.enums.BusinessType; |
| | | import com.ruoyi.common.security.utils.SecurityUtils; |
| | | import com.ruoyi.goods.domain.dto.*; |
| | | import com.ruoyi.goods.domain.vo.MgtGoodsEditInfoVo; |
| | | 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 com.ruoyi.system.api.domain.vo.MgtSelectGoodsPageVo; |
| | | import io.swagger.annotations.Api; |
| | | import io.swagger.annotations.ApiOperation; |
| | | import org.springframework.validation.annotation.Validated; |
| | | import org.springframework.web.bind.annotation.RequestBody; |
| | | import org.springframework.web.bind.annotation.RequestMapping; |
| | | import org.springframework.web.bind.annotation.RequestMethod; |
| | |
| | | * @date 2023年06月01日 |
| | | * @version: 1.0 |
| | | */ |
| | | @Api(value = "平台端商品相关接口", tags = "平台端商品相关接口", description = "平台端商品相关接口") |
| | | @Api(value = "管理后台商品相关接口", tags = "管理后台商品相关接口", description = "管理后台商品相关接口") |
| | | @RestController |
| | | @RequestMapping("/mgt/goods") |
| | | public class MgtGoodsController { |
| | |
| | | |
| | | @RequestMapping(value = "/exportPageMgtGoods", method = RequestMethod.POST) |
| | | @ApiOperation(value = "导出商品列表") |
| | | public void exportPageMgtGoods(@RequestBody MgtGoodsPageDto mgtGoodsPageDto, HttpServletResponse response) { |
| | | public void exportPageMgtGoods( MgtGoodsPageDto mgtGoodsPageDto, HttpServletResponse response) { |
| | | Page<MgtGoodsPageVo> page = new Page<>(); |
| | | page.setSize(2000); |
| | | page.setCurrent(1); |
| | | if(mgtGoodsPageDto.getPageSize() > 5000){ |
| | | page.setSize(5000); |
| | | page.setCurrent(1); |
| | | }else{ |
| | | page.setSize(mgtGoodsPageDto.getPageSize()); |
| | | page.setCurrent(mgtGoodsPageDto.getPageNum()); |
| | | } |
| | | List<MgtGoodsPageVo> mgtGoodsPageVoList = goodsService.pageMgtGoods(page,mgtGoodsPageDto); |
| | | ExcelUtil<MgtGoodsPageVo> util = new ExcelUtil<MgtGoodsPageVo>(MgtGoodsPageVo.class); |
| | | util.exportExcel(response, mgtGoodsPageVoList, "商品列表"); |
| | |
| | | |
| | | @RequestMapping(value = "/getMgtGoodsTotal", method = RequestMethod.POST) |
| | | @ApiOperation(value = "获取商品统计") |
| | | public R<MgtGoodsTotalVo> getMgtGoodsTotal(@RequestBody MgtBaseDto mgtBaseDto) { |
| | | Long userId = SecurityUtils.getUserId(); |
| | | mgtBaseDto.setUserId(userId); |
| | | public R<MgtGoodsTotalVo> getMgtGoodsTotal() { |
| | | MgtGoodsTotalVo mgtGoodsTotalVo = goodsService.getMgtGoodsTotal(); |
| | | return R.ok(mgtGoodsTotalVo); |
| | | } |
| | |
| | | @RequestMapping(value = "/editMgtGoods", method = RequestMethod.POST) |
| | | @Log(title = "商品管理", businessType = BusinessType.UPDATE,operContent = "编辑商品") |
| | | @ApiOperation(value = "平台编辑商品") |
| | | public R editMgtGoods(@RequestBody MgtGoodsEditDto mgtGoodsEditDto) { |
| | | public R editMgtGoods(@Validated @RequestBody MgtGoodsEditDto mgtGoodsEditDto) { |
| | | Long userId = SecurityUtils.getUserId(); |
| | | mgtGoodsEditDto.setUserId(userId); |
| | | goodsService.editMgtGoods(mgtGoodsEditDto); |
| | |
| | | List<MgtSelectGoodsPageVo> mgtSelectGoodsPageVos = goodsService.pageMgtSelectGoods(page,mgtSelectGoodsPageDto); |
| | | return R.ok(page.setRecords(mgtSelectGoodsPageVos)); |
| | | } |
| | | |
| | | @RequestMapping(value = "/getMgtGoodsEditInfo", method = RequestMethod.POST) |
| | | @ApiOperation(value = "获取商品编辑信息") |
| | | public R<MgtGoodsEditInfoVo> getMgtGoodsEditInfo(@RequestBody MgtBaseGetDto mgtBaseGetDto) { |
| | | MgtGoodsEditInfoVo mgtGoodsEditInfoVo = goodsService.getMgtGoodsEditInfo(mgtBaseGetDto); |
| | | return R.ok(mgtGoodsEditInfoVo); |
| | | } |
| | | } |