Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Contribute to GitLab
Sign in
Toggle navigation
Z
zhengyuan-danger-chemistry-manage
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
耿迪迪
zhengyuan-danger-chemistry-manage
Commits
076b02f8
You need to sign in or sign up before continuing.
Commit
076b02f8
authored
Oct 06, 2022
by
zhangjianqian
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
大屏环形图数据
parent
909ec438
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
75 additions
and
0 deletions
+75
-0
SysDeptController.java
...a/com/zehong/web/controller/system/SysDeptController.java
+14
-0
SysDeptMapper.java
...src/main/java/com/zehong/system/mapper/SysDeptMapper.java
+7
-0
ISysDeptService.java
.../main/java/com/zehong/system/service/ISysDeptService.java
+8
-0
SysDeptServiceImpl.java
...va/com/zehong/system/service/impl/SysDeptServiceImpl.java
+27
-0
SysDeptMapper.xml
...system/src/main/resources/mapper/system/SysDeptMapper.xml
+19
-0
No files found.
danger-manage-admin/src/main/java/com/zehong/web/controller/system/SysDeptController.java
View file @
076b02f8
...
...
@@ -2,6 +2,9 @@ package com.zehong.web.controller.system;
import
java.util.Iterator
;
import
java.util.List
;
import
io.swagger.annotations.Api
;
import
io.swagger.annotations.ApiOperation
;
import
org.apache.commons.lang3.ArrayUtils
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.security.access.prepost.PreAuthorize
;
...
...
@@ -29,6 +32,7 @@ import com.zehong.system.service.ISysDeptService;
*
* @author zehong
*/
@Api
(
"部门"
)
@RestController
@RequestMapping
(
"/system/dept"
)
public
class
SysDeptController
extends
BaseController
...
...
@@ -88,6 +92,16 @@ public class SysDeptController extends BaseController
return
AjaxResult
.
success
(
deptService
.
buildDeptTreeSelect
(
depts
));
}
/**
* 二级分类查询下属分类员工数量
* @return
*/
@ApiOperation
(
"部门"
)
@GetMapping
(
"/classification"
)
public
AjaxResult
classification
()
{
return
AjaxResult
.
success
(
deptService
.
classification
());
}
/**
* 加载对应角色部门列表树
*/
...
...
danger-manage-system/src/main/java/com/zehong/system/mapper/SysDeptMapper.java
View file @
076b02f8
...
...
@@ -125,4 +125,11 @@ public interface SysDeptMapper
public
List
<
Map
<
String
,
Object
>>
selectDeptlabelList
();
public
String
selectNamesByIds
(
@Param
(
"ids"
)
List
<
Long
>
ids
);
/**
*根据部门id查询下属部门
*/
public
List
<
Map
<
String
,
Object
>>
classification
(
Long
deptId
);
public
List
<
Map
<
String
,
Object
>>
classificationByList
(
@Param
(
"list"
)
List
<
Map
<
String
,
Object
>>
list
);
}
danger-manage-system/src/main/java/com/zehong/system/service/ISysDeptService.java
View file @
076b02f8
package
com
.
zehong
.
system
.
service
;
import
java.util.List
;
import
java.util.Map
;
import
com.zehong.common.core.domain.TreeSelect
;
import
com.zehong.common.core.domain.entity.SysDept
;
...
...
@@ -35,6 +37,12 @@ public interface ISysDeptService
*/
public
List
<
TreeSelect
>
buildDeptTreeSelect
(
List
<
SysDept
>
depts
);
/**
* 二级分类查询下属分类员工数量
* @return
*/
public
List
<
Map
<
String
,
Object
>>
classification
();
/**
* 根据角色ID查询部门树信息
*
...
...
danger-manage-system/src/main/java/com/zehong/system/service/impl/SysDeptServiceImpl.java
View file @
076b02f8
...
...
@@ -3,6 +3,7 @@ package com.zehong.system.service.impl;
import
java.util.ArrayList
;
import
java.util.Iterator
;
import
java.util.List
;
import
java.util.Map
;
import
java.util.stream.Collectors
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.stereotype.Service
;
...
...
@@ -89,6 +90,32 @@ public class SysDeptServiceImpl implements ISysDeptService
return
deptTrees
.
stream
().
map
(
TreeSelect:
:
new
).
collect
(
Collectors
.
toList
());
}
/**
* 二级分类查询下属分类员工数量
* @return
*/
@Override
public
List
<
Map
<
String
,
Object
>>
classification
()
{
List
<
Map
<
String
,
Object
>>
list
=
deptMapper
.
classification
(
100
l
);
for
(
Map
<
String
,
Object
>
map
:
list
){
List
<
Map
<
String
,
Object
>>
list1
=
new
ArrayList
<>();
list1
.
add
(
map
);
Long
num
=
selectNum
(
list1
,(
Long
)
map
.
get
(
"num"
));
map
.
put
(
"num"
,
num
);
}
return
list
;
}
public
Long
selectNum
(
List
<
Map
<
String
,
Object
>>
list
,
Long
num
){
List
<
Map
<
String
,
Object
>>
resultList
=
deptMapper
.
classificationByList
(
list
);
if
(
resultList
.
size
()==
0
){
return
num
;
}
else
{
for
(
Map
<
String
,
Object
>
map
:
resultList
){
num
=
num
+
(
Long
)
map
.
get
(
"num"
);
}
return
selectNum
(
resultList
,
num
);
}
}
/**
* 根据角色ID查询部门树信息
*
...
...
danger-manage-system/src/main/resources/mapper/system/SysDeptMapper.xml
View file @
076b02f8
...
...
@@ -163,4 +163,23 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
#{id}
</foreach>
</select>
<select
id=
"classification"
parameterType=
"Long"
resultType=
"java.util.HashMap"
>
SELECT d.dept_id AS deptId,d.dept_name AS deptName,COUNT(d.dept_id) AS num FROM t_staff s
LEFT JOIN sys_dept d ON s.`dept_id` = d.`dept_id`
WHERE d.del_flag = 0
AND d.parent_id = #{deptId}
GROUP BY d.`dept_id`
</select>
<select
id=
"classificationByList"
resultType=
"java.util.HashMap"
>
SELECT d.dept_id AS deptId,d.dept_name AS deptName,COUNT(d.dept_id) AS num FROM t_staff s
LEFT JOIN sys_dept d ON s.`dept_id` = d.`dept_id`
WHERE d.del_flag = 0
AND d.parent_id IN
<foreach
collection=
"list"
item=
"item"
open=
"("
separator=
","
close=
")"
>
#{item.deptId}
</foreach>
GROUP BY d.`dept_id`
</select>
</mapper>
\ No newline at end of file
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