物资类型优化

This commit is contained in:
sxu 2024-11-05 15:44:44 +08:00
parent c58e9be3dd
commit 3cbe0af7d3
2 changed files with 8 additions and 2 deletions

View File

@ -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<Integer> parentIds = typeService.selectParentId(maTypeVo);
if (CollectionUtils.isEmpty(parentIds)) {
return AjaxResult.success(new ArrayList<>());
}
List<MaTypeVo> 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<MaTypeVo> newMaTypeVos = typeService.getMyTypeAndBindUsers(maTypeVos);
return AjaxResult.success(ListPagingUtil.paging(pageIndex, pageSize, newMaTypeVos));

View File

@ -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
<where>
<if test="level == 1">
and mt4.type_id = #{typeId}
@ -152,6 +153,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
and mt.level = 4
</if>
and mt2.type_id is not null
and mhs.house_id = #{houseId} and mhs.del_flag = 0
</where>
</select>