Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Contribute to GitLab
Sign in
Toggle navigation
S
sentinel
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
曲欣亮
sentinel
Commits
2f135272
Commit
2f135272
authored
Nov 19, 2018
by
Quxl
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
管理员权限
parent
17075bfc
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
53 additions
and
5 deletions
+53
-5
AdminAuthController.java
...in/java/com/egolm/film/api/admin/AdminAuthController.java
+45
-5
AdminAuthService.java
...va/com/egolm/film/api/admin/service/AdminAuthService.java
+2
-0
AdminAuthServiceImpl.java
...olm/film/api/admin/service/impl/AdminAuthServiceImpl.java
+6
-0
No files found.
src/main/java/com/egolm/film/api/admin/AdminAuthController.java
View file @
2f135272
...
@@ -2,7 +2,6 @@ package com.egolm.film.api.admin;
...
@@ -2,7 +2,6 @@ package com.egolm.film.api.admin;
import
java.io.File
;
import
java.io.File
;
import
java.io.FileNotFoundException
;
import
java.io.FileNotFoundException
;
import
java.util.Date
;
import
java.util.List
;
import
java.util.List
;
import
java.util.Map
;
import
java.util.Map
;
...
@@ -12,6 +11,7 @@ import org.springframework.util.ResourceUtils;
...
@@ -12,6 +11,7 @@ import org.springframework.util.ResourceUtils;
import
org.springframework.web.bind.annotation.RequestMapping
;
import
org.springframework.web.bind.annotation.RequestMapping
;
import
org.springframework.web.bind.annotation.ResponseBody
;
import
org.springframework.web.bind.annotation.ResponseBody
;
import
com.alibaba.fastjson.JSON
;
import
com.egolm.common.FileUtil
;
import
com.egolm.common.FileUtil
;
import
com.egolm.common.StringUtil
;
import
com.egolm.common.StringUtil
;
import
com.egolm.common.bean.Rjx
;
import
com.egolm.common.bean.Rjx
;
...
@@ -25,6 +25,8 @@ import com.egolm.film.config.XException;
...
@@ -25,6 +25,8 @@ import com.egolm.film.config.XException;
import
com.egolm.film.util.Common
;
import
com.egolm.film.util.Common
;
import
io.swagger.annotations.Api
;
import
io.swagger.annotations.Api
;
import
io.swagger.annotations.ApiImplicitParam
;
import
io.swagger.annotations.ApiImplicitParams
;
import
io.swagger.annotations.ApiOperation
;
import
io.swagger.annotations.ApiOperation
;
@Api
@Api
...
@@ -41,6 +43,12 @@ public class AdminAuthController {
...
@@ -41,6 +43,12 @@ public class AdminAuthController {
@ResponseBody
@ResponseBody
@RequestMapping
(
"adminList"
)
@RequestMapping
(
"adminList"
)
@ApiOperation
(
"管理员分页查询"
)
@ApiOperation
(
"管理员分页查询"
)
@ApiImplicitParams
({
@ApiImplicitParam
(
paramType
=
"query"
,
dataType
=
"string"
,
required
=
false
,
name
=
"keyword"
,
value
=
"关键字"
),
@ApiImplicitParam
(
paramType
=
"query"
,
dataType
=
"integer"
,
required
=
false
,
name
=
"group_id"
,
value
=
"组ID"
),
@ApiImplicitParam
(
paramType
=
"query"
,
dataType
=
"long"
,
required
=
true
,
name
=
"index"
,
value
=
"分页编号"
),
@ApiImplicitParam
(
paramType
=
"query"
,
dataType
=
"long"
,
required
=
true
,
name
=
"limit"
,
value
=
"分页大小"
),
})
public
Object
adminList
(
String
keyword
,
Integer
group_id
,
Long
index
,
Long
limit
)
{
public
Object
adminList
(
String
keyword
,
Integer
group_id
,
Long
index
,
Long
limit
)
{
index
=
index
==
null
?
1
:
index
;
index
=
index
==
null
?
1
:
index
;
limit
=
limit
==
null
?
20
:
limit
;
limit
=
limit
==
null
?
20
:
limit
;
...
@@ -52,6 +60,12 @@ public class AdminAuthController {
...
@@ -52,6 +60,12 @@ public class AdminAuthController {
@ResponseBody
@ResponseBody
@RequestMapping
(
"adminSave"
)
@RequestMapping
(
"adminSave"
)
@ApiOperation
(
"添加管理员"
)
@ApiOperation
(
"添加管理员"
)
@ApiImplicitParams
({
@ApiImplicitParam
(
paramType
=
"query"
,
dataType
=
"string"
,
required
=
true
,
name
=
"realname"
,
value
=
"姓名"
),
@ApiImplicitParam
(
paramType
=
"query"
,
dataType
=
"string"
,
required
=
true
,
name
=
"username"
,
value
=
"用户名"
),
@ApiImplicitParam
(
paramType
=
"query"
,
dataType
=
"string"
,
required
=
true
,
name
=
"password"
,
value
=
"密码"
),
@ApiImplicitParam
(
paramType
=
"query"
,
dataType
=
"integer"
,
required
=
true
,
name
=
"group_id"
,
value
=
"组ID"
),
})
public
Object
adminSave
(
String
realname
,
String
username
,
String
password
,
Integer
group_id
)
{
public
Object
adminSave
(
String
realname
,
String
username
,
String
password
,
Integer
group_id
)
{
String
remoteIp
=
WebMvcConfig
.
getRemoteIp
();
String
remoteIp
=
WebMvcConfig
.
getRemoteIp
();
Fc_admin
admin
=
new
Fc_admin
();
Fc_admin
admin
=
new
Fc_admin
();
...
@@ -73,6 +87,13 @@ public class AdminAuthController {
...
@@ -73,6 +87,13 @@ public class AdminAuthController {
@ResponseBody
@ResponseBody
@RequestMapping
(
"adminUpdate"
)
@RequestMapping
(
"adminUpdate"
)
@ApiOperation
(
"修改管理员"
)
@ApiOperation
(
"修改管理员"
)
@ApiImplicitParams
({
@ApiImplicitParam
(
paramType
=
"query"
,
dataType
=
"string"
,
required
=
true
,
name
=
"adminid"
,
value
=
"管理员ID"
),
@ApiImplicitParam
(
paramType
=
"query"
,
dataType
=
"string"
,
required
=
true
,
name
=
"realname"
,
value
=
"姓名"
),
@ApiImplicitParam
(
paramType
=
"query"
,
dataType
=
"string"
,
required
=
true
,
name
=
"username"
,
value
=
"用户名"
),
@ApiImplicitParam
(
paramType
=
"query"
,
dataType
=
"string"
,
required
=
false
,
name
=
"password"
,
value
=
"密码"
),
@ApiImplicitParam
(
paramType
=
"query"
,
dataType
=
"integer"
,
required
=
true
,
name
=
"group_id"
,
value
=
"组ID"
),
})
public
Object
adminUpdate
(
Integer
adminid
,
String
realname
,
String
username
,
String
password
,
Integer
group_id
)
{
public
Object
adminUpdate
(
Integer
adminid
,
String
realname
,
String
username
,
String
password
,
Integer
group_id
)
{
XException
.
assertNotBlank
(
"管理员ID不能为空"
,
adminid
);
XException
.
assertNotBlank
(
"管理员ID不能为空"
,
adminid
);
XException
.
assertNotBlank
(
"姓名不能为空"
,
realname
);
XException
.
assertNotBlank
(
"姓名不能为空"
,
realname
);
...
@@ -96,6 +117,9 @@ public class AdminAuthController {
...
@@ -96,6 +117,9 @@ public class AdminAuthController {
@ResponseBody
@ResponseBody
@RequestMapping
(
"adminDilabled"
)
@RequestMapping
(
"adminDilabled"
)
@ApiOperation
(
"禁用管理员"
)
@ApiOperation
(
"禁用管理员"
)
@ApiImplicitParams
({
@ApiImplicitParam
(
paramType
=
"query"
,
dataType
=
"integer"
,
required
=
true
,
name
=
"adminid"
,
value
=
"管理员ID"
,
allowMultiple
=
true
),
})
public
Object
adminDilabled
(
Integer
[]
adminid
)
{
public
Object
adminDilabled
(
Integer
[]
adminid
)
{
XException
.
assertNotBlank
(
"管理员ID不能为空"
,
(
Object
[])
adminid
);
XException
.
assertNotBlank
(
"管理员ID不能为空"
,
(
Object
[])
adminid
);
service
.
disableAdmin
(
adminid
);
service
.
disableAdmin
(
adminid
);
...
@@ -105,6 +129,11 @@ public class AdminAuthController {
...
@@ -105,6 +129,11 @@ public class AdminAuthController {
@ResponseBody
@ResponseBody
@RequestMapping
(
"groupList"
)
@RequestMapping
(
"groupList"
)
@ApiOperation
(
"管理员分组,分页查询"
)
@ApiOperation
(
"管理员分组,分页查询"
)
@ApiImplicitParams
({
@ApiImplicitParam
(
paramType
=
"query"
,
dataType
=
"string"
,
required
=
false
,
name
=
"keyword"
,
value
=
"关键字"
),
@ApiImplicitParam
(
paramType
=
"query"
,
dataType
=
"long"
,
required
=
true
,
name
=
"index"
,
value
=
"分页编号"
),
@ApiImplicitParam
(
paramType
=
"query"
,
dataType
=
"long"
,
required
=
true
,
name
=
"limit"
,
value
=
"分页大小"
),
})
public
Object
groupList
(
String
keyword
,
Long
index
,
Long
limit
)
{
public
Object
groupList
(
String
keyword
,
Long
index
,
Long
limit
)
{
index
=
index
==
null
?
1
:
index
;
index
=
index
==
null
?
1
:
index
;
limit
=
limit
==
null
?
20
:
limit
;
limit
=
limit
==
null
?
20
:
limit
;
...
@@ -114,12 +143,23 @@ public class AdminAuthController {
...
@@ -114,12 +143,23 @@ public class AdminAuthController {
}
}
@ResponseBody
@ResponseBody
@RequestMapping
(
"
group
Auth"
)
@RequestMapping
(
"
all
Auth"
)
@ApiOperation
(
"
管理组
权限查询"
)
@ApiOperation
(
"
全部
权限查询"
)
public
Object
groupAuth
(
Integer
gorupid
)
throws
FileNotFoundException
{
public
Object
allAuth
(
)
throws
FileNotFoundException
{
File
file
=
ResourceUtils
.
getFile
(
"classpath:auth_admin.json"
);
File
file
=
ResourceUtils
.
getFile
(
"classpath:auth_admin.json"
);
String
json
=
FileUtil
.
fileToString
(
file
);
String
json
=
FileUtil
.
fileToString
(
file
);
return
Rjx
.
jsonOk
().
setData
(
json
);
return
Rjx
.
jsonOk
().
setData
(
JSON
.
parseArray
(
json
));
}
@ResponseBody
@RequestMapping
(
"groupAuth"
)
@ApiOperation
(
"管理组权限查询"
)
@ApiImplicitParams
({
@ApiImplicitParam
(
paramType
=
"query"
,
dataType
=
"integer"
,
required
=
true
,
name
=
"group_id"
,
value
=
"组ID"
),
})
public
Object
groupAuth
(
Integer
group_id
)
throws
FileNotFoundException
{
String
json
=
service
.
queryGroupAuth
(
group_id
);
return
Rjx
.
jsonOk
().
setData
(
JSON
.
parseArray
(
json
));
}
}
@ResponseBody
@ResponseBody
...
...
src/main/java/com/egolm/film/api/admin/service/AdminAuthService.java
View file @
2f135272
...
@@ -21,4 +21,6 @@ public interface AdminAuthService {
...
@@ -21,4 +21,6 @@ public interface AdminAuthService {
void
mergeAdmin
(
Fc_admin
admin
);
void
mergeAdmin
(
Fc_admin
admin
);
String
queryGroupAuth
(
Integer
group_id
);
}
}
src/main/java/com/egolm/film/api/admin/service/impl/AdminAuthServiceImpl.java
View file @
2f135272
...
@@ -57,5 +57,11 @@ public class AdminAuthServiceImpl implements AdminAuthService {
...
@@ -57,5 +57,11 @@ public class AdminAuthServiceImpl implements AdminAuthService {
public
void
mergeAdmin
(
Fc_admin
admin
)
{
public
void
mergeAdmin
(
Fc_admin
admin
)
{
jdbcTemplate
.
merge
(
admin
);
jdbcTemplate
.
merge
(
admin
);
}
}
@Override
public
String
queryGroupAuth
(
Integer
group_id
)
{
String
sql
=
"select group_power from fc_admin_group where group_id = ?"
;
return
jdbcTemplate
.
queryForString
(
sql
,
group_id
);
}
}
}
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment