|
@@ -1,14 +1,15 @@
|
|
|
package com.ym.mec.web.service.impl;
|
|
|
|
|
|
-import org.apache.ibatis.annotations.Param;
|
|
|
-import org.springframework.beans.factory.annotation.Autowired;
|
|
|
-import org.springframework.stereotype.Service;
|
|
|
-
|
|
|
import com.ym.mec.common.dal.BaseDAO;
|
|
|
+import com.ym.mec.common.page.PageInfo;
|
|
|
import com.ym.mec.common.service.impl.BaseServiceImpl;
|
|
|
import com.ym.mec.web.dal.dao.SubjectDao;
|
|
|
import com.ym.mec.web.dal.entity.Subject;
|
|
|
+import com.ym.mec.web.dal.enums.YesOrNoEnum;
|
|
|
+import com.ym.mec.web.dal.page.SubjectQueryInfo;
|
|
|
import com.ym.mec.web.service.SubjectService;
|
|
|
+import org.springframework.beans.factory.annotation.Autowired;
|
|
|
+import org.springframework.stereotype.Service;
|
|
|
|
|
|
import java.util.List;
|
|
|
|
|
@@ -38,4 +39,28 @@ public class SubjectServiceImpl extends BaseServiceImpl<Integer, Subject> imple
|
|
|
return subjectDao.findByCode(code);
|
|
|
}
|
|
|
|
|
|
+ @Override
|
|
|
+ public PageInfo<Subject> queryPageTree(SubjectQueryInfo queryInfo) {
|
|
|
+ PageInfo<Subject> pageInfo = queryPage(queryInfo);
|
|
|
+ for (Subject subject:pageInfo.getRows()) {
|
|
|
+ subject = getTree(subject,queryInfo.getDelFlag());
|
|
|
+ }
|
|
|
+ return pageInfo;
|
|
|
+ }
|
|
|
+
|
|
|
+ private Subject getTree(Subject sub,YesOrNoEnum yesOrNoEnum){
|
|
|
+ //得到根节点对象
|
|
|
+ //获取子节点list
|
|
|
+ List<Subject> subjects = subjectDao.findByParentId(sub.getCode(),yesOrNoEnum);
|
|
|
+ //如果存在子节点
|
|
|
+ if(subjects != null && subjects.size() > 0) {
|
|
|
+ //将子节点list放入父节点对象
|
|
|
+ sub.setSubjects(subjects);
|
|
|
+ //遍历子节点....
|
|
|
+ for (Subject subject : subjects) {
|
|
|
+ getTree(subject,yesOrNoEnum);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ return sub;
|
|
|
+ }
|
|
|
}
|