<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="org.jeecg.modules.database.mapper.LocalDatabaseMapper">
    <select id="search" resultType="org.jeecg.modules.database.entity.LocalDatabase">
        select distinct l.* from local_database l left join experiment e on l.experiment_id = e.id
        left join experiment_sample_info s on e.id = s.experiment_id
        left join experiment_deviation_equipment  b on e.id = b.experiment_id
        left join experiment_deviation_condition  c on e.id = c.experiment_id
        left join experiment_anneal_process  ap on e.id = ap.experiment_id
        left join experiment_radiation_process  rp on e.id = rp.experiment_id
        left join experiment_test_process  tp on e.id = tp.experiment_id
        <where>
            <if test="keyWord != null and keyWord != ''">
                l.experiment_no like concat('%', #{keyWord}, '%')
                or l.name like concat('%', #{keyWord}, '%')
                or l.client_name like concat('%', #{keyWord}, '%')
                or l.type like concat('%', #{keyWord}, '%')
                or s.sample_name like concat('%', #{keyWord}, '%')
                or s.sample_type like concat('%', #{keyWord}, '%')
                or s.sample_model like concat('%', #{keyWord}, '%')
                or s.sample_batch like concat('%', #{keyWord}, '%')
                or s.sample_manufacturer like concat('%', #{keyWord}, '%')
                or b.equipment_model like concat('%', #{keyWord}, '%')
                or b.equipment_name like concat('%', #{keyWord}, '%')
                or b.equipment_type like concat('%', #{keyWord}, '%')
                or b.equipment_no like concat('%', #{keyWord}, '%')
                or c.offset_condition like concat('%', #{keyWord}, '%')
                or c.offset_voltage like concat('%', #{keyWord}, '%')
                or c.input_signal like concat('%', #{keyWord}, '%')
                or c.load_capacity like concat('%', #{keyWord}, '%')
                or c.offset_current like concat('%', #{keyWord}, '%')
                or c.other_condition like concat('%', #{keyWord}, '%')
                or c.duty_cycle like concat('%', #{keyWord}, '%')
                or c.signal_amplitude like concat('%', #{keyWord}, '%')
                or c.signal_frequency like concat('%', #{keyWord}, '%')
                or c.signal_type like concat('%', #{keyWord}, '%')
                or ap.comment like concat('%', #{keyWord}, '%')
                or ap.exception_record like concat('%', #{keyWord}, '%')
                or ap.deviation_equipment like concat('%', #{keyWord}, '%')
                or rp.measurement_rate like concat('%', #{keyWord}, '%')
                or rp.radiation_standard like concat('%', #{keyWord}, '%')
                or rp.comment like concat('%', #{keyWord}, '%')
                or rp.exception_record like concat('%', #{keyWord}, '%')
                or rp.radiation_detail like concat('%', #{keyWord}, '%')
                or tp.comment like concat('%', #{keyWord}, '%')
                or tp.exception_record like concat('%', #{keyWord}, '%')
                or tp.radiation_detail like concat('%', #{keyWord}, '%')
                or tp.test_parameters like concat('%', #{keyWord}, '%')
                or tp.test_equipment like concat('%', #{keyWord}, '%')
                or tp.test_metering_point like concat('%', #{keyWord}, '%')
                or tp.test_fluence_point like concat('%', #{keyWord}, '%')
                or tp.annealing_duration like concat('%', #{keyWord}, '%')
                or tp.test_data like concat('%', #{keyWord}, '%')
            </if>
        </where>
    </select>
</mapper>