StringprimarySql="SELECT distinct column_name FROM INFORMATION_SCHEMA.`KEY_COLUMN_USAGE` WHERE table_name= '"+tableName+"' AND constraint_name='PRIMARY'";
Stringsql1="SELECT "+metaData+" FROM "+tableName+" GROUP BY "+metaData+" HAVING COUNT("+metaData+")>1;";
List<Map>mapList=commonQuery(sql1,datasourceId);
if(mapList.size()==0){
return"该字段没有重复值";
}else{
Stringsql="SELECT * FROM "+tableName+" WHERE id not in (SELECT MIN(id) FROM "+tableName+" GROUP BY "+metaData+" HAVING COUNT("+metaData+")>1);";
Stringsql="SELECT * FROM "+tableName+" WHERE "+primaryKey+" not in (SELECT MIN("+primaryKey+") FROM "+tableName+" GROUP BY "+metaData+" HAVING COUNT("+metaData+")>1);";
returncommonQuery(sql,datasourceId);
}
}
...
...
@@ -279,16 +282,15 @@ public class CommonQueryService extends ServiceImpl<CommonQuerySettingDao, Commo
}
Stringphone="SELECT "+metaData+" FROM "+tableName;
Stringsql="SELECT * FROM "+tableName+" WHERE "+metaData+" REGEXP '^1[3-9][0-9]{9}$'";