1
0
mirror of https://gitee.com/bookshelfplus/bookshelfplus synced 2025-09-12 03:31:39 +08:00
Code Issues Projects Releases Wiki Activity GitHub Gitee

第三方快捷登录前端按钮;后端跳转逻辑;数据库映射完成

This commit is contained in:
2022-04-03 23:40:03 +08:00
parent a54e96de38
commit f62bfed97f
16 changed files with 1326 additions and 9 deletions

View File

@@ -0,0 +1,38 @@
package plus.bookshelf.Common.ThirdParty;
import lombok.Data;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.context.annotation.PropertySource;
import org.springframework.stereotype.Component;
@Component
@ConfigurationProperties(prefix = "thirdparty")
@PropertySource("thirdparty.properties")
@Data
public class ThirdPartyConfig {
// Gitee
@Value("${thirdparty.gitee.clientid}")
private String giteeClientId;
@Value("${thirdparty.gitee.clientsecret}")
private String giteeClientsecret;
@Value("${thirdparty.gitee.redirecturi}")
private String giteeRedirecturi;
// QQ
@Value("${thirdparty.qq.clientid}")
private String qqClientid;
@Value("${thirdparty.qq.clientsecret}")
private String qqClientsecret;
@Value("${thirdparty.qq.redirecturi}")
private String qqRedirecturi;
//GitHub
@Value("${thirdparty.github.clientid}")
private String githubClientid;
@Value("${thirdparty.github.clientsecret}")
private String githubClientsecret;
@Value("${thirdparty.github.redirecturi}")
private String githubRedirecturi;
}

View File

@@ -0,0 +1,76 @@
package plus.bookshelf.Controller.Controller;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import me.zhyd.oauth.config.AuthConfig;
import me.zhyd.oauth.model.AuthCallback;
import me.zhyd.oauth.request.AuthGiteeRequest;
import me.zhyd.oauth.request.AuthRequest;
import me.zhyd.oauth.utils.AuthStateUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.*;
import plus.bookshelf.Common.Error.BusinessErrorCode;
import plus.bookshelf.Common.Error.BusinessException;
import plus.bookshelf.Common.Response.CommonReturnType;
import plus.bookshelf.Common.ThirdParty.ThirdPartyConfig;
import plus.bookshelf.Service.Impl.UserServiceImpl;
import java.util.Map;
@Api(tags = "第三方登录")
@Controller
@RequestMapping("/third-party")
public class ThirdPartyController extends BaseController {
// refer document: https://justauth.wiki/guide/
// Gitee: https://justauth.wiki/guide/oauth/gitee
// state在OAuth的流程中的主要作用就是保证请求完整性防止CSRF风险此处传的state将在回调时传回
@Autowired
private ThirdPartyConfig thirdPartyConfig;
@ApiOperation(value = "第三方用户登录跳转地址", notes = "传入需要登录的第三方平台大小写均可返回跳转url")
@RequestMapping(value = "login", method = {RequestMethod.GET})
@ResponseBody
public CommonReturnType login(@RequestParam(value = "platform") String platform) throws BusinessException {
AuthRequest authRequest = getAuthRequest(platform);
String authorizeUrl = authRequest.authorize(AuthStateUtils.createState());
return CommonReturnType.create(authorizeUrl);
}
@ApiOperation(value = "快捷登录回调函数", notes = "传入 code 值,进行登录")
@RequestMapping(value = "callback/{platform}", method = {RequestMethod.GET})
@ResponseBody
public CommonReturnType qq(@PathVariable("platform") String platform,
// @RequestParam Map<String,String> params,
AuthCallback callback) throws BusinessException {
// System.out.println(params);
// System.out.println(platform);
// System.out.println(params.get("code"));
// System.out.println(params.get("state"));
AuthRequest authRequest = getAuthRequest(platform);
return CommonReturnType.create(authRequest.login(callback));
}
// 创建授权request
private AuthRequest getAuthRequest(String platform) throws BusinessException {
switch (platform.toLowerCase()) {
case "gitee":
return new AuthGiteeRequest(AuthConfig.builder()
.clientId(thirdPartyConfig.getGiteeClientId())
.clientSecret(thirdPartyConfig.getGiteeClientsecret())
.redirectUri(thirdPartyConfig.getGiteeRedirecturi())
.build());
case "qq":
return new AuthGiteeRequest(AuthConfig.builder()
.clientId(thirdPartyConfig.getQqClientid())
.clientSecret(thirdPartyConfig.getQqClientsecret())
.redirectUri(thirdPartyConfig.getQqRedirecturi())
.build());
default:
throw new BusinessException(BusinessErrorCode.PARAMETER_VALIDATION_ERROR, "不支持该第三方平台");
}
}
}

