MakeBillOfLadingMapper.xml 1.86 KB
<?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="cn.iocoder.yudao.module.shipment.dal.mysql.makeBillOfLading.MakeBillOfLadingMapper">

	<select id="getBpmStatus" resultType="java.lang.String">
		SELECT status from bpm_process_instance_ext
		where deleted=0 and process_instance_id=#{process_instance_id}
	</select>

    <select id="getLadingBillOrderInfo" parameterType="java.lang.Long" resultType="cn.iocoder.yudao.module.shipment.vo.makeBillOfLading.MakeBillOfLadingListBackVO">
        SELECT distinct
    t1.id as id,
	t.order_id as orderId,
	t.order_no as orderNo,
	t.customs_type,
	t.drawee as draweeCode,
	(select count(*) from ecw_order_approval c where c.order_id=t.order_id and c.type in (1,31) and c.deleted=0) as specialPriceCount,
	(select count(*) from ecw_order_approval c where c.order_id=t.order_id and c.type in (2,32) and c.deleted=0) as adminDiscountCount,
	(select count(*) from ecw_order_approval c where c.order_id=t.order_id and c.type=4 and c.deleted=0) as bubbleDiscount,
	(select count(*) from ecw_order_approval c where c.order_id=t.order_id and c.type=5 and c.deleted=0) as heavyDiscount,
	t.is_cargo_control as isCargoControl,
	t.sum_num as num,(
	SELECT
		count( 1 )
	FROM
		ecw_box_load_info a
	WHERE
		a.order_id = t.order_id and a.deleted=0
	) as loadNum,
	(
	SELECT
		b.title_en
	FROM
		ecw_warehouse_line a
		LEFT JOIN ecw_warehouse b ON a.dest_warehouse_id = b.id
	WHERE
		a.id = t.line_id
		LIMIT 1
	) as destWarehouse,
	t.sum_volume as loadVolume,
	t.sum_weight as loadWeight,
	(select a.nickname from system_user a where a.id=t.salesman_id) as salesmanId,
	IFNULL(t1.`status`,0) as status
FROM
	ecw_order t
	LEFT JOIN ecw_make_bill_of_lading t1 ON t.order_id = t1.order_id and t1.deleted=0
	where t.order_id=#{orderId}
    </select>
</mapper>