TestMasterQuery.java 944 B

12345678910111213
  1. public class TestMasterQuery {
  2. public static void main(String[] a) throws Exception {
  3. Class.forName("com.mysql.cj.jdbc.Driver");
  4. java.sql.Connection c = java.sql.DriverManager.getConnection(
  5. "jdbc:mysql://cq-cdb-8fjmemkb.sql.tencentcdb.com:27220/ylrz_saas?allowMultiQueries=true","root","Ylrz_1q2w3e4r5t6y");
  6. java.sql.PreparedStatement ps = c.prepareStatement(
  7. "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");
  8. ps.setLong(1,1); ps.setLong(2,1);
  9. java.sql.ResultSet r = ps.executeQuery();
  10. System.out.println(r.next() ? "master query OK id="+r.getLong(1) : "master query OK empty");
  11. c.close();
  12. }
  13. }