20200619-zlp-1

首页-一日流程学习树
This commit is contained in:
paidaxing444
2020-06-19 17:08:30 +08:00
parent 21ed75af7a
commit eb8ab45518
14 changed files with 261 additions and 495 deletions

View File

@ -44,7 +44,7 @@ public class ByDayFlowDetailController extends BaseController
{
startPage();
List<ByDayFlowDetail> list = byDayFlowDetailService.selectByDayFlowDetailList(byDayFlowDetail);
System.out.println("-------------------------------"+list);
//System.out.println("-------------------------------"+list);
return getDataTable(list);
}
@ -76,7 +76,7 @@ public class ByDayFlowDetailController extends BaseController
*/
@GetMapping("/treeselect")
public AjaxResult treeselect(ByDayFlowDetail byDayFlowDetail) {
List<ByDayFlowDetail> byDayFlowDetails = byDayFlowDetailService.selectByDayFlowDetailList(byDayFlowDetail);
List<ByDayFlowDetail> byDayFlowDetails = byDayFlowDetailService.selectByDayFlowDetailListTree(byDayFlowDetail);
return AjaxResult.success(byDayFlowDetailService.buildDayFlowDetailTreeSelect(byDayFlowDetails));
}

View File

@ -22,7 +22,7 @@ public class ByDayFlowDetail extends BaseEntity
private Long id;
/** 树状父类ID */
private Long parentid;
private Long parentId;
/** 树状子类 */
private List<ByDayFlowDetail> children = new ArrayList<ByDayFlowDetail>();
@ -155,16 +155,16 @@ public class ByDayFlowDetail extends BaseEntity
.append("updateUser", getUpdateUser())
.append("createTime", getCreateTime())
.append("updateTime", getUpdateTime())
.append("parentid", getParentid())
.append("parentid", getParentId())
.toString();
}
public Long getParentid() {
return parentid;
public Long getParentId() {
return parentId;
}
public void setParentid(Long parentid) {
this.parentid = parentid;
public void setParentId(Long parentId) {
this.parentId = parentId;
}
public List<ByDayFlowDetail> getChildren() {

View File

@ -27,6 +27,14 @@ public interface ByDayFlowDetailMapper
*/
public List<ByDayFlowDetail> selectByDayFlowDetailList(ByDayFlowDetail byDayFlowDetail);
/**
* 查询一日流程树
*
* @param byDayFlowDetail 一日流程
* @return 一日流程树集合
*/
public List<ByDayFlowDetail> selectByDayFlowDetailListTree(ByDayFlowDetail byDayFlowDetail);
/**
* 根据ID查询所有子部门
*

View File

@ -29,6 +29,14 @@ public interface IByDayFlowDetailService
*/
public List<ByDayFlowDetail> selectByDayFlowDetailList(ByDayFlowDetail byDayFlowDetail);
/**
* 查询一日流程列表树
*
* @param byDayFlowDetail 一日流程
* @return 一日流程树集合
*/
public List<ByDayFlowDetail> selectByDayFlowDetailListTree(ByDayFlowDetail byDayFlowDetail);
/**
* 构建前端所需要树结构
*

View File

@ -50,6 +50,18 @@ public class ByDayFlowDetailServiceImpl implements IByDayFlowDetailService
return byDayFlowDetailMapper.selectByDayFlowDetailList(byDayFlowDetail);
}
/**
* 查询一日流程列表树
*
* @param byDayFlowDetail 一日流程
* @return 一日流程树集合
*/
@Override
public List<ByDayFlowDetail> selectByDayFlowDetailListTree(ByDayFlowDetail byDayFlowDetail)
{
return byDayFlowDetailMapper.selectByDayFlowDetailListTree(byDayFlowDetail);
}
/**
* 构建前端所需要树结构
*
@ -58,17 +70,19 @@ public class ByDayFlowDetailServiceImpl implements IByDayFlowDetailService
*/
@Override
public List<ByDayFlowDetail> buildDayFlowDetailTree(List<ByDayFlowDetail> byDayFlowDetails) {
System.out.println("start---");
List<ByDayFlowDetail> returnList = new ArrayList<ByDayFlowDetail>();
List<Long> tempList = new ArrayList<Long>();
for (ByDayFlowDetail byDayFlowDetail : byDayFlowDetails)
{
tempList.add(byDayFlowDetail.getParentid());
tempList.add(byDayFlowDetail.getId());
}
for (Iterator<ByDayFlowDetail> iterator = byDayFlowDetails.iterator(); iterator.hasNext();)
{
ByDayFlowDetail byDayFlowDetail = (ByDayFlowDetail) iterator.next();
System.out.println("test==="+!tempList.contains(byDayFlowDetail.getParentId()));
// 如果是顶级节点, 遍历该父节点的所有子节点
if (!tempList.contains(byDayFlowDetail.getParentid()))
if (!tempList.contains(byDayFlowDetail.getParentId()))
{
recursionFn(byDayFlowDetails, byDayFlowDetail);
returnList.add(byDayFlowDetail);
@ -127,8 +141,9 @@ public class ByDayFlowDetailServiceImpl implements IByDayFlowDetailService
while (it.hasNext())
{
ByDayFlowDetail n = (ByDayFlowDetail) it.next();
if (StringUtils.isNotNull(n.getParentid()) && n.getParentid().longValue() == t.getId().longValue())
if (StringUtils.isNotNull(n.getParentId()) && n.getParentId().longValue() == t.getId().longValue())
{
//System.out.println("parentid="+n.getParentId().longValue()+"---"+t.getId().longValue());
tlist.add(n);
}
}

View File

@ -42,7 +42,7 @@ public class ByClassController extends BaseController {
/**
* 查询班级信息列表
*/
@PreAuthorize("@ss.hasPermi('system:class:list')")
@PreAuthorize("@ss.hasPermi('system:class:list')"+ "||@ss.hasPermi('system:school:list')")
@GetMapping("/list")
public TableDataInfo list(ByClass byClass) {
startPage();

View File

@ -65,7 +65,7 @@ public class ByTeacherJbxxController extends BaseController
/**
* 查询教师基本信息列表
*/
@PreAuthorize("@ss.hasPermi('system:teacher:list')")
@PreAuthorize("@ss.hasPermi('system:teacher:list')"+ "||@ss.hasPermi('system:user:list')")
@GetMapping("/listgroupxw")
public TableDataInfo listGroupXw(ByTeacherJbxx byTeacherJbxx)
{

View File

@ -7,6 +7,7 @@
<resultMap type="ByDayFlowDetail" id="ByDayFlowDetailResult">
<result property="id" column="id"/>
<result property="sortNumber" column="sort_number"/>
<result property="parentId" column="parent_id"/>
<result property="targetCount" column="target_count"/>
<result property="name" column="name"/>
<result property="content" column="content"/>
@ -23,6 +24,13 @@
from by_day_flow_detail
</sql>
<sql id="selectByDayFlowDetailsVo">
select * from(
select dict_value+9999 id,dict_label name,0 parent_id,dict_sort sort_number from sys_dict_data where dict_type='sys_dayflow_type'
union all
select id,name,flow_type+9999,sort_number from by_day_flow_detail ) t
</sql>
<select id="selectByDayFlowDetailList" parameterType="ByDayFlowDetail" resultMap="ByDayFlowDetailResult">
<include refid="selectByDayFlowDetailVo"/>
<where>
@ -37,6 +45,20 @@
</where>
</select>
<select id="selectByDayFlowDetailListTree" parameterType="ByDayFlowDetail" resultMap="ByDayFlowDetailResult">
<include refid="selectByDayFlowDetailsVo"/>
<where>
<if test="sortNumber != null ">and sort_number = #{sortNumber}</if>
<if test="targetCount != null ">and target_count = #{targetCount}</if>
<if test="name != null and name != ''">and name like concat('%', #{name}, '%')</if>
<if test="content != null and content != ''">and content = #{content}</if>
<if test="note != null and note != ''">and note = #{note}</if>
<if test="flowType != null ">and flow_type = #{flowType}</if>
<if test="createUser != null ">and create_user = #{createUser}</if>
<if test="updateUser != null ">and update_user = #{updateUser}</if>
</where>
</select>
<select id="selectByDayFlowDetailById" parameterType="Long" resultMap="ByDayFlowDetailResult">
<include refid="selectByDayFlowDetailVo"/>
where id = #{id}