View File

@@ -1,8 +1,6 @@
package plus.bookshelf.Controller.Controller;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiImplicitParams;
import io.swagger.annotations.ApiOperation;
import org.apache.commons.codec.digest.DigestUtils;
import org.springframework.beans.BeanUtils;
@@ -12,10 +10,7 @@ import org.springframework.web.bind.annotation.*;
import plus.bookshelf.Common.Error.BusinessErrorCode;
import plus.bookshelf.Common.Error.BusinessException;
import plus.bookshelf.Common.Response.CommonReturnType;
import plus.bookshelf.Common.SessionManager.LocalSessionManager;
import plus.bookshelf.Common.SessionManager.RedisSessionManager;
import plus.bookshelf.Controller.VO.UserVO;
import plus.bookshelf.Dao.Mapper.UserDOMapper;
import plus.bookshelf.Service.Impl.UserServiceImpl;
import plus.bookshelf.Service.Model.UserModel;

View File

@@ -0,0 +1,102 @@
package plus.bookshelf.Dao.DO;
public class ThirdPartyUserAuthDO {
/**
*
* This field was generated by MyBatis Generator.
* This field corresponds to the database column third_party_user_auth_relation.id
*
* @mbg.generated
*/
private Integer id;
/**
*
* This field was generated by MyBatis Generator.
* This field corresponds to the database column third_party_user_auth_relation.user_id
*
* @mbg.generated
*/
private String userId;
/**
*
* This field was generated by MyBatis Generator.
* This field corresponds to the database column third_party_user_auth_relation.third_party_user_id
*
* @mbg.generated
*/
private String thirdPartyUserId;
/**
* This method was generated by MyBatis Generator.
* This method returns the value of the database column third_party_user_auth_relation.id
*
* @return the value of third_party_user_auth_relation.id
*
* @mbg.generated
*/
public Integer getId() {
return id;
}
/**
* This method was generated by MyBatis Generator.
* This method sets the value of the database column third_party_user_auth_relation.id
*
* @param id the value for third_party_user_auth_relation.id
*
* @mbg.generated
*/
public void setId(Integer id) {
this.id = id;
}
/**
* This method was generated by MyBatis Generator.
* This method returns the value of the database column third_party_user_auth_relation.user_id
*
* @return the value of third_party_user_auth_relation.user_id
*
* @mbg.generated
*/
public String getUserId() {
return userId;
}
/**
* This method was generated by MyBatis Generator.
* This method sets the value of the database column third_party_user_auth_relation.user_id
*
* @param userId the value for third_party_user_auth_relation.user_id
*
* @mbg.generated
*/
public void setUserId(String userId) {
this.userId = userId == null ? null : userId.trim();
}
/**
* This method was generated by MyBatis Generator.
* This method returns the value of the database column third_party_user_auth_relation.third_party_user_id
*
* @return the value of third_party_user_auth_relation.third_party_user_id
*
* @mbg.generated
*/
public String getThirdPartyUserId() {
return thirdPartyUserId;
}
/**
* This method was generated by MyBatis Generator.
* This method sets the value of the database column third_party_user_auth_relation.third_party_user_id
*
* @param thirdPartyUserId the value for third_party_user_auth_relation.third_party_user_id
*
* @mbg.generated
*/
public void setThirdPartyUserId(String thirdPartyUserId) {
this.thirdPartyUserId = thirdPartyUserId == null ? null : thirdPartyUserId.trim();
}
}

View File

