| | |
| | | import cc.mrbird.febs.common.controller.BaseController; |
| | | import cc.mrbird.febs.common.entity.FebsResponse; |
| | | import cc.mrbird.febs.common.entity.QueryRequest; |
| | | import cc.mrbird.febs.common.exception.FebsException; |
| | | import cc.mrbird.febs.mall.entity.MallNewsInfo; |
| | | import cc.mrbird.febs.mall.entity.MallShop; |
| | | import cc.mrbird.febs.mall.service.IMallShopService; |
| | | import lombok.RequiredArgsConstructor; |
| | | import lombok.extern.slf4j.Slf4j; |
| | | import org.springframework.validation.annotation.Validated; |
| | | import org.springframework.web.bind.annotation.GetMapping; |
| | | import org.springframework.web.bind.annotation.RequestMapping; |
| | | import org.springframework.web.bind.annotation.RestController; |
| | | import org.springframework.web.bind.annotation.*; |
| | | |
| | | @Slf4j |
| | | @Validated |
| | |
| | | public FebsResponse shopListInPage(MallShop mallShop, QueryRequest request) { |
| | | return new FebsResponse().success().data(getDataTable(mallShopService.findShopListInPage(mallShop, request))); |
| | | } |
| | | |
| | | @PostMapping(value = "/add") |
| | | public FebsResponse add(MallShop mallShop) { |
| | | mallShop.setState(2); |
| | | mallShopService.save(mallShop); |
| | | return new FebsResponse().success().message("添加成功"); |
| | | } |
| | | |
| | | @PostMapping(value = "/update") |
| | | public FebsResponse update(MallShop mallShop) { |
| | | mallShopService.updateById(mallShop); |
| | | return new FebsResponse().success().message("编辑成功"); |
| | | } |
| | | |
| | | @GetMapping(value = "/del/{id}") |
| | | public FebsResponse del(@PathVariable("id") Long id) { |
| | | mallShopService.removeById(id); |
| | | return new FebsResponse().success().message("删除成功"); |
| | | } |
| | | |
| | | @PostMapping(value = "/upOrDown/{id}/{state}") |
| | | public FebsResponse upOrDown(@PathVariable("id") Long id,@PathVariable("state") Integer state) { |
| | | MallShop shop = mallShopService.getById(id); |
| | | if (shop == null) { |
| | | throw new FebsException("店铺不存在"); |
| | | } |
| | | |
| | | shop.setState(state); |
| | | mallShopService.updateById(shop); |
| | | return new FebsResponse().success().message("操作成功"); |
| | | } |
| | | } |