|  |  |  | 
|---|
|  |  |  | import com.doumee.service.business.ApproveTemplService; | 
|---|
|  |  |  | import io.swagger.annotations.Api; | 
|---|
|  |  |  | import io.swagger.annotations.ApiOperation; | 
|---|
|  |  |  | import org.apache.poi.ss.formula.functions.T; | 
|---|
|  |  |  | import org.springframework.beans.factory.annotation.Autowired; | 
|---|
|  |  |  | import org.springframework.web.bind.annotation.*; | 
|---|
|  |  |  |  | 
|---|
|  |  |  | 
|---|
|  |  |  | @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); | 
|---|
|  |  |  | approveTemplService.deleteById(id,this.getLoginUser(token)); | 
|---|
|  |  |  | return ApiResponse.success(null); | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | 
|---|
|  |  |  | @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)); | 
|---|
|  |  |  | approveTemplService.deleteByIdInBatch(this.getIdList(ids),this.getLoginUser(token)); | 
|---|
|  |  |  | return ApiResponse.success(null); | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | 
|---|
|  |  |  | @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); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | 
|---|
|  |  |  | ExcelExporter.build(ApproveTempl.class).export(approveTemplService.findPage(pageWrap).getRecords(), "审批模版信息表", response); | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | @ApiOperation("根据ID查询") | 
|---|
|  |  |  | @GetMapping("/{id}") | 
|---|
|  |  |  | @ApiOperation("根据Type查询") | 
|---|
|  |  |  | @GetMapping("/{type}") | 
|---|
|  |  |  | @CloudRequiredPermission("business:approvetempl:query") | 
|---|
|  |  |  | public ApiResponse findById(@PathVariable Integer id,@RequestHeader(Constants.HEADER_USER_TOKEN) String token){ | 
|---|
|  |  |  | return ApiResponse.success(approveTemplService.findById(id)); | 
|---|
|  |  |  | 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("根据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)); | 
|---|
|  |  |  | //    } | 
|---|
|  |  |  | } | 
|---|