Merge remote-tracking branch 'origin/DM/物料查询接口'
This commit is contained in:
commit
319ea98f0b
|
|
@ -7,10 +7,13 @@ 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;
|
||||
import com.nflg.product.bomnew.pojo.query.ChildBomReportQuery;
|
||||
import com.nflg.product.bomnew.pojo.query.CompareReportQuery;
|
||||
|
|
@ -35,12 +38,8 @@ import org.ttzero.excel.entity.ListSheet;
|
|||
import javax.annotation.Resource;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import javax.validation.Valid;
|
||||
import javax.xml.transform.Result;
|
||||
import java.io.IOException;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Objects;
|
||||
import java.util.Set;
|
||||
import java.util.*;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
@Api(tags = "BOM-报表接口")
|
||||
|
|
@ -290,4 +289,33 @@ public class BomReportApi extends BaseApi {
|
|||
}, datas);
|
||||
EecExcelUtil.eecExcel(name, new ListSheet<>(exportList), response);
|
||||
}
|
||||
|
||||
|
||||
@PostMapping("queryMaterial")
|
||||
@ApiOperation("物料查询")
|
||||
public ResultVO<Page<MaterialQueryResult>> materialQuery(@RequestBody MaterialQueryDTO queryParam){
|
||||
|
||||
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,12 +1,11 @@
|
|||
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;
|
||||
import com.nflg.product.bomnew.pojo.vo.BaseMaterialVO;
|
||||
import com.nflg.product.bomnew.pojo.vo.MaterialMateVO;
|
||||
import com.nflg.product.bomnew.pojo.vo.RolePostVo;
|
||||
import com.nflg.product.bomnew.pojo.vo.UserInfoVO;
|
||||
import com.nflg.product.bomnew.pojo.vo.*;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
|
||||
import java.util.List;
|
||||
|
|
@ -62,4 +61,6 @@ public interface MaterialMainMapper extends BaseMapper<MaterialMainEntity> {
|
|||
UserInfoVO getUserInfoByUserCode(@Param("userCode")String userCode);
|
||||
|
||||
String getUserDepartmentDptCode(@Param("rowId") Long rowId);
|
||||
|
||||
Page<MaterialQueryResult> queryMaterial(Page<MaterialQueryDTO> page, @Param("query") MaterialQueryDTO query);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -0,0 +1,38 @@
|
|||
package com.nflg.product.bomnew.pojo.dto;
|
||||
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
/**
|
||||
* 物料查询
|
||||
*/
|
||||
@Data
|
||||
public class MaterialQueryDTO implements Serializable {
|
||||
|
||||
|
||||
@ApiModelProperty(value = "物料分类")
|
||||
private String materialCategoryCode;
|
||||
|
||||
|
||||
@ApiModelProperty(value = "物料编码")
|
||||
private String materialNo;
|
||||
|
||||
@ApiModelProperty("图号")
|
||||
private String drawingNo;
|
||||
|
||||
|
||||
@ApiModelProperty(value = "物料描述")
|
||||
private String materialDesc;
|
||||
|
||||
// 设置每页显示条数
|
||||
private Long pageSize = 20L;
|
||||
|
||||
// 当前页
|
||||
private Long page = 1L;
|
||||
|
||||
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
}
|
||||
|
|
@ -0,0 +1,56 @@
|
|||
package com.nflg.product.bomnew.pojo.vo;
|
||||
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.TableField;
|
||||
import com.google.common.collect.ImmutableList;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
|
||||
@Data
|
||||
public class MaterialQueryResult {
|
||||
|
||||
/**
|
||||
* 物料编码
|
||||
*/
|
||||
@TableField(value = "material_no")
|
||||
@ApiModelProperty(value = "物料编码")
|
||||
private String materialNo;
|
||||
|
||||
|
||||
@ApiModelProperty(value = "图号")
|
||||
private String drawingNo;
|
||||
|
||||
/**
|
||||
* 物料名称
|
||||
*/
|
||||
@TableField(value = "material_name")
|
||||
@ApiModelProperty(value = "物料名称")
|
||||
private String materialName;
|
||||
|
||||
/**
|
||||
* 物料描述
|
||||
*/
|
||||
@TableField(value = "material_desc")
|
||||
@ApiModelProperty(value = "物料描述")
|
||||
private String materialDesc;
|
||||
|
||||
@ApiModelProperty(value = "基本计量单位")
|
||||
private String materialUnit;
|
||||
|
||||
@ApiModelProperty(value = "物料状态 1:激活 2:禁止采购 3:售后专用 4:冻结 5:完全弃用")
|
||||
private Integer materialState;
|
||||
|
||||
@ApiModelProperty("排序号")
|
||||
private String orderNo;
|
||||
|
||||
|
||||
private String materialStateName;
|
||||
|
||||
public String getMaterialStateName() {
|
||||
ImmutableList<String> of = ImmutableList.of("", "激活", "禁止采购", "售后专用", "冻结", "完全弃用");
|
||||
if(materialState!=null) {
|
||||
return of.get(materialState);
|
||||
}
|
||||
return "";
|
||||
}
|
||||
}
|
||||
|
|
@ -201,4 +201,43 @@
|
|||
<select id="getUserDepartmentDptCode" resultType="java.lang.String">
|
||||
select dpt_code from t_authority_department where row_id=#{rowId}
|
||||
</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
|
||||
<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},'%')
|
||||
</if>
|
||||
<if test="query.drawingNo != null and 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>
|
||||
<choose>
|
||||
<when test="query.materialNo != null and query.materialNo != ''" >
|
||||
order by orderMaterialNo
|
||||
</when>
|
||||
<when test="query.drawingNo != null and query.drawingNo != ''">
|
||||
order by orderDrawingNo
|
||||
</when>
|
||||
<when test="query.materialDesc != null and query.materialDesc != ''">
|
||||
order by orderMaterialDesc
|
||||
</when>
|
||||
</choose>
|
||||
</select>
|
||||
</mapper>
|
||||
|
|
|
|||
Loading…
Reference in New Issue