import java.util.*;
public class SQLDemo {
public static String sqlCommon="";
//模拟写sql语句
public static String querySQL(Map<String,Object> map,String tableName){
//map若有参数查询则size从1开始算起
if (map.isEmpty()||map.size()==0) {
sqlCommon = "select * from "+tableName;
} else {
sqlCommon = "select * from "+tableName+" where ";
//再进行拼接sql语句回去
//如果只有一个则不用添加and 若有多个参数则再设计
Set set = map.keySet();
Iterator iterable = set.iterator();
int index = 0;//默认下标为零,其作用是判断是否与map的最后一个参数相等从而去掉and
while(iterable.hasNext()){
String key = (String)iterable.next();
Object value = map.get(key);
//判