Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
P
peizhen-java
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
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
PeiZhen-Java
peizhen-java
Commits
05961170
Commit
05961170
authored
Sep 19, 2023
by
sdif
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
用户端代码提交
parent
98a80ca3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
20 additions
and
5 deletions
+20
-5
pz-system/src/main/java/com/pz/system/mapper/DepartmentMapper.java
+3
-1
pz-system/src/main/java/com/pz/system/service/impl/DepartmentServiceImpl.java
+3
-4
pz-system/src/main/resources/mapper/system/DepartmentMapper.xml
+14
-0
No files found.
pz-system/src/main/java/com/pz/system/mapper/DepartmentMapper.java
View file @
05961170
...
@@ -5,6 +5,8 @@ import com.pz.system.domain.vo.DepartmentVo;
...
@@ -5,6 +5,8 @@ import com.pz.system.domain.vo.DepartmentVo;
import
com.pz.common.core.mapper.BaseMapperPlus
;
import
com.pz.common.core.mapper.BaseMapperPlus
;
import
org.apache.ibatis.annotations.Mapper
;
import
org.apache.ibatis.annotations.Mapper
;
import
java.util.List
;
/**
/**
* 科室Mapper接口
* 科室Mapper接口
*
*
...
@@ -13,5 +15,5 @@ import org.apache.ibatis.annotations.Mapper;
...
@@ -13,5 +15,5 @@ import org.apache.ibatis.annotations.Mapper;
*/
*/
@Mapper
@Mapper
public
interface
DepartmentMapper
extends
BaseMapperPlus
<
DepartmentMapper
,
Department
,
DepartmentVo
>
{
public
interface
DepartmentMapper
extends
BaseMapperPlus
<
DepartmentMapper
,
Department
,
DepartmentVo
>
{
List
<
DepartmentVo
>
selectDepartmentChildren
(
Integer
parentId
);
}
}
pz-system/src/main/java/com/pz/system/service/impl/DepartmentServiceImpl.java
View file @
05961170
...
@@ -127,12 +127,11 @@ public class DepartmentServiceImpl implements IDepartmentService {
...
@@ -127,12 +127,11 @@ public class DepartmentServiceImpl implements IDepartmentService {
}
}
}
}
//为根菜单设置子菜单,getClild是递归调用的
for
(
DepartmentVo
entity
:
rootMenu
)
{
for
(
DepartmentVo
entity
:
rootMenu
)
{
entity
.
setLabel
(
entity
.
getTitle
());
entity
.
setLabel
(
entity
.
getTitle
());
/* 获取根节点下的所有子节点 使用getChild方法*/
//查询主科室下面所有的子科室
List
<
DepartmentVo
>
childList
=
getChild
(
entity
.
getId
().
toString
(),
allMenu
);
entity
.
setChildren
(
baseMapper
.
selectDepartmentChildren
(
entity
.
getValue
()));
entity
.
setChildren
(
childList
);
//给根节点设置子节点
}
}
return
rootMenu
;
return
rootMenu
;
}
}
...
...
pz-system/src/main/resources/mapper/system/DepartmentMapper.xml
0 → 100644
View file @
05961170
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd" >
<mapper
namespace=
"com.pz.system.mapper.DepartmentMapper"
>
<select
id=
"selectDepartmentChildren"
resultType=
"com.pz.system.domain.vo.DepartmentVo"
>
select id as value,title as text from (
select t1.id,t1.title,
if(find_in_set(parent_id, @pids) > 0, @pids := concat(@pids, ',', id), 0) as ischild
from (
select id,parent_id,title from department t WHERE t.del_flag = 0 order by parent_id, id
) t1,
(select @pids := #{parentId}) t2
) t3 where ischild != 0
</select>
</mapper>
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