MakeBillOfLadingMapper.xml 1.86 KB
Newer Older
lanbaoming's avatar
lanbaoming committed
1 2 3 4
<?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">

lanbaoming's avatar
lanbaoming committed
5 6 7 8
	<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>
lanbaoming's avatar
lanbaoming committed
9 10 11 12 13 14 15 16

    <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,
17
	(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,
18 19 20
	(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,
lanbaoming's avatar
lanbaoming committed
21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49
	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>