StationRepository.java
3.49 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
package com.bsth.repository;
import java.util.List;
import org.springframework.data.jpa.repository.Modifying;
import org.springframework.data.jpa.repository.Query;
import org.springframework.stereotype.Repository;
import org.springframework.transaction.annotation.Transactional;
import com.bsth.entity.Station;
/**
*
* @Interface: StationRepository(站点Repository数据持久层接口)
*
* @Extends : BaseRepository
*
* @Description: TODO(站点Repository数据持久层接口)
*
* @Author bsth@lq
*
* @Date 2016年05月03日 上午9:21:17
*
* @Version 公交调度系统BS版 0.1
*
*/
@Repository
public interface StationRepository extends BaseRepository<Station, Integer> {
/**
* @Description :TODO(查询最大站点ID)
*
* @return int <站点id>
*/
@Query(value = "SELECT IFNULL(num,0) as maxId from (SELECT MAX(id) as num FROM bsth_c_station) k"
, nativeQuery=true)
long stationMaxId();
/*@Query(value = "SELECT s.b_jwpoints,s.id FROM bsth_c_station s where s.station_name like ?1"
, nativeQuery=true)
List<Object[]> findStationName(String stationName);*/
@Query(value = " SELECT t.b_jwpoints,t.id FROM (" +
" SELECT b.id,b.b_jwpoints,a.station_name,a.directions FROM (" +
" SELECT s.station,s.station_name,s.directions FROM bsth_c_stationroute s where s.destroy = 0 and s.directions = ?1) a " +
" LEFT JOIN bsth_c_station b on a.station = b. id) t where t.station_name LIKE ?2"
, nativeQuery=true)
List<Object[]> findStationName(Integer dir , String stationName);
/**
* @Description :TODO(站点保存)
*
* @param map <stationCode:站点编码;stationName:站点名称;roadCoding:道路编码;dbType:原坐标类型;bJwpoints:中心点百度坐标
*
* gLonx:中心点WGS坐标经度;gLaty:中心点WGS坐标纬度;descriptions:说明;createBy:创建人;updateBy:更新人>
*/
@Modifying
@Query(value="INSERT INTO bsth_c_station (" +
"id, code , db_type , b_jwpoints , " +
"g_lonx , g_laty , create_by, update_by) " +
" VALUES(" +
"?1 , ?2 , ?3 , ?4 , ?5," +
"?6 , ?7 , ?8)", nativeQuery=true)
public void stationSave(int id, String stationCode,String dbType,String bJwpoints,
Float gLonx, Float gLaty,Integer createBy,Integer updateBy);
/**
* @Description :TODO(站点更新)
*
* @param map <dbType:原坐标类型;bJwpoints:中心点百度坐标
*
* gLonx:中心点WGS坐标经度;gLaty:中心点WGS坐标纬度;updateBy:更新人>
*/
@Transactional
@Modifying
@Query(value="UPDATE bsth_c_station SET " +
"db_type = ?1, " +
"b_jwpoints = ?2, " +
"g_lonx = ?3, " +
"g_laty = ?4, " +
"update_by = ?5" +
" WHERE id = ?6 ", nativeQuery=true)
public void stationUpdate(String dbType,String bJwpoints,Float gLonx,Float gLaty,Integer updateBy,Integer stationId);
@Query(value = "select st_astext(g_polygon_grid) as g_polygon_grid, shapes_type,concat(g_lonx, ' ', g_laty) as g_center_point ,radius, code,station_name from bsth_c_station where code=?1", nativeQuery = true)
/*@Query(value = "select st_astext(r.g_polygon_grid) as g_polygon_grid, r.shapes_type,concat(s.g_lonx, ' ', s.g_laty) as g_center_point ,r.radius, code,station_name " +
"from bsth_c_station s, bsth_c_stationroute r where s.id=r.station code=?1", nativeQuery = true)*/
public Object[][] bufferAera(String stationCode);
}