| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112 |
- package com.zhongzheng.controller.staff;
- import java.util.List;
- import java.util.Arrays;
- import lombok.RequiredArgsConstructor;
- import org.springframework.security.access.prepost.PreAuthorize;
- import org.springframework.beans.factory.annotation.Autowired;
- import org.springframework.web.bind.annotation.GetMapping;
- import org.springframework.web.bind.annotation.PostMapping;
- import org.springframework.web.bind.annotation.PutMapping;
- import org.springframework.web.bind.annotation.DeleteMapping;
- import org.springframework.web.bind.annotation.PathVariable;
- import org.springframework.web.bind.annotation.RequestBody;
- import org.springframework.web.bind.annotation.RequestMapping;
- import org.springframework.web.bind.annotation.RestController;
- import com.zhongzheng.common.annotation.Log;
- import com.zhongzheng.common.core.controller.BaseController;
- import com.zhongzheng.common.core.domain.AjaxResult;
- import com.zhongzheng.common.enums.BusinessType;
- import com.zhongzheng.modules.staff.vo.StaffEmergencyContactVo;
- import com.zhongzheng.modules.staff.bo.StaffEmergencyContactQueryBo;
- import com.zhongzheng.modules.staff.bo.StaffEmergencyContactAddBo;
- import com.zhongzheng.modules.staff.bo.StaffEmergencyContactEditBo;
- import com.zhongzheng.modules.staff.service.IStaffEmergencyContactService;
- import com.zhongzheng.common.utils.poi.ExcelUtil;
- import com.zhongzheng.common.core.page.TableDataInfo;
- import io.swagger.annotations.Api;
- import io.swagger.annotations.ApiOperation;
- /**
- * 员工紧急联系人Controller
- *
- * @author ruoyi
- * @date 2024-03-21
- */
- @Api(value = "员工紧急联系人控制器", tags = {"员工紧急联系人管理"})
- @RequiredArgsConstructor(onConstructor_ = @Autowired)
- @RestController
- @RequestMapping("/system/contact")
- public class StaffEmergencyContactController extends BaseController {
- private final IStaffEmergencyContactService iStaffEmergencyContactService;
- /**
- * 查询员工紧急联系人列表
- */
- @ApiOperation("查询员工紧急联系人列表")
- @PreAuthorize("@ss.hasPermi('system:contact:list')")
- @GetMapping("/list")
- public TableDataInfo<StaffEmergencyContactVo> list(StaffEmergencyContactQueryBo bo) {
- startPage();
- List<StaffEmergencyContactVo> list = iStaffEmergencyContactService.queryList(bo);
- return getDataTable(list);
- }
- /**
- * 导出员工紧急联系人列表
- */
- @ApiOperation("导出员工紧急联系人列表")
- @PreAuthorize("@ss.hasPermi('system:contact:export')")
- @Log(title = "员工紧急联系人", businessType = BusinessType.EXPORT)
- @GetMapping("/export")
- public AjaxResult<StaffEmergencyContactVo> export(StaffEmergencyContactQueryBo bo) {
- List<StaffEmergencyContactVo> list = iStaffEmergencyContactService.queryList(bo);
- ExcelUtil<StaffEmergencyContactVo> util = new ExcelUtil<StaffEmergencyContactVo>(StaffEmergencyContactVo.class);
- return util.exportExcel(list, "员工紧急联系人");
- }
- /**
- * 获取员工紧急联系人详细信息
- */
- @ApiOperation("获取员工紧急联系人详细信息")
- @PreAuthorize("@ss.hasPermi('system:contact:query')")
- @GetMapping("/{contactId}")
- public AjaxResult<StaffEmergencyContactVo> getInfo(@PathVariable("contactId" ) Long contactId) {
- return AjaxResult.success(iStaffEmergencyContactService.queryById(contactId));
- }
- /**
- * 新增员工紧急联系人
- */
- @ApiOperation("新增员工紧急联系人")
- @PreAuthorize("@ss.hasPermi('system:contact:add')")
- @Log(title = "员工紧急联系人", businessType = BusinessType.INSERT)
- @PostMapping()
- public AjaxResult<Void> add(@RequestBody StaffEmergencyContactAddBo bo) {
- return toAjax(iStaffEmergencyContactService.insertByAddBo(bo) ? 1 : 0);
- }
- /**
- * 修改员工紧急联系人
- */
- @ApiOperation("修改员工紧急联系人")
- @PreAuthorize("@ss.hasPermi('system:contact:edit')")
- @Log(title = "员工紧急联系人", businessType = BusinessType.UPDATE)
- @PutMapping()
- public AjaxResult<Void> edit(@RequestBody StaffEmergencyContactEditBo bo) {
- return toAjax(iStaffEmergencyContactService.updateByEditBo(bo) ? 1 : 0);
- }
- /**
- * 删除员工紧急联系人
- */
- @ApiOperation("删除员工紧急联系人")
- @PreAuthorize("@ss.hasPermi('system:contact:remove')")
- @Log(title = "员工紧急联系人" , businessType = BusinessType.DELETE)
- @DeleteMapping("/{contactIds}")
- public AjaxResult<Void> remove(@PathVariable Long[] contactIds) {
- return toAjax(iStaffEmergencyContactService.deleteWithValidByIds(Arrays.asList(contactIds), true) ? 1 : 0);
- }
- }
|