@@ -0,0 +1,597 @@
package plus.bookshelf.Dao.DO;
public class ThirdPartyUserDO {
/**
*
* This field was generated by MyBatis Generator.
* This field corresponds to the database column third_party_user_info.id
*
* @mbg.generated
*/
private Integer id;
/**
*
* This field was generated by MyBatis Generator.
* This field corresponds to the database column third_party_user_info.uuid
*
* @mbg.generated
*/
private String uuid;
/**
*
* This field was generated by MyBatis Generator.
* This field corresponds to the database column third_party_user_info.source
*
* @mbg.generated
*/
private String source;
/**
*
* This field was generated by MyBatis Generator.
* This field corresponds to the database column third_party_user_info.access_token
*
* @mbg.generated
*/
private String accessToken;
/**
*
* This field was generated by MyBatis Generator.
* This field corresponds to the database column third_party_user_info.expire_in
*
* @mbg.generated
*/
private Integer expireIn;
/**
*
* This field was generated by MyBatis Generator.
* This field corresponds to the database column third_party_user_info.refresh_token
*
* @mbg.generated
*/
private String refreshToken;
/**
*
* This field was generated by MyBatis Generator.
* This field corresponds to the database column third_party_user_info.open_id
*
* @mbg.generated
*/
private String openId;
/**
*
* This field was generated by MyBatis Generator.
* This field corresponds to the database column third_party_user_info.uid
*
* @mbg.generated
*/
private String uid;
/**
*
* This field was generated by MyBatis Generator.
* This field corresponds to the database column third_party_user_info.access_code
*
* @mbg.generated
*/
private String accessCode;
/**
*
* This field was generated by MyBatis Generator.
* This field corresponds to the database column third_party_user_info.union_id
*
* @mbg.generated
*/
private String unionId;
/**
*
* This field was generated by MyBatis Generator.
* This field corresponds to the database column third_party_user_info.scope
*
* @mbg.generated
*/
private String scope;
/**
*
* This field was generated by MyBatis Generator.
* This field corresponds to the database column third_party_user_info.token_type
*
* @mbg.generated
*/
private String tokenType;
/**
*
* This field was generated by MyBatis Generator.
* This field corresponds to the database column third_party_user_info.id_token
*
* @mbg.generated
*/
private String idToken;
/**
*
* This field was generated by MyBatis Generator.
* This field corresponds to the database column third_party_user_info.mac_algorithm
*
* @mbg.generated
*/
private String macAlgorithm;
/**
*
* This field was generated by MyBatis Generator.
* This field corresponds to the database column third_party_user_info.mac_key
*
* @mbg.generated
*/
private String macKey;
/**
*
* This field was generated by MyBatis Generator.
* This field corresponds to the database column third_party_user_info.code
*
* @mbg.generated
*/
private String code;
/**
*
* This field was generated by MyBatis Generator.
* This field corresponds to the database column third_party_user_info.oauth_token
*
* @mbg.generated
*/
private String oauthToken;
/**
*
* This field was generated by MyBatis Generator.
* This field corresponds to the database column third_party_user_info.oauth_token_secret
*
* @mbg.generated
*/
private String oauthTokenSecret;
/**
* This method was generated by MyBatis Generator.
* This method returns the value of the database column third_party_user_info.id
*
* @return the value of third_party_user_info.id
*
* @mbg.generated
*/
public Integer getId() {
return id;
}
/**
* This method was generated by MyBatis Generator.
* This method sets the value of the database column third_party_user_info.id
*
* @param id the value for third_party_user_info.id
*
* @mbg.generated
*/
public void setId(Integer id) {
this.id = id;
}
/**
* This method was generated by MyBatis Generator.
* This method returns the value of the database column third_party_user_info.uuid
*
* @return the value of third_party_user_info.uuid
*
* @mbg.generated
*/
public String getUuid() {
return uuid;
}
/**
* This method was generated by MyBatis Generator.
* This method sets the value of the database column third_party_user_info.uuid
*
* @param uuid the value for third_party_user_info.uuid
*
* @mbg.generated
*/
public void setUuid(String uuid) {
this.uuid = uuid == null ? null : uuid.trim();
}
/**
* This method was generated by MyBatis Generator.
* This method returns the value of the database column third_party_user_info.source
*
* @return the value of third_party_user_info.source
*
* @mbg.generated
*/
public String getSource() {
return source;
}
/**
* This method was generated by MyBatis Generator.
* This method sets the value of the database column third_party_user_info.source
*
* @param source the value for third_party_user_info.source
*
* @mbg.generated
*/
public void setSource(String source) {
this.source = source == null ? null : source.trim();
}
/**
* This method was generated by MyBatis Generator.
* This method returns the value of the database column third_party_user_info.access_token
*
* @return the value of third_party_user_info.access_token
*
* @mbg.generated
*/
public String getAccessToken() {
return accessToken;
}
/**
* This method was generated by MyBatis Generator.
* This method sets the value of the database column third_party_user_info.access_token
*
* @param accessToken the value for third_party_user_info.access_token
*
* @mbg.generated
*/
public void setAccessToken(String accessToken) {
this.accessToken = accessToken == null ? null : accessToken.trim();
}
/**
* This method was generated by MyBatis Generator.
* This method returns the value of the database column third_party_user_info.expire_in
*
* @return the value of third_party_user_info.expire_in
*
* @mbg.generated
*/
public Integer getExpireIn() {
return expireIn;
}
/**
* This method was generated by MyBatis Generator.
* This method sets the value of the database column third_party_user_info.expire_in
*
* @param expireIn the value for third_party_user_info.expire_in
*
* @mbg.generated
*/
public void setExpireIn(Integer expireIn) {
this.expireIn = expireIn;
}
/**
* This method was generated by MyBatis Generator.
* This method returns the value of the database column third_party_user_info.refresh_token
*
* @return the value of third_party_user_info.refresh_token
*
* @mbg.generated
*/
public String getRefreshToken() {
return refreshToken;
}
/**
* This method was generated by MyBatis Generator.
* This method sets the value of the database column third_party_user_info.refresh_token
*
* @param refreshToken the value for third_party_user_info.refresh_token
*
* @mbg.generated
*/
public void setRefreshToken(String refreshToken) {
this.refreshToken = refreshToken == null ? null : refreshToken.trim();
}
/**
* This method was generated by MyBatis Generator.
* This method returns the value of the database column third_party_user_info.open_id
*
* @return the value of third_party_user_info.open_id
*
* @mbg.generated
*/
public String getOpenId() {
return openId;
}
/**
* This method was generated by MyBatis Generator.
* This method sets the value of the database column third_party_user_info.open_id
*
* @param openId the value for third_party_user_info.open_id
*
* @mbg.generated
*/
public void setOpenId(String openId) {
this.openId = openId == null ? null : openId.trim();
}
/**
* This method was generated by MyBatis Generator.
* This method returns the value of the database column third_party_user_info.uid
*
* @return the value of third_party_user_info.uid
*
* @mbg.generated
*/
public String getUid() {
return uid;
}
/**
* This method was generated by MyBatis Generator.
* This method sets the value of the database column third_party_user_info.uid
*
* @param uid the value for third_party_user_info.uid
*
* @mbg.generated
*/
public void setUid(String uid) {
this.uid = uid == null ? null : uid.trim();
}
/**
* This method was generated by MyBatis Generator.
* This method returns the value of the database column third_party_user_info.access_code
*
* @return the value of third_party_user_info.access_code
*
* @mbg.generated
*/
public String getAccessCode() {
return accessCode;
}
/**
* This method was generated by MyBatis Generator.
* This method sets the value of the database column third_party_user_info.access_code
*
* @param accessCode the value for third_party_user_info.access_code
*
* @mbg.generated
*/
public void setAccessCode(String accessCode) {
this.accessCode = accessCode == null ? null : accessCode.trim();
}
/**
* This method was generated by MyBatis Generator.
* This method returns the value of the database column third_party_user_info.union_id
*
* @return the value of third_party_user_info.union_id
*
* @mbg.generated
*/
public String getUnionId() {
return unionId;
}
/**
* This method was generated by MyBatis Generator.
* This method sets the value of the database column third_party_user_info.union_id
*
* @param unionId the value for third_party_user_info.union_id
*
* @mbg.generated
*/
public void setUnionId(String unionId) {
this.unionId = unionId == null ? null : unionId.trim();
}
/**
* This method was generated by MyBatis Generator.
* This method returns the value of the database column third_party_user_info.scope
*
* @return the value of third_party_user_info.scope
*
* @mbg.generated
*/
public String getScope() {
return scope;
}
/**
* This method was generated by MyBatis Generator.
* This method sets the value of the database column third_party_user_info.scope
*
* @param scope the value for third_party_user_info.scope
*
* @mbg.generated
*/
public void setScope(String scope) {
this.scope = scope == null ? null : scope.trim();
}
/**
* This method was generated by MyBatis Generator.
* This method returns the value of the database column third_party_user_info.token_type
*
* @return the value of third_party_user_info.token_type
*
* @mbg.generated
*/
public String getTokenType() {
return tokenType;
}
/**
* This method was generated by MyBatis Generator.
* This method sets the value of the database column third_party_user_info.token_type
*
* @param tokenType the value for third_party_user_info.token_type
*
* @mbg.generated
*/
public void setTokenType(String tokenType) {
this.tokenType = tokenType == null ? null : tokenType.trim();
}
/**
* This method was generated by MyBatis Generator.
* This method returns the value of the database column third_party_user_info.id_token
*
* @return the value of third_party_user_info.id_token
*
* @mbg.generated
*/
public String getIdToken() {
return idToken;
}
/**
* This method was generated by MyBatis Generator.
* This method sets the value of the database column third_party_user_info.id_token
*
* @param idToken the value for third_party_user_info.id_token
*
* @mbg.generated
*/
public void setIdToken(String idToken) {
this.idToken = idToken == null ? null : idToken.trim();
}
/**
* This method was generated by MyBatis Generator.
* This method returns the value of the database column third_party_user_info.mac_algorithm
*
* @return the value of third_party_user_info.mac_algorithm
*
* @mbg.generated
*/
public String getMacAlgorithm() {
return macAlgorithm;
}
/**
* This method was generated by MyBatis Generator.
* This method sets the value of the database column third_party_user_info.mac_algorithm
*
* @param macAlgorithm the value for third_party_user_info.mac_algorithm
*
* @mbg.generated
*/
public void setMacAlgorithm(String macAlgorithm) {
this.macAlgorithm = macAlgorithm == null ? null : macAlgorithm.trim();
}
/**
* This method was generated by MyBatis Generator.
* This method returns the value of the database column third_party_user_info.mac_key
*
* @return the value of third_party_user_info.mac_key
*
* @mbg.generated
*/
public String getMacKey() {
return macKey;
}
/**
* This method was generated by MyBatis Generator.
* This method sets the value of the database column third_party_user_info.mac_key
*
* @param macKey the value for third_party_user_info.mac_key
*
* @mbg.generated
*/
public void setMacKey(String macKey) {
this.macKey = macKey == null ? null : macKey.trim();
}
/**
* This method was generated by MyBatis Generator.
* This method returns the value of the database column third_party_user_info.code
*
* @return the value of third_party_user_info.code
*
* @mbg.generated
*/
public String getCode() {
return code;
}
/**
* This method was generated by MyBatis Generator.
* This method sets the value of the database column third_party_user_info.code
*
* @param code the value for third_party_user_info.code
*
* @mbg.generated
*/
public void setCode(String code) {
this.code = code == null ? null : code.trim();
}
/**
* This method was generated by MyBatis Generator.
* This method returns the value of the database column third_party_user_info.oauth_token
*
* @return the value of third_party_user_info.oauth_token
*
* @mbg.generated
*/
public String getOauthToken() {
return oauthToken;
}
/**
* This method was generated by MyBatis Generator.
* This method sets the value of the database column third_party_user_info.oauth_token
*
* @param oauthToken the value for third_party_user_info.oauth_token
*
* @mbg.generated
*/
public void setOauthToken(String oauthToken) {
this.oauthToken = oauthToken == null ? null : oauthToken.trim();
}
/**
* This method was generated by MyBatis Generator.
* This method returns the value of the database column third_party_user_info.oauth_token_secret
*
* @return the value of third_party_user_info.oauth_token_secret
*
* @mbg.generated
*/
public String getOauthTokenSecret() {
return oauthTokenSecret;
}
/**
* This method was generated by MyBatis Generator.
* This method sets the value of the database column third_party_user_info.oauth_token_secret
*
* @param oauthTokenSecret the value for third_party_user_info.oauth_token_secret
*
* @mbg.generated
*/
public void setOauthTokenSecret(String oauthTokenSecret) {
this.oauthTokenSecret = oauthTokenSecret == null ? null : oauthTokenSecret.trim();
}
}

