package com.ruoyi.safety.controller; import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.ruoyi.framework.aspectj.lang.annotation.Log; import com.ruoyi.framework.aspectj.lang.enums.BusinessType; import com.ruoyi.framework.web.domain.AjaxResult; import com.ruoyi.safety.pojo.SafetyPersonnel; import com.ruoyi.safety.service.SafetyPersonnelService; import io.swagger.annotations.Api; import io.swagger.annotations.ApiOperation; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.web.bind.annotation.*; /** * 安环管理-人员档案接口。 */ @RestController @Api(tags = "安环管理-人员档案") @RequestMapping("/safety/personnel") public class SafetyPersonnelController extends SafetyControllerSupport { @Autowired private SafetyPersonnelService personnelService; /** * 分页查询人员档案。 */ @Log(title = "安环管理-人员档案-分页查询", businessType = BusinessType.OTHER) @ApiOperation("分页查询人员档案") @GetMapping("/list") public AjaxResult list(Page page, SafetyPersonnel query, @RequestParam(value = "pageNum", required = false) Long pageNum, @RequestParam(value = "pageSize", required = false) Long pageSize) { return AjaxResult.success(personnelService.queryPage(buildPage(page, pageNum, pageSize), query)); } /** * 新增人员档案。 */ @Log(title = "安环管理-人员档案-新增", businessType = BusinessType.INSERT) @ApiOperation("新增人员档案") @PostMapping("/add") public AjaxResult add(@RequestBody SafetyPersonnel personnel) { return toAjax(personnelService.saveSafety(personnel)); } /** * 修改人员档案。 */ @Log(title = "安环管理-人员档案-修改", businessType = BusinessType.UPDATE) @ApiOperation("修改人员档案") @PutMapping("/update") public AjaxResult update(@RequestBody SafetyPersonnel personnel) { return toAjax(personnelService.updateSafety(personnel)); } /** * 删除人员档案。 */ @Log(title = "安环管理-人员档案-删除", businessType = BusinessType.DELETE) @ApiOperation("删除人员档案") @DeleteMapping("/delete/{id}") public AjaxResult delete(@PathVariable Long id) { return toAjax(personnelService.deleteSafetyById(id)); } /** * 查询人员档案详情。 */ @Log(title = "安环管理-人员档案-详情", businessType = BusinessType.OTHER) @ApiOperation("查询人员档案详情") @GetMapping("/detail/{id}") public AjaxResult detail(@PathVariable Long id) { return AjaxResult.success(personnelService.getById(id)); } }