feat(wms):丰富发货计划钢卷操作查询功能
- 添加 MyBatis Plus 分页插件及相关查询包装器依赖 - 实现 selectVoPagePlus 方法支持复杂关联查询分页 - 扩展 XML 映射文件以支持详细的钢卷操作数据查询 - 新增 buildQueryWrapperPlus 方法构建查询条件与排序规则 - 集成钢卷详情、仓库信息及异常统计等多表联查逻辑 - 优化分页查询接口以提升大数据量下的响应性能
This commit is contained in:
@@ -1,5 +1,7 @@
|
||||
package com.klp.mapper;
|
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.klp.domain.WmsDeliveryPlanCoilOperate;
|
||||
import com.klp.domain.vo.WmsDeliveryPlanCoilOperateVo;
|
||||
import com.klp.common.core.mapper.BaseMapperPlus;
|
||||
@@ -26,4 +28,6 @@ public interface WmsDeliveryPlanCoilOperateMapper extends BaseMapperPlus<WmsDeli
|
||||
@Param("planId") Long planId,
|
||||
@Param("coilIds") String[] coilIds
|
||||
);
|
||||
|
||||
Page<WmsDeliveryPlanCoilOperateVo> selectVoPagePlus(Page<Object> build,@Param("ew") QueryWrapper<WmsDeliveryPlanCoilOperate> lqw);
|
||||
}
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
package com.klp.service.impl;
|
||||
|
||||
import cn.hutool.core.bean.BeanUtil;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.klp.common.core.page.TableDataInfo;
|
||||
import com.klp.common.core.domain.PageQuery;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
@@ -47,11 +48,21 @@ public class WmsDeliveryPlanCoilOperateServiceImpl implements IWmsDeliveryPlanCo
|
||||
*/
|
||||
@Override
|
||||
public TableDataInfo<WmsDeliveryPlanCoilOperateVo> queryPageList(WmsDeliveryPlanCoilOperateBo bo, PageQuery pageQuery) {
|
||||
LambdaQueryWrapper<WmsDeliveryPlanCoilOperate> lqw = buildQueryWrapper(bo);
|
||||
Page<WmsDeliveryPlanCoilOperateVo> result = baseMapper.selectVoPage(pageQuery.build(), lqw);
|
||||
QueryWrapper<WmsDeliveryPlanCoilOperate> lqw = buildQueryWrapperPlus(bo);
|
||||
Page<WmsDeliveryPlanCoilOperateVo> result = baseMapper.selectVoPagePlus(pageQuery.build(), lqw);
|
||||
return TableDataInfo.build(result);
|
||||
}
|
||||
|
||||
private QueryWrapper<WmsDeliveryPlanCoilOperate> buildQueryWrapperPlus(WmsDeliveryPlanCoilOperateBo bo) {
|
||||
QueryWrapper<WmsDeliveryPlanCoilOperate> lqw = Wrappers.query();
|
||||
lqw.eq(bo.getPlanId() != null, "dpco.plan_id", bo.getPlanId());
|
||||
lqw.eq(bo.getCoilId() != null, "dpco.coil_id", bo.getCoilId());
|
||||
lqw.eq(StringUtils.isNotBlank(bo.getOperateType()), "dpco.operate_type", bo.getOperateType());
|
||||
// 默认按操作时间倒序排列
|
||||
lqw.orderByDesc("dpco.create_time");
|
||||
return lqw;
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询发货计划钢卷操作记录列表
|
||||
*/
|
||||
|
||||
@@ -35,6 +35,93 @@
|
||||
AND 1 = 2
|
||||
</if>
|
||||
</select>
|
||||
<!-- ... existing code ... -->
|
||||
<select id="selectVoPagePlus" resultType="com.klp.domain.vo.WmsDeliveryPlanCoilOperateVo">
|
||||
SELECT
|
||||
dpco.operate_id,
|
||||
dpco.plan_id,
|
||||
dpco.coil_id,
|
||||
dpco.operate_type,
|
||||
dpco.remark,
|
||||
dpco.create_time,
|
||||
dpco.update_time,
|
||||
dpco.create_by,
|
||||
dpco.update_by,
|
||||
mc.coil_id AS "coilDetail.coilId",
|
||||
mc.export_time AS "coilDetail.exportTime",
|
||||
mc.enter_coil_no AS "coilDetail.enterCoilNo",
|
||||
mc.current_coil_no AS "coilDetail.currentCoilNo",
|
||||
mc.supplier_coil_no AS "coilDetail.supplierCoilNo",
|
||||
mc.data_type AS "coilDetail.dataType",
|
||||
mc.material_type AS "coilDetail.materialType",
|
||||
mc.next_warehouse_id AS "coilDetail.nextWarehouseId",
|
||||
mc.qrcode_record_id AS "coilDetail.qrcodeRecordId",
|
||||
mc.team AS "coilDetail.team",
|
||||
mc.has_merge_split AS "coilDetail.hasMergeSplit",
|
||||
mc.parent_coil_nos AS "coilDetail.parentCoilNos",
|
||||
mc.item_type AS "coilDetail.itemType",
|
||||
mc.item_id AS "coilDetail.itemId",
|
||||
mc.gross_weight AS "coilDetail.grossWeight",
|
||||
mc.net_weight AS "coilDetail.netWeight",
|
||||
mc.status AS "coilDetail.status",
|
||||
mc.remark AS "coilDetail.remark",
|
||||
mc.warehouse_id AS "coilDetail.warehouseId",
|
||||
mc.actual_warehouse_id AS "coilDetail.actualWarehouseId",
|
||||
mc.del_flag AS "coilDetail.delFlag",
|
||||
mc.create_time AS "coilDetail.createTime",
|
||||
mc.update_time AS "coilDetail.updateTime",
|
||||
mc.create_by AS "coilDetail.createBy",
|
||||
mc.update_by AS "coilDetail.updateBy",
|
||||
mc.quality_status AS "coilDetail.qualityStatus",
|
||||
mc.trimming_requirement AS "coilDetail.trimmingRequirement",
|
||||
mc.packaging_requirement AS "coilDetail.packagingRequirement",
|
||||
mc.packing_status AS "coilDetail.packingStatus",
|
||||
mc.sale_id AS "coilDetail.saleId",
|
||||
w.warehouse_name AS "coilDetail.warehouseName",
|
||||
su.nick_name AS "coilDetail.saleName",
|
||||
aw.actual_warehouse_name AS "coilDetail.actualWarehouseName",
|
||||
CASE WHEN mc.item_type = 'raw_material' THEN rm.specification
|
||||
WHEN mc.item_type = 'product' THEN p.specification
|
||||
ELSE NULL END AS "coilDetail.specification",
|
||||
CASE WHEN mc.item_type = 'raw_material' THEN rm.material
|
||||
WHEN mc.item_type = 'product' THEN p.material
|
||||
ELSE NULL END AS "coilDetail.material",
|
||||
CASE WHEN mc.item_type = 'raw_material' THEN rm.manufacturer
|
||||
WHEN mc.item_type = 'product' THEN p.manufacturer
|
||||
ELSE NULL END AS "coilDetail.manufacturer",
|
||||
CASE WHEN mc.item_type = 'raw_material' THEN rm.surface_treatment_desc
|
||||
WHEN mc.item_type = 'product' THEN p.surface_treatment_desc
|
||||
ELSE NULL END AS "coilDetail.surfaceTreatmentDesc",
|
||||
CASE WHEN mc.item_type = 'raw_material' THEN rm.zinc_layer
|
||||
WHEN mc.item_type = 'product' THEN p.zinc_layer
|
||||
ELSE NULL END AS "coilDetail.zincLayer",
|
||||
CASE
|
||||
WHEN mc.item_type = 'raw_material' THEN rm.raw_material_name
|
||||
WHEN mc.item_type = 'product' THEN p.product_name
|
||||
ELSE NULL
|
||||
END as "coilDetail.itemName",
|
||||
CASE
|
||||
WHEN mc.item_type = 'raw_material' THEN rm.raw_material_code
|
||||
WHEN mc.item_type = 'product' THEN p.product_code
|
||||
ELSE NULL
|
||||
END as "coilDetail.itemCode",
|
||||
COALESCE(ca.abnormal_count, 0) AS "coilDetail.abnormalCount"
|
||||
FROM wms_delivery_plan_coil_operate dpco
|
||||
LEFT JOIN wms_material_coil mc ON dpco.coil_id = mc.coil_id
|
||||
LEFT JOIN wms_warehouse w ON mc.warehouse_id = w.warehouse_id
|
||||
LEFT JOIN wms_actual_warehouse aw ON mc.actual_warehouse_id = aw.actual_warehouse_id
|
||||
LEFT JOIN sys_user su ON mc.sale_id = su.user_id
|
||||
LEFT JOIN wms_raw_material rm ON mc.item_type = 'raw_material' AND mc.item_id = rm.raw_material_id
|
||||
LEFT JOIN wms_product p ON mc.item_type = 'product' AND mc.item_id = p.product_id
|
||||
LEFT JOIN (
|
||||
SELECT coil_id, COUNT(*) AS abnormal_count
|
||||
FROM wms_coil_abnormal
|
||||
WHERE del_flag = 0
|
||||
GROUP BY coil_id
|
||||
) ca ON mc.coil_id = ca.coil_id
|
||||
${ew.customSqlSegment}
|
||||
</select>
|
||||
|
||||
|
||||
|
||||
</mapper>
|
||||
|
||||
Reference in New Issue
Block a user