From 0a14c5125f2923e0079b766c860e1d4060e716d1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=9F=A9=E5=9B=BD=E4=B8=9C?= Date: Fri, 30 Sep 2022 15:30:10 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E4=BC=81=E4=B8=9A?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../com/rzyc/mapper/ent/BaseInClassMapper.java | 3 ++- .../resources/mapper/ent/BaseInClassMapper.xml | 7 ++----- .../com/rzyc/controller/BaseController.java | 17 +++++++---------- .../com/rzyc/controller/OtherController.java | 9 +++++---- 4 files changed, 16 insertions(+), 20 deletions(-) diff --git a/inventory-dao/src/main/java/com/rzyc/mapper/ent/BaseInClassMapper.java b/inventory-dao/src/main/java/com/rzyc/mapper/ent/BaseInClassMapper.java index 0ccf18a..9876c5c 100644 --- a/inventory-dao/src/main/java/com/rzyc/mapper/ent/BaseInClassMapper.java +++ b/inventory-dao/src/main/java/com/rzyc/mapper/ent/BaseInClassMapper.java @@ -1,5 +1,6 @@ package com.rzyc.mapper.ent; +import com.rzyc.bean.TreeModel; import com.rzyc.model.ent.BaseInClass; import com.rzyc.model.ent.BaseInClassExample; import org.apache.ibatis.annotations.Param; @@ -34,7 +35,7 @@ public interface BaseInClassMapper { /*企业行业类别*/ List findByName(@Param("name") String name); - ListfindAllTree(@Param("inType") Integer inType); + ListfindAllTree(@Param("inType") Integer inType); /*查询所有*/ ListfindAll(); diff --git a/inventory-dao/src/main/resources/mapper/ent/BaseInClassMapper.xml b/inventory-dao/src/main/resources/mapper/ent/BaseInClassMapper.xml index db17828..7c10a1f 100644 --- a/inventory-dao/src/main/resources/mapper/ent/BaseInClassMapper.xml +++ b/inventory-dao/src/main/resources/mapper/ent/BaseInClassMapper.xml @@ -354,11 +354,8 @@ select t1.*, t2.BaseInClassId BaseInClassIdChild,t2.ClassCode ClassCodeChild, t2.IndustryClassName IndustryClassNameChild,t2.SuperInId as SuperInIdChild - from BaseInClass t1 inner join BaseInClass t2 on t1.BaseInClassId = t2.SuperInId - where 1 = 1 - - and t1.in_type = #{inType} - + from BaseInClass t1 LEFT join BaseInClass t2 on t1.BaseInClassId = t2.SuperInId + where t1.SuperInId is null diff --git a/inventory-gov/src/main/java/com/rzyc/controller/BaseController.java b/inventory-gov/src/main/java/com/rzyc/controller/BaseController.java index 59a783b..922edf7 100644 --- a/inventory-gov/src/main/java/com/rzyc/controller/BaseController.java +++ b/inventory-gov/src/main/java/com/rzyc/controller/BaseController.java @@ -9,10 +9,7 @@ import com.common.utils.jpush.Jpush; import com.common.utils.orcode.QRCodeUtil; import com.common.utils.upload.FileUpload; import com.common.utils.jwt.JwtUtil; -import com.rzyc.bean.FactorDay; -import com.rzyc.bean.FactorYear; -import com.rzyc.bean.OaTaskTime; -import com.rzyc.bean.UserDepart; +import com.rzyc.bean.*; import com.common.utils.model.Pager; import com.github.pagehelper.Page; import com.rzyc.bean.bigdata.user.PerformInfo; @@ -1638,12 +1635,12 @@ public class BaseController { /** * 行业类别 * */ - public ListbaseInClasses(int isTree,Integer type){ - List baseInClasses; - if (isTree == 1) { - baseInClasses = baseInClassMapper.findAllTree(type); - }else { - baseInClasses = baseInClassMapper.findByInType(type); + public ListbaseInClasses(int isTree, Integer type){ + List baseInClasses = baseInClassMapper.findAllTree(type); + for (TreeModel treeModel : baseInClasses){ + if(null == treeModel.getChildren() || 0 == treeModel.getChildren().size()){ + treeModel.setChildren(null); + } } return baseInClasses; } diff --git a/inventory-gov/src/main/java/com/rzyc/controller/OtherController.java b/inventory-gov/src/main/java/com/rzyc/controller/OtherController.java index 90831c1..8ba1032 100644 --- a/inventory-gov/src/main/java/com/rzyc/controller/OtherController.java +++ b/inventory-gov/src/main/java/com/rzyc/controller/OtherController.java @@ -10,6 +10,7 @@ import com.common.utils.model.MultiResult; import com.common.utils.model.SingleResult; import com.common.utils.verification.Verification; import com.rzyc.bean.ImportListDetail; +import com.rzyc.bean.TreeModel; import com.rzyc.bean.ent.IndustryClassDto; import com.rzyc.enums.EntListType; import com.rzyc.model.*; @@ -87,9 +88,9 @@ public class OtherController extends BaseController{ @ApiOperation(value = "获取行业类型", notes = "获取行业类型") @GetMapping("/industryClass") @ResponseBody - public SingleResult> industryClass(@Valid IndustryClassDto industryClassDto)throws Exception { + public SingleResult> industryClass(@Valid IndustryClassDto industryClassDto)throws Exception { SingleResult singleResult = new SingleResult(); - List list = super.baseInClasses(industryClassDto.getIsTree(),industryClassDto.getType()); + List list = super.baseInClasses(industryClassDto.getIsTree(),industryClassDto.getType()); if (list!=null){ singleResult.setMessage(Message.SUCCESS); singleResult.setCode(Code.SUCCESS.getCode()); @@ -129,9 +130,9 @@ public class OtherController extends BaseController{ @ApiOperation(value = "所有行业类型", notes = "所有行业类型") @GetMapping("/allIndustryClass") @ResponseBody - public SingleResult> allIndustryClass(@Valid IndustryClassDto industryClassDto)throws Exception { + public SingleResult> allIndustryClass(@Valid IndustryClassDto industryClassDto)throws Exception { SingleResult singleResult = new SingleResult(); - List list = super.baseInClasses(industryClassDto.getIsTree(),industryClassDto.getType()); + List list = super.baseInClasses(industryClassDto.getIsTree(),industryClassDto.getType()); if (list!=null){ singleResult.setMessage(Message.SUCCESS); singleResult.setCode(Code.SUCCESS.getCode());