Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
C
cneeds-server
Overview
Overview
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
zhangzr
cneeds-server
Commits
1cfe83c4
Commit
1cfe83c4
authored
Mar 10, 2020
by
zzrdark
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
1.增加dto
2.系统管理4个模块的查询 3.系统模块add功能 4.增加mysql注释
parent
5e295728
Show whitespace changes
Inline
Side-by-side
Showing
17 changed files
with
383 additions
and
29 deletions
+383
-29
cneeds_server.sql
cneeds-common-data/db/cneeds_server.sql
+8
-8
SysFuncEntity.java
.../main/java/com/mx/cneeds/server/entity/SysFuncEntity.java
+1
-1
SysRoleEntity.java
.../main/java/com/mx/cneeds/server/entity/SysRoleEntity.java
+4
-0
SysUserEntity.java
.../main/java/com/mx/cneeds/server/entity/SysUserEntity.java
+1
-1
FuncDto.java
...-pojo/src/main/java/com/mx/cneeds/common/dto/FuncDto.java
+9
-0
RoleDto.java
...-pojo/src/main/java/com/mx/cneeds/common/dto/RoleDto.java
+42
-0
DepartmentVo.java
...o/src/main/java/com/mx/cneeds/common/vo/DepartmentVo.java
+15
-0
RequestParamterConverter.java
.../mx/cneeds/common/converter/RequestParamterConverter.java
+64
-1
UserClient.java
...java/com/mx/cneeds/server/datashow/client/UserClient.java
+54
-1
CrossFilter.java
...ava/com/mx/cneeds/server/datashow/filter/CrossFilter.java
+0
-2
SystemController.java
...x/cneeds/server/datashow/web/system/SystemController.java
+131
-6
SysDeptService.java
...ava/com/mx/cneeds/server/user/service/SysDeptService.java
+1
-0
SysDeptServiceImpl.java
...x/cneeds/server/user/service/impl/SysDeptServiceImpl.java
+9
-1
SysRoleServiceImpl.java
...x/cneeds/server/user/service/impl/SysRoleServiceImpl.java
+8
-0
SysDeptController.java
...java/com/mx/cneeds/server/user/web/SysDeptController.java
+2
-3
SysRoleController.java
...java/com/mx/cneeds/server/user/web/SysRoleController.java
+32
-2
SysUserController.java
...java/com/mx/cneeds/server/user/web/SysUserController.java
+2
-3
No files found.
cneeds-common-data/db/cneeds_server.sql
View file @
1cfe83c4
...
@@ -104,13 +104,13 @@ CREATE TABLE `sys_dept` (
...
@@ -104,13 +104,13 @@ CREATE TABLE `sys_dept` (
-- ----------------------------
-- ----------------------------
DROP
TABLE
IF
EXISTS
`sys_func`
;
DROP
TABLE
IF
EXISTS
`sys_func`
;
CREATE
TABLE
`sys_func`
(
CREATE
TABLE
`sys_func`
(
`func_id`
bigint
(
20
)
NOT
NULL
,
`func_id`
bigint
(
20
)
NOT
NULL
COMMENT
'ID'
,
`parent_id`
bigint
(
20
)
NOT
NULL
,
`parent_id`
bigint
(
20
)
NOT
NULL
COMMENT
'父类ID'
,
`name`
varchar
(
50
)
CHARACTER
SET
utf8
COLLATE
utf8_general_ci
DEFAULT
NULL
,
`name`
varchar
(
50
)
CHARACTER
SET
utf8
COLLATE
utf8_general_ci
DEFAULT
NULL
COMMENT
'部门名称'
,
`url`
varchar
(
50
)
CHARACTER
SET
utf8
COLLATE
utf8_general_ci
DEFAULT
NULL
,
`url`
varchar
(
50
)
CHARACTER
SET
utf8
COLLATE
utf8_general_ci
DEFAULT
NULL
COMMENT
'地址'
,
`perms`
varchar
(
1000
)
CHARACTER
SET
utf8
COLLATE
utf8_general_ci
DEFAULT
NULL
,
`perms`
varchar
(
1000
)
CHARACTER
SET
utf8
COLLATE
utf8_general_ci
DEFAULT
NULL
COMMENT
'授权'
,
`type`
int
(
11
)
DEFAULT
NULL
,
`type`
int
(
11
)
DEFAULT
NULL
COMMENT
'类型 0:目录 1:菜单 2:按钮'
,
`order_num`
int
(
11
)
DEFAULT
NULL
,
`order_num`
int
(
11
)
DEFAULT
NULL
COMMENT
'排序'
,
PRIMARY
KEY
(
`func_id`
)
USING
BTREE
PRIMARY
KEY
(
`func_id`
)
USING
BTREE
)
ENGINE
=
InnoDB
CHARACTER
SET
=
utf8
COLLATE
=
utf8_general_ci
COMMENT
=
'功能表'
ROW_FORMAT
=
Dynamic
;
)
ENGINE
=
InnoDB
CHARACTER
SET
=
utf8
COLLATE
=
utf8_general_ci
COMMENT
=
'功能表'
ROW_FORMAT
=
Dynamic
;
...
@@ -164,7 +164,7 @@ CREATE TABLE `sys_user` (
...
@@ -164,7 +164,7 @@ CREATE TABLE `sys_user` (
`salt`
varchar
(
20
)
CHARACTER
SET
utf8
COLLATE
utf8_general_ci
DEFAULT
NULL
COMMENT
'加密盐'
,
`salt`
varchar
(
20
)
CHARACTER
SET
utf8
COLLATE
utf8_general_ci
DEFAULT
NULL
COMMENT
'加密盐'
,
`email`
varchar
(
50
)
CHARACTER
SET
utf8
COLLATE
utf8_general_ci
DEFAULT
NULL
COMMENT
'邮箱'
,
`email`
varchar
(
50
)
CHARACTER
SET
utf8
COLLATE
utf8_general_ci
DEFAULT
NULL
COMMENT
'邮箱'
,
`mobile`
varchar
(
50
)
CHARACTER
SET
utf8
COLLATE
utf8_general_ci
DEFAULT
NULL
COMMENT
'手机'
,
`mobile`
varchar
(
50
)
CHARACTER
SET
utf8
COLLATE
utf8_general_ci
DEFAULT
NULL
COMMENT
'手机'
,
`status`
int
(
11
)
DEFAULT
NULL
COMMENT
'账户状态'
,
`status`
int
(
11
)
DEFAULT
NULL
COMMENT
'账户状态
0:禁用 1:正常
'
,
`create_time`
date
DEFAULT
NULL
COMMENT
'创建时间'
,
`create_time`
date
DEFAULT
NULL
COMMENT
'创建时间'
,
`dept_id`
bigint
(
20
)
DEFAULT
NULL
COMMENT
'部门id'
,
`dept_id`
bigint
(
20
)
DEFAULT
NULL
COMMENT
'部门id'
,
PRIMARY
KEY
(
`user_id`
)
USING
BTREE
PRIMARY
KEY
(
`user_id`
)
USING
BTREE
...
...
cneeds-common-data/src/main/java/com/mx/cneeds/server/entity/SysFuncEntity.java
View file @
1cfe83c4
...
@@ -41,7 +41,7 @@ public class SysFuncEntity implements Serializable {
...
@@ -41,7 +41,7 @@ public class SysFuncEntity implements Serializable {
*/
*/
private
String
perms
;
private
String
perms
;
/**
/**
*
*
类型 0:目录 1:菜单 2:按钮
*/
*/
private
Integer
type
;
private
Integer
type
;
/**
/**
...
...
cneeds-common-data/src/main/java/com/mx/cneeds/server/entity/SysRoleEntity.java
View file @
1cfe83c4
...
@@ -3,7 +3,9 @@ package com.mx.cneeds.server.entity;
...
@@ -3,7 +3,9 @@ package com.mx.cneeds.server.entity;
import
com.baomidou.mybatisplus.annotation.TableId
;
import
com.baomidou.mybatisplus.annotation.TableId
;
import
com.baomidou.mybatisplus.annotation.TableName
;
import
com.baomidou.mybatisplus.annotation.TableName
;
import
lombok.Data
;
import
lombok.Data
;
import
org.springframework.transaction.annotation.Transactional
;
import
java.beans.Transient
;
import
java.io.Serializable
;
import
java.io.Serializable
;
import
java.util.Date
;
import
java.util.Date
;
...
@@ -41,4 +43,6 @@ public class SysRoleEntity implements Serializable {
...
@@ -41,4 +43,6 @@ public class SysRoleEntity implements Serializable {
*/
*/
private
Date
createTime
;
private
Date
createTime
;
}
}
cneeds-common-data/src/main/java/com/mx/cneeds/server/entity/SysUserEntity.java
View file @
1cfe83c4
...
@@ -45,7 +45,7 @@ public class SysUserEntity implements Serializable {
...
@@ -45,7 +45,7 @@ public class SysUserEntity implements Serializable {
*/
*/
private
String
mobile
;
private
String
mobile
;
/**
/**
* 账户状态
* 账户状态
0:禁用 1:正常
*/
*/
private
Integer
status
;
private
Integer
status
;
/**
/**
...
...
cneeds-common-pojo/src/main/java/com/mx/cneeds/common/dto/FuncDto.java
View file @
1cfe83c4
...
@@ -21,9 +21,18 @@ public class FuncDto implements Serializable {
...
@@ -21,9 +21,18 @@ public class FuncDto implements Serializable {
private
String
url
;
private
String
url
;
/**
* 授权
*/
private
String
perms
;
private
String
perms
;
/**
* 类型 0:目录 1:菜单 2:按钮
*/
private
Integer
type
;
private
Integer
type
;
/**
* 排序
*/
private
Integer
orderNum
;
private
Integer
orderNum
;
}
}
cneeds-common-pojo/src/main/java/com/mx/cneeds/common/dto/RoleDto.java
0 → 100644
View file @
1cfe83c4
package
com
.
mx
.
cneeds
.
common
.
dto
;
import
lombok.Data
;
import
java.io.Serializable
;
import
java.util.Date
;
/**
* @ClassName DeptDtp
* @Author zzrdark
* @Date 2020-03-10 16:00
* @Description TODO
**/
@Data
public
class
RoleDto
implements
Serializable
{
/**
*
*/
private
Long
roleId
;
/**
* 角色名称
*/
private
String
roleName
;
/**
* 备注
*/
private
String
remark
;
/**
* 部门Id
*/
private
Long
deptId
;
/**
* 创建时间
*/
private
Date
createTime
;
/**
* 部门名称
*/
private
String
deptName
;
}
cneeds-common-pojo/src/main/java/com/mx/cneeds/common/vo/DepartmentVo.java
0 → 100644
View file @
1cfe83c4
package
com
.
mx
.
cneeds
.
common
.
vo
;
import
lombok.Data
;
/**
* @ClassName DepartmentVO
* @Author zzrdark
* @Date 2020-03-10 20:14
* @Description TODO
**/
@Data
public
class
DepartmentVo
{
private
String
deptName
;
private
String
remark
;
}
cneeds-server-datashow/src/main/java/com/mx/cneeds/common/converter/RequestParamterConverter.java
View file @
1cfe83c4
package
com
.
mx
.
cneeds
.
common
.
converter
;
package
com
.
mx
.
cneeds
.
common
.
converter
;
import
javax.xml.bind.DatatypeConverter
;
import
javax.xml.bind.DatatypeConverter
;
import
java.util.regex.Matcher
;
import
java.util.regex.Pattern
;
/**
/**
* @ClassName RequestParamterConverter
* @ClassName RequestParamterConverter
...
@@ -23,7 +25,68 @@ public class RequestParamterConverter {
...
@@ -23,7 +25,68 @@ public class RequestParamterConverter {
return
sb
.
toString
();
return
sb
.
toString
();
}
}
/**
* 下划线命名转驼峰命名
* @param underscore
* @return
*/
public
static
String
underscoreToCamelCase
(
String
underscore
){
String
[]
ss
=
underscore
.
split
(
"_"
);
if
(
ss
.
length
==
1
){
return
underscore
;
}
StringBuffer
sb
=
new
StringBuffer
();
sb
.
append
(
ss
[
0
]);
for
(
int
i
=
1
;
i
<
ss
.
length
;
i
++)
{
sb
.
append
(
upperFirstCase
(
ss
[
i
]));
}
return
sb
.
toString
();
}
/**
* 驼峰 转下划线
* @param camelCase
* @return
*/
public
static
String
toLine
(
String
camelCase
){
Pattern
humpPattern
=
Pattern
.
compile
(
"[A-Z]"
);
Matcher
matcher
=
humpPattern
.
matcher
(
camelCase
);
StringBuffer
sb
=
new
StringBuffer
();
while
(
matcher
.
find
()){
matcher
.
appendReplacement
(
sb
,
"_"
+
matcher
.
group
(
0
).
toLowerCase
());
}
matcher
.
appendTail
(
sb
);
return
sb
.
toString
();
}
/**
* 首字母 转小写
* @param str
* @return
*/
private
static
String
lowerFirstCase
(
String
str
)
{
char
[]
chars
=
str
.
toCharArray
();
chars
[
0
]
+=
32
;
return
String
.
valueOf
(
chars
);
}
/**
* 首字母 转大写
* @param str
* @return
*/
private
static
String
upperFirstCase
(
String
str
)
{
char
[]
chars
=
str
.
toCharArray
();
chars
[
0
]
-=
32
;
return
String
.
valueOf
(
chars
);
}
public
static
void
main
(
String
[]
args
)
{
public
static
void
main
(
String
[]
args
)
{
System
.
out
.
println
(
authorizationConverter
(
"clientapp"
,
"112233"
));
// System.out.println(authorizationConverter("clientapp", "112233"));
System
.
out
.
println
(
toLine
(
"userName"
));
}
}
}
}
cneeds-server-datashow/src/main/java/com/mx/cneeds/server/datashow/client/UserClient.java
View file @
1cfe83c4
...
@@ -16,6 +16,59 @@ import org.springframework.web.bind.annotation.RequestParam;
...
@@ -16,6 +16,59 @@ import org.springframework.web.bind.annotation.RequestParam;
@FeignClient
(
name
=
"CNEEDS-SERVER-USER"
)
@FeignClient
(
name
=
"CNEEDS-SERVER-USER"
)
public
interface
UserClient
{
public
interface
UserClient
{
/**
*
* @param page
* @param pageSize
* @param order
* @param orderField
* @return
*/
@PostMapping
(
"/sys/func/list"
)
@PostMapping
(
"/sys/func/list"
)
PageDto
funcList
(
@RequestParam
Integer
page
,
@RequestParam
(
"limit"
)
Integer
pageSize
);
PageDto
funcList
(
@RequestParam
Integer
page
,
@RequestParam
(
"limit"
)
Integer
pageSize
,
@RequestParam
(
"sidx"
)
String
orderField
,
@RequestParam
(
"order"
)
String
order
);
/**
*
* @param page
* @param pageSize
* @param orderField
* @param order
* @return
*/
@PostMapping
(
"/sys/dept/list"
)
PageDto
deptList
(
@RequestParam
Integer
page
,
@RequestParam
(
"limit"
)
Integer
pageSize
,
@RequestParam
(
"sidx"
)
String
orderField
,
@RequestParam
(
"order"
)
String
order
);
/**
*
* @param page
* @param pageSize
* @param order
* @param orderField
* @return
*/
@PostMapping
(
"/sys/role/list"
)
PageDto
roleList
(
@RequestParam
Integer
page
,
@RequestParam
(
"limit"
)
Integer
pageSize
,
@RequestParam
(
"sidx"
)
String
orderField
,
@RequestParam
(
"order"
)
String
order
);
/**
*
* @param page
* @param pageSize
* @param order
* @param orderField
* @return
*/
@PostMapping
(
"/sys/user/list"
)
PageDto
userList
(
@RequestParam
Integer
page
,
@RequestParam
(
"limit"
)
Integer
pageSize
,
@RequestParam
(
"sidx"
)
String
orderField
,
@RequestParam
(
"order"
)
String
order
);
}
}
cneeds-server-datashow/src/main/java/com/mx/cneeds/server/datashow/filter/CrossFilter.java
View file @
1cfe83c4
...
@@ -27,8 +27,6 @@ public class CrossFilter implements Filter {
...
@@ -27,8 +27,6 @@ public class CrossFilter implements Filter {
@Override
@Override
public
void
doFilter
(
ServletRequest
request
,
ServletResponse
response
,
FilterChain
filterChain
)
throws
IOException
,
ServletException
{
public
void
doFilter
(
ServletRequest
request
,
ServletResponse
response
,
FilterChain
filterChain
)
throws
IOException
,
ServletException
{
HttpServletRequest
httpServletRequest
=
(
HttpServletRequest
)
request
;
HttpServletRequest
httpServletRequest
=
(
HttpServletRequest
)
request
;
log
.
info
(
httpServletRequest
.
getRequestURL
().
toString
());
// log.info(httpServletRequest.getHeader("Access-Control-Allow-Origin"));
HttpServletResponse
httpResponse
=
(
HttpServletResponse
)
response
;
HttpServletResponse
httpResponse
=
(
HttpServletResponse
)
response
;
httpResponse
.
setHeader
(
"Access-Control-Allow-Origin"
,
"*"
);
httpResponse
.
setHeader
(
"Access-Control-Allow-Origin"
,
"*"
);
httpResponse
.
setHeader
(
"Access-Control-Allow-Methods"
,
"*"
);
httpResponse
.
setHeader
(
"Access-Control-Allow-Methods"
,
"*"
);
...
...
cneeds-server-datashow/src/main/java/com/mx/cneeds/server/datashow/web/system/SystemController.java
View file @
1cfe83c4
package
com
.
mx
.
cneeds
.
server
.
datashow
.
web
.
system
;
package
com
.
mx
.
cneeds
.
server
.
datashow
.
web
.
system
;
import
com.mx.cneeds.common.converter.RequestParamterConverter
;
import
com.mx.cneeds.common.dto.PageDto
;
import
com.mx.cneeds.common.dto.PageDto
;
import
com.mx.cneeds.common.result.R
;
import
com.mx.cneeds.common.result.R
;
import
com.mx.cneeds.common.vo.DepartmentVo
;
import
com.mx.cneeds.server.datashow.client.UserClient
;
import
com.mx.cneeds.server.datashow.client.UserClient
;
import
lombok.extern.slf4j.Slf4j
;
import
lombok.extern.slf4j.Slf4j
;
import
org.apache.commons.lang.StringUtils
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.web.bind.annotation.PostMapping
;
import
org.springframework.web.bind.annotation.PostMapping
;
import
org.springframework.web.bind.annotation.RequestMapping
;
import
org.springframework.web.bind.annotation.RequestMapping
;
...
@@ -25,17 +28,139 @@ public class SystemController {
...
@@ -25,17 +28,139 @@ public class SystemController {
private
UserClient
userClient
;
private
UserClient
userClient
;
@PostMapping
(
"/module/list"
)
@PostMapping
(
"/module/list"
)
public
R
funcList
(
@RequestParam
Integer
page
,
@RequestParam
Integer
pageSize
){
public
R
funcList
(
@RequestParam
(
required
=
false
)
Integer
page
,
if
(
page
==
null
&&
page
==
0
){
@RequestParam
(
required
=
false
)
Integer
pageSize
,
page
=
1
;
@RequestParam
(
required
=
false
)
String
sort
){
String
orderField
=
null
;
String
order
=
null
;
if
(
page
==
null
||
page
==
0
){
page
=
new
Integer
(
1
);
}
if
(
pageSize
==
null
||
pageSize
==
0
){
pageSize
=
new
Integer
(
10
);
}
if
(
StringUtils
.
isNotEmpty
(
sort
)
&&
StringUtils
.
isNotBlank
(
sort
.
trim
())){
if
(
sort
.
contains
(
"+"
)){
order
=
new
String
(
"asc"
);
}
if
(
sort
.
contains
(
"-"
)){
order
=
new
String
(
"desc"
);
}
orderField
=
sort
.
substring
(
1
);
orderField
=
RequestParamterConverter
.
toLine
(
orderField
);
}
PageDto
pageDto
=
userClient
.
funcList
(
page
,
pageSize
,
orderField
,
order
);
return
new
R
().
put
(
"data"
,
pageDto
);
}
@PostMapping
(
"/dept/list"
)
public
R
deptList
(
@RequestParam
(
required
=
false
)
Integer
page
,
@RequestParam
(
required
=
false
)
Integer
pageSize
,
@RequestParam
(
required
=
false
)
String
sort
){
String
orderField
=
null
;
String
order
=
null
;
if
(
page
==
null
||
page
==
0
){
page
=
new
Integer
(
1
);
}
if
(
pageSize
==
null
||
pageSize
==
0
){
pageSize
=
new
Integer
(
10
);
}
if
(
StringUtils
.
isNotEmpty
(
sort
)
&&
StringUtils
.
isNotBlank
(
sort
.
trim
())){
if
(
sort
.
contains
(
"+"
)){
order
=
new
String
(
"asc"
);
}
if
(
sort
.
contains
(
"-"
)){
order
=
new
String
(
"desc"
);
}
orderField
=
sort
.
substring
(
1
);
orderField
=
RequestParamterConverter
.
toLine
(
orderField
);
}
PageDto
pageDto
=
userClient
.
deptList
(
page
,
pageSize
,
orderField
,
order
);
return
new
R
().
put
(
"data"
,
pageDto
);
}
@PostMapping
(
"/role/list"
)
public
R
roleList
(
@RequestParam
(
required
=
false
)
Integer
page
,
@RequestParam
(
required
=
false
)
Integer
pageSize
,
@RequestParam
(
required
=
false
)
String
sort
){
String
orderField
=
null
;
String
order
=
null
;
if
(
page
==
null
||
page
==
0
){
page
=
new
Integer
(
1
);
}
if
(
pageSize
==
null
||
pageSize
==
0
){
pageSize
=
new
Integer
(
10
);
}
if
(
StringUtils
.
isNotEmpty
(
sort
)
&&
StringUtils
.
isNotBlank
(
sort
.
trim
())){
if
(
sort
.
contains
(
"+"
)){
order
=
new
String
(
"asc"
);
}
if
(
sort
.
contains
(
"-"
)){
order
=
new
String
(
"desc"
);
}
}
if
(
pageSize
==
null
&&
pageSize
==
0
){
orderField
=
sort
.
substring
(
1
);
pageSize
=
10
;
orderField
=
RequestParamterConverter
.
toLine
(
orderField
)
;
}
}
PageDto
pageDto
=
userClient
.
funcList
(
page
,
pageSize
);
PageDto
pageDto
=
userClient
.
roleList
(
page
,
pageSize
,
orderField
,
order
);
return
new
R
().
put
(
"data"
,
pageDto
);
return
new
R
().
put
(
"data"
,
pageDto
);
}
}
@PostMapping
(
"/user/list"
)
public
R
userList
(
@RequestParam
(
required
=
false
)
Integer
page
,
@RequestParam
(
required
=
false
)
Integer
pageSize
,
@RequestParam
(
required
=
false
)
String
sort
){
String
orderField
=
null
;
String
order
=
null
;
if
(
page
==
null
||
page
==
0
){
page
=
new
Integer
(
1
);
}
if
(
pageSize
==
null
||
pageSize
==
0
){
pageSize
=
new
Integer
(
10
);
}
if
(
StringUtils
.
isNotEmpty
(
sort
)
&&
StringUtils
.
isNotBlank
(
sort
.
trim
())){
if
(
sort
.
contains
(
"+"
)){
order
=
new
String
(
"asc"
);
}
if
(
sort
.
contains
(
"-"
)){
order
=
new
String
(
"desc"
);
}
orderField
=
sort
.
substring
(
1
);
orderField
=
RequestParamterConverter
.
toLine
(
orderField
);
}
PageDto
pageDto
=
userClient
.
userList
(
page
,
pageSize
,
orderField
,
order
);
return
new
R
().
put
(
"data"
,
pageDto
);
}
@PostMapping
(
"/dept/add"
)
public
R
addDept
(
DepartmentVo
departmentVo
){
return
R
.
ok
();
}
}
}
cneeds-server-user/src/main/java/com/mx/cneeds/server/user/service/SysDeptService.java
View file @
1cfe83c4
...
@@ -24,5 +24,6 @@ public interface SysDeptService extends IService<SysDeptEntity> {
...
@@ -24,5 +24,6 @@ public interface SysDeptService extends IService<SysDeptEntity> {
List
<
Long
>
getSubDeptIdList
(
Long
deptId
);
List
<
Long
>
getSubDeptIdList
(
Long
deptId
);
List
<
Long
>
queryDetpIdList
(
Long
parentId
);
List
<
Long
>
queryDetpIdList
(
Long
parentId
);
List
<
SysDeptEntity
>
queryDeptIdsBydeptName
(
List
<
Long
>
Ids
);
}
}
cneeds-server-user/src/main/java/com/mx/cneeds/server/user/service/impl/SysDeptServiceImpl.java
View file @
1cfe83c4
...
@@ -13,7 +13,7 @@ import java.util.Map;
...
@@ -13,7 +13,7 @@ import java.util.Map;
import
com.baomidou.mybatisplus.core.conditions.query.QueryWrapper
;
import
com.baomidou.mybatisplus.core.conditions.query.QueryWrapper
;
import
com.baomidou.mybatisplus.core.metadata.IPage
;
import
com.baomidou.mybatisplus.core.metadata.IPage
;
import
com.baomidou.mybatisplus.extension.service.impl.ServiceImpl
;
import
com.baomidou.mybatisplus.extension.service.impl.ServiceImpl
;
import
org.springframework.transaction.annotation.Transactional
;
@Service
(
"sysDeptService"
)
@Service
(
"sysDeptService"
)
...
@@ -46,6 +46,14 @@ public class SysDeptServiceImpl extends ServiceImpl<SysDeptDao, SysDeptEntity> i
...
@@ -46,6 +46,14 @@ public class SysDeptServiceImpl extends ServiceImpl<SysDeptDao, SysDeptEntity> i
return
baseMapper
.
queryDetpIdList
(
parentId
);
return
baseMapper
.
queryDetpIdList
(
parentId
);
}
}
@Override
// @Transactional
public
List
<
SysDeptEntity
>
queryDeptIdsBydeptName
(
List
<
Long
>
Ids
)
{
return
baseMapper
.
selectList
(
new
QueryWrapper
<
SysDeptEntity
>()
.
select
(
"dept_id"
,
"name"
).
in
(
"dept_id"
,
Ids
));
}
/**
/**
* 递归
* 递归
*/
*/
...
...
cneeds-server-user/src/main/java/com/mx/cneeds/server/user/service/impl/SysRoleServiceImpl.java
View file @
1cfe83c4
...
@@ -3,9 +3,15 @@ package com.mx.cneeds.server.user.service.impl;
...
@@ -3,9 +3,15 @@ package com.mx.cneeds.server.user.service.impl;
import
com.mx.cneeds.common.pager.PageUtils
;
import
com.mx.cneeds.common.pager.PageUtils
;
import
com.mx.cneeds.common.pager.Query
;
import
com.mx.cneeds.common.pager.Query
;
import
com.mx.cneeds.server.dao.SysRoleDao
;
import
com.mx.cneeds.server.dao.SysRoleDao
;
import
com.mx.cneeds.server.entity.SysDeptEntity
;
import
com.mx.cneeds.server.entity.SysRoleEntity
;
import
com.mx.cneeds.server.entity.SysRoleEntity
;
import
com.mx.cneeds.server.user.service.SysDeptService
;
import
com.mx.cneeds.server.user.service.SysRoleService
;
import
com.mx.cneeds.server.user.service.SysRoleService
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.stereotype.Service
;
import
org.springframework.stereotype.Service
;
import
java.util.ArrayList
;
import
java.util.List
;
import
java.util.Map
;
import
java.util.Map
;
import
com.baomidou.mybatisplus.core.conditions.query.QueryWrapper
;
import
com.baomidou.mybatisplus.core.conditions.query.QueryWrapper
;
import
com.baomidou.mybatisplus.core.metadata.IPage
;
import
com.baomidou.mybatisplus.core.metadata.IPage
;
...
@@ -15,6 +21,8 @@ import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
...
@@ -15,6 +21,8 @@ import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
@Service
(
"sysRoleService"
)
@Service
(
"sysRoleService"
)
public
class
SysRoleServiceImpl
extends
ServiceImpl
<
SysRoleDao
,
SysRoleEntity
>
implements
SysRoleService
{
public
class
SysRoleServiceImpl
extends
ServiceImpl
<
SysRoleDao
,
SysRoleEntity
>
implements
SysRoleService
{
@Override
@Override
public
PageUtils
queryPage
(
Map
<
String
,
Object
>
params
)
{
public
PageUtils
queryPage
(
Map
<
String
,
Object
>
params
)
{
IPage
<
SysRoleEntity
>
page
=
this
.
page
(
IPage
<
SysRoleEntity
>
page
=
this
.
page
(
...
...
cneeds-server-user/src/main/java/com/mx/cneeds/server/user/web/SysDeptController.java
View file @
1cfe83c4
...
@@ -32,10 +32,9 @@ public class SysDeptController {
...
@@ -32,10 +32,9 @@ public class SysDeptController {
*/
*/
@RequestMapping
(
"/list"
)
@RequestMapping
(
"/list"
)
// @RequiresPermissions("sys:sysdept:list")
// @RequiresPermissions("sys:sysdept:list")
public
R
list
(
@RequestParam
Map
<
String
,
Object
>
params
){
public
PageUtils
list
(
@RequestParam
Map
<
String
,
Object
>
params
){
PageUtils
page
=
sysDeptService
.
queryPage
(
params
);
PageUtils
page
=
sysDeptService
.
queryPage
(
params
);
return
page
;
return
R
.
ok
().
put
(
"page"
,
page
);
}
}
...
...
cneeds-server-user/src/main/java/com/mx/cneeds/server/user/web/SysRoleController.java
View file @
1cfe83c4
package
com
.
mx
.
cneeds
.
server
.
user
.
web
;
package
com
.
mx
.
cneeds
.
server
.
user
.
web
;
import
com.mx.cneeds.common.dto.RoleDto
;
import
com.mx.cneeds.common.pager.PageUtils
;
import
com.mx.cneeds.common.pager.PageUtils
;
import
com.mx.cneeds.common.result.R
;
import
com.mx.cneeds.common.result.R
;
import
com.mx.cneeds.common.validator.ValidatorUtils
;
import
com.mx.cneeds.common.validator.ValidatorUtils
;
import
com.mx.cneeds.server.entity.SysDeptEntity
;
import
com.mx.cneeds.server.entity.SysRoleEntity
;
import
com.mx.cneeds.server.entity.SysRoleEntity
;
import
com.mx.cneeds.server.user.service.SysDeptService
;
import
com.mx.cneeds.server.user.service.SysRoleService
;
import
com.mx.cneeds.server.user.service.SysRoleService
;
import
org.springframework.beans.BeanUtils
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.web.bind.annotation.*
;
import
org.springframework.web.bind.annotation.*
;
import
java.util.ArrayList
;
import
java.util.Arrays
;
import
java.util.Arrays
;
import
java.util.List
;
import
java.util.Map
;
import
java.util.Map
;
//import org.apache.shiro.authz.annotation.RequiresPermissions;
//import org.apache.shiro.authz.annotation.RequiresPermissions;
...
@@ -27,15 +33,39 @@ public class SysRoleController {
...
@@ -27,15 +33,39 @@ public class SysRoleController {
@Autowired
@Autowired
private
SysRoleService
sysRoleService
;
private
SysRoleService
sysRoleService
;
@Autowired
private
SysDeptService
sysDeptService
;
/**
/**
* 列表
* 列表
*/
*/
@RequestMapping
(
"/list"
)
@RequestMapping
(
"/list"
)
// @RequiresPermissions("sys:sysrole:list")
// @RequiresPermissions("sys:sysrole:list")
public
R
list
(
@RequestParam
Map
<
String
,
Object
>
params
){
public
PageUtils
list
(
@RequestParam
Map
<
String
,
Object
>
params
){
PageUtils
page
=
sysRoleService
.
queryPage
(
params
);
PageUtils
page
=
sysRoleService
.
queryPage
(
params
);
return
R
.
ok
().
put
(
"page"
,
page
);
List
<
Long
>
list
=
new
ArrayList
<>();
page
.
getList
().
forEach
(
e
->
{
SysRoleEntity
entity
=
(
SysRoleEntity
)
e
;
list
.
add
(
entity
.
getDeptId
());
});
List
<
SysDeptEntity
>
sysDeptEntityList
=
sysDeptService
.
queryDeptIdsBydeptName
(
list
);
List
<
RoleDto
>
roleDtos
=
new
ArrayList
<>();
page
.
getList
().
forEach
(
e
->
{
SysRoleEntity
entity
=
(
SysRoleEntity
)
e
;
for
(
SysDeptEntity
deptEntity
:
sysDeptEntityList
)
{
if
(
deptEntity
.
getDeptId
().
equals
(
entity
.
getDeptId
())){
RoleDto
roleDto
=
new
RoleDto
();
BeanUtils
.
copyProperties
(
entity
,
roleDto
);
roleDto
.
setDeptName
(
deptEntity
.
getName
());
roleDtos
.
add
(
roleDto
);
}
}
});
page
.
setList
(
roleDtos
);
return
page
;
}
}
...
...
cneeds-server-user/src/main/java/com/mx/cneeds/server/user/web/SysUserController.java
View file @
1cfe83c4
...
@@ -41,10 +41,9 @@ public class SysUserController {
...
@@ -41,10 +41,9 @@ public class SysUserController {
*/
*/
@RequestMapping
(
"/list"
)
@RequestMapping
(
"/list"
)
// @RequiresPermissions("sys:sysuser:list")
// @RequiresPermissions("sys:sysuser:list")
public
R
list
(
@RequestParam
Map
<
String
,
Object
>
params
){
public
PageUtils
list
(
@RequestParam
Map
<
String
,
Object
>
params
){
PageUtils
page
=
sysUserService
.
queryPage
(
params
);
PageUtils
page
=
sysUserService
.
queryPage
(
params
);
return
page
;
return
R
.
ok
().
put
(
"page"
,
page
);
}
}
...
...
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