View File

@@ -0,0 +1,21 @@
package plus.bookshelf.Dao.Mapper;
import plus.bookshelf.Dao.DO.ThirdPartyUserAuthDO;
public interface ThirdPartyUserAuthDOMapper {
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table third_party_user_auth_relation
*
* @mbg.generated
*/
int insert(ThirdPartyUserAuthDO record);
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table third_party_user_auth_relation
*
* @mbg.generated
*/
int insertSelective(ThirdPartyUserAuthDO record);
}

View File

@@ -0,0 +1,53 @@
package plus.bookshelf.Dao.Mapper;
import plus.bookshelf.Dao.DO.ThirdPartyUserDO;
public interface ThirdPartyUserDOMapper {
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table third_party_user_info
*
* @mbg.generated
*/
int deleteByPrimaryKey(Integer id);
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table third_party_user_info
*
* @mbg.generated
*/
int insert(ThirdPartyUserDO record);
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table third_party_user_info
*
* @mbg.generated
*/
int insertSelective(ThirdPartyUserDO record);
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table third_party_user_info
*
* @mbg.generated
*/
ThirdPartyUserDO selectByPrimaryKey(Integer id);
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table third_party_user_info
*
* @mbg.generated
*/
int updateByPrimaryKeySelective(ThirdPartyUserDO record);
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table third_party_user_info
*
* @mbg.generated
*/
int updateByPrimaryKey(ThirdPartyUserDO record);
}

