and a.device_no LIKE concat('%', #{query.deviceNo}, '%') and a.customer_name LIKE concat('%', #{query.customerName}, '%') and a.agent_name=#{query.agentName} and a.model_no LIKE concat('%', #{query.modelNo}, '%') and a.warranty_state=#{query.warrantyState} and a.start_warranty_date >= #{query.warrantyStartDate} and start_warranty_date <= #{query.warrantyEndDate} update gongfu_device set data_valid_state=0 where id in #{item} update gongfu_device set warranty_state=(select b.id from dictionary a join dictionary_item b on a.id=b.dictionary_id where a.code='deviceWarrantyState' and b.`code`='NotStarted') where start_warranty_date>now(); update gongfu_device set warranty_state=(select b.id from dictionary a join dictionary_item b on a.id=b.dictionary_id where a.code='deviceWarrantyState' and b.`code`='OutsideWarranty') where DATE_ADD(start_warranty_date, INTERVAL warranty_month MONTH) < now(); update gongfu_device set warranty_state=(select b.id from dictionary a join dictionary_item b on a.id=b.dictionary_id where a.code='deviceWarrantyState' and b.`code`='WithinWarranty') where start_warranty_date <= now() and DATE_ADD(start_warranty_date, INTERVAL warranty_month MONTH) >= now() ;