| ¶Ô±ÈÐÂÎļþ |
| | |
| | | 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.service.business.third.model.ApiResponse; |
| | | import com.doumee.service.business.third.model.PageData; |
| | | import com.doumee.service.business.third.model.PageWrap; |
| | | import com.doumee.core.utils.Constants; |
| | | import com.doumee.dao.business.model.ApproveTempl; |
| | | import com.doumee.service.business.ApproveTemplService; |
| | | 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; |
| | | |
| | | /** |
| | | * @author æ±è¹è¹ |
| | | * @since 2024/04/28 16:06 |
| | | */ |
| | | @Api(tags = "å®¡æ¹æ¨¡çä¿¡æ¯è¡¨") |
| | | @RestController |
| | | @RequestMapping(Constants.CLOUD_SERVICE_URL_INDEX+"/business/approveTempl") |
| | | public class ApproveTemplCloudController extends BaseController { |
| | | |
| | | @Autowired |
| | | private ApproveTemplService approveTemplService; |
| | | |
| | | @PreventRepeat |
| | | @ApiOperation("æ°å»º") |
| | | @PostMapping("/create") |
| | | @CloudRequiredPermission("business:approvetempl:create") |
| | | public ApiResponse create(@RequestBody ApproveTempl approveTempl,@RequestHeader(Constants.HEADER_USER_TOKEN) String token){ |
| | | approveTempl.setLoginUserInfo(this.getLoginUser(token)); |
| | | return ApiResponse.success(approveTemplService.create(approveTempl)); |
| | | } |
| | | @PreventRepeat |
| | | @ApiOperation("å叿¨¡ç") |
| | | @PostMapping("/save") |
| | | @CloudRequiredPermission("business:approvetempl:create") |
| | | public ApiResponse save(@RequestBody ApproveTempl approveTempl,@RequestHeader(Constants.HEADER_USER_TOKEN) String token){ |
| | | approveTempl.setLoginUserInfo(this.getLoginUser(token)); |
| | | return ApiResponse.success(approveTemplService.save(approveTempl)); |
| | | } |
| | | |
| | | @ApiOperation("æ ¹æ®IDå é¤") |
| | | @GetMapping("/delete/{id}") |
| | | @CloudRequiredPermission("business:approvetempl:delete") |
| | | public ApiResponse deleteById(@PathVariable Integer id,@RequestHeader(Constants.HEADER_USER_TOKEN) String token){ |
| | | approveTemplService.deleteById(id,this.getLoginUser(token)); |
| | | return ApiResponse.success(null); |
| | | } |
| | | |
| | | @ApiOperation("æ¹éå é¤") |
| | | @GetMapping("/delete/batch") |
| | | @CloudRequiredPermission("business:approvetempl:delete") |
| | | public ApiResponse deleteByIdInBatch(@RequestParam String ids,@RequestHeader(Constants.HEADER_USER_TOKEN) String token){ |
| | | approveTemplService.deleteByIdInBatch(this.getIdList(ids),this.getLoginUser(token)); |
| | | return ApiResponse.success(null); |
| | | } |
| | | |
| | | @ApiOperation("æ ¹æ®IDä¿®æ¹") |
| | | @PostMapping("/updateById") |
| | | @CloudRequiredPermission("business:approvetempl:update") |
| | | public ApiResponse updateById(@RequestBody ApproveTempl approveTempl,@RequestHeader(Constants.HEADER_USER_TOKEN) String token){ |
| | | approveTempl.setLoginUserInfo(this.getLoginUser(token)); |
| | | approveTemplService.updateById(approveTempl); |
| | | return ApiResponse.success(null); |
| | | } |
| | | |
| | | @ApiOperation("å页æ¥è¯¢") |
| | | @PostMapping("/page") |
| | | @CloudRequiredPermission("business:approvetempl:query") |
| | | public ApiResponse<PageData<ApproveTempl>> findPage (@RequestBody PageWrap<ApproveTempl> pageWrap,@RequestHeader(Constants.HEADER_USER_TOKEN) String token){ |
| | | return ApiResponse.success(approveTemplService.findPage(pageWrap)); |
| | | } |
| | | |
| | | @ApiOperation("导åºExcel") |
| | | @PostMapping("/exportExcel") |
| | | @CloudRequiredPermission("business:approvetempl:exportExcel") |
| | | public void exportExcel (@RequestBody PageWrap<ApproveTempl> pageWrap, HttpServletResponse response,@RequestHeader(Constants.HEADER_USER_TOKEN) String token){ |
| | | ExcelExporter.build(ApproveTempl.class).export(approveTemplService.findPage(pageWrap).getRecords(), "å®¡æ¹æ¨¡çä¿¡æ¯è¡¨", response); |
| | | } |
| | | |
| | | @ApiOperation("æ ¹æ®Typeæ¥è¯¢") |
| | | @GetMapping("/{type}") |
| | | @CloudRequiredPermission("business:approvetempl:query") |
| | | public ApiResponse<ApproveTempl> findByType(@PathVariable Integer type,@RequestHeader(Constants.HEADER_USER_TOKEN) String token){ |
| | | ApproveTempl templ =new ApproveTempl(); |
| | | templ.setIsdeleted(Constants.ZERO); |
| | | templ.setType(type); |
| | | return ApiResponse.success(approveTemplService.findOne(templ)); |
| | | } |
| | | @ApiOperation("æ ¹æ®reasonIdæ¥è¯¢") |
| | | @GetMapping("/findById/{id}") |
| | | @CloudRequiredPermission("business:approvetempl:query") |
| | | public ApiResponse<ApproveTempl> findById(@PathVariable Integer id,@RequestHeader(Constants.HEADER_USER_TOKEN) String token){ |
| | | ApproveTempl templ =new ApproveTempl(); |
| | | templ.setIsdeleted(Constants.ZERO); |
| | | templ.setId(id); |
| | | return ApiResponse.success(approveTemplService.findOne(templ)); |
| | | } |
| | | |
| | | |
| | | // @ApiOperation("æ ¹æ®IDæ¥è¯¢") |
| | | // @GetMapping("/{id}") |
| | | // @CloudRequiredPermission("business:approvetempl:query") |
| | | // public ApiResponse findById(@PathVariable Integer id,@RequestHeader(Constants.HEADER_USER_TOKEN) String token){ |
| | | // return ApiResponse.success(approveTemplService.findById(id)); |
| | | // } |
| | | } |