增加职位与角色业务接口
This commit is contained in:
parent
2d27d6b61c
commit
18c46dccf1
@ -108,4 +108,21 @@ public interface IPositionBaseService {
|
|||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
Integer count(Map<String, Object> params);
|
Integer count(Map<String, Object> params);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 上级详情
|
||||||
|
*
|
||||||
|
* @param positionId 职位ID
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
PositionDTO getParentByPositionId(String positionId);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 上级列表
|
||||||
|
*
|
||||||
|
* @param positionIds 职位ID列表
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
List<PositionDTO> listParentByPositionIds(List<String> positionIds);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -36,6 +36,41 @@ public interface IPositionUserBaseService {
|
|||||||
*/
|
*/
|
||||||
List<String> listUserId(List<String> positionIds);
|
List<String> listUserId(List<String> positionIds);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 用户ID列表
|
||||||
|
*
|
||||||
|
* @param positionId
|
||||||
|
* @param userIds
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
List<String> listUserIdByPositionIdAndUserIds(String positionId, List<String> userIds);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 用户ID列表
|
||||||
|
*
|
||||||
|
* @param positionIds
|
||||||
|
* @param userIds
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
List<String> listUserIdByPositionIdsAndUserIds(List<String> positionIds, List<String> userIds);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 职位ID列表
|
||||||
|
*
|
||||||
|
* @param userId
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
List<String> listPositionIdByUserId(String userId);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 职位ID列表
|
||||||
|
*
|
||||||
|
* @param userIds
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
List<String> listPositionIdByUserIds(List<String> userIds);
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 分页用户组用户
|
* 分页用户组用户
|
||||||
*
|
*
|
||||||
@ -68,4 +103,6 @@ public interface IPositionUserBaseService {
|
|||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
List<PositionSimpleDTO> listSimple(List<PositionPO> positionPOs);
|
List<PositionSimpleDTO> listSimple(List<PositionPO> positionPOs);
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -80,6 +80,14 @@ public interface IRoleUserBaseService {
|
|||||||
*/
|
*/
|
||||||
List<String> listUserIdByRoleIdAndUserIds(String roleId, List<String> userIds);
|
List<String> listUserIdByRoleIdAndUserIds(String roleId, List<String> userIds);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 用户ID列表
|
||||||
|
* @param roleIds 角色ID列表
|
||||||
|
* @param userIds 用户ID列表
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
List<String> listUserIdByRoleIdsAndUserIds(List<String> roleIds, List<String> userIds);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 角色ID列表
|
* 角色ID列表
|
||||||
*
|
*
|
||||||
|
@ -53,4 +53,11 @@ public interface IPositionRemoteService {
|
|||||||
|
|
||||||
@RemoteGetMethod("/count")
|
@RemoteGetMethod("/count")
|
||||||
SuccessResultData<Integer> count(@RemoteServerParams String userCenter, @RemoteQueryParams("access_token") String accessToken, @RemoteQueryParamsMap Map<String, Object> params);
|
SuccessResultData<Integer> count(@RemoteServerParams String userCenter, @RemoteQueryParams("access_token") String accessToken, @RemoteQueryParamsMap Map<String, Object> params);
|
||||||
|
|
||||||
|
@RemoteGetMethod("/get-parent/position-id/{positionId}")
|
||||||
|
PositionDTO getParentByPositionId(@RemoteServerParams String userCenter, @RemotePathParams("positionId") String positionId, @RemoteQueryParams("access_token") String accessToken);
|
||||||
|
|
||||||
|
@RemotePostMethod("/list-parent/position-ids")
|
||||||
|
List<PositionDTO> listParentByPositionIds(@RemoteServerParams String userCenter, @RemoteQueryParams("access_token") String accessToken, @RemoteJsonBodyParams IdsVO idsVO);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -36,4 +36,17 @@ public interface IPositionUserRemoteService {
|
|||||||
|
|
||||||
@RemotePostMethod("/list-position-po/user-ids")
|
@RemotePostMethod("/list-position-po/user-ids")
|
||||||
List<PositionPO> listPositionPOByUserIds(@RemoteServerParams String userCenter, @RemoteQueryParams("access_token") String accessToken, @RemoteJsonBodyParams IdsVO idsVO);
|
List<PositionPO> listPositionPOByUserIds(@RemoteServerParams String userCenter, @RemoteQueryParams("access_token") String accessToken, @RemoteJsonBodyParams IdsVO idsVO);
|
||||||
|
|
||||||
|
@RemotePostMethod("/list-user-id/position-id/{positionId}/user-ids")
|
||||||
|
List<String> listUserIdByPositionIdAndUserIds(@RemoteServerParams String userCenter, @RemotePathParams("positionId") String positionId, @RemoteQueryParams("access_token") String accessToken, @RemoteJsonBodyParams IdsVO idsVO);
|
||||||
|
|
||||||
|
@RemotePostMethod("/list-user-id/position-ids/user-ids")
|
||||||
|
List<String> listUserIdByPositionIdsAndUserIds(@RemoteServerParams String userCenter, @RemoteQueryParams("access_token") String accessToken, @RemoteJsonBodyParams IdsVO idsVO);
|
||||||
|
|
||||||
|
@RemoteGetMethod("/list-position-id/user-id/{userId}")
|
||||||
|
List<String> listPositionIdByUserId(@RemoteServerParams String userCenter, @RemotePathParams("userId") String userId, @RemoteQueryParams("access_token") String accessToken);
|
||||||
|
|
||||||
|
@RemotePostMethod("/list-position-id/user-ids")
|
||||||
|
List<String> listPositionIdByUserIds(@RemoteServerParams String userCenter, @RemoteQueryParams("access_token") String accessToken, @RemoteJsonBodyParams IdsVO idsVO);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -38,6 +38,9 @@ public interface IRoleUserRemoteService {
|
|||||||
@RemotePostMethod("/list-user-id/role-id/{roleId}/user-ids")
|
@RemotePostMethod("/list-user-id/role-id/{roleId}/user-ids")
|
||||||
List<String> listUserIdByRoleIdAndUserIds(@RemoteServerParams String userCenter, @RemotePathParams("roleId") String roleId, @RemoteQueryParams("access_token") String accessToken, @RemoteJsonBodyParams IdsVO idsVO);
|
List<String> listUserIdByRoleIdAndUserIds(@RemoteServerParams String userCenter, @RemotePathParams("roleId") String roleId, @RemoteQueryParams("access_token") String accessToken, @RemoteJsonBodyParams IdsVO idsVO);
|
||||||
|
|
||||||
|
@RemotePostMethod("/list-user-id/role-ids/user-ids")
|
||||||
|
List<String> listUserIdByRoleIdsAndUserIds(@RemoteServerParams String userCenter, @RemoteQueryParams("access_token") String accessToken, @RemoteJsonBodyParams IdsVO idsVO);
|
||||||
|
|
||||||
@RemotePostMethod("/list-role-po/role-ids")
|
@RemotePostMethod("/list-role-po/role-ids")
|
||||||
List<RolePO> listRolePOByRoleIds(@RemoteServerParams String userCenter, @RemoteQueryParams("access_token") String accessToken, @RemoteJsonBodyParams IdsVO idsVO);
|
List<RolePO> listRolePOByRoleIds(@RemoteServerParams String userCenter, @RemoteQueryParams("access_token") String accessToken, @RemoteJsonBodyParams IdsVO idsVO);
|
||||||
|
|
||||||
|
@ -12,6 +12,7 @@ import ink.wgink.pojo.result.SuccessResultData;
|
|||||||
import ink.wgink.pojo.result.SuccessResultList;
|
import ink.wgink.pojo.result.SuccessResultList;
|
||||||
import ink.wgink.pojo.vos.IdsVO;
|
import ink.wgink.pojo.vos.IdsVO;
|
||||||
import ink.wgink.properties.ApiPathProperties;
|
import ink.wgink.properties.ApiPathProperties;
|
||||||
|
import org.apache.commons.lang3.StringUtils;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
@ -98,4 +99,22 @@ public class PositionServiceImpl extends DefaultBaseService implements IPosition
|
|||||||
SuccessResultData<Integer> count = positionRemoteService.count(apiPathProperties.getUserCenter(), OAuth2ClientTokenManager.getInstance().getToken().getAccessToken(), params);
|
SuccessResultData<Integer> count = positionRemoteService.count(apiPathProperties.getUserCenter(), OAuth2ClientTokenManager.getInstance().getToken().getAccessToken(), params);
|
||||||
return count.getData();
|
return count.getData();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public PositionDTO getParentByPositionId(String positionId) {
|
||||||
|
if (StringUtils.isBlank(positionId)) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
return positionRemoteService.getParentByPositionId(apiPathProperties.getUserCenter(), positionId, OAuth2ClientTokenManager.getInstance().getToken().getAccessToken());
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public List<PositionDTO> listParentByPositionIds(List<String> positionIds) {
|
||||||
|
if (positionIds.isEmpty()) {
|
||||||
|
return new ArrayList<>();
|
||||||
|
}
|
||||||
|
IdsVO idsVO = new IdsVO();
|
||||||
|
idsVO.setIds(positionIds);
|
||||||
|
return positionRemoteService.listParentByPositionIds(apiPathProperties.getUserCenter(), OAuth2ClientTokenManager.getInstance().getToken().getAccessToken(), idsVO);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -11,6 +11,7 @@ import ink.wgink.pojo.pos.PositionPO;
|
|||||||
import ink.wgink.pojo.result.SuccessResultList;
|
import ink.wgink.pojo.result.SuccessResultList;
|
||||||
import ink.wgink.pojo.vos.IdsVO;
|
import ink.wgink.pojo.vos.IdsVO;
|
||||||
import ink.wgink.properties.ApiPathProperties;
|
import ink.wgink.properties.ApiPathProperties;
|
||||||
|
import org.apache.commons.lang3.StringUtils;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
@ -39,11 +40,59 @@ public class PositionUserServiceImpl extends DefaultBaseService implements IPosi
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public List<String> listUserId(List<String> positionIds) {
|
public List<String> listUserId(List<String> positionIds) {
|
||||||
|
if (positionIds.isEmpty()) {
|
||||||
|
return new ArrayList<>();
|
||||||
|
}
|
||||||
IdsVO idsVO = new IdsVO();
|
IdsVO idsVO = new IdsVO();
|
||||||
idsVO.setIds(positionIds);
|
idsVO.setIds(positionIds);
|
||||||
return positionUserRemoteService.listUserIdByPositionIds(apiPathProperties.getUserCenter(), OAuth2ClientTokenManager.getInstance().getToken().getAccessToken(), idsVO);
|
return positionUserRemoteService.listUserIdByPositionIds(apiPathProperties.getUserCenter(), OAuth2ClientTokenManager.getInstance().getToken().getAccessToken(), idsVO);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public List<String> listUserIdByPositionIdAndUserIds(String positionId, List<String> userIds) {
|
||||||
|
if (StringUtils.isBlank(positionId)) {
|
||||||
|
return new ArrayList<>();
|
||||||
|
}
|
||||||
|
if (userIds == null || userIds.isEmpty()) {
|
||||||
|
return new ArrayList<>();
|
||||||
|
}
|
||||||
|
IdsVO idsVO = new IdsVO();
|
||||||
|
idsVO.setIds(userIds);
|
||||||
|
return positionUserRemoteService.listUserIdByPositionIdAndUserIds(apiPathProperties.getUserCenter(), positionId, OAuth2ClientTokenManager.getInstance().getToken().getAccessToken(), idsVO);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public List<String> listUserIdByPositionIdsAndUserIds(List<String> positionIds, List<String> userIds) {
|
||||||
|
if (positionIds == null || positionIds.isEmpty()) {
|
||||||
|
return new ArrayList<>();
|
||||||
|
}
|
||||||
|
if (userIds == null || userIds.isEmpty()) {
|
||||||
|
return new ArrayList<>();
|
||||||
|
}
|
||||||
|
IdsVO idsVO = new IdsVO();
|
||||||
|
idsVO.setIds(positionIds);
|
||||||
|
idsVO.setIds2(userIds);
|
||||||
|
return positionUserRemoteService.listUserIdByPositionIdsAndUserIds(apiPathProperties.getUserCenter(), OAuth2ClientTokenManager.getInstance().getToken().getAccessToken(), idsVO);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public List<String> listPositionIdByUserId(String userId) {
|
||||||
|
if (StringUtils.isBlank(userId)) {
|
||||||
|
return new ArrayList<>();
|
||||||
|
}
|
||||||
|
return positionUserRemoteService.listPositionIdByUserId(apiPathProperties.getUserCenter(), userId, OAuth2ClientTokenManager.getInstance().getToken().getAccessToken());
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public List<String> listPositionIdByUserIds(List<String> userIds) {
|
||||||
|
if(userIds == null && userIds.isEmpty()) {
|
||||||
|
return new ArrayList<>();
|
||||||
|
}
|
||||||
|
IdsVO idsVO = new IdsVO();
|
||||||
|
idsVO.setIds(userIds);
|
||||||
|
return positionUserRemoteService.listPositionIdByUserIds(apiPathProperties.getUserCenter(), OAuth2ClientTokenManager.getInstance().getToken().getAccessToken(), idsVO);
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public SuccessResultList<List<PositionUserDTO>> listPage(String positionId, ListPage page) {
|
public SuccessResultList<List<PositionUserDTO>> listPage(String positionId, ListPage page) {
|
||||||
return positionUserRemoteService.listPage(apiPathProperties.getUserCenter(), positionId, OAuth2ClientTokenManager.getInstance().getToken().getAccessToken(), page.getPage(), page.getRows(), page.getParams());
|
return positionUserRemoteService.listPage(apiPathProperties.getUserCenter(), positionId, OAuth2ClientTokenManager.getInstance().getToken().getAccessToken(), page.getPage(), page.getRows(), page.getParams());
|
||||||
|
@ -12,6 +12,7 @@ import ink.wgink.pojo.pos.RolePO;
|
|||||||
import ink.wgink.pojo.result.SuccessResultList;
|
import ink.wgink.pojo.result.SuccessResultList;
|
||||||
import ink.wgink.pojo.vos.IdsVO;
|
import ink.wgink.pojo.vos.IdsVO;
|
||||||
import ink.wgink.properties.ApiPathProperties;
|
import ink.wgink.properties.ApiPathProperties;
|
||||||
|
import org.apache.commons.lang3.StringUtils;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
@ -86,11 +87,31 @@ public class RoleUserServiceImpl extends DefaultBaseService implements IRoleUser
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public List<String> listUserIdByRoleIdAndUserIds(String roleId, List<String> userIds) {
|
public List<String> listUserIdByRoleIdAndUserIds(String roleId, List<String> userIds) {
|
||||||
|
if (StringUtils.isBlank(roleId)) {
|
||||||
|
return new ArrayList<>();
|
||||||
|
}
|
||||||
|
if (userIds == null || userIds.isEmpty()) {
|
||||||
|
return new ArrayList<>();
|
||||||
|
}
|
||||||
IdsVO idsVO = new IdsVO();
|
IdsVO idsVO = new IdsVO();
|
||||||
idsVO.setIds(userIds);
|
idsVO.setIds(userIds);
|
||||||
return roleUserRemoteService.listUserIdByRoleIdAndUserIds(apiPathProperties.getUserCenter(), roleId, OAuth2ClientTokenManager.getInstance().getToken().getAccessToken(), idsVO);
|
return roleUserRemoteService.listUserIdByRoleIdAndUserIds(apiPathProperties.getUserCenter(), roleId, OAuth2ClientTokenManager.getInstance().getToken().getAccessToken(), idsVO);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public List<String> listUserIdByRoleIdsAndUserIds(List<String> roleIds, List<String> userIds) {
|
||||||
|
if (roleIds == null || roleIds.isEmpty()) {
|
||||||
|
return new ArrayList<>();
|
||||||
|
}
|
||||||
|
if (userIds == null || userIds.isEmpty()) {
|
||||||
|
return new ArrayList<>();
|
||||||
|
}
|
||||||
|
IdsVO idsVO = new IdsVO();
|
||||||
|
idsVO.setIds(roleIds);
|
||||||
|
idsVO.setIds2(userIds);
|
||||||
|
return roleUserRemoteService.listUserIdByRoleIdsAndUserIds(apiPathProperties.getUserCenter(), OAuth2ClientTokenManager.getInstance().getToken().getAccessToken(), idsVO);
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public List<String> listRoleIdByUserId(String userId) {
|
public List<String> listRoleIdByUserId(String userId) {
|
||||||
return roleUserRemoteService.listRoleIdByUserId(apiPathProperties.getUserCenter(), userId, OAuth2ClientTokenManager.getInstance().getToken().getAccessToken());
|
return roleUserRemoteService.listRoleIdByUserId(apiPathProperties.getUserCenter(), userId, OAuth2ClientTokenManager.getInstance().getToken().getAccessToken());
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
package ink.wgink.service.position.controller.resources;
|
package ink.wgink.service.position.controller.resources;
|
||||||
|
|
||||||
import ink.wgink.common.base.DefaultBaseController;
|
import ink.wgink.common.base.DefaultBaseController;
|
||||||
|
import ink.wgink.exceptions.ParamsException;
|
||||||
import ink.wgink.interfaces.consts.ISystemConstant;
|
import ink.wgink.interfaces.consts.ISystemConstant;
|
||||||
import ink.wgink.pojo.ListPage;
|
import ink.wgink.pojo.ListPage;
|
||||||
import ink.wgink.pojo.dtos.ZTreeDTO;
|
import ink.wgink.pojo.dtos.ZTreeDTO;
|
||||||
@ -152,4 +153,26 @@ public class PositionResourceController extends DefaultBaseController {
|
|||||||
return new SuccessResultData<>(count);
|
return new SuccessResultData<>(count);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ApiOperation(value = "通过ID列表获取职位列表", notes = "通过ID列表获取用户职位接口")
|
||||||
|
@ApiImplicitParams({
|
||||||
|
@ApiImplicitParam(name = "positionId", value = "职位ID", paramType = "path"),
|
||||||
|
})
|
||||||
|
@ApiResponses({@ApiResponse(code = 400, message = "请求失败", response = ErrorResult.class)})
|
||||||
|
@GetMapping("get-parent/position-id/{positionId}")
|
||||||
|
public PositionDTO getParentByPositionId(@PathVariable("positionId") String positionId) {
|
||||||
|
return positionService.getParentByPositionId(positionId);
|
||||||
|
}
|
||||||
|
|
||||||
|
@ApiOperation(value = "通过职位ID列表获取上级职位列表", notes = "通过职位ID列表获取职位列表接口")
|
||||||
|
@ApiResponses({@ApiResponse(code = 400, message = "请求失败", response = ErrorResult.class)})
|
||||||
|
@PostMapping("list-parent/position-ids")
|
||||||
|
public List<PositionDTO> listParentByPositionIds(@RequestBody IdsVO idsVO) {
|
||||||
|
if (idsVO.getIds().isEmpty()) {
|
||||||
|
throw new ParamsException("ids不能为空");
|
||||||
|
}
|
||||||
|
return positionService.listParentByPositionIds(idsVO.getIds());
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
package ink.wgink.service.position.controller.resources;
|
package ink.wgink.service.position.controller.resources;
|
||||||
|
|
||||||
import ink.wgink.common.base.DefaultBaseController;
|
import ink.wgink.common.base.DefaultBaseController;
|
||||||
|
import ink.wgink.exceptions.ParamsException;
|
||||||
import ink.wgink.interfaces.consts.ISystemConstant;
|
import ink.wgink.interfaces.consts.ISystemConstant;
|
||||||
import ink.wgink.pojo.ListPage;
|
import ink.wgink.pojo.ListPage;
|
||||||
import ink.wgink.pojo.dtos.position.PositionUserDTO;
|
import ink.wgink.pojo.dtos.position.PositionUserDTO;
|
||||||
@ -89,4 +90,50 @@ public class PositionUserResourceController extends DefaultBaseController {
|
|||||||
return positionUserService.listPositionPOByUserIds(idsVO.getIds());
|
return positionUserService.listPositionPOByUserIds(idsVO.getIds());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ApiOperation(value = "用户ID列表", notes = "通过职位ID和用户ID列表获取用户ID列表")
|
||||||
|
@ApiImplicitParams({
|
||||||
|
@ApiImplicitParam(name = "roleId", value = "角色ID", paramType = "path", dataType = "String"),
|
||||||
|
})
|
||||||
|
@ApiResponses({@ApiResponse(code = 400, message = "请求失败", response = ErrorResult.class)})
|
||||||
|
@PostMapping("list-user-id/position-id/{positionId}/user-ids")
|
||||||
|
public List<String> listUserIdByPositionIdAndUserIds(@PathVariable("positionId") String positionId, @RequestBody IdsVO idsVO) {
|
||||||
|
if (idsVO.getIds().isEmpty()) {
|
||||||
|
throw new ParamsException("id列表不能为空");
|
||||||
|
}
|
||||||
|
return positionUserService.listUserIdByPositionIdAndUserIds(positionId, idsVO.getIds());
|
||||||
|
}
|
||||||
|
|
||||||
|
@ApiOperation(value = "用户ID列表", notes = "通过职位ID列表和用户ID列表获取用户ID列表")
|
||||||
|
@ApiResponses({@ApiResponse(code = 400, message = "请求失败", response = ErrorResult.class)})
|
||||||
|
@PostMapping("list-user-id/position-ids/user-ids")
|
||||||
|
public List<String> listUserIdByPositionIdAndUserIds(@RequestBody IdsVO idsVO) {
|
||||||
|
if (idsVO.getIds().isEmpty()) {
|
||||||
|
throw new ParamsException("id列表不能为空");
|
||||||
|
}
|
||||||
|
if (idsVO.getIds2().isEmpty()) {
|
||||||
|
throw new ParamsException("id2列表不能为空");
|
||||||
|
}
|
||||||
|
return positionUserService.listUserIdByPositionIdsAndUserIds(idsVO.getIds(), idsVO.getIds2());
|
||||||
|
}
|
||||||
|
|
||||||
|
@ApiOperation(value = "职位ID列表", notes = "通过用户ID获取职位ID列表接口")
|
||||||
|
@ApiImplicitParams({
|
||||||
|
@ApiImplicitParam(name = "userId", value = "用户ID", paramType = "path", dataType = "String"),
|
||||||
|
})
|
||||||
|
@ApiResponses({@ApiResponse(code = 400, message = "请求失败", response = ErrorResult.class)})
|
||||||
|
@GetMapping("list-position-id/user-id/{userId}")
|
||||||
|
public List<String> listPositionIdByUserId(@PathVariable("userId") String userId) {
|
||||||
|
return positionUserService.listPositionIdByUserId(userId);
|
||||||
|
}
|
||||||
|
|
||||||
|
@ApiOperation(value = "职位ID列表", notes = "通过用户ID列表获取职位ID列表")
|
||||||
|
@ApiResponses({@ApiResponse(code = 400, message = "请求失败", response = ErrorResult.class)})
|
||||||
|
@PostMapping("list-position-id/user-ids")
|
||||||
|
public List<String> listPositionIdByUserIds(@RequestBody IdsVO idsVO) {
|
||||||
|
if (idsVO.getIds().isEmpty()) {
|
||||||
|
throw new ParamsException("id列表不能为空");
|
||||||
|
}
|
||||||
|
return positionUserService.listPositionIdByUserIds(idsVO.getIds());
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -109,4 +109,22 @@ public interface IPositionDao extends IInitBaseTable {
|
|||||||
* @throws SearchException
|
* @throws SearchException
|
||||||
*/
|
*/
|
||||||
List<PositionPO> listPO(Map<String, Object> params) throws SearchException;
|
List<PositionPO> listPO(Map<String, Object> params) throws SearchException;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 上级职位
|
||||||
|
*
|
||||||
|
* @param params
|
||||||
|
* @return
|
||||||
|
* @throws SearchException
|
||||||
|
*/
|
||||||
|
PositionDTO getParent(Map<String, Object> params) throws SearchException;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 上级职位列表
|
||||||
|
*
|
||||||
|
* @param params
|
||||||
|
* @return
|
||||||
|
* @throws SearchException
|
||||||
|
*/
|
||||||
|
List<PositionDTO> listParent(Map<String, Object> params) throws SearchException;
|
||||||
}
|
}
|
||||||
|
@ -4,16 +4,17 @@ import com.github.pagehelper.PageHelper;
|
|||||||
import com.github.pagehelper.PageInfo;
|
import com.github.pagehelper.PageInfo;
|
||||||
import ink.wgink.common.base.DefaultBaseService;
|
import ink.wgink.common.base.DefaultBaseService;
|
||||||
import ink.wgink.interfaces.consts.ISystemConstant;
|
import ink.wgink.interfaces.consts.ISystemConstant;
|
||||||
import ink.wgink.pojo.pos.PositionPO;
|
|
||||||
import ink.wgink.service.position.pojo.vos.PositionVO;
|
|
||||||
import ink.wgink.pojo.ListPage;
|
import ink.wgink.pojo.ListPage;
|
||||||
import ink.wgink.pojo.dtos.ZTreeDTO;
|
import ink.wgink.pojo.dtos.ZTreeDTO;
|
||||||
import ink.wgink.pojo.dtos.position.PositionDTO;
|
import ink.wgink.pojo.dtos.position.PositionDTO;
|
||||||
|
import ink.wgink.pojo.pos.PositionPO;
|
||||||
import ink.wgink.pojo.result.SuccessResultList;
|
import ink.wgink.pojo.result.SuccessResultList;
|
||||||
import ink.wgink.service.position.dao.IPositionDao;
|
import ink.wgink.service.position.dao.IPositionDao;
|
||||||
|
import ink.wgink.service.position.pojo.vos.PositionVO;
|
||||||
import ink.wgink.service.position.service.IPositionService;
|
import ink.wgink.service.position.service.IPositionService;
|
||||||
import ink.wgink.util.UUIDUtil;
|
import ink.wgink.util.UUIDUtil;
|
||||||
import ink.wgink.util.map.HashMapUtil;
|
import ink.wgink.util.map.HashMapUtil;
|
||||||
|
import org.apache.commons.lang3.StringUtils;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
@ -141,6 +142,26 @@ public class PositionServiceImpl extends DefaultBaseService implements IPosition
|
|||||||
return count == null ? 0 : count;
|
return count == null ? 0 : count;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public PositionDTO getParentByPositionId(String positionId) {
|
||||||
|
if (StringUtils.isBlank(positionId)) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
Map<String, Object> params = getHashMap(2);
|
||||||
|
params.put("positionId", positionId);
|
||||||
|
return positionDao.getParent(params);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public List<PositionDTO> listParentByPositionIds(List<String> positionIds) {
|
||||||
|
if (positionIds == null || positionIds.isEmpty()) {
|
||||||
|
return new ArrayList<>();
|
||||||
|
}
|
||||||
|
Map<String, Object> params = getHashMap(2);
|
||||||
|
params.put("positionIds", positionIds);
|
||||||
|
return positionDao.listParent(params);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 递归查询子组
|
* 递归查询子组
|
||||||
*
|
*
|
||||||
|
@ -78,6 +78,36 @@ public class PositionUserServiceImpl extends DefaultBaseService implements IPosi
|
|||||||
return positionUserDao.listUserId(params);
|
return positionUserDao.listUserId(params);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public List<String> listUserIdByPositionIdAndUserIds(String positionId, List<String> userIds) {
|
||||||
|
Map<String, Object> params = getHashMap(4);
|
||||||
|
params.put("positionId", positionId);
|
||||||
|
params.put("userIds", userIds);
|
||||||
|
return positionUserDao.listUserId(params);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public List<String> listUserIdByPositionIdsAndUserIds(List<String> positionIds, List<String> userIds) {
|
||||||
|
Map<String, Object> params = getHashMap(4);
|
||||||
|
params.put("positionIds", positionIds);
|
||||||
|
params.put("userIds", userIds);
|
||||||
|
return positionUserDao.listUserId(params);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public List<String> listPositionIdByUserId(String userId) {
|
||||||
|
Map<String, Object> params = getHashMap(2);
|
||||||
|
params.put("userId", userId);
|
||||||
|
return positionUserDao.listPositionId(params);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public List<String> listPositionIdByUserIds(List<String> userIds) {
|
||||||
|
Map<String, Object> params = getHashMap(2);
|
||||||
|
params.put("userIds", userIds);
|
||||||
|
return positionUserDao.listPositionId(params);
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public SuccessResultList<List<PositionUserDTO>> listPage(String positionId, ListPage page) {
|
public SuccessResultList<List<PositionUserDTO>> listPage(String positionId, ListPage page) {
|
||||||
SuccessResultList<List<UserDTO>> successResultList;
|
SuccessResultList<List<UserDTO>> successResultList;
|
||||||
|
@ -256,4 +256,56 @@
|
|||||||
</if>
|
</if>
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
|
<!-- 上级职位 -->
|
||||||
|
<select id="getParent" parameterType="map" resultMap="positionDTO" useCache="true">
|
||||||
|
SELECT
|
||||||
|
*
|
||||||
|
FROM
|
||||||
|
sys_position t1
|
||||||
|
WHERE
|
||||||
|
t1.is_delete = 0
|
||||||
|
<if test="positionId != null and positionId != ''">
|
||||||
|
AND
|
||||||
|
t1.position_id = (
|
||||||
|
SELECT
|
||||||
|
st1.position_parent_id
|
||||||
|
FROM
|
||||||
|
sys_position st1
|
||||||
|
WHERE
|
||||||
|
st1.is_delete = 0
|
||||||
|
AND
|
||||||
|
st1.position_id = #{positionId}
|
||||||
|
AND
|
||||||
|
st1.position_parent_id != '0'
|
||||||
|
)
|
||||||
|
</if>
|
||||||
|
</select>
|
||||||
|
|
||||||
|
<select id="listParent" parameterType="map" resultMap="positionDTO" useCache="true">
|
||||||
|
SELECT
|
||||||
|
*
|
||||||
|
FROM
|
||||||
|
sys_position t1
|
||||||
|
WHERE
|
||||||
|
t1.is_delete = 0
|
||||||
|
<if test="positionIds != null and positionIds.size > 0">
|
||||||
|
AND
|
||||||
|
t1.position_id IN (
|
||||||
|
SELECT
|
||||||
|
st1.position_parent_id
|
||||||
|
FROM
|
||||||
|
sys_position st1
|
||||||
|
WHERE
|
||||||
|
st1.is_delete = 0
|
||||||
|
AND
|
||||||
|
st1.position_id IN
|
||||||
|
<foreach collection="positionIds" index="index" open="(" separator="," close=")">
|
||||||
|
#{positionIds[${index}]}
|
||||||
|
</foreach>
|
||||||
|
AND
|
||||||
|
st1.position_parent_id != '0'
|
||||||
|
)
|
||||||
|
</if>
|
||||||
|
</select>
|
||||||
|
|
||||||
</mapper>
|
</mapper>
|
@ -56,17 +56,25 @@
|
|||||||
user_id
|
user_id
|
||||||
FROM
|
FROM
|
||||||
sys_position_user
|
sys_position_user
|
||||||
WHERE
|
<where>
|
||||||
<if test="positionId != null and positionId != ''">
|
<if test="positionId != null and positionId != ''">
|
||||||
position_id = #{positionId}
|
position_id = #{positionId}
|
||||||
</if>
|
</if>
|
||||||
<if test="positionIds != null and positionIds.size > 0">
|
<if test="positionIds != null and positionIds.size > 0">
|
||||||
|
AND
|
||||||
position_id IN (
|
position_id IN (
|
||||||
<foreach collection="positionIds" index="index" open="(" separator="," close=")">
|
<foreach collection="positionIds" index="index" open="(" separator="," close=")">
|
||||||
#{positionIds[${index}]}
|
#{positionIds[${index}]}
|
||||||
</foreach>
|
</foreach>
|
||||||
)
|
)
|
||||||
</if>
|
</if>
|
||||||
|
<if test="userIds != null and userIds.size > 0">
|
||||||
|
AND
|
||||||
|
user_id IN
|
||||||
|
<foreach collection="userIds" index="index" open="(" separator="," close=")">
|
||||||
|
#{userIds[${index}]}
|
||||||
|
</foreach>
|
||||||
|
</if>
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
<!-- 用户ID列表 -->
|
<!-- 用户ID列表 -->
|
||||||
|
@ -81,19 +81,32 @@ public class RoleUserResourceController extends DefaultBaseController {
|
|||||||
return roleUserService.listRolePOByUserId(userId);
|
return roleUserService.listRolePOByUserId(userId);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ApiOperation(value = "用户ID列表", notes = "通过角色和用户ID列表获取用户ID列表")
|
@ApiOperation(value = "用户ID列表", notes = "通过角色ID和用户ID列表获取用户ID列表")
|
||||||
@ApiImplicitParams({
|
@ApiImplicitParams({
|
||||||
@ApiImplicitParam(name = "roleId", value = "角色ID", paramType = "path", dataType = "String"),
|
@ApiImplicitParam(name = "roleId", value = "角色ID", paramType = "path", dataType = "String"),
|
||||||
})
|
})
|
||||||
@ApiResponses({@ApiResponse(code = 400, message = "请求失败", response = ErrorResult.class)})
|
@ApiResponses({@ApiResponse(code = 400, message = "请求失败", response = ErrorResult.class)})
|
||||||
@PostMapping("list-user-id/role-id/{roleId}/user-ids")
|
@PostMapping("list-user-id/role-id/{roleId}/user-ids")
|
||||||
public List<String> listUserIdByRoleIdAndUserIds(@PathVariable("userId") String roleId, @RequestBody IdsVO idsVO) {
|
public List<String> listUserIdByRoleIdAndUserIds(@PathVariable("roleId") String roleId, @RequestBody IdsVO idsVO) {
|
||||||
if (idsVO.getIds().isEmpty()) {
|
if (idsVO.getIds().isEmpty()) {
|
||||||
throw new ParamsException("id列表不能为空");
|
throw new ParamsException("id列表不能为空");
|
||||||
}
|
}
|
||||||
return roleUserService.listUserIdByRoleIdAndUserIds(roleId, idsVO.getIds());
|
return roleUserService.listUserIdByRoleIdAndUserIds(roleId, idsVO.getIds());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ApiOperation(value = "用户ID列表", notes = "通过角色ID列表和用户ID列表获取用户ID列表")
|
||||||
|
@ApiResponses({@ApiResponse(code = 400, message = "请求失败", response = ErrorResult.class)})
|
||||||
|
@PostMapping("list-user-id/role-ids/user-ids")
|
||||||
|
public List<String> listUserIdByRoleIdAndUserIds(@RequestBody IdsVO idsVO) {
|
||||||
|
if (idsVO.getIds().isEmpty()) {
|
||||||
|
throw new ParamsException("id列表不能为空");
|
||||||
|
}
|
||||||
|
if (idsVO.getIds2().isEmpty()) {
|
||||||
|
throw new ParamsException("id2列表不能为空");
|
||||||
|
}
|
||||||
|
return roleUserService.listUserIdByRoleIdsAndUserIds(idsVO.getIds(), idsVO.getIds2());
|
||||||
|
}
|
||||||
|
|
||||||
@ApiOperation(value = "角色ID列表", notes = "通过用户ID列表获取角色ID列表")
|
@ApiOperation(value = "角色ID列表", notes = "通过用户ID列表获取角色ID列表")
|
||||||
@ApiImplicitParams({
|
@ApiImplicitParams({
|
||||||
@ApiImplicitParam(name = "userId", value = "用户ID", paramType = "path", dataType = "String"),
|
@ApiImplicitParam(name = "userId", value = "用户ID", paramType = "path", dataType = "String"),
|
||||||
|
@ -201,6 +201,20 @@ public class RoleUserServiceImpl extends DefaultBaseService implements IRoleUser
|
|||||||
return roleUserDao.listUserId(params);
|
return roleUserDao.listUserId(params);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public List<String> listUserIdByRoleIdsAndUserIds(List<String> roleIds, List<String> userIds) {
|
||||||
|
if (roleIds == null || roleIds.isEmpty()) {
|
||||||
|
return new ArrayList<>();
|
||||||
|
}
|
||||||
|
if (userIds == null || userIds.isEmpty()) {
|
||||||
|
return new ArrayList<>();
|
||||||
|
}
|
||||||
|
Map<String, Object> params = getHashMap(4);
|
||||||
|
params.put("roleIds", roleIds);
|
||||||
|
params.put("userIds", userIds);
|
||||||
|
return roleUserDao.listUserId(params);
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public List<String> listRoleIdByUserId(String userId) {
|
public List<String> listRoleIdByUserId(String userId) {
|
||||||
Map<String, Object> params = getHashMap(2);
|
Map<String, Object> params = getHashMap(2);
|
||||||
|
Loading…
Reference in New Issue
Block a user