package com.gkhy.safePlatform.account.controller;
|
|
|
import com.alibaba.fastjson.JSONObject;
|
import com.gkhy.safePlatform.account.model.annotation.CommonLogEnable;
|
import com.gkhy.safePlatform.account.model.dto.req.PositionAddReqDTO;
|
import com.gkhy.safePlatform.account.model.dto.req.PositionModReqDTO;
|
import com.gkhy.safePlatform.account.model.dto.resp.PositionDetailRespDTO;
|
import com.gkhy.safePlatform.account.model.dto.resp.PositionRespDTO;
|
import com.gkhy.safePlatform.account.model.query.PositionQuery;
|
import com.gkhy.safePlatform.account.service.PositionService;
|
import com.gkhy.safePlatform.commons.co.ContextCacheUser;
|
import com.gkhy.safePlatform.commons.enums.Module;
|
import com.gkhy.safePlatform.commons.enums.ResultCodes;
|
import com.gkhy.safePlatform.commons.query.PageQuery;
|
import com.gkhy.safePlatform.commons.utils.PageUtils;
|
import com.gkhy.safePlatform.commons.vo.ResultVO;
|
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.security.core.Authentication;
|
import org.springframework.web.bind.annotation.RequestBody;
|
import org.springframework.web.bind.annotation.RequestMapping;
|
import org.springframework.web.bind.annotation.RequestMethod;
|
import org.springframework.web.bind.annotation.RestController;
|
import java.util.List;
|
|
/**
|
* @Description: 岗位
|
*/
|
@RestController
|
@RequestMapping("/position")
|
public class PositionController {
|
|
@Autowired
|
private PositionService positionService;
|
|
|
@RequestMapping(value = "/list",method = RequestMethod.POST)
|
public ResultVO<List<PositionRespDTO>> positionList(Authentication authentication, @RequestBody PositionQuery query){
|
ContextCacheUser currentUser = (ContextCacheUser) authentication.getPrincipal();
|
List<PositionRespDTO> positionRespDTOList = positionService.listPositionInfo(currentUser,query);
|
return new ResultVO<>(ResultCodes.OK,positionRespDTOList);
|
}
|
|
|
|
@RequestMapping(value = "/page/list",method = RequestMethod.POST)
|
public ResultVO<List<PositionDetailRespDTO>> positionPageList(Authentication authentication, @RequestBody PageQuery<PositionQuery> pageQuery){
|
ContextCacheUser currentUser = (ContextCacheUser) authentication.getPrincipal();
|
PageUtils.checkCheck(pageQuery);
|
return positionService.listPositionInfoByPage(currentUser,pageQuery);
|
}
|
|
|
@RequestMapping(value = "/add",method = RequestMethod.POST)
|
@CommonLogEnable(module = Module.ACCOUNT,content = "新增岗位")
|
public ResultVO<String> addPosition(Authentication authentication, @RequestBody PositionAddReqDTO positionAddReqDTO){
|
ContextCacheUser currentUser = (ContextCacheUser) authentication.getPrincipal();
|
positionService.addPositionInfo(currentUser, positionAddReqDTO);
|
return new ResultVO<>(ResultCodes.OK);
|
}
|
|
@RequestMapping(value = "/mod",method = RequestMethod.POST)
|
@CommonLogEnable(module = Module.ACCOUNT,content = "修改岗位")
|
public ResultVO<String> modPosition(Authentication authentication, @RequestBody PositionModReqDTO positionModReqDTO){
|
ContextCacheUser currentUser = (ContextCacheUser) authentication.getPrincipal();
|
positionService.modPositionInfo(currentUser, positionModReqDTO);
|
return new ResultVO<>(ResultCodes.OK);
|
}
|
|
|
@RequestMapping(value = "/del",method = RequestMethod.POST)
|
@CommonLogEnable(module = Module.ACCOUNT,content = "删除岗位")
|
public ResultVO<String> delPosition(Authentication authentication, @RequestBody JSONObject json){
|
ContextCacheUser currentUser = (ContextCacheUser) authentication.getPrincipal();
|
Long positionId = json.getLong("positionId");
|
positionService.delPositionInfo(currentUser, positionId);
|
return new ResultVO<>(ResultCodes.OK);
|
}
|
|
|
}
|