|
@@ -94,7 +94,7 @@ public class CropLandService extends BaseService<CropLand, Long> {
|
|
|
}
|
|
|
|
|
|
public List<CropPoint> findCropLandNoGeomByTableNamesAndBBox(String tableNames, Double x1, Double y1, Double x2, Double y2){
|
|
|
- String wkt = "POLYGON (("+x1+" "+y1+", "+x1+" "+y2+", "+x2+" "+y2+", "+x2+" "+y1+", "+x1+" "+y1+"))";
|
|
|
+ String wkt = bboxToWkt(x1, y1 , x2, y2);
|
|
|
String sql = "";
|
|
|
String[] tableNameArray = TextUtil.split(tableNames, ",");
|
|
|
int i=0;
|
|
@@ -102,7 +102,7 @@ public class CropLandService extends BaseService<CropLand, Long> {
|
|
|
if(i > 0){
|
|
|
sql+="\n union all \n";
|
|
|
}
|
|
|
- sql += " select id,gridcode,crop_type,st_asgeojson(center_point) as geojson,status,receiver,name,address,growing_period ";
|
|
|
+ sql += " select "+ CropPoint.selectColumns;
|
|
|
sql += "from " + table;
|
|
|
sql += " where ST_Intersects(geom,st_geomfromtext('"+wkt+"',4326)) ";
|
|
|
i++;
|
|
@@ -191,11 +191,8 @@ public class CropLandService extends BaseService<CropLand, Long> {
|
|
|
}
|
|
|
|
|
|
|
|
|
-
|
|
|
-
|
|
|
- @Transactional
|
|
|
- public void exec(StringBuffer sql){
|
|
|
- mEntityManager.createNativeQuery(sql.toString()).executeUpdate();
|
|
|
+ public static String bboxToWkt(Double x1, Double y1, Double x2, Double y2){
|
|
|
+ return "POLYGON (("+x1+" "+y1+", "+x1+" "+y2+", "+x2+" "+y2+", "+x2+" "+y1+", "+x1+" "+y1+"))";
|
|
|
}
|
|
|
|
|
|
@Override
|