物资类型管理--新增列表父级查询
This commit is contained in:
parent
09c8b9f101
commit
5e999139a9
|
|
@ -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;
|
||||
|
|
|
|||
|
|
@ -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<Type> list = typeService.selectTypeList(type);
|
||||
List<MaTypeListVo> list = typeService.selectTypeListAndParent(type);
|
||||
return getDataTable(list);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -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<Type> selectTypeList(Type type);
|
||||
|
||||
|
||||
/**
|
||||
* 查询物资类型列表 -- 并且查询当前节点的父级节点名称
|
||||
*
|
||||
* @param typeListVo 物资类型
|
||||
* @return 物资类型集合
|
||||
*/
|
||||
List<MaTypeListVo> selectTypeListAndParent(Type typeListVo);
|
||||
|
||||
|
||||
/**
|
||||
* 新增物资类型
|
||||
*
|
||||
|
|
|
|||
|
|
@ -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<Type> selectTypeList(Type type);
|
||||
|
||||
List<MaTypeListVo> selectTypeListAndParent(Type type);
|
||||
|
||||
/**
|
||||
* 新增物资类型
|
||||
*
|
||||
|
|
|
|||
|
|
@ -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<MaTypeListVo> selectTypeListAndParent(Type type) {
|
||||
// 如果是顶级节点,则查询所有子节点
|
||||
if (type != null && "0".equals(type.getLevel())) {
|
||||
type.setLevel(null);
|
||||
}
|
||||
return typeMapper.selectTypeListAndParent(type);
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增物资类型管理
|
||||
*
|
||||
|
|
|
|||
|
|
@ -186,4 +186,45 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
<include refid="selectTypeVo" />
|
||||
where del_flag = 0 and level != #{level}
|
||||
</select>
|
||||
|
||||
<select id="selectTypeListAndParent" resultType="com.bonus.material.ma.vo.MaTypeListVo">
|
||||
SELECT
|
||||
a.*, -- 当前层级的所有字段
|
||||
a.type_name AS parentFourLevelName, -- 当前层级名称
|
||||
b.type_name AS parentThreeLevelName, -- 父层级名称
|
||||
c.type_name AS parentTwoLevelName, -- 祖父层级名称
|
||||
d.type_name AS parentOneLevelName -- 曾祖父层级名称
|
||||
FROM
|
||||
ma_type a
|
||||
LEFT JOIN
|
||||
ma_type b ON a.parent_id = b.type_id and b.del_flag = '0' -- 第一层,父类型
|
||||
LEFT JOIN
|
||||
ma_type c ON b.parent_id = c.type_id and c.del_flag = '0' -- 第二层,祖父类型
|
||||
LEFT JOIN
|
||||
ma_type d ON c.parent_id = d.type_id and d.del_flag = '0' -- 第三层,曾祖父类型
|
||||
<where>
|
||||
<if test="typeName != null and typeName != ''"> and a.type_name like concat('%', #{typeName}, '%')</if>
|
||||
<if test="parentId != null and parentId != '0' "> and a.parent_id = #{parentId}</if>
|
||||
<if test="storageNum != null "> and a.storage_num = #{storageNum}</if>
|
||||
<if test="typeCode != null and typeCode != ''"> and a.type_code = #{typeCode}</if>
|
||||
<if test="modelCode != null and modelCode != ''"> and a.model_code = #{modelCode}</if>
|
||||
<if test="unitId != null "> and a.unit_id = #{unitId}</if>
|
||||
<if test="manageType != null and manageType != ''"> and a.manage_type = #{manageType}</if>
|
||||
<if test="leasePrice != null "> and a.lease_price = #{leasePrice}</if>
|
||||
<if test="effTime != null "> and a.eff_time = #{effTime}</if>
|
||||
<if test="rentPrice != null "> and a.rent_price = #{rentPrice}</if>
|
||||
<if test="buyPrice != null "> and a.buy_price = #{buyPrice}</if>
|
||||
<if test="payRatio != null "> and a.pay_ratio = #{payRatio}</if>
|
||||
<if test="level != null and level != ''"> and a.`level` = #{level}</if>
|
||||
<if test="ratedLoad != null and ratedLoad != ''"> and a.rated_load = #{ratedLoad}</if>
|
||||
<if test="testLoad != null and testLoad != ''"> and a.test_load = #{testLoad}</if>
|
||||
<if test="holdingTime != null "> and a.holding_time = #{holdingTime}</if>
|
||||
<if test="warnNum != null "> and a.warn_num = #{warnNum}</if>
|
||||
<if test="isPlan != null and isPlan != ''"> and a.is_plan = #{isPlan}</if>
|
||||
<if test="isAncuo != null and isAncuo != ''"> and a.is_ancuo = #{isAncuo}</if>
|
||||
<if test="facModel != null and facModel != ''"> and a.fac_model = #{facModel}</if>
|
||||
<if test="intelligentCode != null and intelligentCode != ''"> and a.intelligent_code = #{intelligentCode}</if>
|
||||
and a.del_flag = '0'
|
||||
</where>
|
||||
</select>
|
||||
</mapper>
|
||||
Loading…
Reference in New Issue