¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.doumee.cloud.admin; |
| | | |
| | | import com.doumee.api.BaseController; |
| | | import com.doumee.config.annotation.CloudRequiredPermission; |
| | | import com.doumee.config.annotation.LoginNoRequired; |
| | | 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.core.utils.Constants; |
| | | import com.doumee.dao.business.model.YwProblem; |
| | | import com.doumee.service.business.YwProblemService; |
| | | 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/01/06 11:05 |
| | | */ |
| | | @Api(tags = "è¿ç»´é®é¢ä¸æ¥ä¿¡æ¯è¡¨") |
| | | @RestController |
| | | @RequestMapping(Constants.CLOUD_SERVICE_URL_INDEX+"/business/ywProblem") |
| | | public class YwProblemController extends BaseController { |
| | | |
| | | @Autowired |
| | | private YwProblemService ywProblemService; |
| | | |
| | | @LoginNoRequired |
| | | @PreventRepeat |
| | | @ApiOperation("é®é¢ææ¥") |
| | | @PostMapping("/create") |
| | | public ApiResponse create(@RequestBody YwProblem ywProblem) { |
| | | return ApiResponse.success(ywProblemService.create(ywProblem)); |
| | | } |
| | | |
| | | @ApiOperation("æ ¹æ®IDå é¤") |
| | | @GetMapping("/delete/{id}") |
| | | @CloudRequiredPermission("business:ywproblem:delete") |
| | | public ApiResponse deleteById(@PathVariable Integer id) { |
| | | ywProblemService.deleteById(id); |
| | | return ApiResponse.success(null); |
| | | } |
| | | |
| | | @ApiOperation("æ¹éå é¤") |
| | | @GetMapping("/delete/batch") |
| | | @CloudRequiredPermission("business:ywproblem:delete") |
| | | public ApiResponse deleteByIdInBatch(@RequestParam String ids) { |
| | | String [] idArray = ids.split(","); |
| | | List<Integer> idList = new ArrayList<>(); |
| | | for (String id : idArray) { |
| | | idList.add(Integer.valueOf(id)); |
| | | } |
| | | ywProblemService.deleteByIdInBatch(idList); |
| | | return ApiResponse.success(null); |
| | | } |
| | | |
| | | @ApiOperation("æ ¹æ®IDä¿®æ¹") |
| | | @PostMapping("/updateById") |
| | | @CloudRequiredPermission("business:ywproblem:update") |
| | | public ApiResponse updateById(@RequestBody YwProblem ywProblem) { |
| | | ywProblemService.updateById(ywProblem); |
| | | return ApiResponse.success(null); |
| | | } |
| | | |
| | | @ApiOperation("å页æ¥è¯¢") |
| | | @PostMapping("/page") |
| | | @CloudRequiredPermission("business:ywproblem:query") |
| | | public ApiResponse<PageData<YwProblem>> findPage (@RequestBody PageWrap<YwProblem> pageWrap) { |
| | | return ApiResponse.success(ywProblemService.findPage(pageWrap)); |
| | | } |
| | | |
| | | @ApiOperation("导åºExcel") |
| | | @PostMapping("/exportExcel") |
| | | @CloudRequiredPermission("business:ywproblem:exportExcel") |
| | | public void exportExcel (@RequestBody PageWrap<YwProblem> pageWrap, HttpServletResponse response) { |
| | | ExcelExporter.build(YwProblem.class).export(ywProblemService.findPage(pageWrap).getRecords(), "è¿ç»´é®é¢ä¸æ¥ä¿¡æ¯è¡¨", response); |
| | | } |
| | | |
| | | @ApiOperation("æ ¹æ®IDæ¥è¯¢") |
| | | @GetMapping("/{id}") |
| | | @CloudRequiredPermission("business:ywproblem:query") |
| | | public ApiResponse findById(@PathVariable Integer id) { |
| | | return ApiResponse.success(ywProblemService.findById(id)); |
| | | } |
| | | } |