|
|
|
@ -12,47 +12,48 @@ |
|
|
|
|
<select id="getDeliveryProduct" |
|
|
|
|
resultType="java.util.Map"> |
|
|
|
|
SELECT |
|
|
|
|
t1.product_id AS productId, |
|
|
|
|
t3.species_name AS speciesName, |
|
|
|
|
t5.traceability_code AS traceabilityCode, |
|
|
|
|
t4.variety_name AS varietyName, |
|
|
|
|
t5.processing_name AS processingName |
|
|
|
|
t1.product_id AS productId, |
|
|
|
|
t3.species_name AS speciesName, |
|
|
|
|
t5.traceability_code AS traceabilityCode, |
|
|
|
|
t4.variety_name AS varietyName, |
|
|
|
|
t5.processing_name AS processingName |
|
|
|
|
FROM |
|
|
|
|
traceability_delivery_record t1 |
|
|
|
|
LEFT JOIN traceability_product t5 ON t1.product_id = t5.id |
|
|
|
|
LEFT JOIN traceability_agricultural_product t2 ON t5.cropper_id = t2.id |
|
|
|
|
LEFT JOIN traceability_species t3 ON t5.species_id = t3.id |
|
|
|
|
LEFT JOIN traceability_variety t4 ON t2.product_variety = t4.id |
|
|
|
|
<if test="reqVO.processingName != null and reqVO.processingName != ''"> |
|
|
|
|
AND t5.processing_name like concat('%', #{reqVO.processingName}, '%') |
|
|
|
|
</if> |
|
|
|
|
<if test="reqVO.type != null and reqVO.type != ''"> |
|
|
|
|
AND t4.id = #{reqVO.type} |
|
|
|
|
</if> |
|
|
|
|
<if test="reqVO.authenticationType != null and reqVO.authenticationType != ''"> |
|
|
|
|
And t1.authentication_type =#{reqVO.authenticationType} |
|
|
|
|
</if> |
|
|
|
|
traceability_delivery_record t1 |
|
|
|
|
LEFT JOIN traceability_product t5 ON t1.product_id = t5.id |
|
|
|
|
LEFT JOIN traceability_cropper t6 on t6.id= t5.cropper_id |
|
|
|
|
LEFT JOIN traceability_agricultural_product t2 ON t5.cropper_id = t2.id |
|
|
|
|
LEFT JOIN traceability_species t3 ON t6.species_id = t3.id |
|
|
|
|
LEFT JOIN traceability_variety t4 ON t2.product_variety = t4.id |
|
|
|
|
<if test="reqVO.processingName != null and reqVO.processingName != ''"> |
|
|
|
|
AND t5.processing_name like concat('%', #{reqVO.processingName}, '%') |
|
|
|
|
</if> |
|
|
|
|
<if test="reqVO.type != null and reqVO.type != ''"> |
|
|
|
|
AND t4.id = #{reqVO.type} |
|
|
|
|
</if> |
|
|
|
|
<if test="reqVO.authenticationType != null and reqVO.authenticationType != ''"> |
|
|
|
|
And t1.authentication_type =#{reqVO.authenticationType} |
|
|
|
|
</if> |
|
|
|
|
GROUP BY |
|
|
|
|
t1.product_id |
|
|
|
|
t1.product_id |
|
|
|
|
</select> |
|
|
|
|
<select id="getDeliveryRecordListByProductId" resultType="java.util.Map"> |
|
|
|
|
select |
|
|
|
|
t1.id as recordId, |
|
|
|
|
t2.logistics_name as logisticsName, |
|
|
|
|
DATE_FORMAT(t1.delivery_time, '%Y-%m-%d %H:%i:%s') AS deliveryTime, |
|
|
|
|
DATE_FORMAT(t1.received_time, '%Y-%m-%d %H:%i:%s') AS receivedTime, |
|
|
|
|
t1.delivery_man as deliveryMan, |
|
|
|
|
t1.received_man as receivedMan, |
|
|
|
|
t2.logistics_name as logisticsName, |
|
|
|
|
DATE_FORMAT(t1.delivery_time, '%Y-%m-%d %H:%i:%s') AS deliveryTime, |
|
|
|
|
DATE_FORMAT(t1.received_time, '%Y-%m-%d %H:%i:%s') AS receivedTime, |
|
|
|
|
t1.delivery_man as deliveryMan, |
|
|
|
|
t1.received_man as receivedMan, |
|
|
|
|
|
|
|
|
|
t1.start_province as startProvince, |
|
|
|
|
t1.start_city as startCity, |
|
|
|
|
t1.start_country as startCountry, |
|
|
|
|
t1.start_address as startAddress, |
|
|
|
|
t1.start_province as startProvince, |
|
|
|
|
t1.start_city as startCity, |
|
|
|
|
t1.start_country as startCountry, |
|
|
|
|
t1.start_address as startAddress, |
|
|
|
|
|
|
|
|
|
t1.end_province as endProvince, |
|
|
|
|
t1.end_city as endCity, |
|
|
|
|
t1.end_country as endCountry, |
|
|
|
|
t1.end_address as endAddress |
|
|
|
|
t1.end_province as endProvince, |
|
|
|
|
t1.end_city as endCity, |
|
|
|
|
t1.end_country as endCountry, |
|
|
|
|
t1.end_address as endAddress |
|
|
|
|
|
|
|
|
|
from traceability_delivery_record t1 |
|
|
|
|
left join traceability_logistics t2 on t1.logistics_id = t2.id |
|
|
|
@ -80,4 +81,4 @@ |
|
|
|
|
WHERE id = #{id} |
|
|
|
|
AND deleted = 0 |
|
|
|
|
</select> |
|
|
|
|
</mapper> |
|
|
|
|
</mapper> |
|
|
|
|