update lims_laboratory.inspection_product
set test_state=null
where id = #{id}
and state = 1
select test_state
from lims_laboratory.inspection_product
where state = 1
and inspection_material_id = (select id from lims_laboratory.inspection_material where inspection_id = #{id})
update lims_laboratory.inspection_product
set state=0
where inspection_material_id = #{id}
select count(id)
from lims_laboratory.inspection_product
where state = 1
and test_state in (0, 1)
select count(id)
from lims_laboratory.inspection_product
where state = 1
and test_state is null
select ip.name,
equipment_name instrumentname,
start_time startTime,
user.name checkname,
end_time endTime
from lims_laboratory.inspection_product ip
left join lims_laboratory.inspection_material on ip.inspection_material_id = inspection_material.id
left join lims_laboratory.inspection i on inspection_material.inspection_id = i.id
left join lims_laboratory.instrument on ip.instrument_id = instrument.id
left join lims_laboratory.user on ip.user_id = user.id
where ip.state=1
and test_state is null