| | |
| | | **/ |
| | | @RestController |
| | | @RequiredArgsConstructor |
| | | @Api(tags = "营业费用管理") |
| | | @Api(tags = "营业费用(Flowable)") |
| | | @RequestMapping("/api/businessExpenseFlowable") |
| | | public class BusinessExpenseFlowableController { |
| | | |
| | |
| | | */ |
| | | @Query(value = "SELECT count(1) FROM sys_user WHERE level_id IN ?1", nativeQuery = true) |
| | | int countByLevels(Long[] ids); |
| | | |
| | | /** |
| | | * 根据角色等级查询用户 |
| | | * @param level / |
| | | * @return / |
| | | */ |
| | | @Query(value = "SELECT u.* FROM sys_user u, sys_users_roles ur, sys_role r WHERE" + |
| | | " u.user_id = ur.user_id AND ur.role_id = r.role_id AND r.level = ?1", nativeQuery = true) |
| | | List<User> findByRoleLevel(Integer level); |
| | | } |
| | |
| | | return new ResponseEntity<>(userService.queryAll(criteria),HttpStatus.OK); |
| | | } |
| | | |
| | | @GetMapping(value = "/approval/level") |
| | | @Log("查询审批员工") |
| | | @ApiOperation("查询审批员工") |
| | | @PreAuthorize("@el.check('user:list')") |
| | | public ResponseEntity<Object> queryApprovalUserByLevel(@RequestParam Long userId) { |
| | | // 获取用户最大角色等级 |
| | | List<Integer> levels = roleService.findByUsersId(userId).stream().map(RoleSmallDto::getLevel).collect(Collectors.toList()); |
| | | int min = Collections.min(levels); |
| | | min = min - 1 <= 0 ? min : min - 1; |
| | | // 根据角色等级查询 |
| | | List<UserDto> userDtoList = userService.findByRoleLevel(min); |
| | | return new ResponseEntity<>(userDtoList,HttpStatus.OK); |
| | | } |
| | | |
| | | @ApiOperation("查询用户") |
| | | @GetMapping |
| | | @PreAuthorize("@el.check('user:list')") |
| | |
| | | */ |
| | | Map getUserBaseInfo(Date yearMonth) throws ParseException; |
| | | |
| | | /** |
| | | * 根据角色等级查询 |
| | | * @param level / |
| | | * @return / |
| | | */ |
| | | List<UserDto> findByRoleLevel(Integer level); |
| | | } |
| | |
| | | // 保存 |
| | | sysUserLevelOtherRepository.save(sysUserLevelOther); |
| | | } |
| | | |
| | | @Override |
| | | @Transactional(rollbackFor = Exception.class) |
| | | public List<UserDto> findByRoleLevel(Integer level) { |
| | | // 根据角色等级查询用户 |
| | | return userMapper.toDto(userRepository.findByRoleLevel(level)); |
| | | } |
| | | } |
| | |
| | | }) |
| | | } |
| | | |
| | | export function getApprovalUsersByLevel(id) { |
| | | return request({ |
| | | url: 'api/users/approval/level?userId=' + id, |
| | | method: 'get' |
| | | }) |
| | | } |
| | | |
| | | export function add(data) { |
| | | return request({ |
| | | url: 'api/users', |
| | |
| | | }) |
| | | } |
| | | |
| | | export default { getAll, add, edit, del, get, getApprovalUsers, getUserCalendarInfo, getUserBaseInfo } |
| | | export default { getAll, add, edit, del, get, getApprovalUsers, getApprovalUsersByLevel, getUserCalendarInfo, getUserBaseInfo } |