CASE WHEN lds.id IS NULL THEN 0 ELSE 1 END AS isScan,ldpl.id parceListId,(
select GROUP_CONCAT( DISTINCT position_code)
from logpm_warehouse_updown_goods_log
where association_id = ldpl.id
) positionCode,lwug.allocation_id allocationId
CASE WHEN lds.id IS NULL THEN 0 ELSE 1 END AS isScan,ldpl.id parceListId,GROUP_CONCAT(lds.allocation_title) positionCode,lds.allocation_id allocationId
from logpm_distribution_parcel_list ldpl
LEFT JOIN logpm_distribution_stock lds on lds.parcel_list_id = ldpl.id
LEFT JOIN logpm_warehouse_updown_goods_log lwug on lwug.association_id = ldpl.id
<where>
<iftest="param.allocationId != null and param.allocationId != ''"> and lwug.allocation_id = #{param.allocationId} </if>
<iftest="param.allocation != null and param.allocation != ''"> and lwug.position_code = #{param.allocation} </if>
<iftest="param.allocationId != null and param.allocationId != ''"> and lds.allocation_id = #{param.allocationId} </if>
<iftest="param.allocation != null and param.allocation != ''"> and lds.allocation_title = #{param.allocation} </if>