View File

@@ -0,0 +1,52 @@
<?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="plus.bookshelf.Dao.Mapper.ThirdPartyUserAuthDOMapper">
<resultMap id="BaseResultMap" type="plus.bookshelf.Dao.DO.ThirdPartyUserAuthDO">
<!--
WARNING - @mbg.generated
This element is automatically generated by MyBatis Generator, do not modify.
-->
<result column="id" jdbcType="INTEGER" property="id" />
<result column="user_id" jdbcType="VARCHAR" property="userId" />
<result column="third_party_user_id" jdbcType="VARCHAR" property="thirdPartyUserId" />
</resultMap>
<insert id="insert" parameterType="plus.bookshelf.Dao.DO.ThirdPartyUserAuthDO">
<!--
WARNING - @mbg.generated
This element is automatically generated by MyBatis Generator, do not modify.
-->
insert into third_party_user_auth_relation (id, user_id, third_party_user_id
)
values (#{id,jdbcType=INTEGER}, #{userId,jdbcType=VARCHAR}, #{thirdPartyUserId,jdbcType=VARCHAR}
)
</insert>
<insert id="insertSelective" parameterType="plus.bookshelf.Dao.DO.ThirdPartyUserAuthDO">
<!--
WARNING - @mbg.generated
This element is automatically generated by MyBatis Generator, do not modify.
-->
insert into third_party_user_auth_relation
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="id != null">
id,
</if>
<if test="userId != null">
user_id,
</if>
<if test="thirdPartyUserId != null">
third_party_user_id,
</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="id != null">
#{id,jdbcType=INTEGER},
</if>
<if test="userId != null">
#{userId,jdbcType=VARCHAR},
</if>
<if test="thirdPartyUserId != null">
#{thirdPartyUserId,jdbcType=VARCHAR},
</if>
</trim>
</insert>
</mapper>

