物料查询接口加分页
This commit is contained in:
parent
e184dec8b4
commit
ff9330816a
|
|
@ -7,9 +7,11 @@ import cn.hutool.core.lang.TypeReference;
|
|||
import cn.hutool.core.util.ObjectUtil;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.google.common.collect.ImmutableList;
|
||||
import com.nflg.product.base.core.api.BaseApi;
|
||||
import com.nflg.product.base.core.exception.NflgBusinessException;
|
||||
import com.nflg.product.base.core.vo.PageVO;
|
||||
import com.nflg.product.bomnew.constant.ReportConstant;
|
||||
import com.nflg.product.bomnew.pojo.dto.MaterialQueryDTO;
|
||||
import com.nflg.product.bomnew.pojo.entity.MaterialMainEntity;
|
||||
|
|
@ -291,26 +293,28 @@ public class BomReportApi extends BaseApi {
|
|||
|
||||
@PostMapping("queryMaterial")
|
||||
@ApiOperation("物料查询")
|
||||
public ResultVO<List<MaterialQueryResult>> materialQuery(@RequestBody MaterialQueryDTO queryParam){
|
||||
List<MaterialQueryResult> result = materialMainService.getBaseMapper().queryMaterial(queryParam);
|
||||
//排序
|
||||
if(StrUtil.isNotBlank(queryParam.getMaterialNo())) {
|
||||
result.forEach(u->{
|
||||
u.setOrderNo(StrUtil.replace(u.getMaterialNo(),queryParam.getMaterialNo(),"0"));
|
||||
});
|
||||
public ResultVO<Page<MaterialQueryResult>> materialQuery(@RequestBody MaterialQueryDTO queryParam){
|
||||
|
||||
}
|
||||
if(StrUtil.isNotBlank(queryParam.getDrawingNo())) {
|
||||
result.forEach(u->{
|
||||
u.setOrderNo(StrUtil.replace(u.getDrawingNo(),queryParam.getDrawingNo(),"0"));
|
||||
});
|
||||
}
|
||||
if(StrUtil.isNotBlank(queryParam.getMaterialDesc())) {
|
||||
result.forEach(u->{
|
||||
u.setOrderNo(StrUtil.replace(u.getMaterialDesc(),queryParam.getMaterialDesc(),"0"));
|
||||
});
|
||||
}
|
||||
result= result.stream().sorted( Comparator.comparing(MaterialQueryResult::getOrderNo)).collect(Collectors.toList());
|
||||
Page<MaterialQueryDTO> page = new PageVO<>(queryParam.getPage(), queryParam.getPageSize());
|
||||
Page<MaterialQueryResult> result = materialMainService.getBaseMapper().queryMaterial(page , queryParam);
|
||||
//排序
|
||||
// if(StrUtil.isNotBlank(queryParam.getMaterialNo())) {
|
||||
// result.forEach(u->{
|
||||
// u.setOrderNo(StrUtil.replace(u.getMaterialNo(),queryParam.getMaterialNo(),"0"));
|
||||
// });
|
||||
//
|
||||
// }
|
||||
// if(StrUtil.isNotBlank(queryParam.getDrawingNo())) {
|
||||
// result.forEach(u->{
|
||||
// u.setOrderNo(StrUtil.replace(u.getDrawingNo(),queryParam.getDrawingNo(),"0"));
|
||||
// });
|
||||
// }
|
||||
// if(StrUtil.isNotBlank(queryParam.getMaterialDesc())) {
|
||||
// result.forEach(u->{
|
||||
// u.setOrderNo(StrUtil.replace(u.getMaterialDesc(),queryParam.getMaterialDesc(),"0"));
|
||||
// });
|
||||
// }
|
||||
// result= result.stream().sorted( Comparator.comparing(MaterialQueryResult::getOrderNo)).collect(Collectors.toList());
|
||||
return ResultVO.success(result);
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,6 +1,7 @@
|
|||
package com.nflg.product.bomnew.mapper.master;
|
||||
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.nflg.product.bomnew.pojo.dto.CategoryExcelDTO;
|
||||
import com.nflg.product.bomnew.pojo.dto.MaterialQueryDTO;
|
||||
import com.nflg.product.bomnew.pojo.entity.MaterialMainEntity;
|
||||
|
|
@ -61,5 +62,5 @@ public interface MaterialMainMapper extends BaseMapper<MaterialMainEntity> {
|
|||
|
||||
String getUserDepartmentDptCode(@Param("rowId") Long rowId);
|
||||
|
||||
List<MaterialQueryResult> queryMaterial(@Param("query") MaterialQueryDTO query);
|
||||
Page<MaterialQueryResult> queryMaterial(Page<MaterialQueryDTO> page, @Param("query") MaterialQueryDTO query);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -26,6 +26,12 @@ public class MaterialQueryDTO implements Serializable {
|
|||
@ApiModelProperty(value = "物料描述")
|
||||
private String materialDesc;
|
||||
|
||||
// 设置每页显示条数
|
||||
private Long pageSize = 20L;
|
||||
|
||||
// 当前页
|
||||
private Long page = 1L;
|
||||
|
||||
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
|
|
|||
|
|
@ -203,18 +203,31 @@
|
|||
</select>
|
||||
|
||||
<select id="queryMaterial" resultType="com.nflg.product.bomnew.pojo.vo.MaterialQueryResult">
|
||||
select material_no,drawing_no, material_name,material_desc,material_unit, material_state from t_material_main where 1=1
|
||||
select material_no,drawing_no, material_name,material_desc,material_unit, material_state
|
||||
<choose>
|
||||
<when test="query.materialNo != null and query.materialNo != ''" >
|
||||
,REPLACE(material_no,IFNULL(#{query.materialNo},''),'0') as orderMaterialNo
|
||||
</when>
|
||||
<when test="query.drawingNo != null and query.drawingNo != ''">
|
||||
,REPLACE(drawing_no,IFNULL(#{query.drawingNo},''),'0') as orderDrawingNo
|
||||
</when>
|
||||
<when test="query.materialDesc != null and query.materialDesc != ''">
|
||||
,REPLACE(material_desc,IFNULL(#{query.materialDesc},''),'0') as orderMaterialDesc
|
||||
</when>
|
||||
</choose>
|
||||
from t_material_main where 1=1
|
||||
<if test="query.materialCategoryCode != null and query.materialCategoryCode != ''">
|
||||
and material_category_code = #{query.materialCategoryCode}
|
||||
</if>
|
||||
<if test="query.materialNo != null and query.materialNo != ''">
|
||||
and material_no like concat('%',#{query.materialNo},'%')
|
||||
and material_no like concat(#{query.materialNo},'%')
|
||||
</if>
|
||||
<if test="query.drawingNo != null and query.drawingNo != ''">
|
||||
and drawing_no like concat('%',#{query.drawingNo},'%')
|
||||
and drawing_no like concat(#{query.drawingNo},'%')
|
||||
</if>
|
||||
<if test="query.materialDesc != null and query.materialDesc != ''">
|
||||
and material_desc like concat('%',#{query.materialDesc},'%')
|
||||
</if>
|
||||
order by orderMfiled
|
||||
</select>
|
||||
</mapper>
|
||||
|
|
|
|||
Loading…
Reference in New Issue