Commit 49559111 by wangqi

帮扶组的帮扶对象单位

parent 7f825345
......@@ -165,4 +165,13 @@ public class SjGfjsBfzwhController extends BaseController
List<SjGfjsBfzbfdx> list = sjGfjsBfzwhService.selectBfdxlist(sjGfjsBfzbfdx);
return getDataTable(list);
}
/**
* 获取部门树列表_帮扶对象
*/
@GetMapping("/bfdxTree")
public AjaxResult bfdxTree(SjGfjsBfzbfdx sjGfjsBfzbfdx)
{
return success(sjGfjsBfzwhService.selectBfdxTree(sjGfjsBfzbfdx));
}
}
package com.qianhe.mapper;
import com.qianhe.common.core.domain.entity.SysDept;
import com.qianhe.domain.SjGfjsBfzbfdx;
import com.qianhe.domain.SjGfjsBfzwh;
......@@ -76,4 +77,6 @@ public interface SjGfjsBfzwhMapper
public int deleteBfzBfdx(Long[] ids);
public List<SjGfjsBfzbfdx> selectBfdxlist(SjGfjsBfzbfdx sjGfjsBfzbfdx);
public List<SysDept> selectBfdxTree_list(SjGfjsBfzbfdx sjGfjsBfzbfdx);
}
......@@ -85,4 +85,10 @@ public interface ISjGfjsBfzwhService
public List<SysDept> buildBfdwxTree(List<SysDept> menus);
public List<SjGfjsBfzbfdx> selectBfdxlist(SjGfjsBfzbfdx sjGfjsBfzbfdx);
public List<TreeSelect> selectBfdxTree(SjGfjsBfzbfdx sjGfjsBfzbfdx);
public List<SysDept> selectBfdxTree_list(SjGfjsBfzbfdx sjGfjsBfzbfdx);
public List<SysDept> buildDeptTree(List<SysDept> depts);
public List<TreeSelect> buildDeptTreeSelect(List<SysDept> depts);
}
......@@ -2,6 +2,7 @@ package com.qianhe.service.impl;
import com.qianhe.common.core.domain.TreeSelect;
import com.qianhe.common.core.domain.entity.SysDept;
import com.qianhe.common.utils.spring.SpringUtils;
import com.qianhe.domain.SjGfjsBfzbfdx;
import com.qianhe.domain.SjGfjsBfzwh;
import com.qianhe.mapper.SjGfjsBfzwhMapper;
......@@ -260,4 +261,50 @@ public class SjGfjsBfzwhServiceImpl implements ISjGfjsBfzwhService
}
@Override
public List<TreeSelect> selectBfdxTree(SjGfjsBfzbfdx sjGfjsBfzbfdx)
{
List<SysDept> depts = SpringUtils.getAopProxy(this).selectBfdxTree_list(sjGfjsBfzbfdx);
return buildDeptTreeSelect(depts);
}
@Override
public List<SysDept> selectBfdxTree_list(SjGfjsBfzbfdx sjGfjsBfzbfdx)
{
return sjGfjsBfzwhMapper.selectBfdxTree_list(sjGfjsBfzbfdx);
}
@Override
public List<TreeSelect> buildDeptTreeSelect(List<SysDept> depts)
{
List<SysDept> deptTrees = buildDeptTree(depts);
return deptTrees.stream().map(TreeSelect::new).collect(Collectors.toList());
}
/**
* 构建前端所需要树结构
*
* @param depts 部门列表
* @return 树结构列表
*/
@Override
public List<SysDept> buildDeptTree(List<SysDept> depts)
{
List<SysDept> returnList = new ArrayList<SysDept>();
List<Long> tempList = depts.stream().map(SysDept::getDeptId).collect(Collectors.toList());
for (SysDept dept : depts)
{
// 如果是顶级节点, 遍历该父节点的所有子节点
if (!tempList.contains(dept.getParentId()))
{
recursionFn(depts, dept);
returnList.add(dept);
}
}
if (returnList.isEmpty())
{
returnList = depts;
}
return returnList;
}
}
......@@ -150,4 +150,42 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="deptId != null "> and dept_id = #{deptId}</if>
</where>
</select>
<resultMap type="SysDept" id="SysDeptResult">
<id property="deptId" column="dept_id" />
<result property="parentId" column="parent_id" />
<result property="ancestors" column="ancestors" />
<result property="deptName" column="dept_name" />
<result property="orderNum" column="order_num" />
<result property="leader" column="leader" />
<result property="phone" column="phone" />
<result property="email" column="email" />
<result property="status" column="status" />
<result property="delFlag" column="del_flag" />
<result property="parentName" column="parent_name" />
<result property="createBy" column="create_by" />
<result property="createTime" column="create_time" />
<result property="updateBy" column="update_by" />
<result property="updateTime" column="update_time" />
<result property="dwjb" column="dwjb" />
<result property="deptLx" column="dept_lx" />
<result property="deptDfl" column="dept_dfl" />
<result property="deptYwfl" column="dept_ywfl" />
</resultMap>
<select id="selectBfdxTree_list" parameterType="SjGfjsBfzbfdx" resultMap="SysDeptResult">
select d.dept_id, d.parent_id,
d.ancestors, d.dept_name,
d.order_num, d.leader, d.phone,
d.email, d.status, d.del_flag, d.create_by, d.create_time,d.dwjb, d.dept_lx, d.dept_dfl, d.dept_ywfl
from sys_dept d
where d.dept_id in (
select dept_id from sj_gfjs_bfzbfdx
<where>
<if test="id != null "> and id = #{id}</if>
<if test="deptId != null "> and dept_id = #{deptId}</if>
</where>
)
</select>
</mapper>
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment