Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Contribute to GitLab
Sign in
Toggle navigation
M
member-api
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
曲欣亮
member-api
Commits
02e4fc17
Commit
02e4fc17
authored
Nov 19, 2018
by
Quxl
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
管理员组和组权限
parent
72ece12a
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
158 additions
and
5 deletions
+158
-5
AdminAuthController.java
...in/java/com/egolm/film/api/admin/AdminAuthController.java
+9
-3
AdminAuthService.java
...va/com/egolm/film/api/admin/service/AdminAuthService.java
+10
-0
AdminAuthServiceImpl.java
...olm/film/api/admin/service/impl/AdminAuthServiceImpl.java
+22
-0
Fc_admin_group.java
src/main/java/com/egolm/film/bean/Fc_admin_group.java
+16
-1
DBUtil.java
src/main/java/com/egolm/film/util/DBUtil.java
+1
-1
SqlWhere.java
src/main/java/com/egolm/film/util/SqlWhere.java
+100
-0
No files found.
src/main/java/com/egolm/film/api/admin/AdminAuthController.java
View file @
02e4fc17
...
...
@@ -3,6 +3,8 @@ package com.egolm.film.api.admin;
import
java.io.File
;
import
java.io.FileNotFoundException
;
import
java.util.Date
;
import
java.util.List
;
import
java.util.Map
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.stereotype.Controller
;
...
...
@@ -12,6 +14,7 @@ import org.springframework.web.bind.annotation.ResponseBody;
import
com.egolm.common.FileUtil
;
import
com.egolm.common.bean.Rjx
;
import
com.egolm.common.jdbc.Page
;
import
com.egolm.film.api.admin.service.AdminAuthService
;
import
com.egolm.film.bean.Fc_admin_group
;
import
com.egolm.film.config.WebMvcConfig
;
...
...
@@ -46,7 +49,6 @@ public class AdminAuthController {
@RequestMapping
(
"adminDilabled"
)
@ApiOperation
(
"禁用管理员"
)
public
Object
adminDilabled
(
String
[]
adminid
)
{
return
Rjx
.
jsonOk
();
}
...
...
@@ -54,8 +56,11 @@ public class AdminAuthController {
@RequestMapping
(
"groupList"
)
@ApiOperation
(
"管理员分组,分页查询"
)
public
Object
groupList
(
String
keyword
,
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
>>
datas
=
service
.
queryGroupList
(
keyword
,
page
);
return
Rjx
.
jsonOk
().
setData
(
datas
);
}
@ResponseBody
...
...
@@ -79,6 +84,7 @@ public class AdminAuthController {
group
.
setCreate_ip
(
remoteIp
);
group
.
setCreate_time
(
System
.
currentTimeMillis
());
group
.
setGroup_power
(
group_power
);
service
.
saveOrUpdateGroup
(
group
);
return
Rjx
.
jsonOk
();
}
...
...
src/main/java/com/egolm/film/api/admin/service/AdminAuthService.java
View file @
02e4fc17
package
com
.
egolm
.
film
.
api
.
admin
.
service
;
import
java.util.List
;
import
java.util.Map
;
import
com.egolm.common.jdbc.Page
;
import
com.egolm.film.bean.Fc_admin_group
;
public
interface
AdminAuthService
{
void
saveOrUpdateGroup
(
Fc_admin_group
group
);
List
<
Map
<
String
,
Object
>>
queryGroupList
(
String
keyword
,
Page
page
);
}
src/main/java/com/egolm/film/api/admin/service/impl/AdminAuthServiceImpl.java
View file @
02e4fc17
package
com
.
egolm
.
film
.
api
.
admin
.
service
.
impl
;
import
java.util.List
;
import
java.util.Map
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.stereotype.Service
;
import
com.egolm.common.StringUtil
;
import
com.egolm.common.jdbc.JdbcTemplate
;
import
com.egolm.common.jdbc.Page
;
import
com.egolm.film.api.admin.service.AdminAuthService
;
import
com.egolm.film.bean.Fc_admin_group
;
import
com.egolm.film.util.SqlWhere
;
@Service
public
class
AdminAuthServiceImpl
implements
AdminAuthService
{
@Autowired
JdbcTemplate
jdbcTemplate
;
@Override
public
void
saveOrUpdateGroup
(
Fc_admin_group
group
)
{
if
(
group
.
getGroup_id
()
==
null
)
{
group
.
setUser_num
(
0
);
}
jdbcTemplate
.
merge
(
group
);
}
@Override
public
List
<
Map
<
String
,
Object
>>
queryGroupList
(
String
keyword
,
Page
page
)
{
SqlWhere
argEdit
=
new
SqlWhere
().
like
(
"group_name"
,
keyword
);
String
sql
=
"select * from"
+
StringUtil
.
join
(
" and "
,
" where "
,
""
,
""
,
argEdit
.
getArgs
());
return
jdbcTemplate
.
limitAll
(
sql
,
page
,
argEdit
.
getObjs
());
}
}
src/main/java/com/egolm/film/bean/Fc_admin_group.java
View file @
02e4fc17
...
...
@@ -45,6 +45,11 @@ public class Fc_admin_group implements java.io.Serializable {
*/
private
Integer
state
;
/**
* 成员数量
*/
private
Integer
user_num
;
/**
* 群组权限
*/
...
...
@@ -66,15 +71,17 @@ public class Fc_admin_group implements java.io.Serializable {
* @param create_ip 创建者ip
* @param adminid 创建者uid
* @param state 小组状态
* @param user_num 成员数量
* @param group_power 群组权限
*/
public
Fc_admin_group
(
Integer
group_id
,
String
group_name
,
Long
create_time
,
String
create_ip
,
Integer
adminid
,
Integer
state
,
String
group_power
)
{
public
Fc_admin_group
(
Integer
group_id
,
String
group_name
,
Long
create_time
,
String
create_ip
,
Integer
adminid
,
Integer
state
,
Integer
user_num
,
String
group_power
)
{
this
.
group_id
=
group_id
;
this
.
group_name
=
group_name
;
this
.
create_time
=
create_time
;
this
.
create_ip
=
create_ip
;
this
.
adminid
=
adminid
;
this
.
state
=
state
;
this
.
user_num
=
user_num
;
this
.
group_power
=
group_power
;
}
...
...
@@ -126,6 +133,14 @@ public class Fc_admin_group implements java.io.Serializable {
return
state
;
}
public
void
setUser_num
(
Integer
user_num
)
{
this
.
user_num
=
user_num
;
}
public
Integer
getUser_num
()
{
return
user_num
;
}
public
void
setGroup_power
(
String
group_power
)
{
this
.
group_power
=
group_power
;
}
...
...
src/main/java/com/egolm/film/util/DBUtil.java
View file @
02e4fc17
...
...
@@ -14,7 +14,7 @@ public class DBUtil {
"film_new"
,
"root"
,
"egolm#2018"
);
mysqlTo
.
execute
();
mysqlTo
.
execute
(
"fc_admin_group"
);
}
}
src/main/java/com/egolm/film/util/SqlWhere.java
0 → 100644
View file @
02e4fc17
package
com
.
egolm
.
film
.
util
;
import
java.util.List
;
import
com.egolm.common.StringUtil
;
public
class
SqlWhere
{
private
List
<
String
>
args
;
private
List
<
Object
>
objs
;
public
SqlWhere
eq
(
String
name
,
Object
obj
)
{
if
(
StringUtil
.
isNotBlank
(
obj
))
{
this
.
args
.
add
(
name
+
" = ?"
);
this
.
objs
.
add
(
obj
);
}
return
this
;
}
public
SqlWhere
gt
(
String
name
,
Object
obj
)
{
if
(
StringUtil
.
isNotBlank
(
obj
))
{
this
.
args
.
add
(
name
+
" > ?"
);
this
.
objs
.
add
(
obj
);
}
return
this
;
}
public
SqlWhere
lt
(
String
name
,
Object
obj
)
{
if
(
StringUtil
.
isNotBlank
(
obj
))
{
this
.
args
.
add
(
name
+
" < ?"
);
this
.
objs
.
add
(
obj
);
}
return
this
;
}
public
SqlWhere
gtq
(
String
name
,
Object
obj
)
{
if
(
StringUtil
.
isNotBlank
(
obj
))
{
this
.
args
.
add
(
name
+
" >= ?"
);
this
.
objs
.
add
(
obj
);
}
return
this
;
}
public
SqlWhere
ltq
(
String
name
,
Object
obj
)
{
if
(
StringUtil
.
isNotBlank
(
obj
))
{
this
.
args
.
add
(
name
+
" <= ?"
);
this
.
objs
.
add
(
obj
);
}
return
this
;
}
public
SqlWhere
like
(
String
name
,
Object
obj
)
{
if
(
StringUtil
.
isNotBlank
(
obj
))
{
this
.
args
.
add
(
name
+
" like ?"
);
this
.
objs
.
add
(
"%"
+
obj
+
"%"
);
}
return
this
;
}
public
SqlWhere
rlike
(
String
name
,
Object
obj
)
{
if
(
StringUtil
.
isNotBlank
(
obj
))
{
this
.
args
.
add
(
name
+
" like ?"
);
this
.
objs
.
add
(
obj
+
"%"
);
}
return
this
;
}
public
SqlWhere
llike
(
String
name
,
Object
obj
)
{
if
(
StringUtil
.
isNotBlank
(
obj
))
{
this
.
args
.
add
(
name
+
" like ?"
);
this
.
objs
.
add
(
"%"
+
obj
);
}
return
this
;
}
public
SqlWhere
in
(
String
name
,
Object
[]
obj
)
{
if
(
obj
!=
null
&&
obj
.
length
>
0
)
{
String
str
=
name
+
" in ("
;
for
(
int
i
=
0
;
i
<
obj
.
length
;
i
++)
{
if
(
i
>
0
)
{
str
+=
", "
;
}
str
+=
"?"
;
this
.
objs
.
add
(
obj
[
i
]);
}
str
+=
")"
;
this
.
args
.
add
(
name
+
" in ("
+
str
+
")"
);
}
return
this
;
}
public
List
<
String
>
getArgs
()
{
return
args
;
}
public
List
<
Object
>
getObjs
()
{
return
objs
;
}
}
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