Commit 05961170 by sdif

用户端代码提交

parent 98a80ca3
......@@ -5,6 +5,8 @@ import com.pz.system.domain.vo.DepartmentVo;
import com.pz.common.core.mapper.BaseMapperPlus;
import org.apache.ibatis.annotations.Mapper;
import java.util.List;
/**
* 科室Mapper接口
*
......@@ -13,5 +15,5 @@ import org.apache.ibatis.annotations.Mapper;
*/
@Mapper
public interface DepartmentMapper extends BaseMapperPlus<DepartmentMapper, Department, DepartmentVo> {
List<DepartmentVo> selectDepartmentChildren(Integer parentId);
}
......@@ -127,12 +127,11 @@ public class DepartmentServiceImpl implements IDepartmentService {
}
}
//为根菜单设置子菜单,getClild是递归调用的
for (DepartmentVo entity : rootMenu) {
entity.setLabel(entity.getTitle());
/* 获取根节点下的所有子节点 使用getChild方法*/
List<DepartmentVo> childList = getChild(entity.getId().toString(), allMenu);
entity.setChildren(childList);//给根节点设置子节点
//查询主科室下面所有的子科室
entity.setChildren(baseMapper.selectDepartmentChildren(entity.getValue()));
}
return rootMenu;
}
......
<?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>
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