| ¶Ô±ÈÐÂÎļþ |
| | |
| | | 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.DiscountMember; |
| | | import com.doumee.dao.business.web.request.DiscountMemberDTO; |
| | | import com.doumee.service.business.DiscountMemberService; |
| | | 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/discountMember") |
| | | public class DiscountMemberController extends BaseController { |
| | | |
| | | @Autowired |
| | | private DiscountMemberService discountMemberService; |
| | | |
| | | @PreventRepeat |
| | | @ApiOperation("æ°å»º") |
| | | @PostMapping("/create") |
| | | @RequiresPermissions("business:discountmember:create") |
| | | public ApiResponse create(@RequestBody DiscountMember discountMember) { |
| | | return ApiResponse.success(discountMemberService.create(discountMember)); |
| | | } |
| | | |
| | | @ApiOperation("æ ¹æ®IDå é¤") |
| | | @GetMapping("/delete/{id}") |
| | | @RequiresPermissions("business:discountmember:delete") |
| | | public ApiResponse deleteById(@PathVariable String id) { |
| | | discountMemberService.deleteById(id); |
| | | return ApiResponse.success(null); |
| | | } |
| | | |
| | | @ApiOperation("æ¹éå é¤") |
| | | @GetMapping("/delete/batch") |
| | | @RequiresPermissions("business:discountmember:delete") |
| | | public ApiResponse deleteByIdInBatch(@RequestParam String ids) { |
| | | String [] idArray = ids.split(","); |
| | | List<String> idList = new ArrayList<>(); |
| | | for (String id : idArray) { |
| | | idList.add(id); |
| | | } |
| | | discountMemberService.deleteByIdInBatch(idList); |
| | | return ApiResponse.success(null); |
| | | } |
| | | |
| | | @ApiOperation("æ ¹æ®IDä¿®æ¹") |
| | | @PostMapping("/updateById") |
| | | @RequiresPermissions("business:discountmember:update") |
| | | public ApiResponse updateById(@RequestBody DiscountMember discountMember) { |
| | | discountMemberService.updateById(discountMember); |
| | | return ApiResponse.success(null); |
| | | } |
| | | |
| | | @ApiOperation("å页æ¥è¯¢") |
| | | @PostMapping("/page") |
| | | @RequiresPermissions("business:discountmember:query") |
| | | public ApiResponse<PageData<DiscountMember>> findPage (@RequestBody PageWrap<DiscountMember> pageWrap) { |
| | | return ApiResponse.success(discountMemberService.findPage(pageWrap)); |
| | | } |
| | | |
| | | @ApiOperation("导åºExcel") |
| | | @PostMapping("/exportExcel") |
| | | @RequiresPermissions("business:discountmember:exportExcel") |
| | | public void exportExcel (@RequestBody PageWrap<DiscountMember> pageWrap, HttpServletResponse response) { |
| | | ExcelExporter.build(DiscountMember.class).export(discountMemberService.findPage(pageWrap).getRecords(), "ç¨æ·éªè¡å¥é¤å¡å
³è表", response); |
| | | } |
| | | |
| | | @ApiOperation("æ ¹æ®IDæ¥è¯¢") |
| | | @GetMapping("/{id}") |
| | | @RequiresPermissions("business:discountmember:query") |
| | | public ApiResponse<DiscountMember> findById(@PathVariable String id) { |
| | | return ApiResponse.success(discountMemberService.getDetail(id)); |
| | | } |
| | | |
| | | @ApiOperation("å¥é¤å¡æ¥åº") |
| | | @PostMapping("/cancel") |
| | | @RequiresPermissions("business:discountmember:update") |
| | | public ApiResponse cancel(@RequestBody DiscountMemberDTO model) { |
| | | discountMemberService.cancel(model); |
| | | return ApiResponse.success(null); |
| | | } |
| | | |
| | | @ApiOperation("å¥é¤å¡è°æ´") |
| | | @PostMapping("/adjust") |
| | | @RequiresPermissions("business:discountmember:update") |
| | | public ApiResponse adjust(@RequestBody DiscountMemberDTO model) { |
| | | discountMemberService.adjust(model); |
| | | return ApiResponse.success(null); |
| | | } |
| | | |
| | | |
| | | } |