| ¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.doumee.api.business; |
| | | |
| | | import com.doumee.api.BaseController; |
| | | import com.doumee.core.annotation.excel.ExcelExporter; |
| | | import com.doumee.core.annotation.pr.PreventRepeat; |
| | | import com.doumee.core.model.ApiResponse; |
| | | import com.doumee.core.model.PageWrap; |
| | | import com.doumee.core.model.PageData; |
| | | import com.doumee.dao.business.model.Discount; |
| | | import com.doumee.service.business.DiscountService; |
| | | import io.swagger.annotations.Api; |
| | | import io.swagger.annotations.ApiOperation; |
| | | import org.apache.shiro.authz.annotation.RequiresPermissions; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.web.bind.annotation.*; |
| | | import javax.servlet.http.HttpServletResponse; |
| | | |
| | | import java.util.ArrayList; |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * @author æ±è¹è¹ |
| | | * @date 2025/02/17 09:43 |
| | | */ |
| | | @Api(tags = "éªè¡å¥é¤ä¿¡æ¯è¡¨") |
| | | @RestController |
| | | @RequestMapping("/business/discount") |
| | | public class DiscountController extends BaseController { |
| | | |
| | | @Autowired |
| | | private DiscountService discountService; |
| | | |
| | | @PreventRepeat |
| | | @ApiOperation("æ°å»º") |
| | | @PostMapping("/create") |
| | | @RequiresPermissions("business:discount:create") |
| | | public ApiResponse create(@RequestBody Discount discount) { |
| | | return ApiResponse.success(discountService.create(discount)); |
| | | } |
| | | |
| | | @ApiOperation("æ ¹æ®IDå é¤") |
| | | @GetMapping("/delete/{id}") |
| | | @RequiresPermissions("business:discount:delete") |
| | | public ApiResponse deleteById(@PathVariable String id) { |
| | | discountService.deleteById(id); |
| | | return ApiResponse.success(null); |
| | | } |
| | | |
| | | @ApiOperation("æ¹éå é¤") |
| | | @GetMapping("/delete/batch") |
| | | @RequiresPermissions("business:discount:delete") |
| | | public ApiResponse deleteByIdInBatch(@RequestParam String ids) { |
| | | String [] idArray = ids.split(","); |
| | | List<String> idList = new ArrayList<>(); |
| | | for (String id : idArray) { |
| | | idList.add(id); |
| | | } |
| | | discountService.deleteByIdInBatch(idList); |
| | | return ApiResponse.success(null); |
| | | } |
| | | |
| | | @ApiOperation("æ ¹æ®IDä¿®æ¹") |
| | | @PostMapping("/updateById") |
| | | @RequiresPermissions("business:discount:update") |
| | | public ApiResponse updateById(@RequestBody Discount discount) { |
| | | discountService.updateById(discount); |
| | | return ApiResponse.success(null); |
| | | } |
| | | |
| | | @ApiOperation("ä¿®æ¹ç¶æ") |
| | | @PostMapping("/updStatus") |
| | | @RequiresPermissions("business:discount:update") |
| | | public ApiResponse updStatus(@RequestBody Discount discount) { |
| | | discountService.updStatus(discount); |
| | | return ApiResponse.success(null); |
| | | } |
| | | |
| | | |
| | | |
| | | |
| | | @ApiOperation("å页æ¥è¯¢") |
| | | @PostMapping("/page") |
| | | @RequiresPermissions("business:discount:query") |
| | | public ApiResponse<PageData<Discount>> findPage (@RequestBody PageWrap<Discount> pageWrap) { |
| | | return ApiResponse.success(discountService.findPage(pageWrap)); |
| | | } |
| | | |
| | | @ApiOperation("导åºExcel") |
| | | @PostMapping("/exportExcel") |
| | | @RequiresPermissions("business:discount:exportExcel") |
| | | public void exportExcel (@RequestBody PageWrap<Discount> pageWrap, HttpServletResponse response) { |
| | | ExcelExporter.build(Discount.class).export(discountService.findPage(pageWrap).getRecords(), "éªè¡å¥é¤ä¿¡æ¯è¡¨", response); |
| | | } |
| | | |
| | | @ApiOperation("æ ¹æ®IDæ¥è¯¢") |
| | | @GetMapping("/{id}") |
| | | @RequiresPermissions("business:discount:query") |
| | | public ApiResponse findById(@PathVariable String id) { |
| | | return ApiResponse.success(discountService.findById(id)); |
| | | } |
| | | } |