第一次提交

This commit is contained in:
wyw
2024-08-08 00:31:26 +08:00
commit c202e2b63d
1819 changed files with 221890 additions and 0 deletions

View File

@ -0,0 +1,78 @@
<?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="com.fastbee.oauth.mapper.OauthAccessTokenMapper">
<resultMap id="BaseResult" type="com.fastbee.oauth.domain.OauthAccessToken">
<result column="token_id" property="tokenId"></result>
<result column="token" property="token"></result>
<result column="authentication_id" property="authenticationId"></result>
<result column="user_name" property="userName"></result>
<result column="client_id" property="clientId"></result>
<result column="authentication" property="authentication"></result>
<result column="refresh_token" property="refreshToken"></result>
<result column="open_id" property="openId"></result>
<result column="user_id" property="userId"></result>
<result column="expires_time" property="expiresTime"></result>
</resultMap>
<sql id="selectOauthAccessTokenVo">
select token_id, token, authentication_id, user_name, client_id, authentication, refresh_token, open_id, user_id, expires_time from oauth_access_token
</sql>
<update id="updateOpenIdByTokenId">
update oauth_access_token
set open_id = #{openUid}
where token_id = #{tokenId}
</update>
<delete id="deleteByUserId">
delete
from oauth_access_token
where user_id = #{userId}
</delete>
<select id="selectUserNameByTokenId" resultType="java.lang.String">
select user_name
from oauth_access_token
where token_id = #{tokenId}
</select>
<select id="selectByTokenId" resultType="com.fastbee.oauth.domain.OauthAccessToken">
<include refid="selectOauthAccessTokenVo"/>
where token_id = #{tokenId}
</select>
<select id="selectByUserName" resultType="com.fastbee.oauth.domain.OauthAccessToken">
<include refid="selectOauthAccessTokenVo"/>
where user_name = #{userName}
</select>
<insert id="insertOauthAccessToken" parameterType="OauthAccessToken">
insert into oauth_access_token
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="tokenId != null">token_id,</if>
<if test="token != null">token,</if>
<if test="authenticationId != null">authentication_id,</if>
<if test="userName != null">user_name,</if>
<if test="clientId != null">client_id,</if>
<if test="authentication != null">authentication,</if>
<if test="refreshToken != null">refresh_token,</if>
<if test="openId != null">open_id,</if>
<if test="userId != null">user_id,</if>
<if test="expiresTime != null">expires_time,</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="tokenId != null">#{tokenId},</if>
<if test="token != null">#{token},</if>
<if test="authenticationId != null">#{authenticationId},</if>
<if test="userName != null">#{userName},</if>
<if test="clientId != null">#{clientId},</if>
<if test="authentication != null">#{authentication},</if>
<if test="refreshToken != null">#{refreshToken},</if>
<if test="openId != null">#{openId},</if>
<if test="userId != null">#{userId},</if>
<if test="expiresTime != null">#{expiresTime},</if>
</trim>
</insert>
</mapper>

View File

@ -0,0 +1,94 @@
<?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="com.fastbee.oauth.mapper.OauthApprovalsMapper">
<resultMap type="OauthApprovals" id="OauthApprovalsResult">
<result property="userid" column="userId" />
<result property="clientid" column="clientId" />
<result property="scope" column="scope" />
<result property="status" column="status" />
<result property="expiresat" column="expiresAt" />
<result property="lastmodifiedat" column="lastModifiedAt" />
</resultMap>
<sql id="selectOauthApprovalsVo">
select userId, clientId, scope, status, expiresAt, lastModifiedAt from oauth_approvals
</sql>
<select id="selectOauthApprovalsList" parameterType="OauthApprovals" resultMap="OauthApprovalsResult">
<include refid="selectOauthApprovalsVo"/>
<where>
<if test="userid != null and userid != ''"> and userId = #{userid}</if>
<if test="clientid != null and clientid != ''"> and clientId = #{clientid}</if>
<if test="scope != null and scope != ''"> and scope = #{scope}</if>
<if test="status != null and status != ''"> and status = #{status}</if>
<if test="expiresat != null "> and expiresAt = #{expiresat}</if>
<if test="lastmodifiedat != null "> and lastModifiedAt = #{lastmodifiedat}</if>
</where>
</select>
<select id="selectOauthApprovalsByUserid" parameterType="String" resultMap="OauthApprovalsResult">
<include refid="selectOauthApprovalsVo"/>
where userId = #{userid}
</select>
<select id="selectListByUserIdAndClientId" resultType="com.fastbee.oauth.domain.OauthApprovals">
select *
from oauth_approvals
where userid = #{userId}
and clientid = #{clientId}
</select>
<insert id="insertOauthApprovals" parameterType="OauthApprovals">
insert into oauth_approvals
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="userid != null">userId,</if>
<if test="clientid != null">clientId,</if>
<if test="scope != null">scope,</if>
<if test="status != null">status,</if>
<if test="expiresat != null">expiresAt,</if>
<if test="lastmodifiedat != null">lastModifiedAt,</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="userid != null">#{userid},</if>
<if test="clientid != null">#{clientid},</if>
<if test="scope != null">#{scope},</if>
<if test="status != null">#{status},</if>
<if test="expiresat != null">#{expiresat},</if>
<if test="lastmodifiedat != null">#{lastmodifiedat},</if>
</trim>
</insert>
<update id="updateOauthApprovals" parameterType="OauthApprovals">
update oauth_approvals
<trim prefix="SET" suffixOverrides=",">
<if test="clientid != null">clientId = #{clientid},</if>
<if test="scope != null">scope = #{scope},</if>
<if test="status != null">status = #{status},</if>
<if test="expiresat != null">expiresAt = #{expiresat},</if>
<if test="lastmodifiedat != null">lastModifiedAt = #{lastmodifiedat},</if>
</trim>
where userId = #{userid}
</update>
<update id="update">
update oauth_approvals
set status = #{status},
expiresat = #{expiresat}
where userid = #{userid}
and clientid = #{clientid}
and scope = #{scope}
</update>
<delete id="deleteOauthApprovalsByUserid" parameterType="String">
delete from oauth_approvals where userId = #{userid}
</delete>
<delete id="deleteOauthApprovalsByUserids" parameterType="String">
delete from oauth_approvals where userId in
<foreach item="userid" collection="array" open="(" separator="," close=")">
#{userid}
</foreach>
</delete>
</mapper>

View File

@ -0,0 +1,135 @@
<?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="com.fastbee.oauth.mapper.OauthClientDetailsMapper">
<resultMap type="com.fastbee.oauth.domain.OauthClientDetails" id="OauthClientDetailsResult">
<result property="id" column="id" />
<result property="clientId" column="client_id" />
<result property="resourceIds" column="resource_ids" />
<result property="clientSecret" column="client_secret" />
<result property="scope" column="scope" />
<result property="authorizedGrantTypes" column="authorized_grant_types" />
<result property="webServerRedirectUri" column="web_server_redirect_uri" />
<result property="authorities" column="authorities" />
<result property="accessTokenValidity" column="access_token_validity" />
<result property="refreshTokenValidity" column="refresh_token_validity" />
<result property="additionalInformation" column="additional_information" />
<result property="autoapprove" column="autoapprove" />
<result property="type" column="type" />
<result property="status" column="status" />
<result property="icon" column="icon" />
<result property="cloudSkillId" column="cloud_skill_id" />
<result property="tenantId" column="tenant_id" />
<result property="tenantName" column="tenant_name" />
</resultMap>
<sql id="selectOauthClientDetailsVo">
select id, client_id, resource_ids, client_secret, scope, authorized_grant_types, web_server_redirect_uri, authorities, access_token_validity, refresh_token_validity, additional_information, autoapprove, type, status, icon, cloud_skill_id,tenant_id, tenant_name from oauth_client_details
</sql>
<select id="selectOauthClientDetailsList" parameterType="com.fastbee.oauth.domain.OauthClientDetails" resultMap="OauthClientDetailsResult">
<include refid="selectOauthClientDetailsVo"/>
<where>
<if test="clientId != null and clientId != ''"> and client_id = #{clientId}</if>
<if test="authorizedGrantTypes != null and authorizedGrantTypes != ''"> and authorized_grant_types = #{authorizedGrantTypes}</if>
<if test="autoapprove != null and autoapprove != ''"> and autoapprove = #{autoapprove}</if>
<if test="type != null "> and type = #{type}</if>
<if test="tenantId != null "> and tenant_id = #{tenantId}</if>
</where>
</select>
<select id="selectOauthClientDetailsById" parameterType="Long" resultMap="OauthClientDetailsResult">
<include refid="selectOauthClientDetailsVo"/>
where id = #{id}
</select>
<select id="selectOauthClientDetailsByType" resultType="com.fastbee.oauth.domain.OauthClientDetails">
<include refid="selectOauthClientDetailsVo"/>
where type = #{type}
and tenant_id = #{tenantId}
</select>
<select id="selectOauthClientDetailsByClientId" resultType="com.fastbee.oauth.domain.OauthClientDetails">
<include refid="selectOauthClientDetailsVo"/>
where client_id = #{clientId}
</select>
<insert id="insertOauthClientDetails" parameterType="com.fastbee.oauth.domain.OauthClientDetails">
insert into oauth_client_details
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="clientId != null">client_id,</if>
<if test="resourceIds != null">resource_ids,</if>
<if test="clientSecret != null">client_secret,</if>
<if test="scope != null">scope,</if>
<if test="authorizedGrantTypes != null">authorized_grant_types,</if>
<if test="webServerRedirectUri != null">web_server_redirect_uri,</if>
<if test="authorities != null">authorities,</if>
<if test="accessTokenValidity != null">access_token_validity,</if>
<if test="refreshTokenValidity != null">refresh_token_validity,</if>
<if test="additionalInformation != null">additional_information,</if>
<if test="autoapprove != null">autoapprove,</if>
<if test="type != null">type,</if>
<if test="status != null">status,</if>
<if test="icon != null">icon,</if>
<if test="cloudSkillId != null">cloud_skill_id,</if>
<if test="tenantId != null">tenant_id,</if>
<if test="tenantName != null and tenantName != ''">tenant_name,</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="clientId != null">#{clientId},</if>
<if test="resourceIds != null">#{resourceIds},</if>
<if test="clientSecret != null">#{clientSecret},</if>
<if test="scope != null">#{scope},</if>
<if test="authorizedGrantTypes != null">#{authorizedGrantTypes},</if>
<if test="webServerRedirectUri != null">#{webServerRedirectUri},</if>
<if test="authorities != null">#{authorities},</if>
<if test="accessTokenValidity != null">#{accessTokenValidity},</if>
<if test="refreshTokenValidity != null">#{refreshTokenValidity},</if>
<if test="additionalInformation != null">#{additionalInformation},</if>
<if test="autoapprove != null">#{autoapprove},</if>
<if test="type != null">#{type},</if>
<if test="status != null">#{status},</if>
<if test="icon != null">#{icon},</if>
<if test="cloudSkillId != null">#{cloudSkillId},</if>
<if test="tenantId != null">#{tenantId},</if>
<if test="tenantName != null and tenantName != ''">#{tenantName},</if>
</trim>
</insert>
<update id="updateOauthClientDetails" parameterType="com.fastbee.oauth.domain.OauthClientDetails">
update oauth_client_details
<trim prefix="SET" suffixOverrides=",">
<if test="clientId != null">client_id = #{clientId},</if>
<if test="resourceIds != null">resource_ids = #{resourceIds},</if>
<if test="clientSecret != null">client_secret = #{clientSecret},</if>
<if test="scope != null">scope = #{scope},</if>
<if test="authorizedGrantTypes != null">authorized_grant_types = #{authorizedGrantTypes},</if>
<if test="webServerRedirectUri != null">web_server_redirect_uri = #{webServerRedirectUri},</if>
<if test="authorities != null">authorities = #{authorities},</if>
<!-- <if test="accessTokenValidity != null">access_token_validity = #{accessTokenValidity},</if>-->
<!-- <if test="refreshTokenValidity != null">refresh_token_validity = #{refreshTokenValidity},</if>-->
access_token_validity = #{accessTokenValidity},
refresh_token_validity = #{refreshTokenValidity},
<if test="additionalInformation != null">additional_information = #{additionalInformation},</if>
<if test="autoapprove != null">autoapprove = #{autoapprove},</if>
<if test="type != null">type = #{type},</if>
<if test="status != null">status = #{status},</if>
<if test="icon != null">icon = #{icon},</if>
<if test="cloudSkillId != null">cloud_skill_id = #{cloudSkillId},</if>
</trim>
where id = #{id}
</update>
<delete id="deleteOauthClientDetailsByClientId" parameterType="String">
delete from oauth_client_details where client_id = #{clientId}
</delete>
<delete id="deleteOauthClientDetailsByIds" parameterType="Long">
delete from oauth_client_details where id in
<foreach item="id" collection="array" open="(" separator="," close=")">
#{id}
</foreach>
</delete>
</mapper>

View File

@ -0,0 +1,64 @@
<?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="com.fastbee.oauth.mapper.OauthCodeMapper">
<resultMap type="OauthCode" id="OauthCodeResult">
<result property="code" column="code" />
<result property="authentication" column="authentication" />
<result property="userId" column="user_id" />
</resultMap>
<sql id="selectOauthCodeVo">
select code, authentication, user_id from oauth_code
</sql>
<select id="selectOauthCodeList" parameterType="OauthCode" resultMap="OauthCodeResult">
<include refid="selectOauthCodeVo"/>
<where>
<if test="code != null and code != ''"> and code = #{code}</if>
<if test="authentication != null and authentication != ''"> and authentication = #{authentication}</if>
<if test="userId != null "> and user_id = #{userId}</if>
</where>
</select>
<select id="selectOauthCodeByCode" parameterType="String" resultMap="OauthCodeResult">
<include refid="selectOauthCodeVo"/>
where code = #{code}
</select>
<insert id="insertOauthCode" parameterType="OauthCode">
insert into oauth_code
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="code != null">code,</if>
<if test="authentication != null">authentication,</if>
<if test="userId != null">user_id,</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="code != null">#{code},</if>
<if test="authentication != null">#{authentication},</if>
<if test="userId != null">#{userId},</if>
</trim>
</insert>
<update id="updateOauthCode" parameterType="OauthCode">
update oauth_code
<trim prefix="SET" suffixOverrides=",">
<if test="authentication != null">authentication = #{authentication},</if>
<if test="userId != null">user_id = #{userId},</if>
</trim>
where code = #{code}
</update>
<delete id="deleteOauthCodeByCode" parameterType="String">
delete from oauth_code where code = #{code}
</delete>
<delete id="deleteOauthCodeByCodes" parameterType="String">
delete from oauth_code where code in
<foreach item="code" collection="array" open="(" separator="," close=")">
#{code}
</foreach>
</delete>
</mapper>