1. 新增联表分页查询方法,在数据库层完成排序和分页 2. 移除前端页面冗余的合同信息缓存和内存排序逻辑 3. 新增钢卷导入组件,支持调拨单钢批量化导入 4. 补充订单明细VO类的联表查询字段
250 lines
10 KiB
XML
250 lines
10 KiB
XML
<?xml version="1.0" encoding="UTF-8" ?>
|
|
<!DOCTYPE mapper
|
|
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
|
<mapper namespace="com.klp.crm.mapper.CrmOrderItemMapper">
|
|
|
|
<resultMap type="com.klp.crm.domain.CrmOrderItem" id="CrmOrderItemResult">
|
|
<result property="itemId" column="item_id"/>
|
|
<result property="orderId" column="order_id"/>
|
|
<result property="productType" column="product_type"/>
|
|
<result property="rawMaterialSpec" column="raw_material_spec"/>
|
|
<result property="productNum" column="product_num"/>
|
|
<result property="specialRequire" column="special_require"/>
|
|
<result property="itemAmount" column="item_amount"/>
|
|
<result property="remark" column="remark"/>
|
|
<result property="finishedProductSpec" column="finished_product_spec"/>
|
|
<result property="material" column="material"/>
|
|
<result property="grade" column="grade"/>
|
|
<result property="weight" column="weight"/>
|
|
<result property="widthTolerance" column="width_tolerance"/>
|
|
<result property="thicknessTolerance" column="thickness_tolerance"/>
|
|
<result property="contractPrice" column="contract_price"/>
|
|
<result property="customizer" column="customizer"/>
|
|
<result property="shipper" column="shipper"/>
|
|
<result property="productionBatch" column="production_batch"/>
|
|
<result property="surfaceTreatment" column="surface_treatment"/>
|
|
<result property="surfaceQuality" column="surface_quality"/>
|
|
<result property="edgeCuttingReq" column="edge_cutting_req"/>
|
|
<result property="packagingReq" column="packaging_req"/>
|
|
<result property="width" column="width"/>
|
|
<result property="thickness" column="thickness"/>
|
|
<result property="purpose" column="purpose"/>
|
|
<result property="createBy" column="create_by"/>
|
|
<result property="createTime" column="create_time"/>
|
|
<result property="updateBy" column="update_by"/>
|
|
<result property="updateTime" column="update_time"/>
|
|
<result property="delFlag" column="del_flag"/>
|
|
</resultMap>
|
|
<!-- 联表查询结果映射 -->
|
|
<resultMap type="com.klp.crm.domain.vo.CrmOrderItemVo" id="CrmOrderItemVoResult">
|
|
<result property="itemId" column="item_id"/>
|
|
<result property="orderId" column="order_id"/>
|
|
<result property="productType" column="product_type"/>
|
|
<result property="rawMaterialSpec" column="raw_material_spec"/>
|
|
<result property="productNum" column="product_num"/>
|
|
<result property="specialRequire" column="special_require"/>
|
|
<result property="itemAmount" column="item_amount"/>
|
|
<result property="remark" column="remark"/>
|
|
<result property="finishedProductSpec" column="finished_product_spec"/>
|
|
<result property="material" column="material"/>
|
|
<result property="grade" column="grade"/>
|
|
<result property="weight" column="weight"/>
|
|
<result property="widthTolerance" column="width_tolerance"/>
|
|
<result property="thicknessTolerance" column="thickness_tolerance"/>
|
|
<result property="contractPrice" column="contract_price"/>
|
|
<result property="customizer" column="customizer"/>
|
|
<result property="shipper" column="shipper"/>
|
|
<result property="productionBatch" column="production_batch"/>
|
|
<result property="surfaceTreatment" column="surface_treatment"/>
|
|
<result property="surfaceQuality" column="surface_quality"/>
|
|
<result property="edgeCuttingReq" column="edge_cutting_req"/>
|
|
<result property="packagingReq" column="packaging_req"/>
|
|
<result property="width" column="width"/>
|
|
<result property="thickness" column="thickness"/>
|
|
<result property="purpose" column="purpose"/>
|
|
<result property="createBy" column="create_by"/>
|
|
<result property="createTime" column="create_time"/>
|
|
<result property="updateBy" column="update_by"/>
|
|
<result property="updateTime" column="update_time"/>
|
|
<result property="delFlag" column="del_flag"/>
|
|
<!-- 合同信息字段 -->
|
|
<result property="contractCode" column="contract_code"/>
|
|
<result property="supplier" column="supplier"/>
|
|
<result property="customer" column="customer"/>
|
|
<result property="signTime" column="sign_time"/>
|
|
<result property="deliveryDate" column="delivery_date"/>
|
|
</resultMap>
|
|
|
|
<!-- 根据订单ID列表查询订单明细 -->
|
|
<select id="selectOrderItemsByOrderIds" resultMap="CrmOrderItemResult">
|
|
SELECT
|
|
item_id,
|
|
order_id,
|
|
product_type,
|
|
raw_material_spec,
|
|
product_num,
|
|
special_require,
|
|
item_amount,
|
|
remark,
|
|
finished_product_spec,
|
|
material,
|
|
grade,
|
|
weight,
|
|
width_tolerance,
|
|
thickness_tolerance,
|
|
contract_price,
|
|
customizer,
|
|
shipper,
|
|
production_batch,
|
|
surface_treatment,
|
|
surface_quality,
|
|
edge_cutting_req,
|
|
packaging_req,
|
|
width,
|
|
thickness,
|
|
purpose,
|
|
create_by,
|
|
create_time,
|
|
update_by,
|
|
update_time,
|
|
del_flag
|
|
FROM crm_order_item
|
|
WHERE del_flag = 0
|
|
AND order_id IN
|
|
<foreach collection="orderIds" item="orderId" open="(" separator="," close=")">
|
|
#{orderId}
|
|
</foreach>
|
|
ORDER BY item_id ASC
|
|
</select>
|
|
|
|
<!-- 联表查询订单明细(支持排序和分页) -->
|
|
<select id="selectVoListWithOrder" resultMap="CrmOrderItemVoResult">
|
|
SELECT
|
|
i.item_id,
|
|
i.order_id,
|
|
i.product_type,
|
|
i.raw_material_spec,
|
|
i.product_num,
|
|
i.special_require,
|
|
i.item_amount,
|
|
i.remark,
|
|
i.finished_product_spec,
|
|
i.material,
|
|
i.grade,
|
|
i.weight,
|
|
i.width_tolerance,
|
|
i.thickness_tolerance,
|
|
i.contract_price,
|
|
i.customizer,
|
|
i.shipper,
|
|
i.production_batch,
|
|
i.surface_treatment,
|
|
i.surface_quality,
|
|
i.edge_cutting_req,
|
|
i.packaging_req,
|
|
i.width,
|
|
i.thickness,
|
|
i.purpose,
|
|
i.create_by,
|
|
i.create_time,
|
|
i.update_by,
|
|
i.update_time,
|
|
i.del_flag,
|
|
o.contract_code,
|
|
o.supplier,
|
|
o.customer,
|
|
o.sign_time,
|
|
o.delivery_date
|
|
FROM crm_order_item i
|
|
LEFT JOIN crm_order o ON i.order_id = o.order_id AND o.del_flag = 0
|
|
<where>
|
|
i.del_flag = 0
|
|
<if test="bo.itemId != null">
|
|
AND i.item_id = #{bo.itemId}
|
|
</if>
|
|
<if test="bo.orderId != null">
|
|
AND i.order_id = #{bo.orderId}
|
|
</if>
|
|
<if test="bo.productType != null and bo.productType != ''">
|
|
AND i.product_type = #{bo.productType}
|
|
</if>
|
|
<if test="bo.rawMaterialSpec != null and bo.rawMaterialSpec != ''">
|
|
AND i.raw_material_spec = #{bo.rawMaterialSpec}
|
|
</if>
|
|
<if test="bo.productNum != null">
|
|
AND i.product_num = #{bo.productNum}
|
|
</if>
|
|
<if test="bo.specialRequire != null and bo.specialRequire != ''">
|
|
AND i.special_require = #{bo.specialRequire}
|
|
</if>
|
|
<if test="bo.finishedProductSpec != null and bo.finishedProductSpec != ''">
|
|
AND i.finished_product_spec = #{bo.finishedProductSpec}
|
|
</if>
|
|
<if test="bo.material != null and bo.material != ''">
|
|
AND i.material LIKE CONCAT('%', #{bo.material}, '%')
|
|
</if>
|
|
<if test="bo.grade != null and bo.grade != ''">
|
|
AND i.grade = #{bo.grade}
|
|
</if>
|
|
<if test="bo.weight != null">
|
|
AND i.weight = #{bo.weight}
|
|
</if>
|
|
<if test="bo.contractPrice != null">
|
|
AND i.contract_price = #{bo.contractPrice}
|
|
</if>
|
|
<if test="bo.customizer != null and bo.customizer != ''">
|
|
AND i.customizer = #{bo.customizer}
|
|
</if>
|
|
<if test="bo.shipper != null and bo.shipper != ''">
|
|
AND i.shipper = #{bo.shipper}
|
|
</if>
|
|
<if test="bo.productionBatch != null and bo.productionBatch != ''">
|
|
AND i.production_batch = #{bo.productionBatch}
|
|
</if>
|
|
<if test="bo.surfaceTreatment != null and bo.surfaceTreatment != ''">
|
|
AND i.surface_treatment = #{bo.surfaceTreatment}
|
|
</if>
|
|
<if test="bo.surfaceQuality != null and bo.surfaceQuality != ''">
|
|
AND i.surface_quality = #{bo.surfaceQuality}
|
|
</if>
|
|
<if test="bo.edgeCuttingReq != null and bo.edgeCuttingReq != ''">
|
|
AND i.edge_cutting_req = #{bo.edgeCuttingReq}
|
|
</if>
|
|
<if test="bo.packagingReq != null and bo.packagingReq != ''">
|
|
AND i.packaging_req = #{bo.packagingReq}
|
|
</if>
|
|
<if test="bo.width != null and bo.width != ''">
|
|
AND i.width = #{bo.width}
|
|
</if>
|
|
<if test="bo.thickness != null and bo.thickness != ''">
|
|
AND i.thickness = #{bo.thickness}
|
|
</if>
|
|
<if test="bo.purpose != null and bo.purpose != ''">
|
|
AND i.purpose = #{bo.purpose}
|
|
</if>
|
|
<!-- 合同表筛选条件 -->
|
|
<if test="bo.contractCode != null and bo.contractCode != ''">
|
|
AND o.contract_code LIKE CONCAT('%', #{bo.contractCode}, '%')
|
|
</if>
|
|
<if test="bo.customer != null and bo.customer != ''">
|
|
AND o.customer LIKE CONCAT('%', #{bo.customer}, '%')
|
|
</if>
|
|
<if test="bo.signDateStart != null">
|
|
AND o.sign_time >= #{bo.signDateStart}
|
|
</if>
|
|
<if test="bo.signDateEnd != null">
|
|
AND o.sign_time < DATE_ADD(#{bo.signDateEnd}, INTERVAL 1 DAY)
|
|
</if>
|
|
<if test="bo.deliveryDateStart != null">
|
|
AND o.delivery_date >= #{bo.deliveryDateStart}
|
|
</if>
|
|
<if test="bo.deliveryDateEnd != null">
|
|
AND o.delivery_date < DATE_ADD(#{bo.deliveryDateEnd}, INTERVAL 1 DAY)
|
|
</if>
|
|
</where>
|
|
ORDER BY o.delivery_date DESC, i.order_id ASC, i.create_time DESC
|
|
</select>
|
|
|
|
</mapper>
|