mirror of
https://github.com/FatttSnake/Pinnacle-OA.git
synced 2026-04-05 23:11:24 +08:00
add personAffairs model and solve warning
This commit is contained in:
@@ -27,64 +27,70 @@ import java.util.List;
|
||||
public class AffairController {
|
||||
@Autowired
|
||||
IAffairService affairService;
|
||||
// IUserService userService;
|
||||
// 不用userService的方法了,userController中已经写好了直接拿来用
|
||||
// IUserService userService;
|
||||
// 不用userService的方法了,userController中已经写好了直接拿来用
|
||||
@Autowired
|
||||
UserController userController;
|
||||
UserController userController;
|
||||
|
||||
|
||||
@PostMapping("/add")
|
||||
public ResponseResult addAffair(@RequestBody Affair affair) {
|
||||
public ResponseResult<Boolean> addAffair(@RequestBody Affair affair) {
|
||||
return ResponseResult.build(ResponseCode.DATABASE_SAVE_OK, "success", affairService.save(affair));
|
||||
}
|
||||
|
||||
@GetMapping("/add/getUser")
|
||||
public ResponseResult getUser() {
|
||||
@GetMapping("/add/get_user")
|
||||
public ResponseResult<List<User>> getUser() {
|
||||
List<User> userList = userController.getAllUser().getData();
|
||||
return ResponseResult.build(ResponseCode.DATABASE_SELECT_OK,"success",userList);
|
||||
return ResponseResult.build(ResponseCode.DATABASE_SELECT_OK, "success", userList);
|
||||
}//获取数据库中所有用户
|
||||
|
||||
@GetMapping("/add/getCurrentUser")
|
||||
public ResponseResult getCurrentUser() {
|
||||
return ResponseResult.build(ResponseCode.DATABASE_SELECT_OK,"success",WebUtil.getLoginUser().getUser());
|
||||
@GetMapping("/add/get_current_user")
|
||||
public ResponseResult<User> getCurrentUser() {
|
||||
return ResponseResult.build(ResponseCode.DATABASE_SELECT_OK, "success", WebUtil.getLoginUser().getUser());
|
||||
}//获取当前用户
|
||||
|
||||
|
||||
|
||||
|
||||
@GetMapping("/NotApproved")
|
||||
public ResponseResult select_NotApproved() {
|
||||
@GetMapping("/personal_affairs")
|
||||
public ResponseResult<List<Affair>> getPersonalAffairs() {
|
||||
LambdaQueryWrapper<Affair> wrapper = new LambdaQueryWrapper<>();
|
||||
wrapper.eq(Affair::getStatus, 0).eq(Affair::getInspectorId,WebUtil.getLoginUser().getUser().getId());
|
||||
wrapper.eq(Affair::getApplicantId, WebUtil.getLoginUser().getUser().getId());
|
||||
wrapper.orderByDesc(Affair::getCreateTime);
|
||||
return ResponseResult.build(ResponseCode.DATABASE_SELECT_OK, "success", affairService.list(wrapper));
|
||||
}
|
||||
|
||||
|
||||
@GetMapping("/Approved")
|
||||
public ResponseResult select_Approved() {
|
||||
@GetMapping("/not_approved")
|
||||
public ResponseResult<List<Affair>> selectNotApproved() {
|
||||
LambdaQueryWrapper<Affair> wrapper = new LambdaQueryWrapper<>();
|
||||
wrapper.eq(Affair::getStatus, 0).eq(Affair::getInspectorId, WebUtil.getLoginUser().getUser().getId());
|
||||
wrapper.orderByDesc(Affair::getCreateTime);
|
||||
return ResponseResult.build(ResponseCode.DATABASE_SELECT_OK, "success", affairService.list(wrapper));
|
||||
}
|
||||
|
||||
|
||||
@GetMapping("/approved")
|
||||
public ResponseResult<List<Affair>> selectApproved() {
|
||||
LambdaQueryWrapper<Affair> wrapper2 = new LambdaQueryWrapper<>();
|
||||
wrapper2.ne(Affair::getStatus, 0).eq(Affair::getInspectorId,WebUtil.getLoginUser().getUser().getId());
|
||||
wrapper2.ne(Affair::getStatus, 0).eq(Affair::getInspectorId, WebUtil.getLoginUser().getUser().getId());
|
||||
wrapper2.orderByDesc(Affair::getInspectTime);
|
||||
return ResponseResult.build(ResponseCode.DATABASE_SELECT_OK, "success", affairService.list(wrapper2));
|
||||
}
|
||||
|
||||
@PutMapping("/yes")
|
||||
public ResponseResult updateAffair_yes(@RequestBody Affair affair) {
|
||||
public ResponseResult updateAffairYes(@RequestBody Affair affair) {
|
||||
System.out.println(affair);
|
||||
return ResponseResult.build(ResponseCode.DATABASE_UPDATE_OK, "success", affairService.updateAffair_Yes(affair));
|
||||
return ResponseResult.build(ResponseCode.DATABASE_UPDATE_OK, "success", affairService.updateAffairYes(affair));
|
||||
//审批同意
|
||||
}
|
||||
|
||||
@PutMapping("/no")
|
||||
public ResponseResult updateAffair_No(@RequestBody Affair affair) {
|
||||
return ResponseResult.build(ResponseCode.DATABASE_UPDATE_OK, "success", affairService.updateAffair_No(affair));
|
||||
public ResponseResult updateAffairNo(@RequestBody Affair affair) {
|
||||
return ResponseResult.build(ResponseCode.DATABASE_UPDATE_OK, "success", affairService.updateAffairNo(affair));
|
||||
//审批驳回
|
||||
}
|
||||
|
||||
|
||||
@DeleteMapping("/{id}")
|
||||
public ResponseResult deleteAffair_Approved(@PathVariable Long id) {
|
||||
public ResponseResult deleteAffairApproved(@PathVariable Long id) {
|
||||
System.out.println("affair");
|
||||
return ResponseResult.build(ResponseCode.DATABASE_DELETE_OK, "success", affairService.removeById(id));
|
||||
//删除已审批事务
|
||||
|
||||
Reference in New Issue
Block a user