第一种方式
select * from cpic a where not exists (select 1 form cpic b where b.barcode=a.barcode and b.creatTime > a.creatTime);
第二种方式
select * from cpic a where a.id in
(select result.id from(select max(t.id) from cpic t group by t.barcode) result);