|
@@ -1,5 +1,6 @@
|
|
|
package com.roma.romaapi.service;
|
|
package com.roma.romaapi.service;
|
|
|
|
|
|
|
|
|
|
+import org.apache.commons.codec.binary.StringUtils;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
import org.springframework.stereotype.Service;
|
|
import org.springframework.stereotype.Service;
|
|
|
import com.roma.romaapi.dao.DbApiDao;
|
|
import com.roma.romaapi.dao.DbApiDao;
|
|
@@ -13,26 +14,23 @@ public class DbApiService {
|
|
|
|
|
|
|
|
@Autowired
|
|
@Autowired
|
|
|
DbApiDao dbApiDao;
|
|
DbApiDao dbApiDao;
|
|
|
- public Map<String, Object> transferSql(String sqlCode, Map<String, String[]> maps){
|
|
|
|
|
- System.out.println("参数--------长度-----"+maps.size());
|
|
|
|
|
|
|
+ public Map<String, Object> transferSql(String sqlCode, Map<String, String> maps){
|
|
|
Map hasSql = dbApiDao.dbQueryForMap(sqlCode);
|
|
Map hasSql = dbApiDao.dbQueryForMap(sqlCode);
|
|
|
boolean isEmpty = hasSql.containsKey("sysErrorCode");
|
|
boolean isEmpty = hasSql.containsKey("sysErrorCode");
|
|
|
if(isEmpty) {
|
|
if(isEmpty) {
|
|
|
return hasSql;
|
|
return hasSql;
|
|
|
}
|
|
}
|
|
|
- // 获取全部的请求参数
|
|
|
|
|
- Map bindData = new HashMap<>();
|
|
|
|
|
String page = "1"; // 页数
|
|
String page = "1"; // 页数
|
|
|
String perPage = "15"; // 显示多少条
|
|
String perPage = "15"; // 显示多少条
|
|
|
- // 组装要绑定的参数数据
|
|
|
|
|
- for (Map.Entry<String, String[]> entry : maps.entrySet()) {
|
|
|
|
|
|
|
+ Map bindData = new HashMap<>();
|
|
|
|
|
+ Object sqlBehavior = hasSql.get("sql_type");
|
|
|
|
|
+ for (Map.Entry<String, String> entry : maps.entrySet()) {
|
|
|
String paramsKey = entry.getKey();
|
|
String paramsKey = entry.getKey();
|
|
|
- String paramsValue = entry.getValue()[0];
|
|
|
|
|
|
|
+ String paramsValue = entry.getValue();
|
|
|
String fourBeforestring = "";
|
|
String fourBeforestring = "";
|
|
|
if(paramsKey.length() >= 4) {
|
|
if(paramsKey.length() >= 4) {
|
|
|
fourBeforestring = paramsKey.substring(0,4);
|
|
fourBeforestring = paramsKey.substring(0,4);
|
|
|
if (fourBeforestring.equals("dbp_")) {
|
|
if (fourBeforestring.equals("dbp_")) {
|
|
|
- System.out.println("参数-------------------"+paramsValue);
|
|
|
|
|
bindData.put(paramsKey, paramsValue);
|
|
bindData.put(paramsKey, paramsValue);
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
@@ -43,8 +41,6 @@ public class DbApiService {
|
|
|
perPage = paramsValue;
|
|
perPage = paramsValue;
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
-
|
|
|
|
|
- Object sqlBehavior = hasSql.get("sql_type");
|
|
|
|
|
Map ret = new HashMap<>();
|
|
Map ret = new HashMap<>();
|
|
|
// query查询行为 update数据有变动行为
|
|
// query查询行为 update数据有变动行为
|
|
|
switch (sqlBehavior.toString()) {
|
|
switch (sqlBehavior.toString()) {
|