select i.*,et.name as type_name,es.name as size_name,po.org_name as org_name,
select i.id,i.type_id,i.size_id,i.supplier_id,i.shelf_id,i.shelf_location,i.epc,i.org_id_int as org_id,i.state,i.bussiness_state,i.location_state,i.production_date,i.warranty_period,i.maintenance_period,i.location_id,i.location_type,i.term_state,i.area_id,et.name as type_name,es.name as size_name,po.org_name as org_name,
bs.name as supplier_name,COALESCE(bc.name, bw.name) as location_name,
bs.name as supplier_name,COALESCE(bc.name, bw.name) as location_name,
es.photo as photo,es.instructions as instructions
es.photo as photo,es.instructions as instructions
FROM base_inventory i
FROM base_inventory i
JOIN base_equipment_type et on et.id=i.type_id
JOIN base_equipment_type et on et.id=i.type_id
join base_equipment_size es on es.id=i.size_id
join base_equipment_size es on es.id=i.size_id
join pub_org po on i.org_id_int=po.org_id
join pub_org po on i.org_id_int=po.org_id
left join base_supplier bs on bs.id=i.supplier_id
left join base_supplier bs on bs.id=i.supplier_id
LEFT JOIN base_cabinet_box bcb ON i.location_id = bcb.id and i.location_type=1
LEFT JOIN base_cabinet_box bcb ON i.location_id = bcb.id and i.location_type=1
LEFT JOIN base_cabinet bc ON bcb.cabinet_id = bc.id
LEFT JOIN base_cabinet bc ON bcb.cabinet_id = bc.id
LEFT JOIN base_warehouse bw ON i.location_id = bw.id AND i.location_type = 0
LEFT JOIN base_warehouse bw ON i.location_id = bw.id AND i.location_type = 0
WHERE i.org_id_int=#{req.orgId} and i.type_id=#{req.typeId}
WHERE i.org_id_int=#{req.orgId} and i.type_id=#{req.typeId}
<iftest="req.locationType !='all' and req.locationType != null">
<iftest="req.locationType !='all' and req.locationType != null">
and i.location_type=#{req.locationType}
and i.location_type=#{req.locationType}
...
@@ -683,6 +683,7 @@
...
@@ -683,6 +683,7 @@
<iftest="req.price !=null and req.price != ''">
<iftest="req.price !=null and req.price != ''">
and i.price=#{req.price}
and i.price=#{req.price}
</if>
</if>
ORDER BY i.type_id,i.size_id
<iftest="pageNo != null and pageNo != '' and pageSize != null and pageSize != '' ">
<iftest="pageNo != null and pageNo != '' and pageSize != null and pageSize != '' ">