View File

@@ -0,0 +1,280 @@
<?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="plus.bookshelf.Dao.Mapper.ThirdPartyUserDOMapper">
<resultMap id="BaseResultMap" type="plus.bookshelf.Dao.DO.ThirdPartyUserDO">
<!--
WARNING - @mbg.generated
This element is automatically generated by MyBatis Generator, do not modify.
-->
<id column="id" jdbcType="INTEGER" property="id" />
<result column="uuid" jdbcType="VARCHAR" property="uuid" />
<result column="source" jdbcType="VARCHAR" property="source" />
<result column="access_token" jdbcType="VARCHAR" property="accessToken" />
<result column="expire_in" jdbcType="INTEGER" property="expireIn" />
<result column="refresh_token" jdbcType="VARCHAR" property="refreshToken" />
<result column="open_id" jdbcType="VARCHAR" property="openId" />
<result column="uid" jdbcType="VARCHAR" property="uid" />
<result column="access_code" jdbcType="VARCHAR" property="accessCode" />
<result column="union_id" jdbcType="VARCHAR" property="unionId" />
<result column="scope" jdbcType="VARCHAR" property="scope" />
<result column="token_type" jdbcType="VARCHAR" property="tokenType" />
<result column="id_token" jdbcType="VARCHAR" property="idToken" />
<result column="mac_algorithm" jdbcType="VARCHAR" property="macAlgorithm" />
<result column="mac_key" jdbcType="VARCHAR" property="macKey" />
<result column="code" jdbcType="VARCHAR" property="code" />
<result column="oauth_token" jdbcType="VARCHAR" property="oauthToken" />
<result column="oauth_token_secret" jdbcType="VARCHAR" property="oauthTokenSecret" />
</resultMap>
<sql id="Base_Column_List">
<!--
WARNING - @mbg.generated
This element is automatically generated by MyBatis Generator, do not modify.
-->
id, uuid, `source`, access_token, expire_in, refresh_token, open_id, `uid`, access_code,
union_id, `scope`, token_type, id_token, mac_algorithm, mac_key, code, oauth_token,
oauth_token_secret
</sql>
<select id="selectByPrimaryKey" parameterType="java.lang.Integer" resultMap="BaseResultMap">
<!--
WARNING - @mbg.generated
This element is automatically generated by MyBatis Generator, do not modify.
-->
select
<include refid="Base_Column_List" />
from third_party_user_info
where id = #{id,jdbcType=INTEGER}
</select>
<delete id="deleteByPrimaryKey" parameterType="java.lang.Integer">
<!--
WARNING - @mbg.generated
This element is automatically generated by MyBatis Generator, do not modify.
-->
delete from third_party_user_info
where id = #{id,jdbcType=INTEGER}
</delete>
<insert id="insert" parameterType="plus.bookshelf.Dao.DO.ThirdPartyUserDO">
<!--
WARNING - @mbg.generated
This element is automatically generated by MyBatis Generator, do not modify.
-->
insert into third_party_user_info (id, uuid, `source`,
access_token, expire_in, refresh_token,
open_id, `uid`, access_code,
union_id, `scope`, token_type,
id_token, mac_algorithm, mac_key,
code, oauth_token, oauth_token_secret
)
values (#{id,jdbcType=INTEGER}, #{uuid,jdbcType=VARCHAR}, #{source,jdbcType=VARCHAR},
#{accessToken,jdbcType=VARCHAR}, #{expireIn,jdbcType=INTEGER}, #{refreshToken,jdbcType=VARCHAR},
#{openId,jdbcType=VARCHAR}, #{uid,jdbcType=VARCHAR}, #{accessCode,jdbcType=VARCHAR},
#{unionId,jdbcType=VARCHAR}, #{scope,jdbcType=VARCHAR}, #{tokenType,jdbcType=VARCHAR},
#{idToken,jdbcType=VARCHAR}, #{macAlgorithm,jdbcType=VARCHAR}, #{macKey,jdbcType=VARCHAR},
#{code,jdbcType=VARCHAR}, #{oauthToken,jdbcType=VARCHAR}, #{oauthTokenSecret,jdbcType=VARCHAR}
)
</insert>
<insert id="insertSelective" parameterType="plus.bookshelf.Dao.DO.ThirdPartyUserDO">
<!--
WARNING - @mbg.generated
This element is automatically generated by MyBatis Generator, do not modify.
-->
insert into third_party_user_info
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="id != null">
id,
</if>
<if test="uuid != null">
uuid,
</if>
<if test="source != null">
`source`,
</if>
<if test="accessToken != null">
access_token,
</if>
<if test="expireIn != null">
expire_in,
</if>
<if test="refreshToken != null">
refresh_token,
</if>
<if test="openId != null">
open_id,
</if>
<if test="uid != null">
`uid`,
</if>
<if test="accessCode != null">
access_code,
</if>
<if test="unionId != null">
union_id,
</if>
<if test="scope != null">
`scope`,
</if>
<if test="tokenType != null">
token_type,
</if>
<if test="idToken != null">
id_token,
</if>
<if test="macAlgorithm != null">
mac_algorithm,
</if>
<if test="macKey != null">
mac_key,
</if>
<if test="code != null">
code,
</if>
<if test="oauthToken != null">
oauth_token,
</if>
<if test="oauthTokenSecret != null">
oauth_token_secret,
</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="id != null">
#{id,jdbcType=INTEGER},
</if>
<if test="uuid != null">
#{uuid,jdbcType=VARCHAR},
</if>
<if test="source != null">
#{source,jdbcType=VARCHAR},
</if>
<if test="accessToken != null">
#{accessToken,jdbcType=VARCHAR},
</if>
<if test="expireIn != null">
#{expireIn,jdbcType=INTEGER},
</if>
<if test="refreshToken != null">
#{refreshToken,jdbcType=VARCHAR},
</if>
<if test="openId != null">
#{openId,jdbcType=VARCHAR},
</if>
<if test="uid != null">
#{uid,jdbcType=VARCHAR},
</if>
<if test="accessCode != null">
#{accessCode,jdbcType=VARCHAR},
</if>
<if test="unionId != null">
#{unionId,jdbcType=VARCHAR},
</if>
<if test="scope != null">
#{scope,jdbcType=VARCHAR},
</if>
<if test="tokenType != null">
#{tokenType,jdbcType=VARCHAR},
</if>
<if test="idToken != null">
#{idToken,jdbcType=VARCHAR},
</if>
<if test="macAlgorithm != null">
#{macAlgorithm,jdbcType=VARCHAR},
</if>
<if test="macKey != null">
#{macKey,jdbcType=VARCHAR},
</if>
<if test="code != null">
#{code,jdbcType=VARCHAR},
</if>
<if test="oauthToken != null">
#{oauthToken,jdbcType=VARCHAR},
</if>
<if test="oauthTokenSecret != null">
#{oauthTokenSecret,jdbcType=VARCHAR},
</if>
</trim>
</insert>
<update id="updateByPrimaryKeySelective" parameterType="plus.bookshelf.Dao.DO.ThirdPartyUserDO">
<!--
WARNING - @mbg.generated
This element is automatically generated by MyBatis Generator, do not modify.
-->
update third_party_user_info
<set>
<if test="uuid != null">
uuid = #{uuid,jdbcType=VARCHAR},
</if>
<if test="source != null">
`source` = #{source,jdbcType=VARCHAR},
</if>
<if test="accessToken != null">
access_token = #{accessToken,jdbcType=VARCHAR},
</if>
<if test="expireIn != null">
expire_in = #{expireIn,jdbcType=INTEGER},
</if>
<if test="refreshToken != null">
refresh_token = #{refreshToken,jdbcType=VARCHAR},
</if>
<if test="openId != null">
open_id = #{openId,jdbcType=VARCHAR},
</if>
<if test="uid != null">
`uid` = #{uid,jdbcType=VARCHAR},
</if>
<if test="accessCode != null">
access_code = #{accessCode,jdbcType=VARCHAR},
</if>
<if test="unionId != null">
union_id = #{unionId,jdbcType=VARCHAR},
</if>
<if test="scope != null">
`scope` = #{scope,jdbcType=VARCHAR},
</if>
<if test="tokenType != null">
token_type = #{tokenType,jdbcType=VARCHAR},
</if>
<if test="idToken != null">
id_token = #{idToken,jdbcType=VARCHAR},
</if>
<if test="macAlgorithm != null">
mac_algorithm = #{macAlgorithm,jdbcType=VARCHAR},
</if>
<if test="macKey != null">
mac_key = #{macKey,jdbcType=VARCHAR},
</if>
<if test="code != null">
code = #{code,jdbcType=VARCHAR},
</if>
<if test="oauthToken != null">
oauth_token = #{oauthToken,jdbcType=VARCHAR},
</if>
<if test="oauthTokenSecret != null">
oauth_token_secret = #{oauthTokenSecret,jdbcType=VARCHAR},
</if>
</set>
where id = #{id,jdbcType=INTEGER}
</update>
<update id="updateByPrimaryKey" parameterType="plus.bookshelf.Dao.DO.ThirdPartyUserDO">
<!--
WARNING - @mbg.generated
This element is automatically generated by MyBatis Generator, do not modify.
-->
update third_party_user_info
set uuid = #{uuid,jdbcType=VARCHAR},
`source` = #{source,jdbcType=VARCHAR},
access_token = #{accessToken,jdbcType=VARCHAR},
expire_in = #{expireIn,jdbcType=INTEGER},
refresh_token = #{refreshToken,jdbcType=VARCHAR},
open_id = #{openId,jdbcType=VARCHAR},
`uid` = #{uid,jdbcType=VARCHAR},
access_code = #{accessCode,jdbcType=VARCHAR},
union_id = #{unionId,jdbcType=VARCHAR},
`scope` = #{scope,jdbcType=VARCHAR},
token_type = #{tokenType,jdbcType=VARCHAR},
id_token = #{idToken,jdbcType=VARCHAR},
mac_algorithm = #{macAlgorithm,jdbcType=VARCHAR},
mac_key = #{macKey,jdbcType=VARCHAR},
code = #{code,jdbcType=VARCHAR},
oauth_token = #{oauthToken,jdbcType=VARCHAR},
oauth_token_secret = #{oauthTokenSecret,jdbcType=VARCHAR}
where id = #{id,jdbcType=INTEGER}
</update>
</mapper>

