递归
This commit is contained in:
parent
ae09d2b353
commit
9be65d3897
15
.idea/workspace.xml
generated
15
.idea/workspace.xml
generated
@ -3,8 +3,19 @@
|
|||||||
<component name="ChangeListManager">
|
<component name="ChangeListManager">
|
||||||
<list default="true" id="e4baaf01-a2c2-445d-98a1-9f4c50c148cf" name="Default Changelist" comment="">
|
<list default="true" id="e4baaf01-a2c2-445d-98a1-9f4c50c148cf" name="Default Changelist" comment="">
|
||||||
<change beforePath="$PROJECT_DIR$/.idea/workspace.xml" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/workspace.xml" afterDir="false" />
|
<change beforePath="$PROJECT_DIR$/.idea/workspace.xml" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/workspace.xml" afterDir="false" />
|
||||||
|
<change beforePath="$PROJECT_DIR$/src/main/java/com/lz/modules/app/Dto/DepartmentsDto.java" beforeDir="false" afterPath="$PROJECT_DIR$/src/main/java/com/lz/modules/app/Dto/DepartmentsDto.java" afterDir="false" />
|
||||||
|
<change beforePath="$PROJECT_DIR$/src/main/java/com/lz/modules/app/controller/DepartmentsController.java" beforeDir="false" afterPath="$PROJECT_DIR$/src/main/java/com/lz/modules/app/controller/DepartmentsController.java" afterDir="false" />
|
||||||
|
<change beforePath="$PROJECT_DIR$/src/main/java/com/lz/modules/app/dao/DepartmentsDao.java" beforeDir="false" afterPath="$PROJECT_DIR$/src/main/java/com/lz/modules/app/dao/DepartmentsDao.java" afterDir="false" />
|
||||||
|
<change beforePath="$PROJECT_DIR$/src/main/java/com/lz/modules/app/service/DepartmentsService.java" beforeDir="false" afterPath="$PROJECT_DIR$/src/main/java/com/lz/modules/app/service/DepartmentsService.java" afterDir="false" />
|
||||||
|
<change beforePath="$PROJECT_DIR$/src/main/java/com/lz/modules/app/service/impl/DepartmentsServiceImpl.java" beforeDir="false" afterPath="$PROJECT_DIR$/src/main/java/com/lz/modules/app/service/impl/DepartmentsServiceImpl.java" afterDir="false" />
|
||||||
<change beforePath="$PROJECT_DIR$/src/main/java/com/lz/modules/sys/oauth2/OAuth2Filter.java" beforeDir="false" afterPath="$PROJECT_DIR$/src/main/java/com/lz/modules/sys/oauth2/OAuth2Filter.java" afterDir="false" />
|
<change beforePath="$PROJECT_DIR$/src/main/java/com/lz/modules/sys/oauth2/OAuth2Filter.java" beforeDir="false" afterPath="$PROJECT_DIR$/src/main/java/com/lz/modules/sys/oauth2/OAuth2Filter.java" afterDir="false" />
|
||||||
<change beforePath="$PROJECT_DIR$/target/classes/com/lz/modules/app/controller/StaffController.class" beforeDir="false" afterPath="$PROJECT_DIR$/target/classes/com/lz/modules/app/controller/StaffController.class" afterDir="false" />
|
<change beforePath="$PROJECT_DIR$/src/main/resources/mapper/generator/DepartmentsDao.xml" beforeDir="false" afterPath="$PROJECT_DIR$/src/main/resources/mapper/generator/DepartmentsDao.xml" afterDir="false" />
|
||||||
|
<change beforePath="$PROJECT_DIR$/target/classes/com/lz/modules/app/Dto/DepartmentsDto.class" beforeDir="false" afterPath="$PROJECT_DIR$/target/classes/com/lz/modules/app/Dto/DepartmentsDto.class" afterDir="false" />
|
||||||
|
<change beforePath="$PROJECT_DIR$/target/classes/com/lz/modules/app/controller/DepartmentsController.class" beforeDir="false" afterPath="$PROJECT_DIR$/target/classes/com/lz/modules/app/controller/DepartmentsController.class" afterDir="false" />
|
||||||
|
<change beforePath="$PROJECT_DIR$/target/classes/com/lz/modules/app/dao/DepartmentsDao.class" beforeDir="false" afterPath="$PROJECT_DIR$/target/classes/com/lz/modules/app/dao/DepartmentsDao.class" afterDir="false" />
|
||||||
|
<change beforePath="$PROJECT_DIR$/target/classes/com/lz/modules/app/service/DepartmentsService.class" beforeDir="false" afterPath="$PROJECT_DIR$/target/classes/com/lz/modules/app/service/DepartmentsService.class" afterDir="false" />
|
||||||
|
<change beforePath="$PROJECT_DIR$/target/classes/com/lz/modules/app/service/impl/DepartmentsServiceImpl.class" beforeDir="false" afterPath="$PROJECT_DIR$/target/classes/com/lz/modules/app/service/impl/DepartmentsServiceImpl.class" afterDir="false" />
|
||||||
|
<change beforePath="$PROJECT_DIR$/target/classes/mapper/generator/DepartmentsDao.xml" beforeDir="false" afterPath="$PROJECT_DIR$/target/classes/mapper/generator/DepartmentsDao.xml" afterDir="false" />
|
||||||
</list>
|
</list>
|
||||||
<option name="EXCLUDED_CONVERTED_TO_IGNORED" value="true" />
|
<option name="EXCLUDED_CONVERTED_TO_IGNORED" value="true" />
|
||||||
<option name="SHOW_DIALOG" value="false" />
|
<option name="SHOW_DIALOG" value="false" />
|
||||||
@ -152,7 +163,7 @@
|
|||||||
<workItem from="1588159936850" duration="1226000" />
|
<workItem from="1588159936850" duration="1226000" />
|
||||||
<workItem from="1588161274115" duration="1691000" />
|
<workItem from="1588161274115" duration="1691000" />
|
||||||
<workItem from="1588163384182" duration="74761000" />
|
<workItem from="1588163384182" duration="74761000" />
|
||||||
<workItem from="1588936950753" duration="55368000" />
|
<workItem from="1588936950753" duration="58139000" />
|
||||||
</task>
|
</task>
|
||||||
<servers />
|
<servers />
|
||||||
</component>
|
</component>
|
||||||
|
|||||||
@ -1,8 +1,10 @@
|
|||||||
package com.lz.modules.app.Dto;
|
package com.lz.modules.app.Dto;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.annotation.TableField;
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
|
|
||||||
import java.io.Serializable;
|
import java.io.Serializable;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 部门表
|
* 部门表
|
||||||
@ -31,6 +33,13 @@ public class DepartmentsDto implements Serializable {
|
|||||||
* 组织架构名称/部门名称
|
* 组织架构名称/部门名称
|
||||||
*/
|
*/
|
||||||
private String departmentName;
|
private String departmentName;
|
||||||
|
/**
|
||||||
|
* ztree属性
|
||||||
|
*/
|
||||||
|
@TableField(exist=false)
|
||||||
|
private Boolean open;
|
||||||
|
|
||||||
|
@TableField(exist=false)
|
||||||
|
private List<?> list;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@ -39,7 +39,7 @@ public class DepartmentsController {
|
|||||||
@RequestMapping("/list")
|
@RequestMapping("/list")
|
||||||
// @RequiresPermissions("staff:structure:list")
|
// @RequiresPermissions("staff:structure:list")
|
||||||
public List<DepartmentsDto> list() {
|
public List<DepartmentsDto> list() {
|
||||||
List<DepartmentsDto> departmentList = BeanConversionUtils.listCopyToAnotherList(DepartmentsDto.class, departmentsService.list());
|
List<DepartmentsDto> departmentList = departmentsService.getDepartmentTree();
|
||||||
|
|
||||||
return departmentList;
|
return departmentList;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1,5 +1,6 @@
|
|||||||
package com.lz.modules.app.dao;
|
package com.lz.modules.app.dao;
|
||||||
|
|
||||||
|
import com.lz.modules.app.Dto.DepartmentsDto;
|
||||||
import com.lz.modules.app.entity.DepartmentsEntity;
|
import com.lz.modules.app.entity.DepartmentsEntity;
|
||||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||||
import org.apache.ibatis.annotations.Mapper;
|
import org.apache.ibatis.annotations.Mapper;
|
||||||
@ -25,5 +26,7 @@ public interface DepartmentsDao extends BaseMapper<DepartmentsEntity> {
|
|||||||
|
|
||||||
int addDepartmentBatch(@Param("departments") List<DepartmentsEntity> departments);
|
int addDepartmentBatch(@Param("departments") List<DepartmentsEntity> departments);
|
||||||
|
|
||||||
|
List<DepartmentsDto> getDepartmentsByparentId(@Param("parentId") String parentId);
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@ -2,6 +2,7 @@ package com.lz.modules.app.service;
|
|||||||
|
|
||||||
import com.baomidou.mybatisplus.extension.service.IService;
|
import com.baomidou.mybatisplus.extension.service.IService;
|
||||||
import com.lz.common.utils.PageUtils;
|
import com.lz.common.utils.PageUtils;
|
||||||
|
import com.lz.modules.app.Dto.DepartmentsDto;
|
||||||
import com.lz.modules.app.entity.DepartmentsEntity;
|
import com.lz.modules.app.entity.DepartmentsEntity;
|
||||||
import com.lz.modules.job.model.responseBo.DepartmentInfosBo;
|
import com.lz.modules.job.model.responseBo.DepartmentInfosBo;
|
||||||
|
|
||||||
@ -23,6 +24,7 @@ public interface DepartmentsService extends IService<DepartmentsEntity> {
|
|||||||
|
|
||||||
void updateDepartmentInfos(List<DepartmentInfosBo> departmentInfosBos);
|
void updateDepartmentInfos(List<DepartmentInfosBo> departmentInfosBos);
|
||||||
|
|
||||||
|
List<DepartmentsDto> getDepartmentTree();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -4,16 +4,20 @@ 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 com.google.common.collect.Lists;
|
import com.google.common.collect.Lists;
|
||||||
|
import com.lz.common.utils.Constant;
|
||||||
import com.lz.common.utils.PageUtils;
|
import com.lz.common.utils.PageUtils;
|
||||||
import com.lz.common.utils.Query;
|
import com.lz.common.utils.Query;
|
||||||
|
import com.lz.modules.app.Dto.DepartmentsDto;
|
||||||
import com.lz.modules.app.dao.DepartmentsDao;
|
import com.lz.modules.app.dao.DepartmentsDao;
|
||||||
import com.lz.modules.app.entity.DepartmentsEntity;
|
import com.lz.modules.app.entity.DepartmentsEntity;
|
||||||
import com.lz.modules.app.service.DepartmentsService;
|
import com.lz.modules.app.service.DepartmentsService;
|
||||||
import com.lz.modules.job.model.responseBo.DepartmentInfosBo;
|
import com.lz.modules.job.model.responseBo.DepartmentInfosBo;
|
||||||
|
import com.lz.modules.sys.entity.SysMenuEntity;
|
||||||
import org.slf4j.LoggerFactory;
|
import org.slf4j.LoggerFactory;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
import javax.annotation.Resource;
|
import javax.annotation.Resource;
|
||||||
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
@ -50,6 +54,25 @@ public class DepartmentsServiceImpl extends ServiceImpl<DepartmentsDao, Departme
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public List<DepartmentsDto> getDepartmentTree() {
|
||||||
|
List<DepartmentsDto> departmentsParentsList = departmentsDao.getDepartmentsByparentId("0");
|
||||||
|
getDepartmentTreeList(departmentsParentsList);
|
||||||
|
return departmentsParentsList;
|
||||||
|
}
|
||||||
|
|
||||||
|
private List<DepartmentsDto> getDepartmentTreeList(List<DepartmentsDto> departmentList) {
|
||||||
|
List<DepartmentsDto> DepartmentsList = Lists.newArrayList();
|
||||||
|
for (DepartmentsDto departmentsDto : departmentList) {
|
||||||
|
List<DepartmentsDto> departmentsChirdList = departmentsDao.getDepartmentsByparentId(departmentsDto.getDepartmentId());
|
||||||
|
if (departmentsChirdList.size() > 0) {
|
||||||
|
departmentsDto.setList(getDepartmentTreeList(departmentsChirdList));
|
||||||
|
}
|
||||||
|
DepartmentsList.add(departmentsDto);
|
||||||
|
}
|
||||||
|
return DepartmentsList;
|
||||||
|
}
|
||||||
|
|
||||||
// @Override
|
// @Override
|
||||||
public List<DepartmentsEntity> filterUpdateDepartmentInfos(List<DepartmentInfosBo> departmentInfosBos) {
|
public List<DepartmentsEntity> filterUpdateDepartmentInfos(List<DepartmentInfosBo> departmentInfosBos) {
|
||||||
List<DepartmentsEntity> departmentsBos = Lists.newArrayList();
|
List<DepartmentsEntity> departmentsBos = Lists.newArrayList();
|
||||||
|
|||||||
@ -67,8 +67,9 @@ public class OAuth2Filter extends AuthenticatingFilter {
|
|||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
// return true;
|
|
||||||
return executeLogin(request, response);
|
return executeLogin(request, response);
|
||||||
|
// return true;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
@ -3,7 +3,7 @@
|
|||||||
|
|
||||||
<mapper namespace="com.lz.modules.app.dao.DepartmentsDao">
|
<mapper namespace="com.lz.modules.app.dao.DepartmentsDao">
|
||||||
|
|
||||||
<!-- 可根据自己的需求,是否要使用 -->
|
<!-- 可根据自己的需求,是否要使用 -->
|
||||||
<resultMap type="com.lz.modules.app.entity.DepartmentsEntity" id="departmentsMap">
|
<resultMap type="com.lz.modules.app.entity.DepartmentsEntity" id="departmentsMap">
|
||||||
<result property="id" column="id"/>
|
<result property="id" column="id"/>
|
||||||
<result property="isDelete" column="is_delete"/>
|
<result property="isDelete" column="is_delete"/>
|
||||||
@ -23,6 +23,10 @@
|
|||||||
select * from lz_departments where is_delete=0 and department_id = #{departmentId}
|
select * from lz_departments where is_delete=0 and department_id = #{departmentId}
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
|
<select id="getDepartmentsByparentId" resultType="com.lz.modules.app.Dto.DepartmentsDto">
|
||||||
|
select department_id,department_parent_id,member_count,department_name from lz_departments where department_parent_id=#{parentId}
|
||||||
|
</select>
|
||||||
|
|
||||||
<update id="updateDepartment">
|
<update id="updateDepartment">
|
||||||
UPDATE lz_departments
|
UPDATE lz_departments
|
||||||
<set>
|
<set>
|
||||||
@ -57,7 +61,8 @@
|
|||||||
</update>
|
</update>
|
||||||
|
|
||||||
<insert id="addDepartmentBatch">
|
<insert id="addDepartmentBatch">
|
||||||
INSERT INTO lz_departments(department_id,department_parent_id,member_count,department_name,chat_id,leader_employee_id,leader_open_id,status)
|
INSERT INTO
|
||||||
|
lz_departments(department_id,department_parent_id,member_count,department_name,chat_id,leader_employee_id,leader_open_id,status)
|
||||||
VALUES
|
VALUES
|
||||||
<foreach collection="departments" item="department" separator=",">
|
<foreach collection="departments" item="department" separator=",">
|
||||||
(#{department.departmentId},#{department.departmentParentId},#{department.memberCount},#{department.departmentName},#{department.chatId},#{department.leaderEmployeeId},#{department.leaderOpenId},#{department.status})
|
(#{department.departmentId},#{department.departmentParentId},#{department.memberCount},#{department.departmentName},#{department.chatId},#{department.leaderEmployeeId},#{department.leaderOpenId},#{department.status})
|
||||||
|
|||||||
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@ -3,7 +3,7 @@
|
|||||||
|
|
||||||
<mapper namespace="com.lz.modules.app.dao.DepartmentsDao">
|
<mapper namespace="com.lz.modules.app.dao.DepartmentsDao">
|
||||||
|
|
||||||
<!-- 可根据自己的需求,是否要使用 -->
|
<!-- 可根据自己的需求,是否要使用 -->
|
||||||
<resultMap type="com.lz.modules.app.entity.DepartmentsEntity" id="departmentsMap">
|
<resultMap type="com.lz.modules.app.entity.DepartmentsEntity" id="departmentsMap">
|
||||||
<result property="id" column="id"/>
|
<result property="id" column="id"/>
|
||||||
<result property="isDelete" column="is_delete"/>
|
<result property="isDelete" column="is_delete"/>
|
||||||
@ -23,6 +23,10 @@
|
|||||||
select * from lz_departments where is_delete=0 and department_id = #{departmentId}
|
select * from lz_departments where is_delete=0 and department_id = #{departmentId}
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
|
<select id="getDepartmentsByparentId" resultType="com.lz.modules.app.Dto.DepartmentsDto">
|
||||||
|
select department_id,department_parent_id,member_count,department_name from lz_departments where department_parent_id=#{parentId}
|
||||||
|
</select>
|
||||||
|
|
||||||
<update id="updateDepartment">
|
<update id="updateDepartment">
|
||||||
UPDATE lz_departments
|
UPDATE lz_departments
|
||||||
<set>
|
<set>
|
||||||
@ -57,7 +61,8 @@
|
|||||||
</update>
|
</update>
|
||||||
|
|
||||||
<insert id="addDepartmentBatch">
|
<insert id="addDepartmentBatch">
|
||||||
INSERT INTO lz_departments(department_id,department_parent_id,member_count,department_name,chat_id,leader_employee_id,leader_open_id,status)
|
INSERT INTO
|
||||||
|
lz_departments(department_id,department_parent_id,member_count,department_name,chat_id,leader_employee_id,leader_open_id,status)
|
||||||
VALUES
|
VALUES
|
||||||
<foreach collection="departments" item="department" separator=",">
|
<foreach collection="departments" item="department" separator=",">
|
||||||
(#{department.departmentId},#{department.departmentParentId},#{department.memberCount},#{department.departmentName},#{department.chatId},#{department.leaderEmployeeId},#{department.leaderOpenId},#{department.status})
|
(#{department.departmentId},#{department.departmentParentId},#{department.memberCount},#{department.departmentName},#{department.chatId},#{department.leaderEmployeeId},#{department.leaderOpenId},#{department.status})
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user