From e33c93d51e8b7de886774a58136956857386c7f8 Mon Sep 17 00:00:00 2001 From: syruan <321359594@qq.com> Date: Wed, 16 Oct 2024 15:58:45 +0800 Subject: [PATCH] =?UTF-8?q?=E7=89=A9=E8=B5=84=E9=85=8D=E7=BD=AE=E7=AE=A1?= =?UTF-8?q?=E7=90=86--=E5=8F=B3=E4=BE=A7=E7=89=A9=E8=B5=84=E9=85=8D?= =?UTF-8?q?=E7=BD=AE=E5=88=97=E8=A1=A8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../bonus/material/ma/MaTypeConfigDto.java | 23 ++++ .../ma/controller/MaTypeConfigController.java | 103 ++++++++++++++++-- .../ma/controller/TypeController.java | 3 +- .../bonus/material/ma/domain/TypeRepair.java | 14 ++- .../material/ma/mapper/TypeKeeperMapper.java | 5 + .../bonus/material/ma/mapper/TypeMapper.java | 15 +++ .../material/ma/mapper/TypeRepairMapper.java | 20 ++-- .../ma/service/ITypeKeeperService.java | 5 + .../ma/service/ITypeRepairService.java | 8 +- .../material/ma/service/ITypeService.java | 10 +- .../service/impl/TypeKeeperServiceImpl.java | 13 ++- .../service/impl/TypeRepairServiceImpl.java | 10 ++ .../ma/service/impl/TypeServiceImpl.java | 29 ++++- .../bonus/material/ma/vo/MaTypeConfigVo.java | 34 +++++- .../mapper/material/ma/TypeKeeperMapper.xml | 14 +++ .../mapper/material/ma/TypeMapper.xml | 47 ++++++++ .../mapper/material/ma/TypeRepairMapper.xml | 11 ++ 17 files changed, 329 insertions(+), 35 deletions(-) create mode 100644 bonus-modules/bonus-material/src/main/java/com/bonus/material/ma/MaTypeConfigDto.java diff --git a/bonus-modules/bonus-material/src/main/java/com/bonus/material/ma/MaTypeConfigDto.java b/bonus-modules/bonus-material/src/main/java/com/bonus/material/ma/MaTypeConfigDto.java new file mode 100644 index 00000000..66766743 --- /dev/null +++ b/bonus-modules/bonus-material/src/main/java/com/bonus/material/ma/MaTypeConfigDto.java @@ -0,0 +1,23 @@ +package com.bonus.material.ma; + +import lombok.Data; +import lombok.ToString; + +/** + * @author : 阮世耀 + * @version : 1.0 + * @PackagePath: com.bonus.material.ma + * @CreateTime: 2024-10-16 15:50 + * @Description: 物资类型配置请求封装DTO + */ +@Data +@ToString +public class MaTypeConfigDto implements java.io.Serializable { + + private Long id; + + private Long typeId; + + private Long userId; + +} diff --git a/bonus-modules/bonus-material/src/main/java/com/bonus/material/ma/controller/MaTypeConfigController.java b/bonus-modules/bonus-material/src/main/java/com/bonus/material/ma/controller/MaTypeConfigController.java index 6937394f..c7a92273 100644 --- a/bonus-modules/bonus-material/src/main/java/com/bonus/material/ma/controller/MaTypeConfigController.java +++ b/bonus-modules/bonus-material/src/main/java/com/bonus/material/ma/controller/MaTypeConfigController.java @@ -3,9 +3,17 @@ package com.bonus.material.ma.controller; import com.bonus.common.biz.domain.TreeSelect; import com.bonus.common.core.web.controller.BaseController; import com.bonus.common.core.web.domain.AjaxResult; +import com.bonus.common.core.web.page.TableDataInfo; import com.bonus.common.security.annotation.RequiresPermissions; +import com.bonus.material.ma.MaTypeConfigDto; +import com.bonus.material.ma.domain.Type; +import com.bonus.material.ma.domain.TypeKeeper; +import com.bonus.material.ma.domain.TypeRepair; import com.bonus.material.ma.service.ITypeKeeperService; import com.bonus.material.ma.service.ITypeRepairService; +import com.bonus.material.ma.service.ITypeService; +import com.bonus.material.ma.vo.MaTypeConfigVo; +import com.bonus.material.ma.vo.MaTypeListVo; import com.google.common.collect.ImmutableList; import io.swagger.annotations.Api; import io.swagger.annotations.ApiOperation; @@ -15,6 +23,7 @@ import org.springframework.web.bind.annotation.RestController; import javax.annotation.Resource; import java.util.*; +import java.util.stream.Collectors; /** * @author : 阮世耀 @@ -40,6 +49,75 @@ public class MaTypeConfigController extends BaseController { @Resource private ITypeRepairService typeRepairService; + // 物资类型Service + @Resource + private ITypeService typeService; + + /** + * 查询物资类型配置右侧列表 + */ + @ApiOperation(value = "查询物资类型配置右侧列表") + @RequiresPermissions("ma:typeConfig:list") + @GetMapping("/getMaTypeConfigList") + public AjaxResult getMaTypeConfigList(MaTypeConfigDto maTypeConfigDto) { + // 1.把所有物资类型查出来 + List list = typeService.selectThreeFourLevelTypeListAndParent(new Type()); + // 2.把维修配置信息查出来 + List typeRepairList = typeRepairService.selectTypeRepairListAndUserName(new TypeRepair()); + // 3.把库管配置信息查出来 + List typeKeeperList = typeKeeperService.selectTypeKeeperListAndUserName(new TypeKeeper()); + + // ------------------- 开启数据处理 --------------------- + + // 4.1 先循环维修配置信息 + for (TypeRepair typeRepair : typeRepairList) { + // 4.循环维修配置信息,把维修员信息设置到物资类型配置信息中 + for (MaTypeConfigVo maTypeConfigVo1 : list) { + // 5.判断当前维修配置信息中的物资类型id是否等于当前物资类型配置信息中的物资类型id + if (typeRepair.getTypeId().equals(maTypeConfigVo1.getTypeId())) { + // 6.如果相等,把维修员信息设置到物资类型配置信息中 + maTypeConfigVo1.setRepairUserId(typeRepair.getUserId()); + maTypeConfigVo1.setRepairUserName(typeRepair.getUserName()); + } + } + } + + // 4.2 再循环库管配置信息 + for (TypeKeeper typeKeeper : typeKeeperList) { + // 4.2循环库管配置信息,把库管员信息设置到物资类型配置信息中 + for (MaTypeConfigVo maTypeConfigVo1 : list) { + // 5.判断当前库管配置信息中的物资类型id是否等于当前物资类型配置信息中的物资类型id + if (typeKeeper.getTypeId().equals(maTypeConfigVo1.getTypeId())) { + // 6.如果相等,把库管员信息设置到物资类型配置信息中 + maTypeConfigVo1.setKeeperUserId(typeKeeper.getUserId()); + maTypeConfigVo1.setKeeperUserName(typeKeeper.getUserName()); + } + } + } + + // ------------------- 数据过滤开始 --------------------- + if (maTypeConfigDto != null) { + // 1.根据库管员或维修员用户id过滤数据 + if (maTypeConfigDto.getUserId() != null && maTypeConfigDto.getUserId() != 0L) { + List filterCollected = list.stream(). + filter(maTypeConfigVo -> maTypeConfigVo.getKeeperUserId().equals(maTypeConfigDto.getUserId()) + || + maTypeConfigVo.getRepairUserId().equals(maTypeConfigDto.getUserId() + )) + .collect(Collectors.toList()); + return success(filterCollected); + } + } + // ------------------- 数据过滤结束 --------------------- + + + + // -------------------- 数据处理结束 --------------------- + return success(list); + } + + + /** * 查询物资配置左侧组织人员树-tree */ @@ -47,7 +125,8 @@ public class MaTypeConfigController extends BaseController { @RequiresPermissions("ma:typeConfig:list") @GetMapping("/getDeptUserTree") public AjaxResult getDeptUserTree() { - // ---------- 模拟人员Tree数据 -------------- + + // ---------- 模拟人员Tree数据 --------------- // 1.创建一个TreeSelect集合,用于外层放组织部门--公司级 List treeSelectList1 = new ArrayList<>(); @@ -55,20 +134,19 @@ public class MaTypeConfigController extends BaseController { TreeSelect treeSelect2 = new TreeSelect(2L, "输电分公司", 1, null); TreeSelect treeSelect3 = new TreeSelect(5L, "变电分公司", 1, null); - // 给公司级部门添加子部门 - - // 2.创建一个TreeSelect集合,用于外层放组织部门--部门级 + // 2. 给公司级部门添加子部门 ,创建TreeSelect集合,存放组织部门--部门级 TreeSelect treeSelect01 = new TreeSelect(11L, "物流库管一班", 2, 1L); + TreeSelect treeSelect02 = new TreeSelect(12L, "物流库管二班", 2, 1L); + TreeSelect treeSelect03 = new TreeSelect(13L, "宏源库管一班", 2, 5L); + + // 3. 创建部门人员 TreeSelect treeSelect001 = new TreeSelect(111L, "王小明", 3, 11L); TreeSelect treeSelect002 = new TreeSelect(112L, "张小三", 3, 11L); - treeSelect01.setChildren(Arrays.asList(treeSelect001, treeSelect002)); - - TreeSelect treeSelect02 = new TreeSelect(12L, "物流库管二班", 2, 1L); - treeSelect1.setChildren(Arrays.asList(treeSelect01, treeSelect02)); - - - TreeSelect treeSelect03 = new TreeSelect(13L, "宏源库管一班", 2, 5L); TreeSelect treeSelect003 = new TreeSelect(113L, "李四", 3, 12L); + + // 4. 把子部门人员添加到子部门中 + treeSelect01.setChildren(Arrays.asList(treeSelect001, treeSelect002)); + treeSelect1.setChildren(Arrays.asList(treeSelect01, treeSelect02)); treeSelect03.setChildren(ImmutableList.of(treeSelect003)); treeSelect3.setChildren(Collections.singletonList(treeSelect03)); @@ -76,6 +154,9 @@ public class MaTypeConfigController extends BaseController { treeSelectList1.add(treeSelect1); treeSelectList1.add(treeSelect2); treeSelectList1.add(treeSelect3); + + // -------------- 模拟人员Tree数据结束 ------------------ + return success(treeSelectList1); } diff --git a/bonus-modules/bonus-material/src/main/java/com/bonus/material/ma/controller/TypeController.java b/bonus-modules/bonus-material/src/main/java/com/bonus/material/ma/controller/TypeController.java index 0a7bc6c5..1acb1974 100644 --- a/bonus-modules/bonus-material/src/main/java/com/bonus/material/ma/controller/TypeController.java +++ b/bonus-modules/bonus-material/src/main/java/com/bonus/material/ma/controller/TypeController.java @@ -4,7 +4,6 @@ import java.util.ArrayList; import java.util.List; import javax.annotation.Resource; import javax.servlet.http.HttpServletResponse; -import javax.validation.Valid; import javax.validation.constraints.NotNull; import com.bonus.common.log.enums.OperaType; @@ -49,7 +48,7 @@ public class TypeController extends BaseController { @GetMapping("/list") public TableDataInfo list(MaTypeListVo type) { startPage(); - List list = typeService.selectTypeListAndParent(type); + List list = typeService.selectTypeListAndParentInfo(type); return getDataTable(list); } diff --git a/bonus-modules/bonus-material/src/main/java/com/bonus/material/ma/domain/TypeRepair.java b/bonus-modules/bonus-material/src/main/java/com/bonus/material/ma/domain/TypeRepair.java index ba7fe586..e1b61f4c 100644 --- a/bonus-modules/bonus-material/src/main/java/com/bonus/material/ma/domain/TypeRepair.java +++ b/bonus-modules/bonus-material/src/main/java/com/bonus/material/ma/domain/TypeRepair.java @@ -3,21 +3,20 @@ package com.bonus.material.ma.domain; import com.bonus.common.core.annotation.Excel; import io.swagger.annotations.ApiModelProperty; import lombok.Data; +import lombok.EqualsAndHashCode; import lombok.ToString; import com.bonus.common.core.web.domain.BaseEntity; /** * 维修班机具配置对象 ma_type_repair - * - * @author xsheng - * @date 2024-09-27 + * + * @author syruan */ - +@EqualsAndHashCode(callSuper = false) @Data @ToString -public class TypeRepair extends BaseEntity -{ +public class TypeRepair extends BaseEntity { private static final long serialVersionUID = 1L; /** ID */ @@ -31,6 +30,9 @@ public class TypeRepair extends BaseEntity @ApiModelProperty(value = "用户") private Long userId; + @ApiModelProperty(value = "用户姓名") + private String userName; + /** 数据所属组织 */ @Excel(name = "数据所属组织") @ApiModelProperty(value = "数据所属组织") diff --git a/bonus-modules/bonus-material/src/main/java/com/bonus/material/ma/mapper/TypeKeeperMapper.java b/bonus-modules/bonus-material/src/main/java/com/bonus/material/ma/mapper/TypeKeeperMapper.java index 4dc372fd..f7501bb5 100644 --- a/bonus-modules/bonus-material/src/main/java/com/bonus/material/ma/mapper/TypeKeeperMapper.java +++ b/bonus-modules/bonus-material/src/main/java/com/bonus/material/ma/mapper/TypeKeeperMapper.java @@ -25,6 +25,11 @@ public interface TypeKeeperMapper { */ List selectTypeKeeperList(TypeKeeper typeKeeper); + /** + * 查询库管员配置列表-并关联查询用户名称 + */ + List selectTypeKeeperListAndUserName(TypeKeeper typeKeeper); + /** * 新增库管员配置 * diff --git a/bonus-modules/bonus-material/src/main/java/com/bonus/material/ma/mapper/TypeMapper.java b/bonus-modules/bonus-material/src/main/java/com/bonus/material/ma/mapper/TypeMapper.java index 30af360e..95d81f94 100644 --- a/bonus-modules/bonus-material/src/main/java/com/bonus/material/ma/mapper/TypeMapper.java +++ b/bonus-modules/bonus-material/src/main/java/com/bonus/material/ma/mapper/TypeMapper.java @@ -2,6 +2,7 @@ package com.bonus.material.ma.mapper; import java.util.List; import com.bonus.material.ma.domain.Type; +import com.bonus.material.ma.vo.MaTypeConfigVo; import com.bonus.material.ma.vo.MaTypeListVo; import com.bonus.material.ma.vo.MaTypeSelectVo; import org.apache.ibatis.annotations.Mapper; @@ -66,6 +67,20 @@ public interface TypeMapper { List selectTypeListAndParent(Type typeListVo); + /** + * 查询四级物资类型列表 -- 并且查询当前节点的父级节点名称 + * @param type + * @return + */ + List selectFourLevelTypeListAndParent(Type type); + + /** + * 查询三级物资类型列表 -- 并且查询当前节点的父级节点名称 + * @param type + * @return + */ + List selectThreeLevelTypeListAndParent(Type type); + /** * 新增物资类型 * diff --git a/bonus-modules/bonus-material/src/main/java/com/bonus/material/ma/mapper/TypeRepairMapper.java b/bonus-modules/bonus-material/src/main/java/com/bonus/material/ma/mapper/TypeRepairMapper.java index e2a2fd4f..6e2de569 100644 --- a/bonus-modules/bonus-material/src/main/java/com/bonus/material/ma/mapper/TypeRepairMapper.java +++ b/bonus-modules/bonus-material/src/main/java/com/bonus/material/ma/mapper/TypeRepairMapper.java @@ -9,15 +9,14 @@ import com.bonus.material.ma.domain.TypeRepair; * @author xsheng * @date 2024-09-27 */ -public interface TypeRepairMapper -{ +public interface TypeRepairMapper { /** * 查询维修班机具配置 * * @param ID 维修班机具配置主键 * @return 维修班机具配置 */ - public TypeRepair selectTypeRepairByID(Long ID); + TypeRepair selectTypeRepairByID(Long ID); /** * 查询维修班机具配置列表 @@ -25,7 +24,12 @@ public interface TypeRepairMapper * @param typeRepair 维修班机具配置 * @return 维修班机具配置集合 */ - public List selectTypeRepairList(TypeRepair typeRepair); + List selectTypeRepairList(TypeRepair typeRepair); + + /** + * 查询配置列表并关联查询用户姓名 + */ + List selectTypeRepairListAndUserName(TypeRepair typeRepair); /** * 新增维修班机具配置 @@ -33,7 +37,7 @@ public interface TypeRepairMapper * @param typeRepair 维修班机具配置 * @return 结果 */ - public int insertTypeRepair(TypeRepair typeRepair); + int insertTypeRepair(TypeRepair typeRepair); /** * 修改维修班机具配置 @@ -41,7 +45,7 @@ public interface TypeRepairMapper * @param typeRepair 维修班机具配置 * @return 结果 */ - public int updateTypeRepair(TypeRepair typeRepair); + int updateTypeRepair(TypeRepair typeRepair); /** * 删除维修班机具配置 @@ -49,7 +53,7 @@ public interface TypeRepairMapper * @param ID 维修班机具配置主键 * @return 结果 */ - public int deleteTypeRepairByID(Long ID); + int deleteTypeRepairByID(Long ID); /** * 批量删除维修班机具配置 @@ -57,5 +61,5 @@ public interface TypeRepairMapper * @param IDs 需要删除的数据主键集合 * @return 结果 */ - public int deleteTypeRepairByIDs(Long[] IDs); + int deleteTypeRepairByIDs(Long[] IDs); } diff --git a/bonus-modules/bonus-material/src/main/java/com/bonus/material/ma/service/ITypeKeeperService.java b/bonus-modules/bonus-material/src/main/java/com/bonus/material/ma/service/ITypeKeeperService.java index 701e600f..000627e7 100644 --- a/bonus-modules/bonus-material/src/main/java/com/bonus/material/ma/service/ITypeKeeperService.java +++ b/bonus-modules/bonus-material/src/main/java/com/bonus/material/ma/service/ITypeKeeperService.java @@ -23,6 +23,11 @@ public interface ITypeKeeperService { */ List selectTypeKeeperList(TypeKeeper typeKeeper); + /** + * 查询库管员配置列表-并关联查询用户名称 + */ + List selectTypeKeeperListAndUserName(TypeKeeper typeKeeper); + /** * 新增库管员配置 * diff --git a/bonus-modules/bonus-material/src/main/java/com/bonus/material/ma/service/ITypeRepairService.java b/bonus-modules/bonus-material/src/main/java/com/bonus/material/ma/service/ITypeRepairService.java index 53bd6412..ffb23427 100644 --- a/bonus-modules/bonus-material/src/main/java/com/bonus/material/ma/service/ITypeRepairService.java +++ b/bonus-modules/bonus-material/src/main/java/com/bonus/material/ma/service/ITypeRepairService.java @@ -9,8 +9,7 @@ import com.bonus.material.ma.domain.TypeRepair; * @author xsheng * @date 2024-09-27 */ -public interface ITypeRepairService -{ +public interface ITypeRepairService { /** * 查询维修班机具配置 * @@ -27,6 +26,11 @@ public interface ITypeRepairService */ public List selectTypeRepairList(TypeRepair typeRepair); + /** + * 查询配置列表并关联查询用户姓名 + */ + List selectTypeRepairListAndUserName(TypeRepair typeRepair); + /** * 新增维修班机具配置 * diff --git a/bonus-modules/bonus-material/src/main/java/com/bonus/material/ma/service/ITypeService.java b/bonus-modules/bonus-material/src/main/java/com/bonus/material/ma/service/ITypeService.java index 6ea729cc..79548d23 100644 --- a/bonus-modules/bonus-material/src/main/java/com/bonus/material/ma/service/ITypeService.java +++ b/bonus-modules/bonus-material/src/main/java/com/bonus/material/ma/service/ITypeService.java @@ -4,6 +4,7 @@ import java.util.List; import com.bonus.common.biz.domain.TreeSelect; import com.bonus.material.ma.domain.Type; +import com.bonus.material.ma.vo.MaTypeConfigVo; import com.bonus.material.ma.vo.MaTypeListVo; import com.bonus.material.ma.vo.MaTypeSelectVo; @@ -40,7 +41,14 @@ public interface ITypeService { */ List selectTypeList(Type type); - List selectTypeListAndParent(Type type); + List selectTypeListAndParentInfo(Type type); + + + /** + * 查询4级加3级的所有物资类型,携带父级信息 + * @param type 参数 + */ + List selectThreeFourLevelTypeListAndParent(Type type); /** * 新增物资类型 diff --git a/bonus-modules/bonus-material/src/main/java/com/bonus/material/ma/service/impl/TypeKeeperServiceImpl.java b/bonus-modules/bonus-material/src/main/java/com/bonus/material/ma/service/impl/TypeKeeperServiceImpl.java index 0da9dd02..c7343f4e 100644 --- a/bonus-modules/bonus-material/src/main/java/com/bonus/material/ma/service/impl/TypeKeeperServiceImpl.java +++ b/bonus-modules/bonus-material/src/main/java/com/bonus/material/ma/service/impl/TypeKeeperServiceImpl.java @@ -11,8 +11,7 @@ import com.bonus.material.ma.service.ITypeKeeperService; /** * 库管员配置Service业务层处理 * - * @author xsheng - * @date 2024-09-27 + * @author syruan */ @Service public class TypeKeeperServiceImpl implements ITypeKeeperService { @@ -42,6 +41,16 @@ public class TypeKeeperServiceImpl implements ITypeKeeperService { return typeKeeperMapper.selectTypeKeeperList(typeKeeper); } + /** + * 查询库管员配置列表-并关联查询用户名称 + * + * @param typeKeeper 查询条件 + */ + @Override + public List selectTypeKeeperListAndUserName(TypeKeeper typeKeeper) { + return typeKeeperMapper.selectTypeKeeperListAndUserName(typeKeeper); + } + /** * 新增库管员配置 * diff --git a/bonus-modules/bonus-material/src/main/java/com/bonus/material/ma/service/impl/TypeRepairServiceImpl.java b/bonus-modules/bonus-material/src/main/java/com/bonus/material/ma/service/impl/TypeRepairServiceImpl.java index 83d43a8a..f3b84b3b 100644 --- a/bonus-modules/bonus-material/src/main/java/com/bonus/material/ma/service/impl/TypeRepairServiceImpl.java +++ b/bonus-modules/bonus-material/src/main/java/com/bonus/material/ma/service/impl/TypeRepairServiceImpl.java @@ -44,6 +44,16 @@ public class TypeRepairServiceImpl implements ITypeRepairService return typeRepairMapper.selectTypeRepairList(typeRepair); } + /** + * 查询配置列表并关联查询用户姓名 + * + * @param typeRepair + */ + @Override + public List selectTypeRepairListAndUserName(TypeRepair typeRepair) { + return typeRepairMapper.selectTypeRepairListAndUserName(typeRepair); + } + /** * 新增维修班机具配置 * diff --git a/bonus-modules/bonus-material/src/main/java/com/bonus/material/ma/service/impl/TypeServiceImpl.java b/bonus-modules/bonus-material/src/main/java/com/bonus/material/ma/service/impl/TypeServiceImpl.java index 2057fa68..a4537a97 100644 --- a/bonus-modules/bonus-material/src/main/java/com/bonus/material/ma/service/impl/TypeServiceImpl.java +++ b/bonus-modules/bonus-material/src/main/java/com/bonus/material/ma/service/impl/TypeServiceImpl.java @@ -9,6 +9,7 @@ import com.bonus.common.biz.domain.TreeSelect; import com.bonus.common.biz.enums.DataCodeEnum; import com.bonus.common.core.utils.DateUtils; import com.bonus.common.core.utils.StringUtils; +import com.bonus.material.ma.vo.MaTypeConfigVo; import com.bonus.material.ma.vo.MaTypeListVo; import com.bonus.material.ma.vo.MaTypeSelectVo; import org.springframework.stereotype.Service; @@ -97,7 +98,7 @@ public class TypeServiceImpl implements ITypeService { * @return 物资类型管理 */ @Override - public List selectTypeListAndParent(Type type) { + public List selectTypeListAndParentInfo(Type type) { // 如果是顶级节点,则查询所有子节点 if (type != null && type.getLevel() != null && "0".equals(type.getLevel())) { type.setLevel(null); @@ -156,6 +157,32 @@ public class TypeServiceImpl implements ITypeService { return maTypeListVos; } + /** + * 查询4级加3级的所有物资类型,携带父级信息 + * + * @param type 参数 + */ + @Override + public List selectThreeFourLevelTypeListAndParent(Type type) { + List fourLevelTypeList = typeMapper.selectFourLevelTypeListAndParent(type); + if (fourLevelTypeList != null && !fourLevelTypeList.isEmpty()) { + List threeLevelTypeList = typeMapper.selectThreeLevelTypeListAndParent(type); + if (threeLevelTypeList != null && !threeLevelTypeList.isEmpty()) { + // 循环,把三级节点放入fourLevelTypeList集合中 + for (MaTypeConfigVo threeLevelType : threeLevelTypeList) { + // 循环,把三级节点放入fourLevelTypeList集合中 + for (MaTypeConfigVo fourLevelType : fourLevelTypeList) { + // 如果三级节点的父级id和四级节点的id相同,则把三级节点放入四级节点的children集合中 + if (threeLevelType.getParentId().equals(fourLevelType.getTypeId())) { + fourLevelType.getChildren().add(threeLevelType); + } + } + } + } + } + return fourLevelTypeList; + } + /** * 新增物资类型管理 * diff --git a/bonus-modules/bonus-material/src/main/java/com/bonus/material/ma/vo/MaTypeConfigVo.java b/bonus-modules/bonus-material/src/main/java/com/bonus/material/ma/vo/MaTypeConfigVo.java index be776d31..b50cc638 100644 --- a/bonus-modules/bonus-material/src/main/java/com/bonus/material/ma/vo/MaTypeConfigVo.java +++ b/bonus-modules/bonus-material/src/main/java/com/bonus/material/ma/vo/MaTypeConfigVo.java @@ -4,6 +4,9 @@ import io.swagger.annotations.ApiModelProperty; import lombok.Data; import lombok.ToString; +import java.util.ArrayList; +import java.util.List; + /** * @author : 阮世耀 * @version : 1.0 @@ -13,7 +16,7 @@ import lombok.ToString; */ @Data @ToString -public class MaTypeConfigVo { +public class MaTypeConfigVo implements java.io.Serializable { @ApiModelProperty(value = "配置id") private Long id; @@ -24,8 +27,17 @@ public class MaTypeConfigVo { @ApiModelProperty(value = "物资类型名称") private String typeName; + @ApiModelProperty(value = "父级id") + private Long parentId; + + @ApiModelProperty(value = "物资仓库id") + private Long houseId; + + @ApiModelProperty(value = "物资仓库名称") + private String houseName; + @ApiModelProperty(value = "库管员id") - private String keeperUserId; + private Long keeperUserId; @ApiModelProperty(value = "库管员姓名") private String keeperUserName; @@ -36,4 +48,22 @@ public class MaTypeConfigVo { @ApiModelProperty(value = "维修员姓名") private String repairUserName; + + private String parentOneLevelName; + + private String parentTwoLevelName; + + private String parentThreeLevelName; + + private String parentFourLevelName; + + + @ApiModelProperty(value = "请求API时调用参数--左侧Tree用户ID") + private Long userId; + + @ApiModelProperty(value = "请求API时调用参数--左侧Tree层级") + private String level; + + @ApiModelProperty(value = "子节点") + private List children = new ArrayList<>(); } diff --git a/bonus-modules/bonus-material/src/main/resources/mapper/material/ma/TypeKeeperMapper.xml b/bonus-modules/bonus-material/src/main/resources/mapper/material/ma/TypeKeeperMapper.xml index 6394a01b..7ae19e3c 100644 --- a/bonus-modules/bonus-material/src/main/resources/mapper/material/ma/TypeKeeperMapper.xml +++ b/bonus-modules/bonus-material/src/main/resources/mapper/material/ma/TypeKeeperMapper.xml @@ -7,6 +7,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" + @@ -68,4 +69,17 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" #{ID} + + \ No newline at end of file diff --git a/bonus-modules/bonus-material/src/main/resources/mapper/material/ma/TypeMapper.xml b/bonus-modules/bonus-material/src/main/resources/mapper/material/ma/TypeMapper.xml index be58065a..d4559f71 100644 --- a/bonus-modules/bonus-material/src/main/resources/mapper/material/ma/TypeMapper.xml +++ b/bonus-modules/bonus-material/src/main/resources/mapper/material/ma/TypeMapper.xml @@ -70,6 +70,17 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" + + + + + + + + + + + select type_id, type_name, parent_id, storage_num, type_code, model_code, unit_id, manage_type, lease_price, @@ -331,4 +342,40 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" where parent_id = #{typeId} and del_flag = 0 + + + + \ No newline at end of file diff --git a/bonus-modules/bonus-material/src/main/resources/mapper/material/ma/TypeRepairMapper.xml b/bonus-modules/bonus-material/src/main/resources/mapper/material/ma/TypeRepairMapper.xml index 672ddded..de02fc41 100644 --- a/bonus-modules/bonus-material/src/main/resources/mapper/material/ma/TypeRepairMapper.xml +++ b/bonus-modules/bonus-material/src/main/resources/mapper/material/ma/TypeRepairMapper.xml @@ -7,6 +7,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" + @@ -69,4 +70,14 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" #{ID} + + \ No newline at end of file