From c999ba348721e48a95d5999da3ffab6ceae5eff2 Mon Sep 17 00:00:00 2001 From: zhangdaihao Date: Thu, 7 Mar 2019 10:17:41 +0800 Subject: [PATCH] =?UTF-8?q?=E7=BB=84=E7=BB=87=E6=9C=BA=E6=9E=84=E7=AE=A1?= =?UTF-8?q?=E7=90=86service=E4=BB=A3=E7=A0=81=E4=B8=8D=E8=A7=84=E8=8C=83?= =?UTF-8?q?=E4=BF=AE=E5=A4=8D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../exception/JeecgBootExceptionHandler.java | 5 +-- .../service/impl/SysDepartServiceImpl.java | 43 +++++++++---------- 2 files changed, 22 insertions(+), 26 deletions(-) diff --git a/jeecg-boot/src/main/java/org/jeecg/common/exception/JeecgBootExceptionHandler.java b/jeecg-boot/src/main/java/org/jeecg/common/exception/JeecgBootExceptionHandler.java index 62a1051..8c00e5f 100644 --- a/jeecg-boot/src/main/java/org/jeecg/common/exception/JeecgBootExceptionHandler.java +++ b/jeecg-boot/src/main/java/org/jeecg/common/exception/JeecgBootExceptionHandler.java @@ -12,9 +12,8 @@ import lombok.extern.slf4j.Slf4j; /** * 异常处理器 * - * @author chenshun - * @email sunlightcs@gmail.com - * @date 2016年10月27日 下午10:16:19 + * @author scott + * @date 2019 */ @RestControllerAdvice @Slf4j diff --git a/jeecg-boot/src/main/java/org/jeecg/modules/system/service/impl/SysDepartServiceImpl.java b/jeecg-boot/src/main/java/org/jeecg/modules/system/service/impl/SysDepartServiceImpl.java index 705c99e..8d081fe 100644 --- a/jeecg-boot/src/main/java/org/jeecg/modules/system/service/impl/SysDepartServiceImpl.java +++ b/jeecg-boot/src/main/java/org/jeecg/modules/system/service/impl/SysDepartServiceImpl.java @@ -1,18 +1,23 @@ package org.jeecg.modules.system.service.impl; -import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; -import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; -import io.netty.util.internal.StringUtil; -import org.jeecg.modules.system.controller.FindsDepartsChildrenUtil; +import java.util.ArrayList; +import java.util.Date; +import java.util.List; +import java.util.UUID; + import org.jeecg.common.util.YouBianCodeUtil; +import org.jeecg.modules.system.controller.FindsDepartsChildrenUtil; import org.jeecg.modules.system.entity.SysDepart; import org.jeecg.modules.system.mapper.SysDepartMapper; import org.jeecg.modules.system.model.SysDepartTreeModel; import org.jeecg.modules.system.service.ISysDepartService; -import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; -import java.util.*; + +import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; + +import io.netty.util.internal.StringUtil; /** *

@@ -25,13 +30,6 @@ import java.util.*; @Service public class SysDepartServiceImpl extends ServiceImpl implements ISysDepartService { - @Autowired - private ISysDepartService sysDepartService; - - // 该集合用来存储部门下的所有数据 - private List globalList = new ArrayList<>(); - - /** * queryTreeList 对应 queryTreeList 查询所有的部门数据,以树结构形式响应给前端 */ @@ -40,8 +38,7 @@ public class SysDepartServiceImpl extends ServiceImpl query = new LambdaQueryWrapper(); query.eq(SysDepart::getDelFlag, 0); query.orderByAsc(SysDepart::getDepartOrder); - List list = sysDepartService.list(query); - globalList = list; + List list = this.list(query); // 调用wrapTreeDataToTreeList方法生成树状数据 List listResult = FindsDepartsChildrenUtil.wrapTreeDataToTreeList(list); return listResult; @@ -68,7 +65,7 @@ public class SysDepartServiceImpl extends ServiceImpl extends ServiceImpl extends ServiceImpl parentList = sysDepartService.list(query); + List parentList = this.list(query); // 查询出父级部门 - SysDepart depart = sysDepartService.getById(parentId); + SysDepart depart = this.getById(parentId); // 获取父级部门的Code String parentCode = depart.getOrgCode(); // 根据父级部门类型算出当前部门的类型 @@ -151,7 +148,7 @@ public class SysDepartServiceImpl extends ServiceImpl>>>>"+id); boolean - * flag = sysDepartService.removeById(id); return flag; } + * flag = this.removeById(id); return flag; } */ /** @@ -163,7 +160,7 @@ public class SysDepartServiceImpl extends ServiceImpl extends ServiceImpl searhBy(String keyWord) { LambdaQueryWrapper query = new LambdaQueryWrapper(); query.like(SysDepart::getDepartName, keyWord); - List departList = this.sysDepartService.list(query); + List departList = this.list(query); List newList = new ArrayList<>(); - if(departList.size() > 0 || sysDepartService != null) { + if(departList.size() > 0) { for(SysDepart depart : departList) { newList.add(new SysDepartTreeModel(depart)); } -- GitLab