select a.material_base_info_id, a.organization_id, a.organization_name, a.top_organization_id, a.shipper_id, a.shipper_code, a.shipper_name, a.material_code, a.material_name, a.bar_code, a.material_classify_code, material_classify_name, a.material_type, a.material_type_name, a.pack_id, a.pack_code, a.pack_name, a.unit_code, a.unit_name, a.brand_id, a.brand_code, a.brand_name, a.shelf_life, a.weight_limit, a.volume_limit, a.material_shape, material_shape_name, a.material_size, a.material_length, a.material_width, a.material_height, a.remark, a.nullify, a.create_time, a.create_by, a.create_by_name, a.update_time, a.update_by, a.update_by_name, a.del_flag, a.common, sku_code, a.unit_price, a.currency, a.origin_country, a.hs_code, a.declaration_unit, a.statutory_unit, a.statutory_second_unit, a.copy_code, a.push_status,a.push_time,a.push_by,a.goods_type,a.gross_weight,a.push_by_name,a.unit,a.INSURE_AMOUNT,a.CHARGE_STANDARD, specification_model as specification_model,nvl(b.stock_qty,0) as stock_quantity,c.charge_standard as charge_standard_class,a.is_normal_material from material_base_info a left join ( select material_base_info_id, sum(INVENTORY_QUANTITY) as stock_qty from MATERIAL_INVENTORY group by material_base_info_id ) b on a.material_base_info_id = b.material_base_info_id left join "NGWL_TEST_SYSTEM"."MATERIAL_CLASSIFY" c on a.MATERIAL_CLASSIFY_CODE = c. CODE ,b.shipper_id AS base_shipper_id, b.shipper_code AS base_shipper_code, b.shipper_name AS base_shipper_name, b.material_code, b.material_name, b.bar_code, b.material_classify_code, b.material_classify_name, b.material_type, b.material_type_name, b.common, b.pack_id, b.pack_code, b.SPECIFICATION_MODEL, b.pack_name and a.organization_id like concat('%', #{organizationId}, '%') and (a.org_id like concat('%', #{orgId}, '%') or a.organization_id like concat('%', #{orgId}, '%')) and a.material_base_info_id = #{materialBaseInfoId} and a.organization_name like concat('%', #{organizationName}, '%') and a.top_organization_id = #{topOrganizationId} and (a.shipper_id = #{shipperId} or a.shipper_id is null or a.shipper_id = 0) and a.shipper_code like concat('%', #{shipperCode}, '%') and a.shipper_name like concat('%', #{shipperName}, '%') and a.material_code like concat('%', #{materialCode}, '%') and a.material_name like concat('%', #{materialName}, '%') and a.unit_name like concat('%', #{unitName}, '%') and a.bar_code like concat('%',#{barCode},'%') FIND_IN_SET(#{code}, a.material_classify_code) > 0 a.material_classify_name like concat('%', #{name}, '%') and a.material_type = #{materialType} and a.material_type_name like concat('%', #{materialTypeName}, '%') and a.pack_id = #{packId} and a.pack_code = #{packCode} and a.pack_name like concat('%', #{packName}, '%') and a.brand_id = #{brandId} and a.brand_code = #{brandCode} and a.brand_name like concat('%', #{brandName}, '%') and a.shelf_life = #{shelfLife} and a.weight_limit = #{weightLimit} and a.volume_limit = #{volumeLimit} and a.material_shape = #{materialShape} and a.material_shape_name like concat('%', #{materialShapeName}, '%') and a.material_size = #{materialSize} and a.material_length = #{materialLength} and a.material_width = #{materialWidth} and a.material_height = #{materialHeight} and a.nullify = #{nullify} and a.create_by_name like concat('%', #{createByName}, '%') and a.update_by_name like concat('%', #{updateByName}, '%') and ( instr(a.material_name, #{compoundOrQuery}) > 0 or instr(a.material_code, #{compoundOrQuery}) > 0 or instr(a.bar_code, #{compoundOrQuery}) > 0 ) and exists ( select 1 from material_goods_rule mgr where mgr.material_base_info_id = material_base_info.material_base_info_id and mgr.batch_id = #{batchId} and mgr.del_flag = 1 ) and a.push_status = #{pushStatus} and date_format(a.push_time,'%Y-%m-%d') >= #{pushTimeStart} and date_format(a.push_time,'%Y-%m-%d') <= #{pushTimeEnd} and date_format(a.create_time,'%Y-%m-%d') >= #{createTimeStart} and date_format(a.create_time,'%Y-%m-%d') <= #{createTimeEnd} and date_format(a.update_time,'%Y-%m-%d') >= #{updateTimeStart} and date_format(a.update_time,'%Y-%m-%d') <= #{updateTimeEnd} and common = #{common} and ( 1 = 1 or common = 1 ) and a.del_flag = #{delFlag} and a.del_flag = 1 and (b.shipper_id = #{shipperId} or b.shipper_id is null or b.shipper_id = 0) and b.shipper_code like concat('%', #{shipperCode}, '%') and b.shipper_name like concat('%', #{shipperName}, '%') and b.material_code = #{materialCode} and b.material_name like concat('%', #{materialName}, '%') and b.bar_code = #{barCode} FIND_IN_SET(#{code}, b.material_classify_code) > 0 b.material_classify_name like concat('%', #{name}, '%') and b.material_type = #{materialType} and b.material_type_name like concat('%', #{materialTypeName}, '%') and (b.shipper_code like concat('%', #{shipperInfo}, '%') or b.shipper_name like concat('%', #{shipperInfo}, '%')) and (b.material_code = #{materialInfo} or b.material_name like concat('%', #{materialInfo}, '%') or b.bar_code = #{materialInfo})