| package com.doumee.api.business; | 
|   | 
| import com.doumee.api.BaseController; | 
| 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.dao.admin.request.RetentionQuery; | 
| import com.doumee.dao.business.model.Retention; | 
| import com.doumee.dao.system.vo.RetentionVo; | 
| import com.doumee.service.business.RetentionService; | 
| 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 2023/11/30 15:33 | 
|  */ | 
| @Api(tags = "在厂人员信息 表(滞留)") | 
| @RestController | 
| @RequestMapping("/business/retention") | 
| public class RetentionController extends BaseController { | 
|   | 
|     @Autowired | 
|     private RetentionService retentionService; | 
|   | 
|     @PreventRepeat | 
|     @ApiOperation("新建") | 
|     @PostMapping("/create") | 
|     @RequiresPermissions("business:retention:create") | 
|     public ApiResponse create(@RequestBody Retention retention) { | 
|         return ApiResponse.success(retentionService.create(retention)); | 
|     } | 
|   | 
|     @ApiOperation("根据ID删除") | 
|     @GetMapping("/delete/{id}") | 
|     @RequiresPermissions("business:retention:delete") | 
|     public ApiResponse deleteById(@PathVariable Integer id) { | 
|         retentionService.deleteById(id); | 
|         return ApiResponse.success(null); | 
|     } | 
|   | 
|     @ApiOperation("批量删除") | 
|     @GetMapping("/delete/batch") | 
|     @RequiresPermissions("business:retention: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)); | 
|         } | 
|         retentionService.deleteByIdInBatch(idList); | 
|         return ApiResponse.success(null); | 
|     } | 
|   | 
|     @ApiOperation("根据ID修改") | 
|     @PostMapping("/updateById") | 
|     @RequiresPermissions("business:retention:update") | 
|     public ApiResponse updateById(@RequestBody Retention retention) { | 
|         retentionService.updateById(retention); | 
|         return ApiResponse.success(null); | 
|     } | 
|   | 
|     @ApiOperation("分页查询") | 
|     @PostMapping("/page") | 
|     //@RequiresPermissions("business:retention:query") | 
|     public ApiResponse<PageData<Retention>> findPage (@RequestBody PageWrap<Retention> pageWrap) { | 
|         return ApiResponse.success(retentionService.findTrainTimePage(pageWrap)); | 
|     } | 
|   | 
|     @ApiOperation("导出Excel") | 
|     @PostMapping("/exportExcel") | 
|     //@RequiresPermissions("business:retention:exportExcel") | 
|     public void exportExcel (@RequestBody PageWrap<Retention> pageWrap, HttpServletResponse response) { | 
|         ExcelExporter.build(RetentionVo.class).export(retentionService.findPageExcel(pageWrap), "在厂人员信息 表(滞留)", response); | 
|     } | 
|   | 
|     @ApiOperation("根据ID查询") | 
|     @GetMapping("/{id}") | 
|     @RequiresPermissions("business:retention:query") | 
|     public ApiResponse findById(@PathVariable Integer id) { | 
|         return ApiResponse.success(retentionService.findById(id)); | 
|     } | 
| } |