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 114ab25a..010f89ff 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 @@ -16,6 +16,7 @@ import com.bonus.material.ma.domain.vo.MaTypeSelectVo; import io.swagger.annotations.Api; import io.swagger.annotations.ApiOperation; import org.apache.commons.lang3.BooleanUtils; +import org.springframework.util.CollectionUtils; import org.springframework.web.bind.annotation.*; import com.bonus.common.log.annotation.SysLog; import com.bonus.common.security.annotation.RequiresPermissions; @@ -68,12 +69,15 @@ public class TypeController extends BaseController { @GetMapping("/getListByMaType") public AjaxResult getListByMaType(MaTypeVo maTypeVo) { List parentIds = typeService.selectParentId(maTypeVo); + if (CollectionUtils.isEmpty(parentIds)) { + return AjaxResult.success(new ArrayList<>()); + } List maTypeVos = new ArrayList<>(); + Integer pageIndex = Convert.toInt(ServletUtils.getParameter("pageNum"), 1); + Integer pageSize = Convert.toInt(ServletUtils.getParameter("pageSize"), 10); for (Integer parentId : parentIds) { maTypeVos.addAll(typeService.getListByParentId(parentId.longValue(), maTypeVo)); } - Integer pageIndex = Convert.toInt(ServletUtils.getParameter("pageNum"), 1); - Integer pageSize = Convert.toInt(ServletUtils.getParameter("pageSize"), 10); if (BooleanUtils.isTrue(maTypeVo.getDisplayBindRelationship())) { List newMaTypeVos = typeService.getMyTypeAndBindUsers(maTypeVos); return AjaxResult.success(ListPagingUtil.paging(pageIndex, pageSize, newMaTypeVos)); 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 9dc83c17..03db2353 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 @@ -138,6 +138,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" LEFT JOIN ma_type mt2 ON mt.parent_id = mt2.type_id LEFT JOIN ma_type mt3 ON mt2.parent_id = mt3.type_id LEFT JOIN ma_type mt4 ON mt3.parent_id = mt4.type_id + LEFT JOIN wh_house_set mhs on mt4.type_id = mhs.type_id and mt4.type_id = #{typeId} @@ -152,6 +153,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" and mt.level = 4 and mt2.type_id is not null + and mhs.house_id = #{houseId} and mhs.del_flag = 0