add 查看授权列表
This commit is contained in:
parent
aec0e22747
commit
98aa0b9f18
@ -25,7 +25,6 @@ import org.dromara.common.social.utils.SocialUtils;
|
|||||||
import org.dromara.common.tenant.helper.TenantHelper;
|
import org.dromara.common.tenant.helper.TenantHelper;
|
||||||
import org.dromara.system.domain.bo.SysTenantBo;
|
import org.dromara.system.domain.bo.SysTenantBo;
|
||||||
import org.dromara.system.domain.vo.SysTenantVo;
|
import org.dromara.system.domain.vo.SysTenantVo;
|
||||||
import org.dromara.system.domain.vo.SysUserVo;
|
|
||||||
import org.dromara.system.service.ISocialUserService;
|
import org.dromara.system.service.ISocialUserService;
|
||||||
import org.dromara.system.service.ISysConfigService;
|
import org.dromara.system.service.ISysConfigService;
|
||||||
import org.dromara.system.service.ISysTenantService;
|
import org.dromara.system.service.ISysTenantService;
|
||||||
@ -139,14 +138,6 @@ public class AuthController {
|
|||||||
@GetMapping("/binding/{source}")
|
@GetMapping("/binding/{source}")
|
||||||
@ResponseBody
|
@ResponseBody
|
||||||
public R<LoginVo> authBinding(@PathVariable("source") String source, HttpServletRequest request){
|
public R<LoginVo> authBinding(@PathVariable("source") String source, HttpServletRequest request){
|
||||||
SysUserVo userLoding = new SysUserVo();
|
|
||||||
if (ObjectUtil.isNull(userLoding)) {
|
|
||||||
return R.fail("授权失败,请先登录再绑定");
|
|
||||||
}
|
|
||||||
if (socialUserService.isExistByUserIdAndSource(userLoding.getUserId(),source))
|
|
||||||
{
|
|
||||||
return R.fail(source + "平台账号已经被账号绑定");
|
|
||||||
}
|
|
||||||
SocialLoginConfigProperties obj = socialProperties.getType().get(source);
|
SocialLoginConfigProperties obj = socialProperties.getType().get(source);
|
||||||
if (ObjectUtil.isNull(obj)){
|
if (ObjectUtil.isNull(obj)){
|
||||||
return R.fail(source + "平台账号暂不支持");
|
return R.fail(source + "平台账号暂不支持");
|
||||||
@ -193,9 +184,6 @@ public class AuthController {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 退出登录
|
* 退出登录
|
||||||
*/
|
*/
|
||||||
|
@ -34,11 +34,9 @@ import org.dromara.common.tenant.helper.TenantHelper;
|
|||||||
import org.dromara.common.web.config.properties.CaptchaProperties;
|
import org.dromara.common.web.config.properties.CaptchaProperties;
|
||||||
import org.dromara.system.domain.SysUser;
|
import org.dromara.system.domain.SysUser;
|
||||||
import org.dromara.system.domain.bo.SocialUserBo;
|
import org.dromara.system.domain.bo.SocialUserBo;
|
||||||
import org.dromara.system.domain.bo.SysUserBo;
|
|
||||||
import org.dromara.system.domain.vo.SocialUserVo;
|
import org.dromara.system.domain.vo.SocialUserVo;
|
||||||
import org.dromara.system.domain.vo.SysTenantVo;
|
import org.dromara.system.domain.vo.SysTenantVo;
|
||||||
import org.dromara.system.domain.vo.SysUserVo;
|
import org.dromara.system.domain.vo.SysUserVo;
|
||||||
import org.dromara.system.mapper.SocialUserMapper;
|
|
||||||
import org.dromara.system.mapper.SysUserMapper;
|
import org.dromara.system.mapper.SysUserMapper;
|
||||||
import org.dromara.system.service.ISocialUserService;
|
import org.dromara.system.service.ISocialUserService;
|
||||||
import org.dromara.system.service.ISysPermissionService;
|
import org.dromara.system.service.ISysPermissionService;
|
||||||
@ -66,7 +64,6 @@ public class SysLoginService {
|
|||||||
|
|
||||||
private final SysUserMapper userMapper;
|
private final SysUserMapper userMapper;
|
||||||
private final ISocialUserService socialUserService;
|
private final ISocialUserService socialUserService;
|
||||||
private final ISysUserService userService;
|
|
||||||
private final CaptchaProperties captchaProperties;
|
private final CaptchaProperties captchaProperties;
|
||||||
private final ISysPermissionService permissionService;
|
private final ISysPermissionService permissionService;
|
||||||
private final ISysTenantService tenantService;
|
private final ISysTenantService tenantService;
|
||||||
@ -176,22 +173,20 @@ public class SysLoginService {
|
|||||||
* @param request Http请求对象
|
* @param request Http请求对象
|
||||||
* @return 统一响应实体
|
* @return 统一响应实体
|
||||||
*/
|
*/
|
||||||
public R<String> socialLogin(String source, AuthResponse<AuthUser> authUser, HttpServletRequest request) throws IOException {
|
public R<String> socialLogin(String source, AuthResponse<AuthUser> authUser, HttpServletRequest request) {
|
||||||
// 判断授权响应是否成功
|
// 判断授权响应是否成功
|
||||||
if (!authUser.ok()) {
|
if (!authUser.ok()) {
|
||||||
return R.fail("对不起,授权信息验证不通过,请退出重试!");
|
return R.fail("对不起,授权信息验证不通过,请退出重试!");
|
||||||
}
|
}
|
||||||
AuthUser authUserData = authUser.getData();
|
AuthUser authUserData = authUser.getData();
|
||||||
String authId = source + authUserData.getUuid();
|
SocialUserVo user = socialUserService.selectSocialUserByAuthId(authUserData.getSource() + authUserData.getUuid());
|
||||||
|
|
||||||
SocialUserVo user = socialUserService.selectSocialUserByAuthId(authId);
|
|
||||||
if (ObjectUtil.isNotNull(user)) {
|
if (ObjectUtil.isNotNull(user)) {
|
||||||
//执行登录和记录登录信息操作
|
//执行登录和记录登录信息操作
|
||||||
return loginAndRecord(user.getTenantId(), user.getUserName(), authUserData);
|
return loginAndRecord(user.getTenantId(), user.getUserName(), authUserData);
|
||||||
} else {
|
} else {
|
||||||
// 判断是否已登录
|
// 判断是否已登录
|
||||||
if (LoginHelper.getUserId() == null) {
|
if (LoginHelper.getUserId() == null) {
|
||||||
return R.fail("授权失败,请先登录再绑定");
|
return R.fail("授权失败,请先登录才能绑定");
|
||||||
}
|
}
|
||||||
SocialUserBo socialUserBo = new SocialUserBo();
|
SocialUserBo socialUserBo = new SocialUserBo();
|
||||||
socialUserBo.setUserId(LoginHelper.getUserId());
|
socialUserBo.setUserId(LoginHelper.getUserId());
|
||||||
@ -201,7 +196,6 @@ public class SysLoginService {
|
|||||||
socialUserBo.setNickName(authUserData.getNickname());
|
socialUserBo.setNickName(authUserData.getNickname());
|
||||||
socialUserBo.setAvatar(authUserData.getAvatar());
|
socialUserBo.setAvatar(authUserData.getAvatar());
|
||||||
socialUserBo.setOpenId(authUserData.getUuid());
|
socialUserBo.setOpenId(authUserData.getUuid());
|
||||||
BeanUtils.copyProperties(authUserData, socialUserBo);
|
|
||||||
BeanUtils.copyProperties(authUserData.getToken(), socialUserBo);
|
BeanUtils.copyProperties(authUserData.getToken(), socialUserBo);
|
||||||
|
|
||||||
socialUserService.insertByBo(socialUserBo);
|
socialUserService.insertByBo(socialUserBo);
|
||||||
|
@ -184,3 +184,152 @@ sms:
|
|||||||
sdkAppId: appid
|
sdkAppId: appid
|
||||||
#地域信息默认为 ap-guangzhou 如无特殊改变可不用设置
|
#地域信息默认为 ap-guangzhou 如无特殊改变可不用设置
|
||||||
territory: ap-guangzhou
|
territory: ap-guangzhou
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
justauth:
|
||||||
|
enabled: true
|
||||||
|
type:
|
||||||
|
QQ:
|
||||||
|
client-id: 10**********6
|
||||||
|
client-secret: 1f7d08**********5b7**********29e
|
||||||
|
redirect-uri: http://oauth.xkcoding.com/demo/oauth/qq/callback
|
||||||
|
union-id: false
|
||||||
|
WEIBO:
|
||||||
|
client-id: 10**********6
|
||||||
|
client-secret: 1f7d08**********5b7**********29e
|
||||||
|
redirect-uri: http://oauth.xkcoding.com/demo/oauth/weibo/callback
|
||||||
|
gitee:
|
||||||
|
client-id: 38eaaa1b77b5e064313057a2f5745ce3a9f3e7686d9bd302c7df2f308ef6db81
|
||||||
|
client-secret: 2e633af8780cb9fe002c4c7291b722db944402e271efb99b062811f52d7da1ff
|
||||||
|
redirect-uri: http://localhost:80/social-login?source=gitee
|
||||||
|
DINGTALK:
|
||||||
|
client-id: 10**********6
|
||||||
|
client-secret: 1f7d08**********5b7**********29e
|
||||||
|
redirect-uri: http://oauth.xkcoding.com/demo/oauth/dingtalk/callback
|
||||||
|
BAIDU:
|
||||||
|
client-id: 10**********6
|
||||||
|
client-secret: 1f7d08**********5b7**********29e
|
||||||
|
redirect-uri: http://oauth.xkcoding.com/demo/oauth/baidu/callback
|
||||||
|
CSDN:
|
||||||
|
client-id: 10**********6
|
||||||
|
client-secret: 1f7d08**********5b7**********29e
|
||||||
|
redirect-uri: http://oauth.xkcoding.com/demo/oauth/csdn/callback
|
||||||
|
CODING:
|
||||||
|
client-id: 10**********6
|
||||||
|
client-secret: 1f7d08**********5b7**********29e
|
||||||
|
redirect-uri: http://oauth.xkcoding.com/demo/oauth/coding/callback
|
||||||
|
coding-group-name: xx
|
||||||
|
OSCHINA:
|
||||||
|
client-id: 10**********6
|
||||||
|
client-secret: 1f7d08**********5b7**********29e
|
||||||
|
redirect-uri: http://oauth.xkcoding.com/demo/oauth/oschina/callback
|
||||||
|
ALIPAY:
|
||||||
|
client-id: 10**********6
|
||||||
|
client-secret: 1f7d08**********5b7**********29e
|
||||||
|
redirect-uri: http://oauth.xkcoding.com/demo/oauth/alipay/callback
|
||||||
|
alipay-public-key: MIIB**************DAQAB
|
||||||
|
WECHAT_OPEN:
|
||||||
|
client-id: 10**********6
|
||||||
|
client-secret: 1f7d08**********5b7**********29e
|
||||||
|
redirect-uri: http://oauth.xkcoding.com/demo/oauth/wechat_open/callback
|
||||||
|
WECHAT_MP:
|
||||||
|
client-id: 10**********6
|
||||||
|
client-secret: 1f7d08**********5b7**********29e
|
||||||
|
redirect-uri: http://oauth.xkcoding.com/demo/oauth/wechat_mp/callback
|
||||||
|
WECHAT_ENTERPRISE:
|
||||||
|
client-id: 10**********6
|
||||||
|
client-secret: 1f7d08**********5b7**********29e
|
||||||
|
redirect-uri: http://oauth.xkcoding.com/demo/oauth/wechat_enterprise/callback
|
||||||
|
agent-id: 1000002
|
||||||
|
TAOBAO:
|
||||||
|
client-id: 10**********6
|
||||||
|
client-secret: 1f7d08**********5b7**********29e
|
||||||
|
redirect-uri: http://oauth.xkcoding.com/demo/oauth/taobao/callback
|
||||||
|
GOOGLE:
|
||||||
|
client-id: 10**********6
|
||||||
|
client-secret: 1f7d08**********5b7**********29e
|
||||||
|
redirect-uri: http://oauth.xkcoding.com/demo/oauth/google/callback
|
||||||
|
FACEBOOK:
|
||||||
|
client-id: 10**********6
|
||||||
|
client-secret: 1f7d08**********5b7**********29e
|
||||||
|
redirect-uri: http://oauth.xkcoding.com/demo/oauth/facebook/callback
|
||||||
|
DOUYIN:
|
||||||
|
client-id: 10**********6
|
||||||
|
client-secret: 1f7d08**********5b7**********29e
|
||||||
|
redirect-uri: http://oauth.xkcoding.com/demo/oauth/douyin/callback
|
||||||
|
LINKEDIN:
|
||||||
|
client-id: 10**********6
|
||||||
|
client-secret: 1f7d08**********5b7**********29e
|
||||||
|
redirect-uri: http://oauth.xkcoding.com/demo/oauth/linkedin/callback
|
||||||
|
MICROSOFT:
|
||||||
|
client-id: 10**********6
|
||||||
|
client-secret: 1f7d08**********5b7**********29e
|
||||||
|
redirect-uri: http://oauth.xkcoding.com/demo/oauth/microsoft/callback
|
||||||
|
MI:
|
||||||
|
client-id: 10**********6
|
||||||
|
client-secret: 1f7d08**********5b7**********29e
|
||||||
|
redirect-uri: http://oauth.xkcoding.com/demo/oauth/mi/callback
|
||||||
|
TOUTIAO:
|
||||||
|
client-id: 10**********6
|
||||||
|
client-secret: 1f7d08**********5b7**********29e
|
||||||
|
redirect-uri: http://oauth.xkcoding.com/demo/oauth/toutiao/callback
|
||||||
|
TEAMBITION:
|
||||||
|
client-id: 10**********6
|
||||||
|
client-secret: 1f7d08**********5b7**********29e
|
||||||
|
redirect-uri: http://oauth.xkcoding.com/demo/oauth/teambition/callback
|
||||||
|
RENREN:
|
||||||
|
client-id: 10**********6
|
||||||
|
client-secret: 1f7d08**********5b7**********29e
|
||||||
|
redirect-uri: http://oauth.xkcoding.com/demo/oauth/renren/callback
|
||||||
|
PINTEREST:
|
||||||
|
client-id: 10**********6
|
||||||
|
client-secret: 1f7d08**********5b7**********29e
|
||||||
|
redirect-uri: http://oauth.xkcoding.com/demo/oauth/pinterest/callback
|
||||||
|
STACK_OVERFLOW:
|
||||||
|
client-id: 10**********6
|
||||||
|
client-secret: 1f7d08**********5b7**********29e
|
||||||
|
redirect-uri: http://oauth.xkcoding.com/demo/oauth/stack_overflow/callback
|
||||||
|
stack-overflow-key: asd*********asd
|
||||||
|
HUAWEI:
|
||||||
|
client-id: 10**********6
|
||||||
|
client-secret: 1f7d08**********5b7**********29e
|
||||||
|
redirect-uri: http://oauth.xkcoding.com/demo/oauth/huawei/callback
|
||||||
|
KUJIALE:
|
||||||
|
client-id: 10**********6
|
||||||
|
client-secret: 1f7d08**********5b7**********29e
|
||||||
|
redirect-uri: http://oauth.xkcoding.com/demo/oauth/kujiale/callback
|
||||||
|
GITLAB:
|
||||||
|
client-id: 10**********6
|
||||||
|
client-secret: 1f7d08**********5b7**********29e
|
||||||
|
redirect-uri: http://oauth.xkcoding.com/demo/oauth/gitlab/callback
|
||||||
|
MEITUAN:
|
||||||
|
client-id: 10**********6
|
||||||
|
client-secret: 1f7d08**********5b7**********29e
|
||||||
|
redirect-uri: http://oauth.xkcoding.com/demo/oauth/meituan/callback
|
||||||
|
ELEME:
|
||||||
|
client-id: 10**********6
|
||||||
|
client-secret: 1f7d08**********5b7**********29e
|
||||||
|
redirect-uri: http://oauth.xkcoding.com/demo/oauth/eleme/callback
|
||||||
|
TWITTER:
|
||||||
|
client-id: 10**********6
|
||||||
|
client-secret: 1f7d08**********5b7**********29e
|
||||||
|
redirect-uri: http://oauth.xkcoding.com/demo/oauth/twitter/callback
|
||||||
|
XMLY:
|
||||||
|
client-id: 10**********6
|
||||||
|
client-secret: 1f7d08**********5b7**********29e
|
||||||
|
redirect-uri: http://oauth.xkcoding.com/demo/oauth/xmly/callback
|
||||||
|
# 设备唯一标识ID
|
||||||
|
device-id: xxxxxxxxxxxxxx
|
||||||
|
# 客户端操作系统类型,1-iOS系统,2-Android系统,3-Web
|
||||||
|
client-os-type: 3
|
||||||
|
# 客户端包名,如果 clientOsType 为1或2时必填。对Android客户端是包名,对IOS客户端是Bundle ID
|
||||||
|
#pack-id: xxxx
|
||||||
|
FEISHU:
|
||||||
|
client-id: 10**********6
|
||||||
|
client-secret: 1f7d08**********5b7**********29e
|
||||||
|
redirect-uri: http://oauth.xkcoding.com/demo/oauth/feishu/callback
|
||||||
|
JD:
|
||||||
|
client-id: 10**********6
|
||||||
|
client-secret: 1f7d08**********5b7**********29e
|
||||||
|
redirect-uri: http://oauth.xkcoding.com/demo/oauth/jd/callback
|
||||||
|
@ -0,0 +1,57 @@
|
|||||||
|
package org.dromara.system.controller.system;
|
||||||
|
|
||||||
|
import jakarta.validation.constraints.NotNull;
|
||||||
|
import lombok.RequiredArgsConstructor;
|
||||||
|
import org.dromara.common.core.domain.R;
|
||||||
|
import org.dromara.common.web.core.BaseController;
|
||||||
|
import org.dromara.system.domain.vo.SocialUserVo;
|
||||||
|
import org.dromara.system.service.ISocialUserService;
|
||||||
|
import org.springframework.validation.annotation.Validated;
|
||||||
|
import org.springframework.web.bind.annotation.GetMapping;
|
||||||
|
import org.springframework.web.bind.annotation.PathVariable;
|
||||||
|
import org.springframework.web.bind.annotation.RequestMapping;
|
||||||
|
import org.springframework.web.bind.annotation.RestController;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 社会化关系
|
||||||
|
*
|
||||||
|
* @author thiszhc
|
||||||
|
* @date 2023-06-16
|
||||||
|
*/
|
||||||
|
@Validated
|
||||||
|
@RequiredArgsConstructor
|
||||||
|
@RestController
|
||||||
|
@RequestMapping("/system/social")
|
||||||
|
public class SocialUserController extends BaseController {
|
||||||
|
|
||||||
|
private final ISocialUserService socialUserService;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询社会化关系列表
|
||||||
|
*/
|
||||||
|
// 这里改成用户默认的。只能查看自己的权限更好哦
|
||||||
|
// @SaCheckPermission("system:user:list")
|
||||||
|
@GetMapping("/list")
|
||||||
|
public R<List<SocialUserVo>> list() {
|
||||||
|
return R.ok(socialUserService.queryList());
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取社会化关系详细信息
|
||||||
|
*
|
||||||
|
* @param id 主键
|
||||||
|
*/
|
||||||
|
// 这里改成用户默认的。只能查看自己的权限更好哦
|
||||||
|
// @SaCheckPermission("system:user:query")
|
||||||
|
@GetMapping("/{id}")
|
||||||
|
public R<SocialUserVo> getInfo(@NotNull(message = "主键不能为空")
|
||||||
|
@PathVariable String id) {
|
||||||
|
return R.ok(socialUserService.queryById(id));
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
}
|
@ -1,14 +1,8 @@
|
|||||||
package org.dromara.system.service;
|
package org.dromara.system.service;
|
||||||
|
|
||||||
import org.dromara.system.domain.SocialUser;
|
|
||||||
import org.dromara.system.domain.bo.SysUserBo;
|
|
||||||
import org.dromara.system.domain.vo.SocialUserVo;
|
|
||||||
import org.dromara.system.domain.bo.SocialUserBo;
|
import org.dromara.system.domain.bo.SocialUserBo;
|
||||||
import org.dromara.common.mybatis.core.page.TableDataInfo;
|
import org.dromara.system.domain.vo.SocialUserVo;
|
||||||
import org.dromara.common.mybatis.core.page.PageQuery;
|
|
||||||
import org.dromara.system.domain.vo.SysUserVo;
|
|
||||||
|
|
||||||
import java.util.Collection;
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -19,6 +13,17 @@ import java.util.List;
|
|||||||
*/
|
*/
|
||||||
public interface ISocialUserService {
|
public interface ISocialUserService {
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询社会化关系
|
||||||
|
*/
|
||||||
|
SocialUserVo queryById(String id);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询社会化关系列表
|
||||||
|
*/
|
||||||
|
List<SocialUserVo> queryList();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 新增授权关系
|
* 新增授权关系
|
||||||
*/
|
*/
|
||||||
@ -31,12 +36,6 @@ public interface ISocialUserService {
|
|||||||
Boolean deleteWithValidById(Long id);
|
Boolean deleteWithValidById(Long id);
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 根据用户ID查询授权关系
|
|
||||||
*/
|
|
||||||
Boolean isExistByUserIdAndSource(Long userId, String source);
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 根据authId查询SocialUser表和SysUser表,返回SocialUserAuthResult映射的对象
|
* 根据authId查询SocialUser表和SysUser表,返回SocialUserAuthResult映射的对象
|
||||||
* @param authId 认证ID
|
* @param authId 认证ID
|
||||||
|
@ -1,25 +1,15 @@
|
|||||||
package org.dromara.system.service.impl;
|
package org.dromara.system.service.impl;
|
||||||
|
|
||||||
import org.dromara.common.core.utils.MapstructUtils;
|
|
||||||
import org.dromara.common.core.utils.StringUtils;
|
|
||||||
import org.dromara.common.mybatis.core.page.TableDataInfo;
|
|
||||||
import org.dromara.common.mybatis.core.page.PageQuery;
|
|
||||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
|
||||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
|
||||||
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
|
||||||
import lombok.RequiredArgsConstructor;
|
import lombok.RequiredArgsConstructor;
|
||||||
import org.dromara.system.domain.bo.SysUserBo;
|
import org.dromara.common.core.utils.MapstructUtils;
|
||||||
import org.dromara.system.domain.vo.SysUserVo;
|
import org.dromara.system.domain.SocialUser;
|
||||||
import org.springframework.stereotype.Service;
|
|
||||||
import org.dromara.system.domain.bo.SocialUserBo;
|
import org.dromara.system.domain.bo.SocialUserBo;
|
||||||
import org.dromara.system.domain.vo.SocialUserVo;
|
import org.dromara.system.domain.vo.SocialUserVo;
|
||||||
import org.dromara.system.domain.SocialUser;
|
|
||||||
import org.dromara.system.mapper.SocialUserMapper;
|
import org.dromara.system.mapper.SocialUserMapper;
|
||||||
import org.dromara.system.service.ISocialUserService;
|
import org.dromara.system.service.ISocialUserService;
|
||||||
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
|
||||||
import java.util.Collection;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 社会化关系Service业务层处理
|
* 社会化关系Service业务层处理
|
||||||
@ -33,6 +23,25 @@ public class SocialUserServiceImpl implements ISocialUserService {
|
|||||||
|
|
||||||
private final SocialUserMapper baseMapper;
|
private final SocialUserMapper baseMapper;
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询社会化关系
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public SocialUserVo queryById(String id){
|
||||||
|
return baseMapper.selectVoById(id);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 授权列表
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public List<SocialUserVo> queryList() {
|
||||||
|
return baseMapper.selectVoList();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 新增社会化关系
|
* 新增社会化关系
|
||||||
*/
|
*/
|
||||||
@ -42,7 +51,11 @@ public class SocialUserServiceImpl implements ISocialUserService {
|
|||||||
validEntityBeforeSave(add);
|
validEntityBeforeSave(add);
|
||||||
boolean flag = baseMapper.insert(add) > 0;
|
boolean flag = baseMapper.insert(add) > 0;
|
||||||
if (flag) {
|
if (flag) {
|
||||||
|
if (add != null) {
|
||||||
bo.setId(add.getId());
|
bo.setId(add.getId());
|
||||||
|
}else {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
return flag;
|
return flag;
|
||||||
}
|
}
|
||||||
@ -64,20 +77,6 @@ public class SocialUserServiceImpl implements ISocialUserService {
|
|||||||
return baseMapper.deleteById(id) > 0;
|
return baseMapper.deleteById(id) > 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* 根据用户id和来源查询用户是否存在
|
|
||||||
*
|
|
||||||
* @param userId 用户id
|
|
||||||
* @param source 来源
|
|
||||||
* @return 是否存在
|
|
||||||
*/
|
|
||||||
@Override
|
|
||||||
public Boolean isExistByUserIdAndSource(Long userId, String source) {
|
|
||||||
LambdaQueryWrapper<SocialUser> lqw = Wrappers.lambdaQuery();
|
|
||||||
lqw.eq(SocialUser::getUserId, userId);
|
|
||||||
lqw.eq(SocialUser::getSource, source);
|
|
||||||
return baseMapper.selectCount(lqw) > 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 根据authId查询用户信息
|
* 根据authId查询用户信息
|
||||||
|
Loading…
x
Reference in New Issue
Block a user