| | |
| | | package cc.mrbird.febs.server.hr.controller; |
| | | |
| | | import cc.mrbird.febs.server.hr.entity.EmpRemarkInfo; |
| | | import cc.mrbird.febs.server.hr.service.IEmpRemarkInfoService; |
| | | import cc.mrbird.febs.server.hr.service.IEmpRemarkinfoService; |
| | | import cc.mrbird.febs.common.core.entity.FebsResponse; |
| | | import cc.mrbird.febs.common.core.entity.QueryRequest; |
| | | import cc.mrbird.febs.common.core.exception.FebsException; |
| | | import cc.mrbird.febs.common.core.utils.FebsUtil; |
| | | import io.swagger.annotations.Api; |
| | | import io.swagger.annotations.ApiOperation; |
| | | import lombok.extern.slf4j.Slf4j; |
| | | import lombok.RequiredArgsConstructor; |
| | | import org.springframework.security.access.prepost.PreAuthorize; |
| | |
| | | import org.springframework.web.bind.annotation.*; |
| | | |
| | | import javax.validation.Valid; |
| | | import javax.validation.constraints.NotBlank; |
| | | import java.util.Map; |
| | | |
| | | /** |
| | | * |
| | | * name:EmpRemarkinfo |
| | | * package:cc.mrbird.febs.server.hr.controller |
| | | * description:员工备注信息控制器 |
| | | * |
| | | * @author luoyibo |
| | | * @date 2021-01-24 20:35:15 |
| | | * @since JDK1.8 |
| | | */ |
| | | * name:EmpRemarkinfo |
| | | * package:cc.mrbird.febs.server.hr.controller |
| | | * description:员工备注信息控制器 |
| | | * |
| | | * @author luoyibo |
| | | * @date 2021-01-31 11:26:48 |
| | | * @since JDK1.8 |
| | | */ |
| | | @Api(tags = "人员备注信息录入接口") |
| | | @Slf4j |
| | | @Validated |
| | | @RestController |
| | | @RequestMapping("empRemarkinfo") |
| | | @RequestMapping("empRemarkInfo") |
| | | @RequiredArgsConstructor |
| | | public class EmpRemarkInfoController { |
| | | |
| | | private final IEmpRemarkInfoService empRemarkinfoService; |
| | | private final IEmpRemarkinfoService empRemarkinfoService; |
| | | |
| | | @GetMapping |
| | | @PreAuthorize("hasAuthority('empRemarkinfo:list')") |
| | | public FebsResponse getAllEmpRemarkinfos(EmpRemarkInfo empRemarkinfo) { |
| | | return new FebsResponse().data(empRemarkinfoService.findEmpRemarkinfos(empRemarkinfo)); |
| | | } |
| | | @GetMapping |
| | | @PreAuthorize("hasAuthority('empRemarkinfo:list')") |
| | | public FebsResponse getAllEmpRemarkinfos(EmpRemarkInfo empRemarkinfo) { |
| | | return new FebsResponse().data(empRemarkinfoService.findEmpRemarkinfos(empRemarkinfo)); |
| | | } |
| | | |
| | | @GetMapping("list") |
| | | @PreAuthorize("hasAuthority('empRemarkinfo:list')") |
| | | public FebsResponse empRemarkinfoList(QueryRequest request, EmpRemarkInfo empRemarkinfo) { |
| | | Map<String, Object> dataTable = FebsUtil.getDataTable(this.empRemarkinfoService.findEmpRemarkinfos(request, empRemarkinfo)); |
| | | return new FebsResponse().data(dataTable); |
| | | } |
| | | @GetMapping("list") |
| | | @PreAuthorize("hasAuthority('empRemarkinfo:list')") |
| | | public FebsResponse empRemarkinfoList(QueryRequest request, EmpRemarkInfo empRemarkinfo) { |
| | | Map<String, Object> dataTable = FebsUtil.getDataTable(this.empRemarkinfoService.findEmpRemarkinfos(request, empRemarkinfo)); |
| | | return new FebsResponse().data(dataTable); |
| | | } |
| | | |
| | | @PostMapping |
| | | @PreAuthorize("hasAuthority('empRemarkinfo:add')") |
| | | public void addEmpRemarkinfo(@Valid EmpRemarkInfo empRemarkinfo) throws FebsException { |
| | | try { |
| | | this.empRemarkinfoService.createEmpRemarkinfo(empRemarkinfo); |
| | | } catch (Exception e) { |
| | | String message = "新增EmpRemarkinfo失败"; |
| | | log.error(message, e); |
| | | throw new FebsException(message); |
| | | } |
| | | } |
| | | @PostMapping |
| | | @PreAuthorize("hasAuthority('empRemarkinfo:add')") |
| | | public void addEmpRemarkinfo(@Valid EmpRemarkInfo empRemarkinfo) throws FebsException { |
| | | try { |
| | | this.empRemarkinfoService.createEmpRemarkinfo(empRemarkinfo); |
| | | } catch (Exception e) { |
| | | String message = "新增员工备注信息失败"; |
| | | log.error(message, e); |
| | | throw new FebsException(message); |
| | | } |
| | | } |
| | | |
| | | @DeleteMapping |
| | | @PreAuthorize("hasAuthority('empRemarkinfo:delete')") |
| | | public void deleteEmpRemarkinfo(EmpRemarkInfo empRemarkinfo) throws FebsException { |
| | | try { |
| | | this.empRemarkinfoService.deleteEmpRemarkinfo(empRemarkinfo); |
| | | } catch (Exception e) { |
| | | String message = "删除EmpRemarkinfo失败"; |
| | | log.error(message, e); |
| | | throw new FebsException(message); |
| | | } |
| | | } |
| | | @DeleteMapping |
| | | @PreAuthorize("hasAuthority('empRemarkinfo:delete')") |
| | | public void deleteEmpRemarkinfo(EmpRemarkInfo empRemarkinfo) throws FebsException { |
| | | try { |
| | | this.empRemarkinfoService.deleteEmpRemarkinfo(empRemarkinfo); |
| | | } catch (Exception e) { |
| | | String message = "删除员工备注信息失败"; |
| | | log.error(message, e); |
| | | throw new FebsException(message); |
| | | } |
| | | } |
| | | |
| | | @PutMapping |
| | | @PreAuthorize("hasAuthority('empRemarkinfo:update')") |
| | | public void updateEmpRemarkinfo(EmpRemarkInfo empRemarkinfo) throws FebsException { |
| | | try { |
| | | this.empRemarkinfoService.updateEmpRemarkinfo(empRemarkinfo); |
| | | } catch (Exception e) { |
| | | String message = "修改EmpRemarkinfo失败"; |
| | | log.error(message, e); |
| | | throw new FebsException(message); |
| | | } |
| | | } |
| | | @DeleteMapping("{ids}") |
| | | @PreAuthorize("hasAuthority('empRemarkinfo:delete')") |
| | | public void logicDeleteEmpRemarkinfo(@PathVariable("ids") String ids) throws FebsException { |
| | | try { |
| | | this.empRemarkinfoService.logicDelEmpRemarkinfo(ids); |
| | | } catch (Exception e) { |
| | | String message = "逻辑删除员工备注信息失败"; |
| | | log.error(message, e); |
| | | throw new FebsException(message); |
| | | } |
| | | } |
| | | |
| | | @PutMapping |
| | | @PreAuthorize("hasAuthority('empRemarkinfo:update')") |
| | | public void updateEmpRemarkinfo(EmpRemarkInfo empRemarkinfo) throws FebsException { |
| | | try { |
| | | this.empRemarkinfoService.updateEmpRemarkinfo(empRemarkinfo); |
| | | } catch (Exception e) { |
| | | String message = "修改员工备注信息失败"; |
| | | log.error(message, e); |
| | | throw new FebsException(message); |
| | | } |
| | | } |
| | | |
| | | @ApiOperation(value = "备注信息提交") |
| | | @DeleteMapping("toNormal/{ids}") |
| | | @PreAuthorize("hasAuthority('empRemarkinfo:delete')") |
| | | public void momentToNormal(@NotBlank(message = "{required}") @PathVariable("ids") String ids) throws FebsException { |
| | | try { |
| | | this.empRemarkinfoService.momentToNormal(ids); |
| | | } catch (Exception e) { |
| | | String message = "备注信息提交失败"; |
| | | log.error(message, e); |
| | | throw new FebsException(message); |
| | | } |
| | | } |
| | | |
| | | } |