feat(gear-mat): 添加配料出库查询功能增强
- 在 MatMaterialOutBo 中添加开始时间和结束时间字段 - 新增 MatMaterialOutMapper 的分页查询方法支持时间范围筛选 - 实现配料出库列表的自定义 SQL 查询逻辑 - 扩展 MatMaterialOutVo 返回对象包含配料基本信息 - 集成日期时间格式化和 JSON 序列化配置 - 支持按出库时间范围进行数据过滤查询
This commit is contained in:
@@ -67,5 +67,18 @@ public class MatMaterialOutBo extends BaseEntity {
|
|||||||
*/
|
*/
|
||||||
private String remark;
|
private String remark;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 开始时间
|
||||||
|
*/
|
||||||
|
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
||||||
|
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
|
||||||
|
private Date beginTime;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 结束时间
|
||||||
|
*/
|
||||||
|
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
||||||
|
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
|
||||||
|
private Date endTime;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -76,5 +76,40 @@ public class MatMaterialOutVo {
|
|||||||
@ExcelProperty(value = "备注")
|
@ExcelProperty(value = "备注")
|
||||||
private String remark;
|
private String remark;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 配料名称
|
||||||
|
*/
|
||||||
|
@ExcelProperty(value = "配料名称")
|
||||||
|
private String materialName;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 配料规格
|
||||||
|
*/
|
||||||
|
@ExcelProperty(value = "配料规格")
|
||||||
|
private String spec;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 配料型号
|
||||||
|
*/
|
||||||
|
@ExcelProperty(value = "配料型号")
|
||||||
|
private String model;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 配料厂家
|
||||||
|
*/
|
||||||
|
@ExcelProperty(value = "配料厂家")
|
||||||
|
private String factory;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 配料单位
|
||||||
|
*/
|
||||||
|
@ExcelProperty(value = "配料单位")
|
||||||
|
private String unit;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 当前库存
|
||||||
|
*/
|
||||||
|
@ExcelProperty(value = "当前库存")
|
||||||
|
private BigDecimal currentStock;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,8 +1,11 @@
|
|||||||
package com.gear.mat.mapper;
|
package com.gear.mat.mapper;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||||
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||||
import com.gear.mat.domain.MatMaterialOut;
|
import com.gear.mat.domain.MatMaterialOut;
|
||||||
import com.gear.mat.domain.vo.MatMaterialOutVo;
|
import com.gear.mat.domain.vo.MatMaterialOutVo;
|
||||||
import com.gear.common.core.mapper.BaseMapperPlus;
|
import com.gear.common.core.mapper.BaseMapperPlus;
|
||||||
|
import org.apache.ibatis.annotations.Param;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 配料出库Mapper接口
|
* 配料出库Mapper接口
|
||||||
@@ -12,4 +15,5 @@ import com.gear.common.core.mapper.BaseMapperPlus;
|
|||||||
*/
|
*/
|
||||||
public interface MatMaterialOutMapper extends BaseMapperPlus<MatMaterialOutMapper, MatMaterialOut, MatMaterialOutVo> {
|
public interface MatMaterialOutMapper extends BaseMapperPlus<MatMaterialOutMapper, MatMaterialOut, MatMaterialOutVo> {
|
||||||
|
|
||||||
|
Page<MatMaterialOutVo> selectVoPagePlus(Page<Object> build,@Param("ew") QueryWrapper<MatMaterialOut> lqw);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
package com.gear.mat.service.impl;
|
package com.gear.mat.service.impl;
|
||||||
|
|
||||||
import cn.hutool.core.bean.BeanUtil;
|
import cn.hutool.core.bean.BeanUtil;
|
||||||
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||||
import com.gear.common.utils.StringUtils;
|
import com.gear.common.utils.StringUtils;
|
||||||
import com.gear.common.core.page.TableDataInfo;
|
import com.gear.common.core.page.TableDataInfo;
|
||||||
import com.gear.common.core.domain.PageQuery;
|
import com.gear.common.core.domain.PageQuery;
|
||||||
@@ -44,11 +45,22 @@ public class MatMaterialOutServiceImpl implements IMatMaterialOutService {
|
|||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public TableDataInfo<MatMaterialOutVo> queryPageList(MatMaterialOutBo bo, PageQuery pageQuery) {
|
public TableDataInfo<MatMaterialOutVo> queryPageList(MatMaterialOutBo bo, PageQuery pageQuery) {
|
||||||
LambdaQueryWrapper<MatMaterialOut> lqw = buildQueryWrapper(bo);
|
QueryWrapper<MatMaterialOut> lqw = buildQueryWrapperPlus(bo);
|
||||||
Page<MatMaterialOutVo> result = baseMapper.selectVoPage(pageQuery.build(), lqw);
|
Page<MatMaterialOutVo> result = baseMapper.selectVoPagePlus(pageQuery.build(), lqw);
|
||||||
return TableDataInfo.build(result);
|
return TableDataInfo.build(result);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private QueryWrapper<MatMaterialOut> buildQueryWrapperPlus(MatMaterialOutBo bo) {
|
||||||
|
QueryWrapper<MatMaterialOut> lqw = new QueryWrapper<>();
|
||||||
|
lqw.eq(StringUtils.isNotBlank(bo.getOutNo()), "mmo.out_no", bo.getOutNo());
|
||||||
|
lqw.eq(bo.getMaterialId() != null, "mmo.material_id", bo.getMaterialId());
|
||||||
|
lqw.eq(StringUtils.isNotBlank(bo.getOutReason()), "mmo.out_reason", bo.getOutReason());
|
||||||
|
lqw.eq(StringUtils.isNotBlank(bo.getOperator()), "mmo.operator", bo.getOperator());
|
||||||
|
lqw.ge(bo.getBeginTime() != null, "mmo.out_time", bo.getBeginTime());
|
||||||
|
lqw.le(bo.getEndTime() != null, "mmo.out_time", bo.getEndTime());
|
||||||
|
return lqw;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 查询配料出库列表
|
* 查询配料出库列表
|
||||||
*/
|
*/
|
||||||
|
|||||||
@@ -19,6 +19,30 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||||||
<result property="updateBy" column="update_by"/>
|
<result property="updateBy" column="update_by"/>
|
||||||
<result property="remark" column="remark"/>
|
<result property="remark" column="remark"/>
|
||||||
</resultMap>
|
</resultMap>
|
||||||
|
<select id="selectVoPagePlus" resultType="com.gear.mat.domain.vo.MatMaterialOutVo">
|
||||||
|
SELECT
|
||||||
|
mmo.out_id AS outId,
|
||||||
|
mmo.out_no AS outNo,
|
||||||
|
mmo.material_id AS materialId,
|
||||||
|
mmo.out_num AS outNum,
|
||||||
|
mmo.out_reason AS outReason,
|
||||||
|
mmo.operator AS operator,
|
||||||
|
mmo.out_time AS outTime,
|
||||||
|
mmo.create_time AS createTime,
|
||||||
|
mmo.create_by AS createBy,
|
||||||
|
mmo.update_time AS updateTime,
|
||||||
|
mmo.update_by AS updateBy,
|
||||||
|
mmo.remark,
|
||||||
|
mm.material_name AS materialName,
|
||||||
|
mm.spec AS spec,
|
||||||
|
mm.model AS model,
|
||||||
|
mm.factory AS factory,
|
||||||
|
mm.unit AS unit,
|
||||||
|
mm.current_stock AS currentStock
|
||||||
|
FROM mat_material_out mmo
|
||||||
|
LEFT JOIN mat_material mm ON mmo.material_id = mm.material_id AND mm.del_flag = 0
|
||||||
|
${ew.customSqlSegment}
|
||||||
|
</select>
|
||||||
|
|
||||||
|
|
||||||
</mapper>
|
</mapper>
|
||||||
|
|||||||
Reference in New Issue
Block a user