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
17075bfc
Commit
17075bfc
authored
Nov 19, 2018
by
Quxl
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
管理员
parent
02e4fc17
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
91 additions
and
8 deletions
+91
-8
AdminAuthController.java
...in/java/com/egolm/film/api/admin/AdminAuthController.java
+56
-6
AdminAuthService.java
...va/com/egolm/film/api/admin/service/AdminAuthService.java
+9
-0
AdminAuthServiceImpl.java
...olm/film/api/admin/service/impl/AdminAuthServiceImpl.java
+26
-2
No files found.
src/main/java/com/egolm/film/api/admin/AdminAuthController.java
View file @
17075bfc
...
@@ -13,11 +13,16 @@ import org.springframework.web.bind.annotation.RequestMapping;
...
@@ -13,11 +13,16 @@ import org.springframework.web.bind.annotation.RequestMapping;
import
org.springframework.web.bind.annotation.ResponseBody
;
import
org.springframework.web.bind.annotation.ResponseBody
;
import
com.egolm.common.FileUtil
;
import
com.egolm.common.FileUtil
;
import
com.egolm.common.StringUtil
;
import
com.egolm.common.bean.Rjx
;
import
com.egolm.common.bean.Rjx
;
import
com.egolm.common.jdbc.Page
;
import
com.egolm.common.jdbc.Page
;
import
com.egolm.film.api.admin.service.AdminAuthService
;
import
com.egolm.film.api.admin.service.AdminAuthService
;
import
com.egolm.film.api.admin.service.AdminTokenService
;
import
com.egolm.film.bean.Fc_admin
;
import
com.egolm.film.bean.Fc_admin_group
;
import
com.egolm.film.bean.Fc_admin_group
;
import
com.egolm.film.config.WebMvcConfig
;
import
com.egolm.film.config.WebMvcConfig
;
import
com.egolm.film.config.XException
;
import
com.egolm.film.util.Common
;
import
io.swagger.annotations.Api
;
import
io.swagger.annotations.Api
;
import
io.swagger.annotations.ApiOperation
;
import
io.swagger.annotations.ApiOperation
;
...
@@ -30,25 +35,70 @@ public class AdminAuthController {
...
@@ -30,25 +35,70 @@ public class AdminAuthController {
@Autowired
@Autowired
AdminAuthService
service
;
AdminAuthService
service
;
@Autowired
AdminTokenService
tokenService
;
@ResponseBody
@ResponseBody
@RequestMapping
(
"adminList"
)
@RequestMapping
(
"adminList"
)
@ApiOperation
(
"管理员分页查询"
)
@ApiOperation
(
"管理员分页查询"
)
public
Object
adminList
(
String
keyword
,
String
group_id
,
Long
index
,
Long
limit
)
{
public
Object
adminList
(
String
keyword
,
Integer
group_id
,
Long
index
,
Long
limit
)
{
return
Rjx
.
jsonOk
();
index
=
index
==
null
?
1
:
index
;
limit
=
limit
==
null
?
20
:
limit
;
Page
page
=
new
Page
(
index
,
limit
);
List
<
Map
<
String
,
Object
>>
list
=
service
.
queryAdminList
(
keyword
,
group_id
,
page
);
return
Rjx
.
jsonOk
().
setData
(
list
);
}
}
@ResponseBody
@ResponseBody
@RequestMapping
(
"adminSave
OrUpdate
"
)
@RequestMapping
(
"adminSave"
)
@ApiOperation
(
"添加管理员"
)
@ApiOperation
(
"添加管理员"
)
public
Object
adminSaveOrUpdate
(
String
realname
,
String
username
,
String
password
,
String
group_id
,
Date
expire_time
,
String
email
,
String
telphone
)
{
public
Object
adminSave
(
String
realname
,
String
username
,
String
password
,
Integer
group_id
)
{
String
remoteIp
=
WebMvcConfig
.
getRemoteIp
();
Fc_admin
admin
=
new
Fc_admin
();
admin
.
setCreate_admin_id
((
Integer
)
tokenService
.
getToken
().
getId
());
admin
.
setCreate_ip
(
remoteIp
);
admin
.
setCreate_time
(
System
.
currentTimeMillis
());
admin
.
setGroup_id
(
group_id
);
admin
.
setRealname
(
realname
);
admin
.
setUsername
(
username
);
String
salt
=
Common
.
getGenerateString
(
6
);
String
encodePassword
=
Common
.
encodePassword
(
password
,
salt
);
admin
.
setPassword
(
encodePassword
);
admin
.
setSalt
(
salt
);
admin
.
setState
(
1
);
service
.
saveAdmin
(
admin
);
return
Rjx
.
jsonOk
();
}
@ResponseBody
@RequestMapping
(
"adminUpdate"
)
@ApiOperation
(
"修改管理员"
)
public
Object
adminUpdate
(
Integer
adminid
,
String
realname
,
String
username
,
String
password
,
Integer
group_id
)
{
XException
.
assertNotBlank
(
"管理员ID不能为空"
,
adminid
);
XException
.
assertNotBlank
(
"姓名不能为空"
,
realname
);
XException
.
assertNotBlank
(
"用户名不能为空"
,
username
);
XException
.
assertNotBlank
(
"分组ID不能为空"
,
group_id
);
Fc_admin
admin
=
new
Fc_admin
();
admin
.
setAdminid
(
adminid
);
admin
.
setGroup_id
(
group_id
);
admin
.
setRealname
(
realname
);
admin
.
setUsername
(
username
);
if
(
StringUtil
.
isNotBlank
(
password
))
{
String
salt
=
Common
.
getGenerateString
(
6
);
String
encodePassword
=
Common
.
encodePassword
(
password
,
salt
);
admin
.
setPassword
(
encodePassword
);
admin
.
setSalt
(
salt
);
}
service
.
mergeAdmin
(
admin
);
return
Rjx
.
jsonOk
();
return
Rjx
.
jsonOk
();
}
}
@ResponseBody
@ResponseBody
@RequestMapping
(
"adminDilabled"
)
@RequestMapping
(
"adminDilabled"
)
@ApiOperation
(
"禁用管理员"
)
@ApiOperation
(
"禁用管理员"
)
public
Object
adminDilabled
(
String
[]
adminid
)
{
public
Object
adminDilabled
(
Integer
[]
adminid
)
{
XException
.
assertNotBlank
(
"管理员ID不能为空"
,
(
Object
[])
adminid
);
service
.
disableAdmin
(
adminid
);
return
Rjx
.
jsonOk
();
return
Rjx
.
jsonOk
();
}
}
...
...
src/main/java/com/egolm/film/api/admin/service/AdminAuthService.java
View file @
17075bfc
...
@@ -4,6 +4,7 @@ import java.util.List;
...
@@ -4,6 +4,7 @@ import java.util.List;
import
java.util.Map
;
import
java.util.Map
;
import
com.egolm.common.jdbc.Page
;
import
com.egolm.common.jdbc.Page
;
import
com.egolm.film.bean.Fc_admin
;
import
com.egolm.film.bean.Fc_admin_group
;
import
com.egolm.film.bean.Fc_admin_group
;
public
interface
AdminAuthService
{
public
interface
AdminAuthService
{
...
@@ -12,4 +13,12 @@ public interface AdminAuthService {
...
@@ -12,4 +13,12 @@ public interface AdminAuthService {
List
<
Map
<
String
,
Object
>>
queryGroupList
(
String
keyword
,
Page
page
);
List
<
Map
<
String
,
Object
>>
queryGroupList
(
String
keyword
,
Page
page
);
List
<
Map
<
String
,
Object
>>
queryAdminList
(
String
keyword
,
Integer
group_id
,
Page
page
);
void
disableAdmin
(
Integer
[]
adminid
);
void
saveAdmin
(
Fc_admin
admin
);
void
mergeAdmin
(
Fc_admin
admin
);
}
}
src/main/java/com/egolm/film/api/admin/service/impl/AdminAuthServiceImpl.java
View file @
17075bfc
...
@@ -10,6 +10,7 @@ import com.egolm.common.StringUtil;
...
@@ -10,6 +10,7 @@ import com.egolm.common.StringUtil;
import
com.egolm.common.jdbc.JdbcTemplate
;
import
com.egolm.common.jdbc.JdbcTemplate
;
import
com.egolm.common.jdbc.Page
;
import
com.egolm.common.jdbc.Page
;
import
com.egolm.film.api.admin.service.AdminAuthService
;
import
com.egolm.film.api.admin.service.AdminAuthService
;
import
com.egolm.film.bean.Fc_admin
;
import
com.egolm.film.bean.Fc_admin_group
;
import
com.egolm.film.bean.Fc_admin_group
;
import
com.egolm.film.util.SqlWhere
;
import
com.egolm.film.util.SqlWhere
;
...
@@ -30,8 +31,31 @@ public class AdminAuthServiceImpl implements AdminAuthService {
...
@@ -30,8 +31,31 @@ public class AdminAuthServiceImpl implements AdminAuthService {
@Override
@Override
public
List
<
Map
<
String
,
Object
>>
queryGroupList
(
String
keyword
,
Page
page
)
{
public
List
<
Map
<
String
,
Object
>>
queryGroupList
(
String
keyword
,
Page
page
)
{
SqlWhere
argEdit
=
new
SqlWhere
().
like
(
"group_name"
,
keyword
);
SqlWhere
argEdit
=
new
SqlWhere
().
like
(
"group_name"
,
keyword
);
String
sql
=
"select * from"
+
StringUtil
.
join
(
" and "
,
" where "
,
""
,
""
,
argEdit
.
getArgs
());
String
sql
=
"select * from fc_admin_group"
+
StringUtil
.
join
(
" and "
,
" where "
,
""
,
""
,
argEdit
.
getArgs
());
return
jdbcTemplate
.
limitAll
(
sql
,
page
,
argEdit
.
getObjs
());
return
jdbcTemplate
.
limit
(
sql
,
page
,
argEdit
.
getObjs
());
}
@Override
public
List
<
Map
<
String
,
Object
>>
queryAdminList
(
String
keyword
,
Integer
group_id
,
Page
page
)
{
SqlWhere
argEdit
=
new
SqlWhere
().
like
(
"realname"
,
keyword
).
like
(
"username"
,
keyword
).
eq
(
"group_id"
,
group_id
);
String
sql
=
"select * from fc_admin"
+
StringUtil
.
join
(
" and "
,
" where "
,
""
,
""
,
argEdit
.
getArgs
());
return
jdbcTemplate
.
limit
(
sql
,
page
,
argEdit
.
getObjs
());
}
@Override
public
void
disableAdmin
(
Integer
[]
adminid
)
{
String
sql
=
"update fc_admin set state = 2 where admin in ("
+
StringUtil
.
join
(
"?"
,
", "
,
adminid
.
length
)
+
")"
;
jdbcTemplate
.
executeUpdate
(
sql
,
(
Object
[])
adminid
);
}
@Override
public
void
saveAdmin
(
Fc_admin
admin
)
{
jdbcTemplate
.
save
(
admin
);
}
@Override
public
void
mergeAdmin
(
Fc_admin
admin
)
{
jdbcTemplate
.
merge
(
admin
);
}
}
}
}
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