| 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.core.utils.Constants; | 
| import com.doumee.dao.business.dto.MemberImport; | 
| import com.doumee.dao.business.dto.WorkTypeQueryDTO; | 
| import com.doumee.dao.business.model.Worktype; | 
| import com.doumee.service.business.WorktypeService; | 
| import io.swagger.annotations.*; | 
| import org.apache.shiro.authz.annotation.RequiresPermissions; | 
| import org.springframework.beans.factory.annotation.Autowired; | 
| import org.springframework.web.bind.annotation.*; | 
| import org.springframework.web.multipart.MultipartFile; | 
|   | 
| import javax.servlet.http.HttpServletResponse; | 
|   | 
| import java.io.File; | 
| import java.util.ArrayList; | 
| import java.util.List; | 
|   | 
| /** | 
|  * @author 江蹄蹄 | 
|  * @date 2024/01/16 10:03 | 
|  */ | 
| @Api(tags = "工种信息表") | 
| @RestController | 
| @RequestMapping("/business/worktype") | 
| public class WorktypeController extends BaseController { | 
|   | 
|     @Autowired | 
|     private WorktypeService worktypeService; | 
|   | 
|     @PreventRepeat | 
|     @ApiOperation("新建") | 
|     @PostMapping("/create") | 
|     @RequiresPermissions("business:worktype:create") | 
|     public ApiResponse create(@RequestBody Worktype worktype) { | 
|         return ApiResponse.success(worktypeService.create(worktype)); | 
|     } | 
|   | 
|     @ApiOperation("根据ID删除") | 
|     @GetMapping("/delete/{id}") | 
|     @RequiresPermissions("business:worktype:delete") | 
|     public ApiResponse deleteById(@PathVariable Integer id) { | 
|         worktypeService.deleteById(id); | 
|         return ApiResponse.success(null); | 
|     } | 
|   | 
|     @ApiOperation("批量删除") | 
|     @GetMapping("/delete/batch") | 
|     @RequiresPermissions("business:worktype: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)); | 
|         } | 
|         worktypeService.deleteByIdInBatch(idList); | 
|         return ApiResponse.success(null); | 
|     } | 
|   | 
|     @ApiOperation("根据ID修改") | 
|     @PostMapping("/updateById") | 
|     @RequiresPermissions("business:worktype:update") | 
|     public ApiResponse updateById(@RequestBody Worktype worktype) { | 
|         worktypeService.updateById(worktype); | 
|         return ApiResponse.success(null); | 
|     } | 
|   | 
|     @ApiOperation("分页查询") | 
|     @PostMapping("/page") | 
|     @RequiresPermissions("business:worktype:query") | 
|     public ApiResponse<PageData<Worktype>> findPage (@RequestBody PageWrap<Worktype> pageWrap) { | 
|         return ApiResponse.success(worktypeService.findPage(pageWrap)); | 
|     } | 
|     @ApiOperation("根据保险方案编码查询") | 
|     @PostMapping("/list") | 
|     @RequiresPermissions("business:worktype:query") | 
|     public ApiResponse<List<Worktype>> findList ( Worktype model) { | 
|         return ApiResponse.success(worktypeService.findList(model)); | 
|     } | 
|   | 
|     @ApiOperation("导出Excel") | 
|     @PostMapping("/exportExcel") | 
|     @RequiresPermissions("business:worktype:exportExcel") | 
|     public void exportExcel (@RequestBody PageWrap<Worktype> pageWrap, HttpServletResponse response) { | 
|         ExcelExporter.build(Worktype.class).export(worktypeService.findPage(pageWrap).getRecords(), "工种信息表", response); | 
|     } | 
|   | 
|     @ApiOperation("根据ID查询") | 
|     @GetMapping("/{id}") | 
|     @RequiresPermissions("business:worktype:query") | 
|     public ApiResponse findById(@PathVariable Integer id) { | 
|         return ApiResponse.success(worktypeService.findById(id)); | 
|     } | 
|   | 
|   | 
|     @ApiOperation("根据条件工种列表") | 
|     @PostMapping("/findListByDTO") | 
|     public ApiResponse<List<Worktype>> findListByDTO (@RequestBody WorkTypeQueryDTO workTypeQueryDTO) { | 
|         return ApiResponse.success(worktypeService.findListByDTO(workTypeQueryDTO)); | 
|     } | 
|   | 
|   | 
| } |