Browse Source

支持mysql原生函数

liwh 1 year ago
parent
commit
8d5d86feff

+ 7 - 1
tile-service/src/main/java/cn/com/taiji/tile/service/impl/TileServiceImpl.java

@@ -189,13 +189,19 @@ public class TileServiceImpl implements ITileService {
 
                     try{
 
-                        MySQLFilterToSQL filterToSql = new MySQLFilterToSQL();
+                        MySQLFilterToSQL filterToSql = new MySQLFilterToSQL(true);
                         filterToSql.setInline(true);
 
                         Filter filter = ECQL.toFilter(cqlFilter);
 
                         String actual = filterToSql.encodeToString(filter);
 
+                        if(actual.indexOf("))', null))") >0){
+
+                            actual = actual.replace("))', null))","))'))");
+
+                        }
+
                         layerDataRun = layerDataRun + " and " +actual;
 
                     }catch (Exception exception){

+ 1 - 1
tile-web/src/main/java/cn/com/taiji/web/controller/TileWebController.java

@@ -113,7 +113,7 @@ public class TileWebController {
                     }
                 }else{
 
-                    log.info("根据图层代码:" + geoRequestParam.getLayers() + "获取图层对应的数据源为空或者为null");
+                    log.info("根据图层代码:" + StringUtils.join(layerGroupList,",") + "获取图层对应的数据源为空或者为null");
                 }
 
             }catch (Exception exception){

+ 0 - 3
tile-web/src/main/java/cn/com/taiji/web/service/impl/GeoDataSourceServiceImpl.java

@@ -14,11 +14,8 @@ import cn.hutool.core.date.DateTime;
 import cn.hutool.core.date.DateUtil;
 import com.alibaba.fastjson.JSONObject;
 import lombok.extern.slf4j.Slf4j;
-import org.geotools.api.filter.FilterFactory;
-import org.geotools.api.filter.expression.Function;
 import org.geotools.data.jdbc.datasource.DBCPDataSourceFactory;
 import org.geotools.data.jdbc.datasource.DataSourceFinder;
-import org.geotools.factory.CommonFactoryFinder;
 import org.geotools.jdbc.JDBCDataStoreFactory;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;