From 2d894c13096c43ae6d6cf6a4462e1153881ab864 Mon Sep 17 00:00:00 2001 From: 三个三 <2029364173@qq.com> Date: 星期一, 12 六月 2023 03:26:14 +0800 Subject: [PATCH] Revert "新增加第三方登录授权功能" --- /dev/null | 14 --- ruoyi-admin/pom.xml | 15 --- ruoyi-admin/src/main/java/org/dromara/web/controller/AuthController.java | 83 -------------------- ruoyi-admin/src/main/java/org/dromara/web/service/SysLoginService.java | 65 ---------------- ruoyi-common/ruoyi-common-core/src/main/java/org/dromara/common/core/enums/DeviceType.java | 4 ruoyi-modules/ruoyi-system/src/main/java/org/dromara/system/mapper/SysUserMapper.java | 45 ---------- pom.xml | 8 -- ruoyi-common/pom.xml | 1 8 files changed, 3 insertions(+), 232 deletions(-) diff --git a/pom.xml b/pom.xml index a1e7524..b20e7f0 100644 --- a/pom.xml +++ b/pom.xml @@ -41,7 +41,6 @@ <bouncycastle.version>1.72</bouncycastle.version> <!-- 绂荤嚎IP鍦板潃瀹氫綅搴� --> <ip2region.version>2.7.0</ip2region.version> - <justauth.version>1.15.6</justauth.version> <!-- 涓存椂淇 snakeyaml 婕忔礊 --> <snakeyaml.version>1.33</snakeyaml.version> @@ -290,13 +289,6 @@ <groupId>org.yaml</groupId> <artifactId>snakeyaml</artifactId> <version>${snakeyaml.version}</version> - </dependency> - - <!-- 绗笁鏂规巿鏉冪櫥褰� --> - <dependency> - <groupId>me.zhyd.oauth</groupId> - <artifactId>JustAuth</artifactId> - <version>${justauth.version}</version> </dependency> <!-- 鍔犲瘑鍖呭紩鍏� --> diff --git a/ruoyi-admin/pom.xml b/ruoyi-admin/pom.xml index dd4fc58..af5f239 100644 --- a/ruoyi-admin/pom.xml +++ b/ruoyi-admin/pom.xml @@ -75,21 +75,6 @@ <artifactId>spring-boot-starter-test</artifactId> <scope>test</scope> </dependency> - <dependency> - <groupId>me.zhyd.oauth</groupId> - <artifactId>JustAuth</artifactId> - </dependency> - <dependency> - <groupId>org.dromara</groupId> - <artifactId>ruoyi-common-auth</artifactId> - <version>5.1.0-SNAPSHOT</version> - </dependency> - <dependency> - <groupId>com.aliyun</groupId> - <artifactId>credentials-java</artifactId> - <version>0.2.4</version> - <scope>compile</scope> - </dependency> <!-- skywalking 鏁村悎 logback --> <!-- <dependency>--> diff --git a/ruoyi-admin/src/main/java/org/dromara/web/controller/AuthController.java b/ruoyi-admin/src/main/java/org/dromara/web/controller/AuthController.java index 6d0ef7b..bba6113 100644 --- a/ruoyi-admin/src/main/java/org/dromara/web/controller/AuthController.java +++ b/ruoyi-admin/src/main/java/org/dromara/web/controller/AuthController.java @@ -2,21 +2,9 @@ import cn.dev33.satoken.annotation.SaIgnore; import cn.hutool.core.collection.CollUtil; -import cn.hutool.core.util.ObjectUtil; -import cn.hutool.json.JSONObject; -import cn.hutool.json.JSONUtil; -import com.alibaba.fastjson.JSON; import jakarta.servlet.http.HttpServletRequest; import jakarta.validation.constraints.NotBlank; import lombok.RequiredArgsConstructor; -import me.zhyd.oauth.cache.AuthDefaultStateCache; -import me.zhyd.oauth.cache.AuthStateCache; -import me.zhyd.oauth.model.AuthCallback; -import me.zhyd.oauth.model.AuthResponse; -import me.zhyd.oauth.model.AuthUser; -import me.zhyd.oauth.request.AuthRequest; -import me.zhyd.oauth.utils.AuthStateUtils; -import org.dromara.common.auth.utils.AuthUtils; import org.dromara.common.core.domain.R; import org.dromara.common.core.domain.model.EmailLoginBody; import org.dromara.common.core.domain.model.LoginBody; @@ -28,8 +16,6 @@ import org.dromara.common.tenant.helper.TenantHelper; import org.dromara.system.domain.bo.SysTenantBo; import org.dromara.system.domain.vo.SysTenantVo; -import org.dromara.system.domain.vo.SysUserVo; -import org.dromara.system.mapper.SysUserMapper; import org.dromara.system.service.ISysConfigService; import org.dromara.system.service.ISysTenantService; import org.dromara.web.domain.vo.LoginTenantVo; @@ -40,11 +26,8 @@ import org.springframework.validation.annotation.Validated; import org.springframework.web.bind.annotation.*; -import java.io.IOException; import java.net.URL; -import java.util.HashMap; import java.util.List; -import java.util.Map; /** * 璁よ瘉 @@ -58,18 +41,10 @@ @RequestMapping("/auth") public class AuthController { - private AuthStateCache authStateCache; private final SysLoginService loginService; private final SysRegisterService registerService; private final ISysConfigService configService; private final ISysTenantService tenantService; - private final SysUserMapper userMapper; - private final Map<String, String> auths = new HashMap<>(); - { - auths.put("gitee", "{\"clientId\":\"38eaaa1b77b5e064313057a2f5745ce3a9f3e7686d9bd302c7df2f308ef6db81\",\"clientSecret\":\"2e633af8780cb9fe002c4c7291b722db944402e271efb99b062811f52d7da1ff\",\"redirectUri\":\"http://127.0.0.1:8888/social-login?source=gitee\"}"); - auths.put("github", "{\"clientId\":\"Iv1.1be0cdcd71aca63b\",\"clientSecret\":\"0d59d28b43152bc8906011624db37b0fed88d154\",\"redirectUri\":\"http://127.0.0.1:80/social-login?source=github\"}"); - authStateCache = AuthDefaultStateCache.INSTANCE;// 浣跨敤榛樿鐨勭紦瀛� - } /** * 鐧诲綍鏂规硶 @@ -139,64 +114,6 @@ loginVo.setToken(token); return R.ok(loginVo); } - - - - - /** - * 璁よ瘉鎺堟潈 - * @param source - * @throws IOException - */ - @GetMapping("/binding/{source}") - @ResponseBody - public R<LoginVo> authBinding(@PathVariable("source") String source, HttpServletRequest request){ - SysUserVo userLoding = new SysUserVo(); - if (ObjectUtil.isNull(userLoding)) { - return R.fail("鎺堟潈澶辫触锛岃鍏堢櫥褰曞啀缁戝畾"); - } - if (userMapper.checkAuthUser(userLoding.getUserId(),source) > 0) - { - return R.fail(source + "骞冲彴璐﹀彿宸茬粡缁戝畾"); - } - String obj = auths.get(source); - if (StringUtils.isEmpty(obj)) - { - return R.fail(source + "骞冲彴璐﹀彿鏆備笉鏀寔"); - } - JSONObject json = JSONUtil.parseObj(obj); - AuthRequest authRequest = AuthUtils.getAuthRequest(source, - json.getStr("clientId"), - json.getStr("clientSecret"), - json.getStr("redirectUri"), authStateCache); - String authorizeUrl = authRequest.authorize(AuthStateUtils.createState()); - return R.ok(authorizeUrl); - } - - /** - * @param source - * @param callback - * @param request - * @return - */ - @SuppressWarnings("unchecked") - @GetMapping("/social-login/{source}") - public R<String> socialLogin(@PathVariable("source") String source, AuthCallback callback, HttpServletRequest request) throws IOException { - String obj = auths.get(source); - if (StringUtils.isEmpty(obj)) - { - return R.fail("绗笁鏂瑰钩鍙扮郴缁熶笉鏀寔鎴栨湭鎻愪緵鏉ユ簮"); - } - JSONObject json = JSONUtil.parseObj(obj); - AuthRequest authRequest = AuthUtils.getAuthRequest(source, - json.getStr("clientId"), - json.getStr("clientSecret"), - json.getStr("redirectUri"), authStateCache); - AuthResponse<AuthUser> response = authRequest.login(callback); - return loginService.socialLogin(source, response, request); - } - - /** * 閫�鍑虹櫥褰� diff --git a/ruoyi-admin/src/main/java/org/dromara/web/service/SysLoginService.java b/ruoyi-admin/src/main/java/org/dromara/web/service/SysLoginService.java index b152710..689a55d 100644 --- a/ruoyi-admin/src/main/java/org/dromara/web/service/SysLoginService.java +++ b/ruoyi-admin/src/main/java/org/dromara/web/service/SysLoginService.java @@ -6,15 +6,11 @@ import cn.hutool.core.bean.BeanUtil; import cn.hutool.core.util.ObjectUtil; import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; -import jakarta.servlet.http.HttpServletRequest; import lombok.RequiredArgsConstructor; import lombok.extern.slf4j.Slf4j; -import me.zhyd.oauth.model.AuthResponse; -import me.zhyd.oauth.model.AuthUser; import org.dromara.common.core.constant.Constants; import org.dromara.common.core.constant.GlobalConstants; import org.dromara.common.core.constant.TenantConstants; -import org.dromara.common.core.domain.R; import org.dromara.common.core.domain.dto.RoleDTO; import org.dromara.common.core.domain.model.LoginUser; import org.dromara.common.core.domain.model.XcxLoginUser; @@ -32,7 +28,6 @@ import org.dromara.common.tenant.exception.TenantException; import org.dromara.common.tenant.helper.TenantHelper; import org.dromara.common.web.config.properties.CaptchaProperties; -import org.dromara.system.domain.SysAuthUser; import org.dromara.system.domain.SysUser; import org.dromara.system.domain.vo.SysTenantVo; import org.dromara.system.domain.vo.SysUserVo; @@ -42,7 +37,6 @@ import org.springframework.beans.factory.annotation.Value; import org.springframework.stereotype.Service; -import java.io.IOException; import java.time.Duration; import java.util.Date; import java.util.List; @@ -159,65 +153,6 @@ recordLoginInfo(user.getUserId()); return StpUtil.getTokenValue(); } - - - /** - * 璁よ瘉鎺堟潈鐧诲綍 - * @param source - * @throws IOException - */ - /** - * 绀句氦鐧诲綍 - * @param source 鐧诲綍鏉ユ簮 - * @param authUser 鎺堟潈鍝嶅簲瀹炰綋 - * @param request Http璇锋眰瀵硅薄 - * @return 缁熶竴鍝嶅簲瀹炰綋 - * @throws IOException - */ - public R<String> socialLogin(String source, AuthResponse<AuthUser> authUser, HttpServletRequest request) throws IOException { - // 鍒ゆ柇鎺堟潈鍝嶅簲鏄惁鎴愬姛 - if (!authUser.ok()) { - return R.fail("瀵逛笉璧凤紝鎺堟潈淇℃伅楠岃瘉涓嶉�氳繃锛岃鑱旂郴绠$悊鍛�"); - } - AuthUser authUserData = authUser.getData(); - // 鍒ゆ柇鏁版嵁搴撲腑鏄惁宸插瓨鍦ㄨ鐢ㄦ埛 - SysUserVo user = userMapper.selectAuthUserByUuid(source + authUserData.getUuid()); - if (ObjectUtil.isNotNull(user)) { - checkTenant(user.getTenantId()); - SysUserVo dbUser = loadUserByUsername(user.getTenantId(), user.getUserName()); - // 鐧诲綍 - LoginHelper.loginByDevice(buildLoginUser(dbUser), DeviceType.auth); - recordLogininfor(dbUser.getTenantId(), user.getUserName(), Constants.LOGIN_SUCCESS, MessageUtils.message("user.login.success")); - recordLoginInfo(user.getUserId()); - return R.ok(StpUtil.getTokenValue()); - } else { - if (LoginHelper.getUserId() == null) { - return R.fail("鎺堟潈澶辫触锛岃鍏堢櫥褰曞啀缁戝畾"); - } - // 缁勮鎺堟潈鐢ㄦ埛淇℃伅 - SysAuthUser sysAuthUser = new SysAuthUser(); - sysAuthUser.setAvatar(authUserData.getAvatar()); - sysAuthUser.setUuid(source + authUserData.getUuid()); - sysAuthUser.setUserId(LoginHelper.getUserId()); - sysAuthUser.setUserName(authUserData.getUsername()); - sysAuthUser.setNickName(authUserData.getNickname()); - sysAuthUser.setEmail(authUserData.getEmail()); - sysAuthUser.setSource(source); - sysAuthUser.setCreateTime(new Date().toString()); - // 鏂扮敤鎴凤紝缁戝畾绗笁鏂硅处鍙� - userMapper.insertAuthUser(sysAuthUser); - SysUserVo lodingData = loadUserByUsername(LoginHelper.getTenantId(), LoginHelper.getUsername()); - checkTenant(lodingData.getTenantId()); - LoginHelper.loginByDevice(buildLoginUser(lodingData), DeviceType.auth); - recordLogininfor(lodingData.getTenantId(), sysAuthUser.getUserName(), Constants.LOGIN_SUCCESS, MessageUtils.message("user.login.success")); - recordLoginInfo(sysAuthUser.getUserId()); - return R.ok(StpUtil.getTokenValue()); - } - } - - - - /** * 閫�鍑虹櫥褰� diff --git a/ruoyi-common/pom.xml b/ruoyi-common/pom.xml index 4813f79..0428aea 100644 --- a/ruoyi-common/pom.xml +++ b/ruoyi-common/pom.xml @@ -11,7 +11,6 @@ <modules> <module>ruoyi-common-bom</module> - <module>ruoyi-common-auth</module> <module>ruoyi-common-core</module> <module>ruoyi-common-doc</module> <module>ruoyi-common-excel</module> diff --git a/ruoyi-common/ruoyi-common-auth/pom.xml b/ruoyi-common/ruoyi-common-auth/pom.xml deleted file mode 100644 index 9af89e6..0000000 --- a/ruoyi-common/ruoyi-common-auth/pom.xml +++ /dev/null @@ -1,22 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<project xmlns="http://maven.apache.org/POM/4.0.0" - xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" - xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> - <parent> - <groupId>org.dromara</groupId> - <artifactId>ruoyi-common</artifactId> - <version>${revision}</version> - <relativePath>../pom.xml</relativePath> - </parent> - <modelVersion>4.0.0</modelVersion> - <artifactId>ruoyi-common-auth</artifactId> - <description> - ruoyi-common-auth 璁よ瘉妯″潡 - </description> - <dependencies> - <dependency> - <groupId>me.zhyd.oauth</groupId> - <artifactId>JustAuth</artifactId> - </dependency> - </dependencies> -</project> diff --git a/ruoyi-common/ruoyi-common-auth/src/main/java/org.dromara.common.auth/utils/AuthUtils.java b/ruoyi-common/ruoyi-common-auth/src/main/java/org.dromara.common.auth/utils/AuthUtils.java deleted file mode 100644 index 981b3be..0000000 --- a/ruoyi-common/ruoyi-common-auth/src/main/java/org.dromara.common.auth/utils/AuthUtils.java +++ /dev/null @@ -1,112 +0,0 @@ -package org.dromara.common.auth.utils; -import me.zhyd.oauth.cache.AuthStateCache; -import me.zhyd.oauth.config.AuthConfig; -import me.zhyd.oauth.exception.AuthException; -import me.zhyd.oauth.request.*; - -/** - * 璁よ瘉鎺堟潈宸ュ叿绫� - * - * @author ruoyi - */ -public class AuthUtils { - public static AuthRequest getAuthRequest(String source, String clientId, String clientSecret, String redirectUri, - AuthStateCache authStateCache) - { - AuthRequest authRequest = null; - switch (source.toLowerCase()) { - case "dingtalk" -> - authRequest = new AuthDingTalkRequest(AuthConfig.builder().clientId(clientId).clientSecret(clientSecret) - .redirectUri(redirectUri).build(), authStateCache); - case "baidu" -> - authRequest = new AuthBaiduRequest(AuthConfig.builder().clientId(clientId).clientSecret(clientSecret) - .redirectUri(redirectUri).build(), authStateCache); - case "github" -> - authRequest = new AuthGithubRequest(AuthConfig.builder().clientId(clientId).clientSecret(clientSecret) - .redirectUri(redirectUri).build(), authStateCache); - case "gitee" -> - authRequest = new AuthGiteeRequest(AuthConfig.builder().clientId(clientId).clientSecret(clientSecret) - .redirectUri(redirectUri).build(), authStateCache); - case "weibo" -> - authRequest = new AuthWeiboRequest(AuthConfig.builder().clientId(clientId).clientSecret(clientSecret) - .redirectUri(redirectUri).build(), authStateCache); - case "coding" -> - authRequest = new AuthCodingRequest(AuthConfig.builder().clientId(clientId).clientSecret(clientSecret) - .redirectUri(redirectUri).codingGroupName("").build(), authStateCache); - case "oschina" -> - authRequest = new AuthOschinaRequest(AuthConfig.builder().clientId(clientId).clientSecret(clientSecret) - .redirectUri(redirectUri).build(), authStateCache); - case "alipay" -> - // 鏀粯瀹濆湪鍒涘缓鍥炶皟鍦板潃鏃讹紝涓嶅厑璁镐娇鐢╨ocalhost鎴栬��127.0.0.1锛屾墍浠ヨ繖鍎跨殑鍥炶皟鍦板潃浣跨敤鐨勫眬鍩熺綉鍐呯殑ip - authRequest = new AuthAlipayRequest(AuthConfig.builder().clientId(clientId).clientSecret(clientSecret) - .alipayPublicKey("").redirectUri(redirectUri).build(), authStateCache); - case "qq" -> - authRequest = new AuthQqRequest(AuthConfig.builder().clientId(clientId).clientSecret(clientSecret) - .redirectUri(redirectUri).build(), authStateCache); - case "wechat_open" -> authRequest = new AuthWeChatOpenRequest(AuthConfig.builder().clientId(clientId) - .clientSecret(clientSecret).redirectUri(redirectUri).build(), authStateCache); - case "csdn" -> - authRequest = new AuthCsdnRequest(AuthConfig.builder().clientId(clientId).clientSecret(clientSecret) - .redirectUri(redirectUri).build(), authStateCache); - case "taobao" -> - authRequest = new AuthTaobaoRequest(AuthConfig.builder().clientId(clientId).clientSecret(clientSecret) - .redirectUri(redirectUri).build(), authStateCache); - case "douyin" -> - authRequest = new AuthDouyinRequest(AuthConfig.builder().clientId(clientId).clientSecret(clientSecret) - .redirectUri(redirectUri).build(), authStateCache); - case "linkedin" -> - authRequest = new AuthLinkedinRequest(AuthConfig.builder().clientId(clientId).clientSecret(clientSecret) - .redirectUri(redirectUri).build(), authStateCache); - case "microsoft" -> authRequest = new AuthMicrosoftRequest(AuthConfig.builder().clientId(clientId) - .clientSecret(clientSecret).redirectUri(redirectUri).build(), authStateCache); - case "mi" -> - authRequest = new AuthMiRequest(AuthConfig.builder().clientId(clientId).clientSecret(clientSecret) - .redirectUri(redirectUri).build(), authStateCache); - case "toutiao" -> - authRequest = new AuthToutiaoRequest(AuthConfig.builder().clientId(clientId).clientSecret(clientSecret) - .redirectUri(redirectUri).build(), authStateCache); - case "teambition" -> authRequest = new AuthTeambitionRequest(AuthConfig.builder().clientId(clientId) - .clientSecret(clientSecret).redirectUri(redirectUri).build(), authStateCache); - case "pinterest" -> authRequest = new AuthPinterestRequest(AuthConfig.builder().clientId(clientId) - .clientSecret(clientSecret).redirectUri(redirectUri).build(), authStateCache); - case "renren" -> - authRequest = new AuthRenrenRequest(AuthConfig.builder().clientId(clientId).clientSecret(clientSecret) - .redirectUri(redirectUri).build(), authStateCache); - case "stack_overflow" -> authRequest = new AuthStackOverflowRequest(AuthConfig.builder().clientId(clientId) - .clientSecret(clientSecret).redirectUri(redirectUri).stackOverflowKey("").build(), - authStateCache); - case "huawei" -> - authRequest = new AuthHuaweiRequest(AuthConfig.builder().clientId(clientId).clientSecret(clientSecret) - .redirectUri(redirectUri).build(), authStateCache); - case "wechat_enterprise" -> - authRequest = new AuthWeChatEnterpriseRequest(AuthConfig.builder().clientId(clientId) - .clientSecret(clientSecret).redirectUri(redirectUri).agentId("").build(), authStateCache); - case "kujiale" -> - authRequest = new AuthKujialeRequest(AuthConfig.builder().clientId(clientId).clientSecret(clientSecret) - .redirectUri(redirectUri).build(), authStateCache); - case "gitlab" -> - authRequest = new AuthGitlabRequest(AuthConfig.builder().clientId(clientId).clientSecret(clientSecret) - .redirectUri(redirectUri).build(), authStateCache); - case "meituan" -> - authRequest = new AuthMeituanRequest(AuthConfig.builder().clientId(clientId).clientSecret(clientSecret) - .redirectUri(redirectUri).build(), authStateCache); - case "eleme" -> - authRequest = new AuthElemeRequest(AuthConfig.builder().clientId(clientId).clientSecret(clientSecret) - .redirectUri(redirectUri).build()); - case "wechat_mp" -> - authRequest = new AuthWeChatMpRequest(AuthConfig.builder().clientId(clientId).clientSecret(clientSecret) - .redirectUri(redirectUri).build(), authStateCache); - case "aliyun" -> - authRequest = new AuthAliyunRequest(AuthConfig.builder().clientId(clientId).clientSecret(clientSecret) - .redirectUri(redirectUri).build(), authStateCache); - default -> { - } - } - if (null == authRequest) - { - throw new AuthException("鏈幏鍙栧埌鏈夋晥鐨凙uth閰嶇疆"); - } - return authRequest; - } -} - diff --git a/ruoyi-common/ruoyi-common-core/src/main/java/org/dromara/common/core/enums/DeviceType.java b/ruoyi-common/ruoyi-common-core/src/main/java/org/dromara/common/core/enums/DeviceType.java index 7127bbb..09bf44b 100644 --- a/ruoyi-common/ruoyi-common-core/src/main/java/org/dromara/common/core/enums/DeviceType.java +++ b/ruoyi-common/ruoyi-common-core/src/main/java/org/dromara/common/core/enums/DeviceType.java @@ -26,9 +26,7 @@ /** * 灏忕▼搴忕 */ - XCX("xcx"), - - auth("auth"); + XCX("xcx"); private final String device; } diff --git a/ruoyi-modules/ruoyi-system/src/main/java/org/dromara/system/domain/SysAuthUser.java b/ruoyi-modules/ruoyi-system/src/main/java/org/dromara/system/domain/SysAuthUser.java deleted file mode 100644 index 5008786..0000000 --- a/ruoyi-modules/ruoyi-system/src/main/java/org/dromara/system/domain/SysAuthUser.java +++ /dev/null @@ -1,40 +0,0 @@ -package org.dromara.system.domain; - -import com.baomidou.mybatisplus.annotation.TableName; -import lombok.Data; -import lombok.NoArgsConstructor; - -@Data -@NoArgsConstructor -@TableName("sys_auth_user") -public class SysAuthUser { - - private static final long serialVersionUID = 1L; - - /** 鎺堟潈ID */ - private Long authId; - - /** 绗笁鏂瑰钩鍙扮敤鎴峰敮涓�ID */ - private String uuid; - - /** 绯荤粺鐢ㄦ埛ID */ - private Long userId; - - /** 鐧诲綍璐﹀彿 */ - private String userName; - - /** 鐢ㄦ埛鏄电О */ - private String nickName; - - /** 澶村儚鍦板潃 */ - private String avatar; - - /** 鐢ㄦ埛閭 */ - private String email; - - /** 鐢ㄦ埛鏉ユ簮 */ - private String source; - - private String createTime; - -} diff --git a/ruoyi-modules/ruoyi-system/src/main/java/org/dromara/system/mapper/SysUserMapper.java b/ruoyi-modules/ruoyi-system/src/main/java/org/dromara/system/mapper/SysUserMapper.java index 94c9c1e..81bd1ff 100644 --- a/ruoyi-modules/ruoyi-system/src/main/java/org/dromara/system/mapper/SysUserMapper.java +++ b/ruoyi-modules/ruoyi-system/src/main/java/org/dromara/system/mapper/SysUserMapper.java @@ -7,7 +7,6 @@ import org.dromara.common.mybatis.annotation.DataColumn; import org.dromara.common.mybatis.annotation.DataPermission; import org.dromara.common.mybatis.core.mapper.BaseMapperPlus; -import org.dromara.system.domain.SysAuthUser; import org.dromara.system.domain.SysUser; import org.dromara.system.domain.vo.SysUserVo; import org.apache.ibatis.annotations.Param; @@ -124,8 +123,8 @@ * @return 鐢ㄦ埛瀵硅薄淇℃伅 */ @DataPermission({ - @DataColumn(key = "deptName", value = "d.dept_id"),// 閮ㄩ棬鏉冮檺 - @DataColumn(key = "userName", value = "u.user_id")// 鐢ㄦ埛鏉冮檺 + @DataColumn(key = "deptName", value = "d.dept_id"), + @DataColumn(key = "userName", value = "u.user_id") }) SysUserVo selectUserById(Long userId); @@ -143,44 +142,4 @@ }) int updateById(@Param(Constants.ENTITY) SysUser user); - /** - * 鏍规嵁鐢ㄦ埛缂栧彿鏌ヨ鎺堟潈鍒楄〃 - * - * @param userId 鐢ㄦ埛缂栧彿 - * @return 鎺堟潈鍒楄〃 - */ - public List<SysAuthUser> selectAuthUserListByUserId(Long userId); - - /** - * 鏍规嵁uuid鏌ヨ鐢ㄦ埛淇℃伅 - * - * @param uuid 鍞竴淇℃伅 - * @return 缁撴灉 - */ - public SysUserVo selectAuthUserByUuid(String uuid); - - /** - * 鏍¢獙source骞冲彴鏄惁缁戝畾 - * - * @param userId 鐢ㄦ埛缂栧彿 - * @param source 缁戝畾骞冲彴 - * @return 缁撴灉 - */ - public int checkAuthUser(@Param("userId") Long userId, @Param("source") String source); - - /** - * 鏂板绗笁鏂规巿鏉冧俊鎭� - * - * @param authUser 鐢ㄦ埛淇℃伅 - * @return 缁撴灉 - */ - public int insertAuthUser(SysAuthUser authUser); - - /** - * 鏍规嵁缂栧彿鍒犻櫎绗笁鏂规巿鏉冧俊鎭� - * - * @param authId 鎺堟潈缂栧彿 - * @return 缁撴灉 - */ - public int deleteAuthUser(Long authId); } diff --git a/ruoyi-modules/ruoyi-system/src/main/resources/mapper/system/SysAuthUserMapper.xml b/ruoyi-modules/ruoyi-system/src/main/resources/mapper/system/SysAuthUserMapper.xml deleted file mode 100644 index 864b3ba..0000000 --- a/ruoyi-modules/ruoyi-system/src/main/resources/mapper/system/SysAuthUserMapper.xml +++ /dev/null @@ -1,60 +0,0 @@ -<?xml version="1.0" encoding="UTF-8" ?> -<!DOCTYPE mapper - PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" - "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> -<mapper namespace="org.dromara.system.mapper.SysUserMapper"> - - <resultMap id="SysAuthUserResult" type="org.dromara.system.domain.SysAuthUser"> - <id property="authId" column="auth_id" /> - <result property="uuid" column="uuid" /> - <result property="userId" column="user_id" /> - <result property="userName" column="user_name" /> - <result property="nickName" column="nick_name" /> - <result property="avatar" column="avatar" /> - <result property="email" column="email" /> - <result property="source" column="source" /> - <result property="createTime" column="create_time" /> - </resultMap> - - - <select id="selectAuthUserByUuid" parameterType="String" resultMap="SysUserResult"> - select b.user_id as user_id, b.user_name as user_name, b.password as password , a.tenant_id as tenant_id - from sys_auth_user a left join sys_user b on a.user_id = b.user_id - where a.uuid = #{uuid} and b.del_flag = '0' - </select> - - <select id="selectAuthUserListByUserId" parameterType="Long" resultMap="SysAuthUserResult"> - select auth_id, uuid, user_id, user_name, nick_name, avatar, email, source, create_time, tenant_id from sys_auth_user where user_id = #{userId} - </select> - - <select id="checkAuthUser" parameterType="org.dromara.system.domain.SysAuthUser" resultType="int"> - select count(1) from sys_auth_user where user_id=#{userId} and source=#{source} limit 1 - </select> - - <insert id="insertAuthUser" parameterType="org.dromara.system.domain.SysAuthUser"> - insert into sys_auth_user( - <if test="uuid != null and uuid != ''">uuid,</if> - <if test="userId != null and userId != 0">user_id,</if> - <if test="userName != null and userName != ''">user_name,</if> - <if test="nickName != null and nickName != ''">nick_name,</if> - <if test="avatar != null and avatar != ''">avatar,</if> - <if test="email != null and email != ''">email,</if> - <if test="source != null and source != ''">source,</if> - create_time - )values( - <if test="uuid != null and uuid != ''">#{uuid},</if> - <if test="userId != null and userId != 0">#{userId},</if> - <if test="userName != null and userName != ''">#{userName},</if> - <if test="nickName != null and nickName != ''">#{nickName},</if> - <if test="avatar != null and avatar != ''">#{avatar},</if> - <if test="email != null and email != ''">#{email},</if> - <if test="source != null and source != ''">#{source},</if> - now() - ) - </insert> - - <delete id="deleteAuthUser" parameterType="Long"> - delete from sys_auth_user where auth_id = #{authId} - </delete> - -</mapper> diff --git a/script/AuthSQL/sys_auth_user.sql b/script/AuthSQL/sys_auth_user.sql deleted file mode 100644 index 4a41675..0000000 --- a/script/AuthSQL/sys_auth_user.sql +++ /dev/null @@ -1,14 +0,0 @@ -CREATE TABLE `sys_auth_user` ( - `auth_id` bigint(20) NOT NULL AUTO_INCREMENT COMMENT '鎺堟潈ID', - `uuid` varchar(500) NOT NULL COMMENT '绗笁鏂瑰钩鍙扮敤鎴峰敮涓�ID', - `user_id` bigint(20) unsigned NOT NULL COMMENT '绯荤粺鐢ㄦ埛ID', - `user_name` varchar(30) NOT NULL COMMENT '鐧诲綍璐﹀彿', - `nick_name` varchar(30) DEFAULT '' COMMENT '鐢ㄦ埛鏄电О', - `avatar` varchar(500) DEFAULT '' COMMENT '澶村儚鍦板潃', - `email` varchar(255) DEFAULT '' COMMENT '鐢ㄦ埛閭', - `source` varchar(255) DEFAULT '' COMMENT '鐢ㄦ埛鏉ユ簮', - ` tenant_id` varchar(20) DEFAULT '000000' COMMENT '绉熸埛id', - `create_time` datetime DEFAULT NULL COMMENT '鍒涘缓鏃堕棿', - `tenant_id` varchar(25) NOT NULL DEFAULT '000000', - PRIMARY KEY (`auth_id`) USING BTREE -) ENGINE=InnoDB AUTO_INCREMENT=102 DEFAULT CHARSET=utf8mb4 COMMENT='绗笁鏂瑰钩鍙版巿鏉冪敤鎴蜂俊鎭〃'; -- Gitblit v1.9.3