如何编写Java工具类生成SQL查询语句?
- 内容介绍
- 文章标签
- 相关推荐
本文共计150个文字,预计阅读时间需要1分钟。
javapublic static String getSelectSql(List columns, Class c) { StringBuffer sb=new StringBuffer(); StringBuffer whereSB=new StringBuffer(); sb.append(select ); for (String string : columns) { sb.append(string + , ); } sb.delete(sb.length() - 2, sb.length()); // Remove the last comma and space sb.append( from + c.getSimpleName()); return sb.toString();}
/**查询语句生成器*/
public static String getSelectSql(List
本文共计150个文字,预计阅读时间需要1分钟。
javapublic static String getSelectSql(List columns, Class c) { StringBuffer sb=new StringBuffer(); StringBuffer whereSB=new StringBuffer(); sb.append(select ); for (String string : columns) { sb.append(string + , ); } sb.delete(sb.length() - 2, sb.length()); // Remove the last comma and space sb.append( from + c.getSimpleName()); return sb.toString();}
/**查询语句生成器*/
public static String getSelectSql(List

