物资类型管理--新增物资仓库查询树状API
This commit is contained in:
parent
0b694fe72a
commit
0d3f737406
|
|
@ -4,13 +4,14 @@ import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import javax.annotation.Resource;
|
import javax.annotation.Resource;
|
||||||
import javax.servlet.http.HttpServletResponse;
|
import javax.servlet.http.HttpServletResponse;
|
||||||
|
import javax.validation.Valid;
|
||||||
|
import javax.validation.constraints.NotNull;
|
||||||
|
|
||||||
import cn.hutool.core.convert.Convert;
|
|
||||||
import com.bonus.common.core.utils.ServletUtils;
|
|
||||||
import com.bonus.common.log.enums.OperaType;
|
import com.bonus.common.log.enums.OperaType;
|
||||||
import com.bonus.material.common.annotation.PreventRepeatSubmit;
|
import com.bonus.material.common.annotation.PreventRepeatSubmit;
|
||||||
import com.bonus.common.biz.domain.TreeSelect;
|
import com.bonus.common.biz.domain.TreeSelect;
|
||||||
import com.bonus.material.ma.vo.MaTypeListVo;
|
import com.bonus.material.ma.vo.MaTypeListVo;
|
||||||
|
import com.bonus.material.ma.vo.MaTypeSelectVo;
|
||||||
import com.bonus.material.warehouse.domain.WhHouseSet;
|
import com.bonus.material.warehouse.domain.WhHouseSet;
|
||||||
import com.bonus.material.warehouse.service.IWhHouseSetService;
|
import com.bonus.material.warehouse.service.IWhHouseSetService;
|
||||||
import io.swagger.annotations.Api;
|
import io.swagger.annotations.Api;
|
||||||
|
|
@ -53,10 +54,20 @@ public class TypeController extends BaseController {
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 根据左列表类型id查询右表格
|
* 根据物资仓库ID查询施工类型
|
||||||
*
|
*/
|
||||||
* @param typeId
|
@ApiOperation(value = "根据物资仓库ID查询施工类型")
|
||||||
* @return
|
@RequiresPermissions("ma:type:list")
|
||||||
|
@GetMapping("/selectMaTypeListByHouseId")
|
||||||
|
public AjaxResult selectMaTypeListByHouseId(@NotNull(message = "物资仓库ID不能为空") Long houseId) {
|
||||||
|
List<MaTypeSelectVo> list = typeService.selectMaTypeListByHouseId(houseId);
|
||||||
|
return success(list);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 根据左列表类型id查询右表格 --- 暂未启用,代码有问题!!
|
||||||
|
* TODO: 待完善
|
||||||
|
* @param typeId 左列表类型id
|
||||||
*/
|
*/
|
||||||
@ApiOperation(value = "根据左列表类型id查询右表格")
|
@ApiOperation(value = "根据左列表类型id查询右表格")
|
||||||
@GetMapping("/getListByMaType")
|
@GetMapping("/getListByMaType")
|
||||||
|
|
@ -73,6 +84,7 @@ public class TypeController extends BaseController {
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
* TODO : 后续优化代码逻辑
|
||||||
* 物资类型下拉树
|
* 物资类型下拉树
|
||||||
*/
|
*/
|
||||||
@ApiOperation(value = "物资类型下拉树")
|
@ApiOperation(value = "物资类型下拉树")
|
||||||
|
|
@ -98,7 +110,9 @@ public class TypeController extends BaseController {
|
||||||
oneLevelTreeList.add(treeSelect);
|
oneLevelTreeList.add(treeSelect);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
thisTree.setChildren(oneLevelTreeList);
|
// 把处理后对应上的1级列表当作child存入0级Tree对象中
|
||||||
|
thisTree.setChildren(!oneLevelTreeList.isEmpty() ? oneLevelTreeList : null);
|
||||||
|
// 最后把0级Tree对象存入Result返回集合中,返回给前端
|
||||||
treeSelectResultList.add(thisTree);
|
treeSelectResultList.add(thisTree);
|
||||||
}
|
}
|
||||||
return AjaxResult.success(treeSelectResultList);
|
return AjaxResult.success(treeSelectResultList);
|
||||||
|
|
|
||||||
|
|
@ -3,6 +3,7 @@ package com.bonus.material.ma.mapper;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import com.bonus.material.ma.domain.Type;
|
import com.bonus.material.ma.domain.Type;
|
||||||
import com.bonus.material.ma.vo.MaTypeListVo;
|
import com.bonus.material.ma.vo.MaTypeListVo;
|
||||||
|
import com.bonus.material.ma.vo.MaTypeSelectVo;
|
||||||
import org.apache.ibatis.annotations.Mapper;
|
import org.apache.ibatis.annotations.Mapper;
|
||||||
import org.apache.ibatis.annotations.Param;
|
import org.apache.ibatis.annotations.Param;
|
||||||
|
|
||||||
|
|
@ -27,8 +28,15 @@ public interface TypeMapper {
|
||||||
*/
|
*/
|
||||||
List<Integer> selectParentId( @Param("typeId")Long typeId, @Param("level")Integer level);
|
List<Integer> selectParentId( @Param("typeId")Long typeId, @Param("level")Integer level);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 根据物资仓库的ID查询物资类型列表
|
||||||
|
* @param houseId 物资仓库ID
|
||||||
|
*/
|
||||||
|
List<MaTypeSelectVo> selectMaTypeListByHouseId(Long houseId);
|
||||||
|
|
||||||
List<Type> getListByParentId(@Param("typeId") Long typeId, @Param("typeName") String typeName);
|
List<Type> getListByTypeName(@Param("typeId") Long typeId, @Param("typeName") String typeName);
|
||||||
|
|
||||||
|
List<MaTypeSelectVo> getMaTypeSelectVoListByParentId(@Param("typeId") Long typeId);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 物资类型树形结构
|
* 物资类型树形结构
|
||||||
|
|
|
||||||
|
|
@ -5,6 +5,7 @@ import java.util.List;
|
||||||
import com.bonus.common.biz.domain.TreeSelect;
|
import com.bonus.common.biz.domain.TreeSelect;
|
||||||
import com.bonus.material.ma.domain.Type;
|
import com.bonus.material.ma.domain.Type;
|
||||||
import com.bonus.material.ma.vo.MaTypeListVo;
|
import com.bonus.material.ma.vo.MaTypeListVo;
|
||||||
|
import com.bonus.material.ma.vo.MaTypeSelectVo;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 物资类型Service接口
|
* 物资类型Service接口
|
||||||
|
|
@ -21,6 +22,8 @@ public interface ITypeService {
|
||||||
|
|
||||||
List<Integer> selectParentId(Long typeId, Integer level);
|
List<Integer> selectParentId(Long typeId, Integer level);
|
||||||
|
|
||||||
|
List<MaTypeSelectVo> selectMaTypeListByHouseId(Long houseId);
|
||||||
|
|
||||||
List<Type> getListByParentId(Long typeId, String typeName);
|
List<Type> getListByParentId(Long typeId, String typeName);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
||||||
|
|
@ -10,6 +10,7 @@ import com.bonus.common.biz.enums.DataCodeEnum;
|
||||||
import com.bonus.common.core.utils.DateUtils;
|
import com.bonus.common.core.utils.DateUtils;
|
||||||
import com.bonus.common.core.utils.StringUtils;
|
import com.bonus.common.core.utils.StringUtils;
|
||||||
import com.bonus.material.ma.vo.MaTypeListVo;
|
import com.bonus.material.ma.vo.MaTypeListVo;
|
||||||
|
import com.bonus.material.ma.vo.MaTypeSelectVo;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
import com.bonus.material.ma.mapper.TypeMapper;
|
import com.bonus.material.ma.mapper.TypeMapper;
|
||||||
import com.bonus.material.ma.domain.Type;
|
import com.bonus.material.ma.domain.Type;
|
||||||
|
|
@ -47,6 +48,11 @@ public class TypeServiceImpl implements ITypeService {
|
||||||
return typeMapper.selectParentId(typeId, level);
|
return typeMapper.selectParentId(typeId, level);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public List<MaTypeSelectVo> selectMaTypeListByHouseId(Long houseId) {
|
||||||
|
return typeMapper.selectMaTypeListByHouseId(houseId);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 根据组织树parent_id查询结果
|
* 根据组织树parent_id查询结果
|
||||||
*
|
*
|
||||||
|
|
@ -55,7 +61,7 @@ public class TypeServiceImpl implements ITypeService {
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public List<Type> getListByParentId(Long typeId, String typeName) {
|
public List<Type> getListByParentId(Long typeId, String typeName) {
|
||||||
return typeMapper.getListByParentId(typeId, typeName);
|
return typeMapper.getListByTypeName(typeId, typeName);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,23 @@
|
||||||
|
package com.bonus.material.ma.vo;
|
||||||
|
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author : 阮世耀
|
||||||
|
* @version : 1.0
|
||||||
|
* @PackagePath: com.bonus.material.ma.vo
|
||||||
|
* @CreateTime: 2024-10-15 15:39
|
||||||
|
* @Description: 物资类型下拉框
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
public class MaTypeSelectVo {
|
||||||
|
|
||||||
|
private Long typeId;
|
||||||
|
|
||||||
|
private String typeName;
|
||||||
|
|
||||||
|
private String parentId;
|
||||||
|
|
||||||
|
private Integer level;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
@ -287,7 +287,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||||
</where>
|
</where>
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
<select id="getListByParentId" resultMap="TypeResult">
|
<select id="getListByTypeName" resultMap="TypeResult">
|
||||||
select DISTINCT m.type_id, m.type_name, m.parent_id, m.manage_type,
|
select DISTINCT m.type_id, m.type_name, m.parent_id, m.manage_type,
|
||||||
m.lease_price,m.rent_price, m.eff_time, m.buy_price, m.level, m.rated_load, m.test_load,
|
m.lease_price,m.rent_price, m.eff_time, m.buy_price, m.level, m.rated_load, m.test_load,
|
||||||
m.holding_time, m.warn_num,
|
m.holding_time, m.warn_num,
|
||||||
|
|
@ -303,4 +303,17 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||||
AND type_name like concat('%',#{typeName},'%')
|
AND type_name like concat('%',#{typeName},'%')
|
||||||
</if>
|
</if>
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
|
<select id="selectMaTypeListByHouseId" resultType="com.bonus.material.ma.vo.MaTypeSelectVo">
|
||||||
|
select
|
||||||
|
wh_house_set.type_id AS typeId,
|
||||||
|
mt.type_name AS typeName,
|
||||||
|
mt.parent_id AS parentId,
|
||||||
|
mt.level
|
||||||
|
from
|
||||||
|
wh_house_set
|
||||||
|
left join ma_type mt on wh_house_set.type_id = mt.type_id
|
||||||
|
where
|
||||||
|
wh_house_set.house_id = #{mouseId} and wh_house_set.del_flag = 0
|
||||||
|
</select>
|
||||||
</mapper>
|
</mapper>
|
||||||
Loading…
Reference in New Issue