| ¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.doumee.cloud.admin; |
| | | |
| | | import com.doumee.api.BaseController; |
| | | import com.doumee.config.annotation.CloudRequiredPermission; |
| | | import com.doumee.core.annotation.excel.ExcelExporter; |
| | | import com.doumee.core.annotation.pr.PreventRepeat; |
| | | import com.doumee.core.utils.Constants; |
| | | import com.doumee.dao.business.model.Member; |
| | | import com.doumee.dao.business.model.Warning; |
| | | import com.doumee.service.business.WarningService; |
| | | import com.doumee.service.business.third.model.ApiResponse; |
| | | import com.doumee.service.business.third.model.PageData; |
| | | import com.doumee.service.business.third.model.PageWrap; |
| | | import io.swagger.annotations.Api; |
| | | import io.swagger.annotations.ApiOperation; |
| | | 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/09/28 09:01 |
| | | */ |
| | | @Api(tags = "æ¥è¦è®°å½ä¿¡æ¯è¡¨") |
| | | @RestController |
| | | @RequestMapping(Constants.CLOUD_SERVICE_URL_INDEX+"/business/warning") |
| | | public class WarningCloudController extends BaseController { |
| | | |
| | | @Autowired |
| | | private WarningService warningService; |
| | | |
| | | @PreventRepeat |
| | | @ApiOperation("æ°å»º") |
| | | @PostMapping("/create") |
| | | @CloudRequiredPermission("business:warning:create") |
| | | public ApiResponse create(@RequestBody Warning warning, @RequestHeader(Constants.HEADER_USER_TOKEN) String token) { |
| | | warning.setLoginUserInfo(this.getLoginUser(token)); |
| | | return ApiResponse.success(warningService.create(warning)); |
| | | } |
| | | |
| | | @ApiOperation("æ ¹æ®IDå é¤") |
| | | @GetMapping("/delete/{id}") |
| | | @CloudRequiredPermission("business:warning:delete") |
| | | public ApiResponse deleteById(@PathVariable Integer id, @RequestHeader(Constants.HEADER_USER_TOKEN) String token) { |
| | | warningService.deleteById(id,this.getLoginUser(token)); |
| | | return ApiResponse.success(null); |
| | | } |
| | | @ApiOperation("æ ¹æ®ID ç¦å¯ç¨ ") |
| | | @PostMapping("/updateStatus") |
| | | @CloudRequiredPermission("business:warning:update") |
| | | public ApiResponse updateStatus(@RequestBody Warning param, @RequestHeader(Constants.HEADER_USER_TOKEN) String token){ |
| | | param.setLoginUserInfo(this.getLoginUser(token)); |
| | | warningService.updateStatus(param); |
| | | return ApiResponse.success(null); |
| | | } |
| | | |
| | | @ApiOperation("æ¹éå é¤") |
| | | @GetMapping("/delete/batch") |
| | | @CloudRequiredPermission("business:warning:delete") |
| | | public ApiResponse deleteByIdInBatch(@RequestParam String ids, @RequestHeader(Constants.HEADER_USER_TOKEN) String token) { |
| | | String [] idArray = ids.split(","); |
| | | List<Integer> idList = new ArrayList<>(); |
| | | for (String id : idArray) { |
| | | idList.add(Integer.valueOf(id)); |
| | | } |
| | | warningService.deleteByIdInBatch(idList,this.getLoginUser(token)); |
| | | return ApiResponse.success(null); |
| | | } |
| | | |
| | | @ApiOperation("æ ¹æ®IDä¿®æ¹") |
| | | @PostMapping("/updateById") |
| | | @CloudRequiredPermission("business:warning:update") |
| | | public ApiResponse updateById(@RequestBody Warning warning, @RequestHeader(Constants.HEADER_USER_TOKEN) String token) { |
| | | warning.setLoginUserInfo(this.getLoginUser(token)); |
| | | warningService.updateById(warning); |
| | | return ApiResponse.success(null); |
| | | } |
| | | |
| | | @ApiOperation("å页æ¥è¯¢") |
| | | @PostMapping("/page") |
| | | @CloudRequiredPermission("business:warning:query") |
| | | public ApiResponse<PageData<Warning>> findPage (@RequestBody PageWrap<Warning> pageWrap, @RequestHeader(Constants.HEADER_USER_TOKEN) String token) { |
| | | return ApiResponse.success(warningService.findPage(pageWrap)); |
| | | } |
| | | @ApiOperation("æ¥è¯¢å
¨é¨") |
| | | @PostMapping("/allList") |
| | | @CloudRequiredPermission("business:warning:query") |
| | | public ApiResponse<List<Warning>> findPage (@RequestBody Warning pageWrap, @RequestHeader(Constants.HEADER_USER_TOKEN) String token) { |
| | | return ApiResponse.success(warningService.findList(pageWrap)); |
| | | } |
| | | |
| | | @ApiOperation("导åºExcel") |
| | | @PostMapping("/exportExcel") |
| | | @CloudRequiredPermission("business:warning:exportExcel") |
| | | public void exportExcel (@RequestBody PageWrap<Warning> pageWrap, HttpServletResponse response, @RequestHeader(Constants.HEADER_USER_TOKEN) String token) { |
| | | ExcelExporter.build(Warning.class).export(warningService.findPage(pageWrap).getRecords(), "æ¥è¦è®°å½ä¿¡æ¯è¡¨", response); |
| | | } |
| | | |
| | | @ApiOperation("æ ¹æ®IDæ¥è¯¢") |
| | | @GetMapping("/{id}") |
| | | @CloudRequiredPermission("business:warning:query") |
| | | public ApiResponse findById(@PathVariable Integer id, @RequestHeader(Constants.HEADER_USER_TOKEN) String token) { |
| | | return ApiResponse.success(warningService.findById(id)); |
| | | } |
| | | } |