| | |
| | | import cc.mrbird.febs.server.system.service.IPositionService; |
| | | 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 lombok.extern.slf4j.Slf4j; |
| | | import org.springframework.validation.annotation.Validated; |
| | | import org.springframework.web.bind.annotation.*; |
| | | |
| | | import javax.validation.Valid; |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | |
| | | /** |
| | | * |
| | | * name:Position |
| | | * package:cc.mrbird.febs.server.system.controller |
| | | * description:岗位信息控制器 |
| | | * |
| | | * @author Alan |
| | | * @date 2021-02-16 11:52:53 |
| | | * @since JDK1.8 |
| | | */ |
| | | * name:Position |
| | | * package:cc.mrbird.febs.server.system.controller |
| | | * description:岗位信息控制器 |
| | | * |
| | | * @author Alan |
| | | * @date 2021-02-16 11:52:53 |
| | | * @since JDK1.8 |
| | | */ |
| | | @Api(tags = "岗位信息管理接口") |
| | | @Slf4j |
| | | @Validated |
| | |
| | | @RequiredArgsConstructor |
| | | public class PositionController { |
| | | |
| | | private final IPositionService positionService; |
| | | private final IPositionService positionService; |
| | | |
| | | @ApiOperation(value = "岗位信息翻页列表") |
| | | @GetMapping |
| | | public FebsResponse getAllPositions(QueryRequest request,Position position) { |
| | | Map |
| | | <String, Object> dataTable = FebsUtil.getDataTable(this.positionService.findPositions(request, position)); |
| | | return new FebsResponse().data(dataTable); |
| | | } |
| | | @ApiOperation(value = "岗位信息翻页列表") |
| | | @GetMapping |
| | | public FebsResponse getAllPositions(QueryRequest request, Position position) { |
| | | Map<String, Object> dataTable = FebsUtil.getDataTable(this.positionService.findPositions(request, position)); |
| | | return new FebsResponse().data(dataTable); |
| | | } |
| | | |
| | | |
| | | @ApiOperation(value = "岗位信息增加") |
| | | @PostMapping |
| | | @PreAuthorize("hasAuthority('position:add')") |
| | | public void addPosition(@Valid Position position) throws FebsException { |
| | | try { |
| | | this.positionService.createPosition(position); |
| | | } catch (Exception e) { |
| | | String message = "新增岗位信息失败"; |
| | | log.error(message, e); |
| | | throw new FebsException(message); |
| | | } |
| | | } |
| | | @ApiOperation(value = "岗位信息增加") |
| | | @PostMapping |
| | | public void addPosition(@Valid Position position) throws FebsException { |
| | | try { |
| | | this.positionService.createPosition(position); |
| | | } catch (Exception e) { |
| | | String message = "新增岗位信息失败"; |
| | | log.error(message, e); |
| | | throw new FebsException(message); |
| | | } |
| | | } |
| | | |
| | | @ApiOperation(value = "岗位信息物理删除") |
| | | @DeleteMapping |
| | | @ApiOperation(value = "岗位信息物理删除") |
| | | @DeleteMapping |
| | | |
| | | public void deletePosition(Position position) throws FebsException { |
| | | try { |
| | | this.positionService.deletePosition(position); |
| | | } catch (Exception e) { |
| | | String message = "删除岗位信息失败"; |
| | | log.error(message, e); |
| | | throw new FebsException(message); |
| | | } |
| | | } |
| | | public void deletePosition(Position position) throws FebsException { |
| | | try { |
| | | this.positionService.deletePosition(position); |
| | | } catch (Exception e) { |
| | | String message = "删除岗位信息失败"; |
| | | log.error(message, e); |
| | | throw new FebsException(message); |
| | | } |
| | | } |
| | | |
| | | @ApiOperation(value = "岗位信息逻辑删除") |
| | | @DeleteMapping("{ids}") |
| | | @ApiOperation(value = "岗位信息逻辑删除") |
| | | @DeleteMapping("{ids}") |
| | | |
| | | public void logicDeletePosition(@PathVariable("ids") String ids) throws FebsException { |
| | | try { |
| | | this.positionService.logicDelPosition(ids); |
| | | } catch (Exception e) { |
| | | String message = "逻辑删除岗位信息失败"; |
| | | log.error(message, e); |
| | | throw new FebsException(message); |
| | | } |
| | | } |
| | | public void logicDeletePosition(@PathVariable("ids") String ids) throws FebsException { |
| | | try { |
| | | this.positionService.logicDelPosition(ids); |
| | | } catch (Exception e) { |
| | | String message = "逻辑删除岗位信息失败"; |
| | | log.error(message, e); |
| | | throw new FebsException(message); |
| | | } |
| | | } |
| | | |
| | | @ApiOperation(value = "岗位信息修改") |
| | | @PutMapping |
| | | public void updatePosition(Position position) throws FebsException { |
| | | try { |
| | | this.positionService.updatePosition(position); |
| | | } catch (Exception e) { |
| | | String message = "修改岗位信息失败"; |
| | | log.error(message, e); |
| | | throw new FebsException(message); |
| | | } |
| | | } |
| | | @ApiOperation(value = "岗位信息修改") |
| | | @PutMapping |
| | | public void updatePosition(Position position) throws FebsException { |
| | | try { |
| | | this.positionService.updatePosition(position); |
| | | } catch (Exception e) { |
| | | String message = "修改岗位信息失败"; |
| | | log.error(message, e); |
| | | throw new FebsException(message); |
| | | } |
| | | } |
| | | |
| | | @GetMapping("dicJob") |
| | | public FebsResponse selectDicJobs() { |
| | | return new FebsResponse().data(positionService.selectDicJobs()); |
| | | } |
| | | |
| | | @GetMapping("setPositionRedis") |
| | | List<Position> setPositionRedis() { |
| | | return positionService.setPositionRedis(); |
| | | } |
| | | } |