Commit cfcd372d authored by chenyuxi's avatar chenyuxi

feat: 权限相关接口

parent 311670c8
......@@ -57,7 +57,7 @@ public class SysUserDeptPermission extends Model<SysUserDeptPermission> {
@Schema(description = "关联项目名称")
private String projectName;
@Schema(description = "归属系统 0 mvp 1 甲方客户端")
@Schema(description = "归属系统 yifu-mvp、yifu-csp")
private String client;
@NotBlank(message = "账号类型 不能为空")
......
......@@ -50,6 +50,23 @@ public class UserDeptPermissionController {
private final SysUserDeptPermissionService sysUserDeptPermissionService;
/**
* 客户服务平台——获取用户权限
* @param sysUserDeptPermission 实体
* @return success/false
*/
@SysLog("客户服务平台——用户权限控制")
@PostMapping("/info")
public R<SysUserDeptPermission> getInfo(@RequestBody SysUserDeptPermission sysUserDeptPermission) {
if(Common.isEmpty(sysUserDeptPermission.getProjectNo())){
R.failed("项目编码不能为空");
}
if(Common.isEmpty(sysUserDeptPermission.getUserId())){
R.failed("用户ID不能为空");
}
return R.ok(sysUserDeptPermissionService.getInfo(sysUserDeptPermission.getProjectNo(),sysUserDeptPermission.getUserId()));
}
/**
* 客户服务平台——用户权限控制
* @param sysUserDeptPermission 实体
......@@ -86,6 +103,9 @@ public class UserDeptPermissionController {
if(Common.isEmpty(sysUserDeptPermission.getProjectNo())){
R.failed("项目编码不能为空");
}
if(Common.isEmpty(sysUserDeptPermission.getProjectName())){
R.failed("项目名称不能为空");
}
if(Common.isEmpty(sysUserDeptPermission.getUserId())){
R.failed("用户ID不能为空");
}
......
......@@ -34,6 +34,16 @@ import java.util.Map;
*/
public interface SysUserDeptPermissionService extends IService<SysUserDeptPermission> {
/**
* 项目下用户数据权限
* @param projectNo 项目编号
* @param userId 用户ID
*
* @return UserPermissionVo 用户在指定项目下的权限
*/
SysUserDeptPermission getInfo(String projectNo, String userId);
/**
* 项目下用户数据权限
* @param projectNo 项目编号
......
......@@ -63,6 +63,15 @@ public class SysUserDeptPermissionServiceImpl extends ServiceImpl<SysUserDeptPer
private static final PasswordEncoder ENCODER = new BCryptPasswordEncoder();
@Override
public SysUserDeptPermission getInfo(String projectNo, String userId) {
LambdaQueryWrapper<SysUserDeptPermission> permissionQuery = Wrappers.<SysUserDeptPermission>lambdaQuery()
.eq(SysUserDeptPermission::getUserId, userId)
.eq(SysUserDeptPermission::getProjectNo, projectNo)
.last(" limit 1 ");
return baseMapper.selectOne(permissionQuery);
}
@Override
public UserPermissionVo getUserPermissionVo(String projectNo, String userId) {
UserPermissionVo authority = new UserPermissionVo();
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment