leutu
2024-06-03 3ef35e6cd16bbfa206b26bb3271eac40ad020bcb
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
<?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.iot.mapper.OauthClientDetailsMapper">
    
    <resultMap type="com.fastbee.iot.domain.OauthClientDetails" id="OauthClientDetailsResult">
        <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"    />
    </resultMap>
 
    <sql id="selectOauthClientDetailsVo">
        select 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 from oauth_client_details
    </sql>
 
    <select id="selectOauthClientDetailsList" parameterType="com.fastbee.iot.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>
        </where>
    </select>
    
    <select id="selectOauthClientDetailsByClientId" parameterType="String" resultMap="OauthClientDetailsResult">
        <include refid="selectOauthClientDetailsVo"/>
        where client_id = #{clientId}
    </select>
        
    <insert id="insertOauthClientDetails" parameterType="com.fastbee.iot.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>
         </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>
         </trim>
    </insert>
 
    <update id="updateOauthClientDetails" parameterType="com.fastbee.iot.domain.OauthClientDetails">
        update oauth_client_details
        <trim prefix="SET" suffixOverrides=",">
            <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>
            <if test="additionalInformation != null">additional_information = #{additionalInformation},</if>
            <if test="autoapprove != null">autoapprove = #{autoapprove},</if>
            <if test="type != null">type = #{type},</if>
        </trim>
        where client_id = #{clientId}
    </update>
 
    <delete id="deleteOauthClientDetailsByClientId" parameterType="String">
        delete from oauth_client_details where client_id = #{clientId}
    </delete>
 
    <delete id="deleteOauthClientDetailsByClientIds" parameterType="String">
        delete from oauth_client_details where client_id in 
        <foreach item="clientId" collection="array" open="(" separator="," close=")">
            #{clientId}
        </foreach>
    </delete>
</mapper>