public class TestMasterQuery { public static void main(String[] a) throws Exception { Class.forName("com.mysql.cj.jdbc.Driver"); java.sql.Connection c = java.sql.DriverManager.getConnection( "jdbc:mysql://cq-cdb-8fjmemkb.sql.tencentcdb.com:27220/ylrz_saas?allowMultiQueries=true","root","Ylrz_1q2w3e4r5t6y"); java.sql.PreparedStatement ps = c.prepareStatement( "select id, company_id, visible_company_ids, template_code from company_workflow_lobster where del_flag = 0 and ( company_id = ? or ( visible_company_ids is not null and visible_company_ids != '' and find_in_set(?, visible_company_ids) ) ) and (template_kind is null or template_kind = '' or template_kind = 'MASTER') order by create_time desc limit 1"); ps.setLong(1,1); ps.setLong(2,1); java.sql.ResultSet r = ps.executeQuery(); System.out.println(r.next() ? "master query OK id="+r.getLong(1) : "master query OK empty"); c.close(); } }