diff --git a/bonus-common-biz/src/main/java/com/bonus/common/biz/domain/TreeSelect.java b/bonus-common-biz/src/main/java/com/bonus/common/biz/domain/TreeSelect.java index 31c0eaad..fc39260b 100644 --- a/bonus-common-biz/src/main/java/com/bonus/common/biz/domain/TreeSelect.java +++ b/bonus-common-biz/src/main/java/com/bonus/common/biz/domain/TreeSelect.java @@ -13,7 +13,7 @@ import java.util.List; @Data public class TreeSelect implements Serializable { - private static final long serialVersionUID = 1L; + private static final long serialVersionUID = 469203039368157600L; /** 节点ID */ private Long id; 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 ff9b3886..b7195b9c 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 @@ -6,6 +6,7 @@ import javax.servlet.http.HttpServletResponse; import com.bonus.common.log.enums.OperaType; import com.bonus.material.common.annotation.PreventRepeatSubmit; import com.bonus.common.biz.domain.TreeSelect; +import com.bonus.material.ma.vo.MaTypeListVo; import io.swagger.annotations.Api; import io.swagger.annotations.ApiOperation; import org.springframework.web.bind.annotation.*; @@ -36,9 +37,9 @@ public class TypeController extends BaseController { @ApiOperation(value = "查询物资类型管理列表") @RequiresPermissions("ma:type:list") @GetMapping("/list") - public TableDataInfo list(Type type) { + public TableDataInfo list(MaTypeListVo type) { startPage(); - List list = typeService.selectTypeList(type); + List list = typeService.selectTypeListAndParent(type); return getDataTable(list); } 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 b7c9229b..835c6cb1 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.MaTypeListVo; import org.apache.ibatis.annotations.Mapper; import org.apache.ibatis.annotations.Param; @@ -33,6 +34,16 @@ public interface TypeMapper { */ List selectTypeList(Type type); + + /** + * 查询物资类型列表 -- 并且查询当前节点的父级节点名称 + * + * @param typeListVo 物资类型 + * @return 物资类型集合 + */ + List selectTypeListAndParent(Type typeListVo); + + /** * 新增物资类型 * 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 6bf2a072..fd03bea3 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.MaTypeListVo; /** * 物资类型Service接口 @@ -26,6 +27,8 @@ public interface ITypeService { */ List selectTypeList(Type type); + List selectTypeListAndParent(Type type); + /** * 新增物资类型 * 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 9503c198..078f9299 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 @@ -8,6 +8,7 @@ import java.util.stream.Collectors; import com.bonus.common.biz.domain.TreeSelect; import com.bonus.common.core.utils.DateUtils; import com.bonus.common.core.utils.StringUtils; +import com.bonus.material.ma.vo.MaTypeListVo; import org.springframework.stereotype.Service; import com.bonus.material.ma.mapper.TypeMapper; import com.bonus.material.ma.domain.Type; @@ -55,6 +56,21 @@ public class TypeServiceImpl implements ITypeService { return typeMapper.selectTypeList(type); } + /** + * 查询物资类型管理列表 -- 并获取父级信息 + * + * @param type 物资类型管理 + * @return 物资类型管理 + */ + @Override + public List selectTypeListAndParent(Type type) { + // 如果是顶级节点,则查询所有子节点 + if (type != null && "0".equals(type.getLevel())) { + type.setLevel(null); + } + return typeMapper.selectTypeListAndParent(type); + } + /** * 新增物资类型管理 * 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 094ed06d..2576399c 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 @@ -186,4 +186,45 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" where del_flag = 0 and level != #{level} + + \ No newline at end of file