StaffEmergencyContactController.java 4.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112
  1. package com.zhongzheng.controller.staff;
  2. import java.util.List;
  3. import java.util.Arrays;
  4. import lombok.RequiredArgsConstructor;
  5. import org.springframework.security.access.prepost.PreAuthorize;
  6. import org.springframework.beans.factory.annotation.Autowired;
  7. import org.springframework.web.bind.annotation.GetMapping;
  8. import org.springframework.web.bind.annotation.PostMapping;
  9. import org.springframework.web.bind.annotation.PutMapping;
  10. import org.springframework.web.bind.annotation.DeleteMapping;
  11. import org.springframework.web.bind.annotation.PathVariable;
  12. import org.springframework.web.bind.annotation.RequestBody;
  13. import org.springframework.web.bind.annotation.RequestMapping;
  14. import org.springframework.web.bind.annotation.RestController;
  15. import com.zhongzheng.common.annotation.Log;
  16. import com.zhongzheng.common.core.controller.BaseController;
  17. import com.zhongzheng.common.core.domain.AjaxResult;
  18. import com.zhongzheng.common.enums.BusinessType;
  19. import com.zhongzheng.modules.staff.vo.StaffEmergencyContactVo;
  20. import com.zhongzheng.modules.staff.bo.StaffEmergencyContactQueryBo;
  21. import com.zhongzheng.modules.staff.bo.StaffEmergencyContactAddBo;
  22. import com.zhongzheng.modules.staff.bo.StaffEmergencyContactEditBo;
  23. import com.zhongzheng.modules.staff.service.IStaffEmergencyContactService;
  24. import com.zhongzheng.common.utils.poi.ExcelUtil;
  25. import com.zhongzheng.common.core.page.TableDataInfo;
  26. import io.swagger.annotations.Api;
  27. import io.swagger.annotations.ApiOperation;
  28. /**
  29. * 员工紧急联系人Controller
  30. *
  31. * @author ruoyi
  32. * @date 2024-03-21
  33. */
  34. @Api(value = "员工紧急联系人控制器", tags = {"员工紧急联系人管理"})
  35. @RequiredArgsConstructor(onConstructor_ = @Autowired)
  36. @RestController
  37. @RequestMapping("/system/contact")
  38. public class StaffEmergencyContactController extends BaseController {
  39. private final IStaffEmergencyContactService iStaffEmergencyContactService;
  40. /**
  41. * 查询员工紧急联系人列表
  42. */
  43. @ApiOperation("查询员工紧急联系人列表")
  44. @PreAuthorize("@ss.hasPermi('system:contact:list')")
  45. @GetMapping("/list")
  46. public TableDataInfo<StaffEmergencyContactVo> list(StaffEmergencyContactQueryBo bo) {
  47. startPage();
  48. List<StaffEmergencyContactVo> list = iStaffEmergencyContactService.queryList(bo);
  49. return getDataTable(list);
  50. }
  51. /**
  52. * 导出员工紧急联系人列表
  53. */
  54. @ApiOperation("导出员工紧急联系人列表")
  55. @PreAuthorize("@ss.hasPermi('system:contact:export')")
  56. @Log(title = "员工紧急联系人", businessType = BusinessType.EXPORT)
  57. @GetMapping("/export")
  58. public AjaxResult<StaffEmergencyContactVo> export(StaffEmergencyContactQueryBo bo) {
  59. List<StaffEmergencyContactVo> list = iStaffEmergencyContactService.queryList(bo);
  60. ExcelUtil<StaffEmergencyContactVo> util = new ExcelUtil<StaffEmergencyContactVo>(StaffEmergencyContactVo.class);
  61. return util.exportExcel(list, "员工紧急联系人");
  62. }
  63. /**
  64. * 获取员工紧急联系人详细信息
  65. */
  66. @ApiOperation("获取员工紧急联系人详细信息")
  67. @PreAuthorize("@ss.hasPermi('system:contact:query')")
  68. @GetMapping("/{contactId}")
  69. public AjaxResult<StaffEmergencyContactVo> getInfo(@PathVariable("contactId" ) Long contactId) {
  70. return AjaxResult.success(iStaffEmergencyContactService.queryById(contactId));
  71. }
  72. /**
  73. * 新增员工紧急联系人
  74. */
  75. @ApiOperation("新增员工紧急联系人")
  76. @PreAuthorize("@ss.hasPermi('system:contact:add')")
  77. @Log(title = "员工紧急联系人", businessType = BusinessType.INSERT)
  78. @PostMapping()
  79. public AjaxResult<Void> add(@RequestBody StaffEmergencyContactAddBo bo) {
  80. return toAjax(iStaffEmergencyContactService.insertByAddBo(bo) ? 1 : 0);
  81. }
  82. /**
  83. * 修改员工紧急联系人
  84. */
  85. @ApiOperation("修改员工紧急联系人")
  86. @PreAuthorize("@ss.hasPermi('system:contact:edit')")
  87. @Log(title = "员工紧急联系人", businessType = BusinessType.UPDATE)
  88. @PutMapping()
  89. public AjaxResult<Void> edit(@RequestBody StaffEmergencyContactEditBo bo) {
  90. return toAjax(iStaffEmergencyContactService.updateByEditBo(bo) ? 1 : 0);
  91. }
  92. /**
  93. * 删除员工紧急联系人
  94. */
  95. @ApiOperation("删除员工紧急联系人")
  96. @PreAuthorize("@ss.hasPermi('system:contact:remove')")
  97. @Log(title = "员工紧急联系人" , businessType = BusinessType.DELETE)
  98. @DeleteMapping("/{contactIds}")
  99. public AjaxResult<Void> remove(@PathVariable Long[] contactIds) {
  100. return toAjax(iStaffEmergencyContactService.deleteWithValidByIds(Arrays.asList(contactIds), true) ? 1 : 0);
  101. }
  102. }