root преди 5 години
родител
ревизия
9b44019674

+ 1 - 1
facade/src/app/routes/passport/login/login.component.html

@@ -41,7 +41,7 @@
41 41
 </form>
42 42
 <div class="other">
43 43
   {{ 'app.login.sign-in-with' | translate }}
44
-  <i nz-tooltip="使用中联HIS登录" (click)="open('zlhis', 'window')" nz-icon type="alipay-circle" class="icon"></i>
44
+  <i *ngFor="let item of threeLogin" [nz-tooltip]="item.name" (click)="open(item, 'window')" nz-icon type="alipay-circle" class="icon"></i>
45 45
   <!-- <i nz-tooltip="in fact Github via redirect" (click)="open('github')" nz-icon type="taobao-circle" class="icon"></i>
46 46
   <i (click)="open('weibo', 'window')" nz-icon type="weibo-circle" class="icon"></i> -->
47 47
   <a class="register" routerLink="/passport/register">{{ 'app.login.signup' | translate }}</a>

+ 32 - 26
facade/src/app/routes/passport/login/login.component.ts

@@ -27,6 +27,7 @@ export class UserLoginComponent implements OnDestroy {
27 27
   form: FormGroup;
28 28
   error = '';
29 29
   type = 0;
30
+  threeLogin: any[] = [];
30 31
 
31 32
   constructor(
32 33
     fb: FormBuilder,
@@ -50,6 +51,7 @@ export class UserLoginComponent implements OnDestroy {
50 51
       remember: [true],
51 52
     });
52 53
     modalSrv.closeAll();
54
+    this.threeLogin = this.settingsService.user.threeLogin || [];
53 55
   }
54 56
 
55 57
   // #region fields
@@ -164,36 +166,40 @@ export class UserLoginComponent implements OnDestroy {
164 166
 
165 167
   // #region social
166 168
 
167
-  open(type: string, openType: SocialOpenType = 'href') {
169
+  open(item: object, openType: SocialOpenType = 'href') {
168 170
     let url = ``;
169 171
     let callback = ``;
170
-    if (environment.production) {
171
-      callback = 'https://ng-alain.github.io/ng-alain/#/callback/' + type;
172
-    } else {
173
-      callback = 'http://localhost:4200/#/callback/' + type;
174
-    }
175
-    switch (type) {
176
-      case 'auth0':
177
-        url = `//cipchk.auth0.com/login?client=8gcNydIDzGBYxzqV0Vm1CX_RXH-wsWo5&redirect_uri=${decodeURIComponent(
178
-          callback,
179
-        )}`;
180
-        break;
181
-      case 'github':
182
-        url = `//github.com/login/oauth/authorize?client_id=9d6baae4b04a23fcafa2&response_type=code&redirect_uri=${decodeURIComponent(
183
-          callback,
184
-        )}`;
185
-        break;
186
-      case 'weibo':
187
-        url = `https://api.weibo.com/oauth2/authorize?client_id=1239507802&response_type=code&redirect_uri=${decodeURIComponent(
188
-          callback,
189
-        )}`;
190
-        break;
191
-      case 'zlhis':
192
-        url = `https://api.weibo.com/oauth2/authorize?client_id=1239507802&response_type=code&redirect_uri=${decodeURIComponent(
172
+    const type = item['code'];
173
+    //if (environment.production) {
174
+    //  callback = 'https://ng-alain.github.io/ng-alain/#/callback/' + type;
175
+    //} else {
176
+     callback = 'http://localhost:4200/#/callback/' + type;
177
+    //}
178
+    url = `${item['uri']}?client_id=${item['clientId']}&response_type=code&redirect_uri=${decodeURIComponent(
193 179
           callback,
194 180
         )}`;
195
-        break;
196
-    }
181
+    // switch (type) {
182
+    //   case 'auth0':
183
+    //     url = `//cipchk.auth0.com/login?client=8gcNydIDzGBYxzqV0Vm1CX_RXH-wsWo5&redirect_uri=${decodeURIComponent(
184
+    //       callback,
185
+    //     )}`;
186
+    //     break;
187
+    //   case 'github':
188
+    //     url = `//github.com/login/oauth/authorize?client_id=9d6baae4b04a23fcafa2&response_type=code&redirect_uri=${decodeURIComponent(
189
+    //       callback,
190
+    //     )}`;
191
+    //     break;
192
+    //   case 'weibo':
193
+    //     url = `https://api.weibo.com/oauth2/authorize?client_id=1239507802&response_type=code&redirect_uri=${decodeURIComponent(
194
+    //       callback,
195
+    //     )}`;
196
+    //     break;
197
+    //   case 'zlhis':
198
+    //     url = `https://api.weibo.com/oauth2/authorize?client_id=1239507802&response_type=code&redirect_uri=${decodeURIComponent(
199
+    //       callback,
200
+    //     )}`;
201
+    //     break;
202
+    // }
197 203
     if (openType === 'window') {
198 204
       this.socialService
199 205
         .login(url, '/', {

+ 5 - 5
pom.xml

@@ -137,11 +137,11 @@
137 137
 						<artifactId>ojdbc6</artifactId>
138 138
 						<version>11.2.0</version>
139 139
 					</dependency>
140
-					<dependency>
141
-						<groupId>org.mybatis.generator</groupId>
142
-						<artifactId>mybatis-generator-core</artifactId>
143
-						<version>1.3.7</version>
144
-					</dependency>
140
+					<!--<dependency>-->
141
+						<!--<groupId>org.mybatis.generator</groupId>-->
142
+						<!--<artifactId>mybatis-generator-core</artifactId>-->
143
+						<!--<version>1.3.7</version>-->
144
+					<!--</dependency>-->
145 145
 				</dependencies>
146 146
 			</plugin>
147 147
 			<plugin>

+ 12 - 3
src/main/java/com/kingkong/bljs/api/IndexController.java

@@ -3,6 +3,7 @@ package com.kingkong.bljs.api;
3 3
 import com.alibaba.fastjson.JSONArray;
4 4
 import com.alibaba.fastjson.JSONObject;
5 5
 import com.kingkong.bljs.dao.AppMapper;
6
+import com.kingkong.bljs.dao.ThreeloginMapper;
6 7
 import com.kingkong.bljs.entity.App;
7 8
 import com.kingkong.bljs.security.CustomUser;
8 9
 import com.kingkong.bljs.service.*;
@@ -57,6 +58,9 @@ public class IndexController extends ApiController {
57 58
     @Autowired
58 59
     private AppMapper appMapper;
59 60
 
61
+    @Autowired
62
+    private ThreeloginMapper threeloginMapper;
63
+
60 64
 
61 65
     @GetMapping("app")
62 66
     public Map app(@RequestParam("app_id") String app_id) throws Exception{
@@ -64,7 +68,11 @@ public class IndexController extends ApiController {
64 68
         List<Map> menu = new ArrayList<Map>();
65 69
         result.put("app",appInfo(app_id));
66 70
         result.put("menu",null);
67
-        result.put("user",new HashMap());
71
+
72
+        Map user = new HashMap();
73
+        user.put("threeLogin", threeloginMapper.selectByAppId(app_id));
74
+
75
+        result.put("user",user);
68 76
 
69 77
         return result;
70 78
     }
@@ -78,7 +86,7 @@ public class IndexController extends ApiController {
78 86
         //先清除缓存
79 87
         userService.clearUser(customUser.getUsername(),customUser.getAppid());
80 88
         Map user = userService.getCurrentUser();
81
-
89
+        user.put("threeLogin", threeloginMapper.selectByAppId(app_id));
82 90
 
83 91
         result.put("app",appInfo(app_id));
84 92
         if(null == user){
@@ -92,7 +100,8 @@ public class IndexController extends ApiController {
92 100
     }
93 101
 
94 102
     private App appInfo(String appid) throws Exception{
95
-        App app = appMapper.get(appid);
103
+
104
+        App app = appMapper.selectByPrimaryKey(Integer.parseInt(appid));
96 105
         if(null == app)
97 106
             throw new Exception("系统不存在!");
98 107
         if(app.getStatus() != 1)

+ 92 - 7
src/main/java/com/kingkong/bljs/dao/AppMapper.java

@@ -1,15 +1,100 @@
1 1
 package com.kingkong.bljs.dao;
2 2
 
3 3
 import com.kingkong.bljs.entity.App;
4
-import com.kingkong.bljs.entity.UserApi;
5
-import org.apache.ibatis.annotations.Param;
4
+import org.apache.ibatis.annotations.Delete;
5
+import org.apache.ibatis.annotations.Insert;
6
+import org.apache.ibatis.annotations.ResultMap;
6 7
 import org.apache.ibatis.annotations.Select;
8
+import org.apache.ibatis.annotations.Update;
7 9
 
8 10
 public interface AppMapper {
11
+    /**
12
+     * This method was generated by MyBatis Generator.
13
+     * This method corresponds to the database table K_USER.K_APP
14
+     *
15
+     * @mbg.generated Fri May 24 16:36:22 CST 2019
16
+     */
17
+    @Delete({
18
+        "delete from K_USER.K_APP",
19
+        "where ID = #{id,jdbcType=DECIMAL}"
20
+    })
21
+    int deleteByPrimaryKey(Integer id);
9 22
 
10
-    @Select("select * from k_app where client_id=#{client_id}")
11
-    App getByClientId(String client_id);
23
+    /**
24
+     * This method was generated by MyBatis Generator.
25
+     * This method corresponds to the database table K_USER.K_APP
26
+     *
27
+     * @mbg.generated Fri May 24 16:36:22 CST 2019
28
+     */
29
+    @Insert({
30
+        "insert into K_USER.K_APP (ID, NAME, ",
31
+        "NOTE, STATUS, ICON, ",
32
+        "CREATED_AT, UPDATED_AT, ",
33
+        "DELETED_AT, CLIENT_ID, ",
34
+        "CLIENT_SECRET, REDIRECT_URI)",
35
+        "values (#{id,jdbcType=DECIMAL}, #{name,jdbcType=VARCHAR}, ",
36
+        "#{note,jdbcType=VARCHAR}, #{status,jdbcType=DECIMAL}, #{icon,jdbcType=VARCHAR}, ",
37
+        "#{createdAt,jdbcType=DATE}, #{updatedAt,jdbcType=DATE}, ",
38
+        "#{deletedAt,jdbcType=DATE}, #{clientId,jdbcType=VARCHAR}, ",
39
+        "#{clientSecret,jdbcType=VARCHAR}, #{redirectUri,jdbcType=VARCHAR})"
40
+    })
41
+    int insert(App record);
12 42
 
13
-    @Select("select * from   where id=#{id}")
14
-    App get(String id);
15
-}
43
+    /**
44
+     * This method was generated by MyBatis Generator.
45
+     * This method corresponds to the database table K_USER.K_APP
46
+     *
47
+     * @mbg.generated Fri May 24 16:36:22 CST 2019
48
+     */
49
+    int insertSelective(App record);
50
+
51
+    /**
52
+     * This method was generated by MyBatis Generator.
53
+     * This method corresponds to the database table K_USER.K_APP
54
+     *
55
+     * @mbg.generated Fri May 24 16:36:22 CST 2019
56
+     */
57
+    @Select({
58
+        "select",
59
+        "ID, NAME, NOTE, STATUS, ICON, CREATED_AT, UPDATED_AT, DELETED_AT, CLIENT_ID, ",
60
+        "CLIENT_SECRET, REDIRECT_URI",
61
+        "from K_USER.K_APP",
62
+        "where ID = #{id,jdbcType=DECIMAL}"
63
+    })
64
+    @ResultMap("com.kingkong.bljs.dao.AppMapper.BaseResultMap")
65
+    App selectByPrimaryKey(Integer id);
66
+
67
+    /**
68
+     * This method was generated by MyBatis Generator.
69
+     * This method corresponds to the database table K_USER.K_APP
70
+     *
71
+     * @mbg.generated Fri May 24 16:36:22 CST 2019
72
+     */
73
+    int updateByPrimaryKeySelective(App record);
74
+
75
+    /**
76
+     * This method was generated by MyBatis Generator.
77
+     * This method corresponds to the database table K_USER.K_APP
78
+     *
79
+     * @mbg.generated Fri May 24 16:36:22 CST 2019
80
+     */
81
+    @Update({
82
+        "update K_USER.K_APP",
83
+        "set NAME = #{name,jdbcType=VARCHAR},",
84
+          "NOTE = #{note,jdbcType=VARCHAR},",
85
+          "STATUS = #{status,jdbcType=DECIMAL},",
86
+          "ICON = #{icon,jdbcType=VARCHAR},",
87
+          "CREATED_AT = #{createdAt,jdbcType=DATE},",
88
+          "UPDATED_AT = #{updatedAt,jdbcType=DATE},",
89
+          "DELETED_AT = #{deletedAt,jdbcType=DATE},",
90
+          "CLIENT_ID = #{clientId,jdbcType=VARCHAR},",
91
+          "CLIENT_SECRET = #{clientSecret,jdbcType=VARCHAR},",
92
+          "REDIRECT_URI = #{redirectUri,jdbcType=VARCHAR}",
93
+        "where ID = #{id,jdbcType=DECIMAL}"
94
+    })
95
+    int updateByPrimaryKey(App record);
96
+
97
+
98
+    @Select({"select * from k_app where client_id=#{clientId}"})
99
+    App selectByClientId(String clientId);
100
+}

+ 96 - 0
src/main/java/com/kingkong/bljs/dao/ThreeloginMapper.java

@@ -0,0 +1,96 @@
1
+package com.kingkong.bljs.dao;
2
+
3
+import com.kingkong.bljs.entity.Threelogin;
4
+import org.apache.ibatis.annotations.Delete;
5
+import org.apache.ibatis.annotations.Insert;
6
+import org.apache.ibatis.annotations.ResultMap;
7
+import org.apache.ibatis.annotations.Select;
8
+import org.apache.ibatis.annotations.Update;
9
+
10
+import java.util.List;
11
+
12
+public interface ThreeloginMapper {
13
+    /**
14
+     * This method was generated by MyBatis Generator.
15
+     * This method corresponds to the database table K_USER.K_THREE_LOGIN
16
+     *
17
+     * @mbg.generated Fri May 24 17:01:32 CST 2019
18
+     */
19
+    @Delete({
20
+        "delete from K_USER.K_THREE_LOGIN",
21
+        "where CODE = #{code,jdbcType=VARCHAR}"
22
+    })
23
+    int deleteByPrimaryKey(String code);
24
+
25
+    /**
26
+     * This method was generated by MyBatis Generator.
27
+     * This method corresponds to the database table K_USER.K_THREE_LOGIN
28
+     *
29
+     * @mbg.generated Fri May 24 17:01:32 CST 2019
30
+     */
31
+    @Insert({
32
+        "insert into K_USER.K_THREE_LOGIN (CODE, CLIENT_ID, ",
33
+        "CLIENT_SECRET, NAME, ",
34
+        "CREATED_AT, UPDATED_AT, ",
35
+        "DELETED_AT, APP_ID)",
36
+        "values (#{code,jdbcType=VARCHAR}, #{clientId,jdbcType=VARCHAR}, ",
37
+        "#{clientSecret,jdbcType=VARCHAR}, #{name,jdbcType=VARCHAR}, ",
38
+        "#{createdAt,jdbcType=DATE}, #{updatedAt,jdbcType=DATE}, ",
39
+        "#{deletedAt,jdbcType=DATE}, #{appId,jdbcType=DECIMAL})"
40
+    })
41
+    int insert(Threelogin record);
42
+
43
+    /**
44
+     * This method was generated by MyBatis Generator.
45
+     * This method corresponds to the database table K_USER.K_THREE_LOGIN
46
+     *
47
+     * @mbg.generated Fri May 24 17:01:32 CST 2019
48
+     */
49
+    int insertSelective(Threelogin record);
50
+
51
+    /**
52
+     * This method was generated by MyBatis Generator.
53
+     * This method corresponds to the database table K_USER.K_THREE_LOGIN
54
+     *
55
+     * @mbg.generated Fri May 24 17:01:32 CST 2019
56
+     */
57
+    @Select({
58
+        "select",
59
+        "CODE, CLIENT_ID, CLIENT_SECRET, NAME, CREATED_AT, UPDATED_AT, DELETED_AT, APP_ID",
60
+        "from K_USER.K_THREE_LOGIN",
61
+        "where CODE = #{code,jdbcType=VARCHAR}"
62
+    })
63
+    @ResultMap("com.kingkong.bljs.dao.ThreeloginMapper.BaseResultMap")
64
+    Threelogin selectByPrimaryKey(String code);
65
+
66
+    /**
67
+     * This method was generated by MyBatis Generator.
68
+     * This method corresponds to the database table K_USER.K_THREE_LOGIN
69
+     *
70
+     * @mbg.generated Fri May 24 17:01:32 CST 2019
71
+     */
72
+    int updateByPrimaryKeySelective(Threelogin record);
73
+
74
+    /**
75
+     * This method was generated by MyBatis Generator.
76
+     * This method corresponds to the database table K_USER.K_THREE_LOGIN
77
+     *
78
+     * @mbg.generated Fri May 24 17:01:32 CST 2019
79
+     */
80
+    @Update({
81
+        "update K_USER.K_THREE_LOGIN",
82
+        "set CLIENT_ID = #{clientId,jdbcType=VARCHAR},",
83
+          "CLIENT_SECRET = #{clientSecret,jdbcType=VARCHAR},",
84
+          "NAME = #{name,jdbcType=VARCHAR},",
85
+          "CREATED_AT = #{createdAt,jdbcType=DATE},",
86
+          "UPDATED_AT = #{updatedAt,jdbcType=DATE},",
87
+          "DELETED_AT = #{deletedAt,jdbcType=DATE},",
88
+          "APP_ID = #{appId,jdbcType=DECIMAL}",
89
+        "where CODE = #{code,jdbcType=VARCHAR}"
90
+    })
91
+    int updateByPrimaryKey(Threelogin record);
92
+
93
+
94
+    @Select({"select * from k_three_login where app_id=#{appid}"})
95
+    List<Threelogin> selectByAppId(String appid);
96
+}

+ 218 - 50
src/main/java/com/kingkong/bljs/entity/App.java

@@ -1,88 +1,256 @@
1 1
 package com.kingkong.bljs.entity;
2 2
 
3
+import java.util.Date;
4
+
3 5
 public class App {
4
-    private int id;
6
+    /**
7
+     *
8
+     * This field was generated by MyBatis Generator.
9
+     * This field corresponds to the database column K_USER.K_APP.ID
10
+     *
11
+     * @mbg.generated Fri May 24 16:36:22 CST 2019
12
+     */
13
+    private Integer id;
14
+
15
+    /**
16
+     *
17
+     * This field was generated by MyBatis Generator.
18
+     * This field corresponds to the database column K_USER.K_APP.NAME
19
+     *
20
+     * @mbg.generated Fri May 24 16:36:22 CST 2019
21
+     */
5 22
     private String name;
23
+
24
+    /**
25
+     *
26
+     * This field was generated by MyBatis Generator.
27
+     * This field corresponds to the database column K_USER.K_APP.NOTE
28
+     *
29
+     * @mbg.generated Fri May 24 16:36:22 CST 2019
30
+     */
6 31
     private String note;
7
-    private int status;
32
+
33
+    /**
34
+     *
35
+     * This field was generated by MyBatis Generator.
36
+     * This field corresponds to the database column K_USER.K_APP.STATUS
37
+     *
38
+     * @mbg.generated Fri May 24 16:36:22 CST 2019
39
+     */
40
+    private Short status;
41
+
42
+    /**
43
+     *
44
+     * This field was generated by MyBatis Generator.
45
+     * This field corresponds to the database column K_USER.K_APP.ICON
46
+     *
47
+     * @mbg.generated Fri May 24 16:36:22 CST 2019
48
+     */
8 49
     private String icon;
9
-    private String client_id;
10
-    private String client_secret;
11
-    private String redirect_uri;
12 50
 
51
+    /**
52
+     *
53
+     * This field was generated by MyBatis Generator.
54
+     * This field corresponds to the database column K_USER.K_APP.CREATED_AT
55
+     *
56
+     * @mbg.generated Fri May 24 16:36:22 CST 2019
57
+     */
58
+    private Date createdAt;
13 59
 
14
-    public int getId() {
15
-        return id;
16
-    }
60
+    /**
61
+     *
62
+     * This field was generated by MyBatis Generator.
63
+     * This field corresponds to the database column K_USER.K_APP.UPDATED_AT
64
+     *
65
+     * @mbg.generated Fri May 24 16:36:22 CST 2019
66
+     */
67
+    private Date updatedAt;
68
+
69
+    /**
70
+     *
71
+     * This field was generated by MyBatis Generator.
72
+     * This field corresponds to the database column K_USER.K_APP.DELETED_AT
73
+     *
74
+     * @mbg.generated Fri May 24 16:36:22 CST 2019
75
+     */
76
+    private Date deletedAt;
77
+
78
+    /**
79
+     *
80
+     * This field was generated by MyBatis Generator.
81
+     * This field corresponds to the database column K_USER.K_APP.CLIENT_ID
82
+     *
83
+     * @mbg.generated Fri May 24 16:36:22 CST 2019
84
+     */
85
+    private String clientId;
86
+
87
+    /**
88
+     *
89
+     * This field was generated by MyBatis Generator.
90
+     * This field corresponds to the database column K_USER.K_APP.CLIENT_SECRET
91
+     *
92
+     * @mbg.generated Fri May 24 16:36:22 CST 2019
93
+     */
94
+    private String clientSecret;
17 95
 
18
-    public void setId(int id) {
96
+    /**
97
+     *
98
+     * This field was generated by MyBatis Generator.
99
+     * This field corresponds to the database column K_USER.K_APP.REDIRECT_URI
100
+     *
101
+     * @mbg.generated Fri May 24 16:36:22 CST 2019
102
+     */
103
+    private String redirectUri;
104
+
105
+    /**
106
+     * This method was generated by MyBatis Generator.
107
+     * This method corresponds to the database table K_USER.K_APP
108
+     *
109
+     * @mbg.generated Fri May 24 16:36:22 CST 2019
110
+     */
111
+    public App(Integer id, String name, String note, Short status, String icon, Date createdAt, Date updatedAt, Date deletedAt, String clientId, String clientSecret, String redirectUri) {
19 112
         this.id = id;
113
+        this.name = name;
114
+        this.note = note;
115
+        this.status = status;
116
+        this.icon = icon;
117
+        this.createdAt = createdAt;
118
+        this.updatedAt = updatedAt;
119
+        this.deletedAt = deletedAt;
120
+        this.clientId = clientId;
121
+        this.clientSecret = clientSecret;
122
+        this.redirectUri = redirectUri;
20 123
     }
21 124
 
22
-    public String getName() {
23
-        return name;
125
+    /**
126
+     * This method was generated by MyBatis Generator.
127
+     * This method returns the value of the database column K_USER.K_APP.ID
128
+     *
129
+     * @return the value of K_USER.K_APP.ID
130
+     *
131
+     * @mbg.generated Fri May 24 16:36:22 CST 2019
132
+     */
133
+    public Integer getId() {
134
+        return id;
24 135
     }
25 136
 
26
-    public void setName(String name) {
27
-        this.name = name;
137
+    /**
138
+     * This method was generated by MyBatis Generator.
139
+     * This method returns the value of the database column K_USER.K_APP.NAME
140
+     *
141
+     * @return the value of K_USER.K_APP.NAME
142
+     *
143
+     * @mbg.generated Fri May 24 16:36:22 CST 2019
144
+     */
145
+    public String getName() {
146
+        return name;
28 147
     }
29 148
 
149
+    /**
150
+     * This method was generated by MyBatis Generator.
151
+     * This method returns the value of the database column K_USER.K_APP.NOTE
152
+     *
153
+     * @return the value of K_USER.K_APP.NOTE
154
+     *
155
+     * @mbg.generated Fri May 24 16:36:22 CST 2019
156
+     */
30 157
     public String getNote() {
31 158
         return note;
32 159
     }
33 160
 
34
-    public void setNote(String note) {
35
-        this.note = note;
36
-    }
37
-
38
-    public int getStatus() {
161
+    /**
162
+     * This method was generated by MyBatis Generator.
163
+     * This method returns the value of the database column K_USER.K_APP.STATUS
164
+     *
165
+     * @return the value of K_USER.K_APP.STATUS
166
+     *
167
+     * @mbg.generated Fri May 24 16:36:22 CST 2019
168
+     */
169
+    public Short getStatus() {
39 170
         return status;
40 171
     }
41 172
 
42
-    public void setStatus(int status) {
43
-        this.status = status;
44
-    }
45
-
173
+    /**
174
+     * This method was generated by MyBatis Generator.
175
+     * This method returns the value of the database column K_USER.K_APP.ICON
176
+     *
177
+     * @return the value of K_USER.K_APP.ICON
178
+     *
179
+     * @mbg.generated Fri May 24 16:36:22 CST 2019
180
+     */
46 181
     public String getIcon() {
47 182
         return icon;
48 183
     }
49 184
 
50
-    public void setIcon(String icon) {
51
-        this.icon = icon;
52
-    }
53
-
54
-    public String getClient_id() {
55
-        return client_id;
185
+    /**
186
+     * This method was generated by MyBatis Generator.
187
+     * This method returns the value of the database column K_USER.K_APP.CREATED_AT
188
+     *
189
+     * @return the value of K_USER.K_APP.CREATED_AT
190
+     *
191
+     * @mbg.generated Fri May 24 16:36:22 CST 2019
192
+     */
193
+    public Date getCreatedAt() {
194
+        return createdAt;
56 195
     }
57 196
 
58
-    public void setClient_id(String client_id) {
59
-        this.client_id = client_id;
197
+    /**
198
+     * This method was generated by MyBatis Generator.
199
+     * This method returns the value of the database column K_USER.K_APP.UPDATED_AT
200
+     *
201
+     * @return the value of K_USER.K_APP.UPDATED_AT
202
+     *
203
+     * @mbg.generated Fri May 24 16:36:22 CST 2019
204
+     */
205
+    public Date getUpdatedAt() {
206
+        return updatedAt;
60 207
     }
61 208
 
62
-    public String getClient_secret() {
63
-        return client_secret;
209
+    /**
210
+     * This method was generated by MyBatis Generator.
211
+     * This method returns the value of the database column K_USER.K_APP.DELETED_AT
212
+     *
213
+     * @return the value of K_USER.K_APP.DELETED_AT
214
+     *
215
+     * @mbg.generated Fri May 24 16:36:22 CST 2019
216
+     */
217
+    public Date getDeletedAt() {
218
+        return deletedAt;
64 219
     }
65 220
 
66
-    public void setClient_secret(String client_secret) {
67
-        this.client_secret = client_secret;
221
+    /**
222
+     * This method was generated by MyBatis Generator.
223
+     * This method returns the value of the database column K_USER.K_APP.CLIENT_ID
224
+     *
225
+     * @return the value of K_USER.K_APP.CLIENT_ID
226
+     *
227
+     * @mbg.generated Fri May 24 16:36:22 CST 2019
228
+     */
229
+    public String getClientId() {
230
+        return clientId;
68 231
     }
69 232
 
70
-    public String getRedirect_uri() {
71
-        return redirect_uri;
233
+    /**
234
+     * This method was generated by MyBatis Generator.
235
+     * This method returns the value of the database column K_USER.K_APP.CLIENT_SECRET
236
+     *
237
+     * @return the value of K_USER.K_APP.CLIENT_SECRET
238
+     *
239
+     * @mbg.generated Fri May 24 16:36:22 CST 2019
240
+     */
241
+    public String getClientSecret() {
242
+        return clientSecret;
72 243
     }
73 244
 
74
-    public void setRedirect_uri(String redirect_uri) {
75
-        this.redirect_uri = redirect_uri;
76
-    }
77
-
78
-    public App(int id, String name, String note, int status, String icon, String client_id, String client_secret, String redirect_uri) {
79
-        this.id = id;
80
-        this.name = name;
81
-        this.note = note;
82
-        this.status = status;
83
-        this.icon = icon;
84
-        this.client_id = client_id;
85
-        this.client_secret = client_secret;
86
-        this.redirect_uri = redirect_uri;
245
+    /**
246
+     * This method was generated by MyBatis Generator.
247
+     * This method returns the value of the database column K_USER.K_APP.REDIRECT_URI
248
+     *
249
+     * @return the value of K_USER.K_APP.REDIRECT_URI
250
+     *
251
+     * @mbg.generated Fri May 24 16:36:22 CST 2019
252
+     */
253
+    public String getRedirectUri() {
254
+        return redirectUri;
87 255
     }
88
-}
256
+}

+ 198 - 0
src/main/java/com/kingkong/bljs/entity/Threelogin.java

@@ -0,0 +1,198 @@
1
+package com.kingkong.bljs.entity;
2
+
3
+import java.util.Date;
4
+
5
+public class Threelogin {
6
+    /**
7
+     *
8
+     * This field was generated by MyBatis Generator.
9
+     * This field corresponds to the database column K_USER.K_THREE_LOGIN.CODE
10
+     *
11
+     * @mbg.generated Fri May 24 17:01:32 CST 2019
12
+     */
13
+    private String code;
14
+
15
+    /**
16
+     *
17
+     * This field was generated by MyBatis Generator.
18
+     * This field corresponds to the database column K_USER.K_THREE_LOGIN.CLIENT_ID
19
+     *
20
+     * @mbg.generated Fri May 24 17:01:32 CST 2019
21
+     */
22
+    private String clientId;
23
+
24
+    /**
25
+     *
26
+     * This field was generated by MyBatis Generator.
27
+     * This field corresponds to the database column K_USER.K_THREE_LOGIN.CLIENT_SECRET
28
+     *
29
+     * @mbg.generated Fri May 24 17:01:32 CST 2019
30
+     */
31
+    private String clientSecret;
32
+
33
+    /**
34
+     *
35
+     * This field was generated by MyBatis Generator.
36
+     * This field corresponds to the database column K_USER.K_THREE_LOGIN.NAME
37
+     *
38
+     * @mbg.generated Fri May 24 17:01:32 CST 2019
39
+     */
40
+    private String name;
41
+
42
+    /**
43
+     *
44
+     * This field was generated by MyBatis Generator.
45
+     * This field corresponds to the database column K_USER.K_THREE_LOGIN.CREATED_AT
46
+     *
47
+     * @mbg.generated Fri May 24 17:01:32 CST 2019
48
+     */
49
+    private Date createdAt;
50
+
51
+    /**
52
+     *
53
+     * This field was generated by MyBatis Generator.
54
+     * This field corresponds to the database column K_USER.K_THREE_LOGIN.UPDATED_AT
55
+     *
56
+     * @mbg.generated Fri May 24 17:01:32 CST 2019
57
+     */
58
+    private Date updatedAt;
59
+
60
+    /**
61
+     *
62
+     * This field was generated by MyBatis Generator.
63
+     * This field corresponds to the database column K_USER.K_THREE_LOGIN.DELETED_AT
64
+     *
65
+     * @mbg.generated Fri May 24 17:01:32 CST 2019
66
+     */
67
+    private Date deletedAt;
68
+
69
+    /**
70
+     *
71
+     * This field was generated by MyBatis Generator.
72
+     * This field corresponds to the database column K_USER.K_THREE_LOGIN.APP_ID
73
+     *
74
+     * @mbg.generated Fri May 24 17:01:32 CST 2019
75
+     */
76
+    private Integer appId;
77
+
78
+
79
+    private String uri;
80
+
81
+    /**
82
+     * This method was generated by MyBatis Generator.
83
+     * This method corresponds to the database table K_USER.K_THREE_LOGIN
84
+     *
85
+     * @mbg.generated Fri May 24 17:01:32 CST 2019
86
+     */
87
+    public Threelogin(String code, String clientId, String clientSecret, String name, Date createdAt, Date updatedAt, Date deletedAt, Integer appId,String uri) {
88
+        this.code = code;
89
+        this.clientId = clientId;
90
+        this.clientSecret = clientSecret;
91
+        this.name = name;
92
+        this.createdAt = createdAt;
93
+        this.updatedAt = updatedAt;
94
+        this.deletedAt = deletedAt;
95
+        this.appId = appId;
96
+        this.uri = uri;
97
+    }
98
+
99
+    /**
100
+     * This method was generated by MyBatis Generator.
101
+     * This method returns the value of the database column K_USER.K_THREE_LOGIN.CODE
102
+     *
103
+     * @return the value of K_USER.K_THREE_LOGIN.CODE
104
+     *
105
+     * @mbg.generated Fri May 24 17:01:32 CST 2019
106
+     */
107
+    public String getCode() {
108
+        return code;
109
+    }
110
+
111
+    /**
112
+     * This method was generated by MyBatis Generator.
113
+     * This method returns the value of the database column K_USER.K_THREE_LOGIN.CLIENT_ID
114
+     *
115
+     * @return the value of K_USER.K_THREE_LOGIN.CLIENT_ID
116
+     *
117
+     * @mbg.generated Fri May 24 17:01:32 CST 2019
118
+     */
119
+    public String getClientId() {
120
+        return clientId;
121
+    }
122
+
123
+    /**
124
+     * This method was generated by MyBatis Generator.
125
+     * This method returns the value of the database column K_USER.K_THREE_LOGIN.CLIENT_SECRET
126
+     *
127
+     * @return the value of K_USER.K_THREE_LOGIN.CLIENT_SECRET
128
+     *
129
+     * @mbg.generated Fri May 24 17:01:32 CST 2019
130
+     */
131
+    public String getClientSecret() {
132
+        return clientSecret;
133
+    }
134
+
135
+    /**
136
+     * This method was generated by MyBatis Generator.
137
+     * This method returns the value of the database column K_USER.K_THREE_LOGIN.NAME
138
+     *
139
+     * @return the value of K_USER.K_THREE_LOGIN.NAME
140
+     *
141
+     * @mbg.generated Fri May 24 17:01:32 CST 2019
142
+     */
143
+    public String getName() {
144
+        return name;
145
+    }
146
+
147
+    /**
148
+     * This method was generated by MyBatis Generator.
149
+     * This method returns the value of the database column K_USER.K_THREE_LOGIN.CREATED_AT
150
+     *
151
+     * @return the value of K_USER.K_THREE_LOGIN.CREATED_AT
152
+     *
153
+     * @mbg.generated Fri May 24 17:01:32 CST 2019
154
+     */
155
+    public Date getCreatedAt() {
156
+        return createdAt;
157
+    }
158
+
159
+    /**
160
+     * This method was generated by MyBatis Generator.
161
+     * This method returns the value of the database column K_USER.K_THREE_LOGIN.UPDATED_AT
162
+     *
163
+     * @return the value of K_USER.K_THREE_LOGIN.UPDATED_AT
164
+     *
165
+     * @mbg.generated Fri May 24 17:01:32 CST 2019
166
+     */
167
+    public Date getUpdatedAt() {
168
+        return updatedAt;
169
+    }
170
+
171
+    /**
172
+     * This method was generated by MyBatis Generator.
173
+     * This method returns the value of the database column K_USER.K_THREE_LOGIN.DELETED_AT
174
+     *
175
+     * @return the value of K_USER.K_THREE_LOGIN.DELETED_AT
176
+     *
177
+     * @mbg.generated Fri May 24 17:01:32 CST 2019
178
+     */
179
+    public Date getDeletedAt() {
180
+        return deletedAt;
181
+    }
182
+
183
+    /**
184
+     * This method was generated by MyBatis Generator.
185
+     * This method returns the value of the database column K_USER.K_THREE_LOGIN.APP_ID
186
+     *
187
+     * @return the value of K_USER.K_THREE_LOGIN.APP_ID
188
+     *
189
+     * @mbg.generated Fri May 24 17:01:32 CST 2019
190
+     */
191
+    public Integer getAppId() {
192
+        return appId;
193
+    }
194
+
195
+    public String getUri(){
196
+        return this.uri;
197
+    }
198
+}

+ 3 - 3
src/main/java/com/kingkong/bljs/security/CustomClientDetailService.java

@@ -20,18 +20,18 @@ public class CustomClientDetailService implements ClientDetailsService {
20 20
     @Override
21 21
     public ClientDetails loadClientByClientId(String s) throws ClientRegistrationException {
22 22
 
23
-        App app = appMapper.getByClientId(s);
23
+        App app = appMapper.selectByClientId(s);
24 24
 
25 25
         if(null == app)
26 26
             throw new ClientRegistrationException("incorrect client id");
27 27
 
28 28
         BaseClientDetails clientDetails = new BaseClientDetails();
29 29
         clientDetails.setClientId(s);
30
-        clientDetails.setClientSecret("{noop}" + app.getClient_secret());
30
+        clientDetails.setClientSecret("{noop}" + app.getClientSecret());
31 31
         clientDetails.setAuthorizedGrantTypes(Arrays.asList("authorization_code","client_credentials", "refresh_token", "password", "implicit"));
32 32
         clientDetails.setScope(Arrays.asList("*","all"));
33 33
         Set<String> uris = new HashSet<>();
34
-        uris.add(app.getRedirect_uri());
34
+        uris.add(app.getRedirectUri());
35 35
         clientDetails.setRegisteredRedirectUri(uris);
36 36
         clientDetails.setAccessTokenValiditySeconds(3600*24);
37 37
         return clientDetails;

+ 1 - 1
src/main/resources/application-c.properties

@@ -1,4 +1,4 @@
1
-spring.datasource.url=jdbc:oracle:thin:@192.168.1.150:1521:es
1
+spring.datasource.url=jdbc:oracle:thin:@127.0.0.1:1521:test2
2 2
 spring.datasource.username=k_user
3 3
 spring.datasource.password=123
4 4
 spring.datasource.driver-class-name=oracle.jdbc.driver.OracleDriver

+ 1 - 1
src/main/resources/application.properties

@@ -1 +1 @@
1
-spring.profiles.active=his
1
+spring.profiles.active=c

+ 6 - 5
src/main/resources/generatorConfig.xml

@@ -14,12 +14,12 @@
14 14
 
15 15
         <!-- optional,旨在创建class时,对注释进行控制 -->
16 16
         <commentGenerator>
17
-            <property name="suppressDate" value="true" />
17
+            <property name="suppressAllComments" value="false" />
18 18
         </commentGenerator>
19 19
 
20 20
 
21 21
         <!--jdbc的数据库连接 -->
22
-        <jdbcConnection driverClass="oracle.jdbc.driver.OracleDriver" connectionURL="jdbc:oracle:thin:@127.0.0.1:1521:orcl" userId="k_user" password="123">
22
+        <jdbcConnection driverClass="oracle.jdbc.driver.OracleDriver" connectionURL="jdbc:oracle:thin:@127.0.0.1:1521:test2" userId="k_user" password="123">
23 23
         </jdbcConnection>
24 24
 
25 25
 
@@ -51,7 +51,7 @@
51 51
         </javaModelGenerator>
52 52
 
53 53
         <!--Mapper映射文件生成所在的目录 为每一个数据库的表生成对应的SqlMap文件 -->
54
-        <sqlMapGenerator targetPackage="com.kingkong.bljs.dao" targetProject="src/main/java">
54
+        <sqlMapGenerator targetPackage="mapper" targetProject="src/main/resources">
55 55
             <property name="enableSubPackages" value="false"/>
56 56
         </sqlMapGenerator>
57 57
 
@@ -87,7 +87,8 @@
87 87
 
88 88
 
89 89
 
90
-        <table tableName="k_dictionary" schema="k_user">
90
+        <table tableName="k_three_login" schema="k_user" enableCountByExample="false" enableUpdateByExample="false" enableDeleteByExample="false"
91
+               enableSelectByExample="false" selectByExampleQueryId="false">
91 92
 
92 93
             <!-- optional   , only for mybatis3 runtime
93 94
                  自动生成的键值(identity,或者序列值)
@@ -127,7 +128,7 @@
127 128
                     delimitedColumnName:true ,匹配column的值和数据库列的名称 大小写完全匹配,false 忽略大小写匹配
128 129
                     是否限定表的列名,即固定表列在Model中的名称
129 130
             -->
130
-            <ignoreColumn column="PLAN_ID"  delimitedColumnName="true" />
131
+            <!--<ignoreColumn column="PLAN_ID"  delimitedColumnName="true" />-->
131 132
 
132 133
 
133 134
             <!--optional.覆盖MBG对Model 的生成规则

+ 121 - 0
src/main/resources/mapper/ThreeloginMapper.xml

@@ -0,0 +1,121 @@
1
+<?xml version="1.0" encoding="UTF-8"?>
2
+<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
3
+<mapper namespace="com.kingkong.bljs.dao.ThreeloginMapper">
4
+  <resultMap id="BaseResultMap" type="com.kingkong.bljs.entity.Threelogin">
5
+    <!--
6
+      WARNING - @mbg.generated
7
+      This element is automatically generated by MyBatis Generator, do not modify.
8
+      This element was generated on Fri May 24 17:01:32 CST 2019.
9
+    -->
10
+    <constructor>
11
+      <idArg column="CODE" javaType="java.lang.String" jdbcType="VARCHAR" />
12
+      <arg column="CLIENT_ID" javaType="java.lang.String" jdbcType="VARCHAR" />
13
+      <arg column="CLIENT_SECRET" javaType="java.lang.String" jdbcType="VARCHAR" />
14
+      <arg column="NAME" javaType="java.lang.String" jdbcType="VARCHAR" />
15
+      <arg column="CREATED_AT" javaType="java.util.Date" jdbcType="DATE" />
16
+      <arg column="UPDATED_AT" javaType="java.util.Date" jdbcType="DATE" />
17
+      <arg column="DELETED_AT" javaType="java.util.Date" jdbcType="DATE" />
18
+      <arg column="APP_ID" javaType="java.lang.Integer" jdbcType="DECIMAL" />
19
+    </constructor>
20
+  </resultMap>
21
+  <sql id="Base_Column_List">
22
+    <!--
23
+      WARNING - @mbg.generated
24
+      This element is automatically generated by MyBatis Generator, do not modify.
25
+      This element was generated on Fri May 24 17:01:32 CST 2019.
26
+    -->
27
+    CODE, CLIENT_ID, CLIENT_SECRET, NAME, CREATED_AT, UPDATED_AT, DELETED_AT, APP_ID
28
+  </sql>
29
+  <insert id="insertSelective" parameterType="com.kingkong.bljs.entity.Threelogin">
30
+    <!--
31
+      WARNING - @mbg.generated
32
+      This element is automatically generated by MyBatis Generator, do not modify.
33
+      This element was generated on Fri May 24 17:01:32 CST 2019.
34
+    -->
35
+    insert into K_USER.K_THREE_LOGIN
36
+    <trim prefix="(" suffix=")" suffixOverrides=",">
37
+      <if test="code != null">
38
+        CODE,
39
+      </if>
40
+      <if test="clientId != null">
41
+        CLIENT_ID,
42
+      </if>
43
+      <if test="clientSecret != null">
44
+        CLIENT_SECRET,
45
+      </if>
46
+      <if test="name != null">
47
+        NAME,
48
+      </if>
49
+      <if test="createdAt != null">
50
+        CREATED_AT,
51
+      </if>
52
+      <if test="updatedAt != null">
53
+        UPDATED_AT,
54
+      </if>
55
+      <if test="deletedAt != null">
56
+        DELETED_AT,
57
+      </if>
58
+      <if test="appId != null">
59
+        APP_ID,
60
+      </if>
61
+    </trim>
62
+    <trim prefix="values (" suffix=")" suffixOverrides=",">
63
+      <if test="code != null">
64
+        #{code,jdbcType=VARCHAR},
65
+      </if>
66
+      <if test="clientId != null">
67
+        #{clientId,jdbcType=VARCHAR},
68
+      </if>
69
+      <if test="clientSecret != null">
70
+        #{clientSecret,jdbcType=VARCHAR},
71
+      </if>
72
+      <if test="name != null">
73
+        #{name,jdbcType=VARCHAR},
74
+      </if>
75
+      <if test="createdAt != null">
76
+        #{createdAt,jdbcType=DATE},
77
+      </if>
78
+      <if test="updatedAt != null">
79
+        #{updatedAt,jdbcType=DATE},
80
+      </if>
81
+      <if test="deletedAt != null">
82
+        #{deletedAt,jdbcType=DATE},
83
+      </if>
84
+      <if test="appId != null">
85
+        #{appId,jdbcType=DECIMAL},
86
+      </if>
87
+    </trim>
88
+  </insert>
89
+  <update id="updateByPrimaryKeySelective" parameterType="com.kingkong.bljs.entity.Threelogin">
90
+    <!--
91
+      WARNING - @mbg.generated
92
+      This element is automatically generated by MyBatis Generator, do not modify.
93
+      This element was generated on Fri May 24 17:01:32 CST 2019.
94
+    -->
95
+    update K_USER.K_THREE_LOGIN
96
+    <set>
97
+      <if test="clientId != null">
98
+        CLIENT_ID = #{clientId,jdbcType=VARCHAR},
99
+      </if>
100
+      <if test="clientSecret != null">
101
+        CLIENT_SECRET = #{clientSecret,jdbcType=VARCHAR},
102
+      </if>
103
+      <if test="name != null">
104
+        NAME = #{name,jdbcType=VARCHAR},
105
+      </if>
106
+      <if test="createdAt != null">
107
+        CREATED_AT = #{createdAt,jdbcType=DATE},
108
+      </if>
109
+      <if test="updatedAt != null">
110
+        UPDATED_AT = #{updatedAt,jdbcType=DATE},
111
+      </if>
112
+      <if test="deletedAt != null">
113
+        DELETED_AT = #{deletedAt,jdbcType=DATE},
114
+      </if>
115
+      <if test="appId != null">
116
+        APP_ID = #{appId,jdbcType=DECIMAL},
117
+      </if>
118
+    </set>
119
+    where CODE = #{code,jdbcType=VARCHAR}
120
+  </update>
121
+</mapper>