david 2 lat temu
rodzic
commit
40c1775df8

+ 4 - 0
src/main/java/com/roma/romaapi/dao/DbApiDao.java

@@ -54,12 +54,16 @@ public class DbApiDao {
 
     // 查询数据--多条数据使用
     public List<Map<String, Object>> dbCustomQueryForList(String sql, Map<String, Object> bindValue){
+        System.out.println("sql-----"+sql);
+        System.out.println("bindvalue------------"+bindValue);
         List<Map<String, Object>> resMap2 = namedParameterJdbcTemplate.queryForList(sql, bindValue);
         return  resMap2;
     }
 
     // 执行增删改语句
     public Integer dbUpdate(String sql, Map<String, Object> bindValue){
+        System.out.println("sql-----"+sql);
+        System.out.println("bindvalue------------"+bindValue);
         Integer row = namedParameterJdbcTemplate.update(sql, bindValue);
         return  row;
     }

+ 4 - 5
src/main/java/com/roma/romaapi/service/DbApiService.java

@@ -14,6 +14,7 @@ public class DbApiService {
     @Autowired
     DbApiDao dbApiDao;
     public Map<String, Object> transferSql(String sqlCode, Map<String, String[]> maps){
+        System.out.println("参数--------长度-----"+maps.size());
         Map hasSql = dbApiDao.dbQueryForMap(sqlCode);
         boolean isEmpty = hasSql.containsKey("sysErrorCode");
         if(isEmpty) {
@@ -31,6 +32,7 @@ public class DbApiService {
             if(paramsKey.length() >= 4) {
                 fourBeforestring = paramsKey.substring(0,4);
                 if (fourBeforestring.equals("api_")) {
+                    System.out.println("参数-------------------"+paramsValue);
                     bindData.put(paramsKey, paramsValue);
                 }
             }
@@ -69,14 +71,11 @@ public class DbApiService {
         Map res = new HashMap<>();
         Object sql = sqlData.get("sql_string");// 获取sql语句
         Object isList = sqlData.get("is_list");// 是否查单条数据
-
         if(isList.equals(2)) {
             // 如果查询单条数据
             String selectSql = sql.toString();
-            Map info = dbApiDao.dbCustomQueryForMap(selectSql, bindData);
-            Integer count = info.isEmpty() ? 0 : 1;
-            res.put("count", count);
-            res.put("rows", info);
+            res = dbApiDao.dbCustomQueryForMap(selectSql, bindData);
+
         } else if(isList.equals(1)) {
             // 如果是查询列表
             Integer nowPage = Integer.parseInt(page);  // 当前第几页

+ 1 - 1
src/main/resources/application.properties

@@ -1 +1 @@
-#服务
server.port=8081
server.servlet.session.timeout=600

#数据库
spring.datasource.driver-class-name=com.mysql.cj.jdbc.Driver
spring.datasource.url = jdbc:mysql://172.30.218.169:3306/lowcode?serverTimezone=UTC&tinyInt1isBit=false&transformedBitIsBoolean=false
spring.datasource.username = root
spring.datasource.password = mypass

#redis
spring.redis.database=0
spring.redis.password=
#spring.redis.password=name:password
spring.redis.port=6379
spring.redis.host=127.0.0.1
spring.redis.timeout=5000
spring.redis.lettuce.pool.max-active=3
spring.redis.lettuce.pool.min-idle=2
spring.redis.lettuce.pool.max-idle=3
spring.redis.lettuce.pool.max-wait=-1
#spring.redis.lettuce.shutdown-timeout=100
#spring.cache.redis.cache-null-values=false


+#服务
server.port=8081
server.servlet.session.timeout=600

#数据库
spring.datasource.driver-class-name=com.mysql.cj.jdbc.Driver
spring.datasource.url = jdbc:mysql://172.19.16.186:3306/lowcode?serverTimezone=UTC&tinyInt1isBit=false&transformedBitIsBoolean=false
spring.datasource.username = root
spring.datasource.password = mypass

#redis
spring.redis.database=0
spring.redis.password=
#spring.redis.password=name:password
spring.redis.port=6379
spring.redis.host=127.0.0.1
spring.redis.timeout=5000
spring.redis.lettuce.pool.max-active=3
spring.redis.lettuce.pool.min-idle=2
spring.redis.lettuce.pool.max-idle=3
spring.redis.lettuce.pool.max-wait=-1
#spring.redis.lettuce.shutdown-timeout=100
#spring.cache.redis.cache-null-values=false