|
@@ -15,7 +15,7 @@ import org.springframework.stereotype.Component;
|
|
|
import java.util.*;
|
|
|
import java.util.function.Consumer;
|
|
|
|
|
|
-import static com.boman.common.core.utils.obj.ObjectUtils.escapeStr;
|
|
|
+import static com.boman.common.core.utils.obj.ObjectUtils.*;
|
|
|
import static com.boman.web.core.constant.FormDataConstant.*;
|
|
|
|
|
|
/**
|
|
@@ -529,7 +529,7 @@ public interface StandardlyMapper {
|
|
|
packCondition(packCondition, wholeSql);
|
|
|
|
|
|
wholeSql.append(" order by ").append(orderBy).append(" limit ").append(limit);
|
|
|
- if (ObjectUtils.isNotEmpty(offset)) {
|
|
|
+ if (isNotEmpty(offset)) {
|
|
|
wholeSql.append(", ").append(offset);
|
|
|
}
|
|
|
|
|
@@ -542,13 +542,20 @@ public interface StandardlyMapper {
|
|
|
JSONObject param = (JSONObject) para.get("param");
|
|
|
String tableName = (String) para.get("tableName");
|
|
|
|
|
|
+ String result;
|
|
|
StringBuilder wholeSql = new StringBuilder();
|
|
|
- wholeSql.append("select * from ").append(tableName).append(" where ");
|
|
|
- for (Map.Entry<String, Object> entry : param.entrySet()) {
|
|
|
- wholeSql.append(entry.getKey()).append(" = ").append(entry.getValue()).append(" and ");
|
|
|
+ wholeSql.append("select * from ").append(tableName);
|
|
|
+ if (isEmpty(param)) {
|
|
|
+ result = wholeSql.toString();
|
|
|
+ } else {
|
|
|
+ wholeSql.append(" where ");
|
|
|
+ for (Map.Entry<String, Object> entry : param.entrySet()) {
|
|
|
+ wholeSql.append(entry.getKey()).append(" = ").append(entry.getValue()).append(" and ");
|
|
|
+ }
|
|
|
+
|
|
|
+ result = StringUtils.substringBeforeLast(wholeSql.toString(), "and");
|
|
|
}
|
|
|
|
|
|
- String result = StringUtils.substringBeforeLast(wholeSql.toString(), "and");
|
|
|
LOGGER.info("查询拼出的sql语句为:{}", result);
|
|
|
return result;
|
|
|
}
|
|
@@ -563,7 +570,7 @@ public interface StandardlyMapper {
|
|
|
wholeSql.append("select ");
|
|
|
// showData
|
|
|
StringBuilder showDataSql = new StringBuilder();
|
|
|
- if (ObjectUtils.isNotEmpty(showData)) {
|
|
|
+ if (isNotEmpty(showData)) {
|
|
|
for (String columnName : showData) {
|
|
|
showDataSql.append(columnName).append(", ");
|
|
|
}
|
|
@@ -609,7 +616,7 @@ public interface StandardlyMapper {
|
|
|
* @param wholeSql sql
|
|
|
*/
|
|
|
private void packCondition(JSONObject packCondition, StringBuilder wholeSql) {
|
|
|
- if (ObjectUtils.isNotEmpty(packCondition)) {
|
|
|
+ if (isNotEmpty(packCondition)) {
|
|
|
wholeSql.append(" where ");
|
|
|
StringBuilder conditionSql = new StringBuilder();
|
|
|
for (Map.Entry<String, Object> entry : packCondition.entrySet()) {
|