package com.sw.mes.fb.checkout.dao;

import com.sw.mes.core.base.BaseDao;
import com.sw.mes.fb.checkout.entity.OperateCheckOutDataLog;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.Pageable;
import org.springframework.data.jpa.repository.Query;

import java.util.Map;

/**
* @Author
* @Description：
* @Date:
* @Modified By:
*/
public interface OperateCheckOutDataLogDao extends BaseDao<OperateCheckOutDataLog, Long>{
    @Query(value = "select * from (select cod.yb_section_no,cod.fb_section_no,cod.checkout_id,cod.checkout_name,cod.check_time,cod.re_check_type,cod.check_user_name,cod.specification,cod.length,cod.instore_length_fb,cod.actual_length,cod.instore_length_yb,cod.consume_length_yb,cod.collapse_loss,cod.weight,cod.theory_weight_fb,cod.length_slope,cod.square_rod_remark,cod.yb_level,cod.experi_level,cod.yb_experi_level,cod.fb_experi_level,cod.product_level_fb,cod.material_number,cod.order_no,cod.crystal_grayness,cod.square_rod_grayness,cod.line_scratch,cod.knife_scratch,cod.colour_difference,cod.yin_yang_face,cod.water_mark,cod.flat_handle,cod.round_handle,cod.wheel_mark,cod.roller_print,cod.scratch,cod.head_slope,cod.tail_slope,cod.check_line_no,cod.conduction_type,cod.diameter_max,cod.diameter_min,cod.side_length_max,cod.side_length_min,cod.verticality_max,cod.verticality_min,cod.projection_max,cod.projection_min,cod.chord_length_max,cod.chord_length_min,cod.plane_taper_max,cod.plane_taper_min,cod.flat_orientation,cod.orientation,cod.concession_length,cod.recut_length,cod.no_friction,cod.sticks_count,cod.spell_bar_length,cod.crack_width,cod.other_remark,cod.collapse,cod.broken_grey_no_edge,cod.grey_hide_center,cod.grey_hide_edge,cod.hot_spot,cod.wheel_high_lights,cod.size_exception,cod.ridge_broken,cod.crack,cod.material_source_value,cod.size_type,cod.order_type,cod.damage_grey_sum,cod.abnormal_sum,cod.damage_grey_hide_edge,cod.side_length_differ,cod.dopant,cod.device_no,cod.temperature,cod.plan_order_no,cod.plan_order_type,cod.plan_material_code,cod.plan_grade,cod.plan_stick_count,cod.plan_len_range,cod.plan_dopant,cod.plan_conductive_type,cod.plan_resistivity,cod.plan_specs,cod.length_prep,cod.product_level,cod.check_type,cod.patchwork_collapse,cod.patchwork_crack,cod.crystal_no,cod.diam_decide,cod.is_fb_size_check,cod.flag4m,cod.section_compose,cod.abnormal_length,cod.class_abnormal_length,cod.theory_abnormal_length,cod.total_length,cod.theory_total_length,cod.section_type,cod.update_user,cod.update_time,cod.defect_code,cod.defect_site,cod.defect_description from zhxx_operate_check_out_data cod where (cod.check_user_name = ?3 or ?3 is null) and (cod.fb_section_no = ?1 or ?1 is null) and (cod.yb_section_no = ?2 or ?2 is null) and (cod.check_time >=?4 or ?4 is null) and  (cod.check_time <=?5 or ?5 is null) union select codl.yb_section_no,codl.fb_section_no,codl.checkout_id,codl.checkout_name,codl.check_time,codl.re_check_type,codl.check_user_name,codl.specification,codl.length,codl.instore_length_fb,codl.actual_length,codl.instore_length_yb,codl.consume_length_yb,codl.collapse_loss,codl.weight,codl.theory_weight_fb,codl.length_slope,codl.square_rod_remark,codl.yb_level,codl.experi_level,codl.yb_experi_level,codl.fb_experi_level,codl.product_level_fb,codl.material_number,codl.order_no,codl.crystal_grayness,codl.square_rod_grayness,codl.line_scratch,codl.knife_scratch,codl.colour_difference,codl.yin_yang_face,codl.water_mark,codl.flat_handle,codl.round_handle,codl.wheel_mark,codl.roller_print,codl.scratch,codl.head_slope,codl.tail_slope,codl.check_line_no,codl.conduction_type,codl.diameter_max,codl.diameter_min,codl.side_length_max,codl.side_length_min,codl.verticality_max,codl.verticality_min,codl.projection_max,codl.projection_min,codl.chord_length_max,codl.chord_length_min,codl.plane_taper_max,codl.plane_taper_min,codl.flat_orientation,codl.orientation,codl.concession_length,codl.recut_length,codl.no_friction,codl.sticks_count,codl.spell_bar_length,codl.crack_width,codl.other_remark,codl.collapse,codl.broken_grey_no_edge,codl.grey_hide_center,codl.grey_hide_edge,codl.hot_spot,codl.wheel_high_lights,codl.size_exception,codl.ridge_broken,codl.crack,codl.material_source_value,codl.size_type,codl.order_type,codl.damage_grey_sum,codl.abnormal_sum,codl.damage_grey_hide_edge,codl.side_length_differ,codl.dopant,codl.device_no,codl.temperature,codl.plan_order_no,codl.plan_order_type,codl.plan_material_code,codl.plan_grade,codl.plan_stick_count,codl.plan_len_range,codl.plan_dopant,codl.plan_conductive_type,codl.plan_resistivity,codl.plan_specs,codl.length_prep,codl.product_level,codl.check_type,codl.patchwork_collapse,codl.patchwork_crack,codl.crystal_no,codl.diam_decide,codl.is_fb_size_check,codl.flag4m,codl.section_compose,codl.abnormal_length,codl.class_abnormal_length,codl.theory_abnormal_length,codl.total_length,codl.theory_total_length,codl.section_type,codl.update_user,codl.update_time,codl.defect_code,codl.defect_site,codl.defect_description from zhxx_operate_check_out_data_log codl  where (codl.check_user_name = ?3 or ?3 is null) and (codl.fb_section_no = ?1 or ?1 is null) and (codl.yb_section_no = ?2 or ?2 is null) and (codl.check_time >=?4 or ?4 is null) and  (codl.check_time <=?5 or ?5 is null) and  (codl.operate_type = 0 )) codnew order by check_time desc",
            countQuery = "select count(1) from (select cod.fb_section_no,cod.check_time from zhxx_operate_check_out_data cod where (cod.check_user_name = ?3 or ?3 is null) and (cod.fb_section_no = ?1 or ?1 is null) and (cod.yb_section_no = ?2 or ?2 is null) and (cod.check_time >=?4 or ?4 is null) and  (cod.check_time <=?5 or ?5 is null) union select codl.fb_section_no,codl.check_time from zhxx_operate_check_out_data_log codl  where (codl.check_user_name = ?3 or ?3 is null) and (codl.fb_section_no = ?1 or ?1 is null) and (codl.yb_section_no = ?2 or ?2 is null) and (codl.check_time >=?4 or ?4 is null) and  (codl.check_time <=?5 or ?5 is null) and  (codl.operate_type = 0 )) codnew order by check_time desc", nativeQuery = true)
    Page<Map<String, Object>> getPageListInfo(String search_EQ_fbSectionNo, String search_EQ_ybSectionNo, String search_EQ_checkUserName,
                                              String search_GTE_checkTime, String search_LT_checkTime, Pageable pageable);
}
