|
@@ -33,17 +33,18 @@
|
|
|
|
|
|
<select id="getNoPackContractProductById" resultType="com.fjhx.sale.entity.contract.vo.ContractProductVo">
|
|
|
SELECT
|
|
|
- *
|
|
|
+ *
|
|
|
FROM
|
|
|
(
|
|
|
SELECT
|
|
|
- t1.*,
|
|
|
- t1.`code` AS contractCode,
|
|
|
- t2.quantity AS cpQuantity,
|
|
|
- t2.id AS contractProductId,
|
|
|
- ( SELECT IFNULL( SUM( quantity ), 0 ) FROM pack_detail_product WHERE contract_product_id = t2.id ) AS sumPackQuantity
|
|
|
+ t2.*,
|
|
|
+ t1.id AS contractId,
|
|
|
+ t1.`code` AS contractCode,
|
|
|
+ t2.quantity AS cpQuantity,
|
|
|
+ t2.id AS contractProductId,
|
|
|
+ ( SELECT IFNULL( SUM( quantity ), 0 ) FROM pack_detail_product WHERE contract_product_id = t2.id ) AS sumPackQuantity
|
|
|
FROM
|
|
|
- contract t1
|
|
|
+ contract t1
|
|
|
LEFT JOIN contract_product t2 ON t1.id = t2.contract_id
|
|
|
<where>
|
|
|
<if test="customerId neq null and customerId neq '' ">
|
|
@@ -53,7 +54,7 @@
|
|
|
) t1
|
|
|
WHERE t1.sumPackQuantity < t1.cpQuantity
|
|
|
<if test="contractIds neq null and contractIds.size() > 0">
|
|
|
- <foreach collection="contractIds" item="contractId" open="AND t1.id IN (" separator="," close=")">
|
|
|
+ <foreach collection="contractIds" item="contractId" open="AND contractId IN (" separator="," close=")">
|
|
|
#{contractId}
|
|
|
</foreach>
|
|
|
</if>
|