| | |
| | | |
| | | import com.ruoyi.common.basic.PageInfo; |
| | | import com.ruoyi.common.core.domain.AjaxResult; |
| | | import com.ruoyi.framework.web.service.TokenService; |
| | | import com.ruoyi.system.domain.TGoods; |
| | | import com.ruoyi.system.query.TGoodsQuery; |
| | | import com.ruoyi.system.service.TGoodsService; |
| | | import com.ruoyi.system.service.TGoodsService; |
| | | import com.ruoyi.system.vo.TGoodsVO; |
| | | import io.swagger.annotations.Api; |
| | |
| | | public class TGoodsController { |
| | | |
| | | private final TGoodsService goodsService; |
| | | private final TokenService tokenService; |
| | | |
| | | @Autowired |
| | | public TGoodsController(TGoodsService goodsService) { |
| | | public TGoodsController(TGoodsService goodsService, TokenService tokenService) { |
| | | this.goodsService = goodsService; |
| | | this.tokenService = tokenService; |
| | | } |
| | | |
| | | /** |
| | |
| | | @ApiOperation( value = "查询商品管理分页列表") |
| | | @PostMapping(value = "/pageList") |
| | | public AjaxResult<PageInfo<TGoodsVO>> pageList(@RequestBody TGoodsQuery query) { |
| | | query.setShopId(tokenService.getLoginUser().getObjectId()); |
| | | return AjaxResult.success(goodsService.pageList(query)); |
| | | } |
| | | |
| | |
| | | @ApiOperation( value = "添加商品管理") |
| | | @PostMapping(value = "/add") |
| | | public AjaxResult<Boolean> add(@RequestBody TGoods dto) { |
| | | dto.setShopId(tokenService.getLoginUser().getObjectId()); |
| | | return AjaxResult.success(goodsService.save(dto)); |
| | | } |
| | | |