select m.investigation_manage_id, m.organization_id, m.organization_name, m.top_organization_id, m.investigation_number, m.old_investigation_number, m.investigation_status, m.investigation_range, m.investigation_type, m.investigation_method, m.investigation_frequency, m.different_number, m.warehouse_id, m.warehouse_code, m.warehouse_name, m.audit_status, m.audit_remark, m.audit_by, m.audit_by_name, m.audit_time, m.task_distribution, m.task_distribution_time, m.operators_by, m.operators_name, m.investigation_man_by, m.investigation_man_name, m.nullify, m.remark, m.create_time, m.create_by, m.create_by_name, m.update_time, m.update_by, m.update_by_name, m.del_flag, (SELECT IFNULL(SUM(d.inventory_quantity), 0) FROM investigetion_manage_detail d WHERE d.investigation_number = m.investigation_number AND d.del_flag = 1) as total_inventory_quantity, (SELECT IFNULL(SUM(d.inventory_quantity), 0) FROM investigetion_manage_detail d WHERE d.investigation_number = m.investigation_number AND d.del_flag = 1 AND d.investigation_status IN (3, 4)) as investigated_inventory_quantity from investigation_manage m and m.del_flag = 1 and m.organization_id = #{organizationId} and m.organization_name like concat('%', #{organizationName}, '%') and m.top_organization_id = #{topOrganizationId} and m.investigation_number like concat('%',#{investigationNumber},'%') and m.old_investigation_number = concat('%',#{oldInvestigationNumber},'%') and m.investigation_status = #{investigationStatus} and m.investigation_range = #{investigationRange} and m.investigation_type = #{investigationType} and m.investigation_method = #{investigationMethod} and m.investigation_frequency = #{investigationFrequency} and m.different_number = #{differentNumber} and m.warehouse_id = #{warehouseId} and m.warehouse_code = #{warehouseCode} and m.warehouse_name like concat('%', #{warehouseName}, '%') and m.audit_status = #{auditStatus} and m.audit_remark = #{auditRemark} and m.audit_by = #{auditBy} and m.audit_by_name like concat('%', #{auditByName}, '%') and m.audit_time = #{auditTime} and m.task_distribution = #{taskDistribution} and m.task_distribution_time = #{taskDistributionTime} and m.operators_by = #{operatorsBy} and m.operators_name like concat('%', #{operatorsName}, '%') and m.nullify = #{nullify} and m.create_by_name like concat('%', #{createByName}, '%') and m.update_by_name like concat('%', #{updateByName}, '%') and date_format(m.create_time,'%Y-%m-%d %H:%i:%s') =]]> #{createStartTime} and date_format(m.create_time,'%Y-%m-%d %H:%i:%s') #{createEndTime} and m.remark like concat('%',#{remark},'%') and m.investigation_manage_id in #{item} and m.del_flag = #{delFlag} and m.del_flag = 1