View File

@@ -76,9 +76,6 @@
<!--<table tableName="book_info" domainObjectName="BookDO" enableCountByExample="false"-->
<!-- enableUpdateByExample="false" enableDeleteByExample="false" enableSelectByExample="true"-->
<!-- selectByExampleQueryId="false"></table>-->
<!--<table tableName="book_thumbnail_info" domainObjectName="ThumbnailDO" enableCountByExample="false"-->
<!-- enableUpdateByExample="false" enableDeleteByExample="false" enableSelectByExample="false"-->
<!-- selectByExampleQueryId="false"></table>-->
<!--<table tableName="category_info" domainObjectName="CategoryDO" enableCountByExample="false"-->
<!-- enableUpdateByExample="false" enableDeleteByExample="false" enableSelectByExample="false"-->
<!-- selectByExampleQueryId="false"></table>-->
@@ -91,5 +88,11 @@
<!--<table tableName="user_info" domainObjectName="UserDO" enableCountByExample="false"-->
<!-- enableUpdateByExample="false" enableDeleteByExample="false" enableSelectByExample="false"-->
<!-- selectByExampleQueryId="false"></table>-->
<!--<table tableName="third_party_user_info" domainObjectName="ThirdPartyUserDO" enableCountByExample="false"-->
<!-- enableUpdateByExample="false" enableDeleteByExample="false" enableSelectByExample="false"-->
<!-- selectByExampleQueryId="false"></table>-->
<!--<table tableName="third_party_user_auth_relation" domainObjectName="ThirdPartyUserAuthDO" enableCountByExample="false"-->
<!-- enableUpdateByExample="false" enableDeleteByExample="false" enableSelectByExample="false"-->
<!-- selectByExampleQueryId="false"></table>-->
</context>
</generatorConfiguration>

View File

@@ -0,0 +1,15 @@
# 第三方登录 Client ID 和 Client Secret
# Gitee
thirdparty.gitee.clientid=
thirdparty.gitee.clientsecret=
thirdparty.gitee.redirecturi=
# GitHub
thirdparty.github.clientid=
thirdparty.github.clientsecret=
thirdparty.github.redirecturi=
# QQ
thirdparty.qq.clientid=
thirdparty.qq.clientsecret=
thirdparty.qq.redirecturi=