| ¶Ô±ÈÐÂÎļþ |
| | |
| | | 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.dto.ApproveDTO; |
| | | import com.doumee.dao.business.model.Approve; |
| | | import com.doumee.service.business.ApproveService; |
| | | 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 2023/12/28 14:09 |
| | | */ |
| | | @Api(tags = "审æ¹ä¿¡æ¯è®°å½è¡¨") |
| | | @RestController |
| | | @RequestMapping(Constants.CLOUD_SERVICE_URL_INDEX+"/business/approve") |
| | | public class ApproveCloudController extends BaseController { |
| | | |
| | | @Autowired |
| | | private ApproveService approveService; |
| | | |
| | | @PreventRepeat |
| | | @ApiOperation("æ°å»º") |
| | | @PostMapping("/create") |
| | | @CloudRequiredPermission("business:approve:create") |
| | | public ApiResponse create(@RequestHeader(Constants.HEADER_USER_TOKEN) String token,@RequestBody Approve approve) { |
| | | return ApiResponse.success(approveService.create(approve)); |
| | | } |
| | | |
| | | @ApiOperation("æ ¹æ®IDå é¤") |
| | | @GetMapping("/delete/{id}") |
| | | @CloudRequiredPermission("business:approve:delete") |
| | | public ApiResponse deleteById(@PathVariable Integer id,@RequestHeader(Constants.HEADER_USER_TOKEN) String token) { |
| | | approveService.deleteById(id); |
| | | return ApiResponse.success(null); |
| | | } |
| | | @ApiOperation("æ¹éå é¤") |
| | | @GetMapping("/delete/batch") |
| | | @CloudRequiredPermission("business:approve: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)); |
| | | } |
| | | approveService.deleteByIdInBatch(idList); |
| | | return ApiResponse.success(null); |
| | | } |
| | | |
| | | @ApiOperation("æ ¹æ®IDä¿®æ¹") |
| | | @PostMapping("/updateById") |
| | | @CloudRequiredPermission("business:approve:update") |
| | | public ApiResponse updateById(@RequestBody Approve approve,@RequestHeader(Constants.HEADER_USER_TOKEN) String token) { |
| | | approveService.updateById(approve); |
| | | return ApiResponse.success(null); |
| | | } |
| | | |
| | | @ApiOperation("å页æ¥è¯¢") |
| | | @PostMapping("/page") |
| | | @CloudRequiredPermission("business:approve:query") |
| | | public ApiResponse<PageData<Approve>> findPage (@RequestBody PageWrap<Approve> pageWrap,@RequestHeader(Constants.HEADER_USER_TOKEN) String token) { |
| | | return ApiResponse.success(approveService.findPage(pageWrap)); |
| | | } |
| | | |
| | | @ApiOperation("导åºExcel") |
| | | @PostMapping("/exportExcel") |
| | | @CloudRequiredPermission("business:approve:exportExcel") |
| | | public void exportExcel (@RequestBody PageWrap<Approve> pageWrap, HttpServletResponse response,@RequestHeader(Constants.HEADER_USER_TOKEN) String token) { |
| | | ExcelExporter.build(Approve.class).export(approveService.findPage(pageWrap).getRecords(), "审æ¹ä¿¡æ¯è®°å½è¡¨", response); |
| | | } |
| | | |
| | | @ApiOperation("æ ¹æ®IDæ¥è¯¢") |
| | | @GetMapping("/{id}") |
| | | @CloudRequiredPermission("business:approve:query") |
| | | public ApiResponse findById(@PathVariable Integer id,@RequestHeader(Constants.HEADER_USER_TOKEN) String token) { |
| | | return ApiResponse.success(approveService.findById(id)); |
| | | } |
| | | |
| | | @ApiOperation("审æ¹ä¿¡æ¯æäº¤") |
| | | @PostMapping("/approved") |
| | | @CloudRequiredPermission("business:approve:create") |
| | | public ApiResponse approved (@RequestBody ApproveDTO approveDTO, @RequestHeader(Constants.HEADER_USER_TOKEN) String token) { |
| | | approveDTO.setLoginUserInfo(getLoginUser(token)); |
| | | approveService.approved(approveDTO); |
| | | return ApiResponse.success("æä½æå"); |
| | | } |
| | | |
| | | } |