StationRouteRepository.java 1.9 KB
package com.bsth.repository;

import java.util.List;

import org.springframework.data.jpa.repository.Query;
import org.springframework.stereotype.Repository;

import com.bsth.entity.StationRoute;

/**
 * 
 * @Interface: StationRouteRepository(站点路由Repository数据持久层接口)
 * 
 * @Extends : BaseRepository
 * 
 * @Description: TODO(站点路由Repository数据持久层接口)
 * 
 * @Author bsth@lq
 * 
 * @Date 2016年5月03日 上午9:21:17
 *
 * @Version 公交调度系统BS版 0.1
 * 
 */

@Repository
public interface StationRouteRepository extends BaseRepository<StationRoute, Integer> {
	
	@Query(value = "SELECT  a.id,"+
							"a.line,"+
							"a.station,"+
							"a.station_name,"+
							"a.station_route_code,"+
							"a.line_code,"+
							"a.station_code,"+
							"a.station_mark,"+
							"b.b_jwpoints as 'station.b_jwpoints' ,"+
							"b.g_laty AS 'station.g_laty',"+
							"b.g_lonx AS 'station.g_lonx',"+
							"b.g_polygon_grid AS 'station.g_polygon_grid',"+
							"b.radius AS 'station.radius',"+
							"b.shapes_type AS 'station.shapes_type',"+
							"b.destroy AS 'station.destroy',"+
							"b.versions AS 'station.versions' FROM ("+
						"SELECT "+
							"r.id,"+
							"r.line,"+
							"r.station,"+
							"r.station_name,"+
							"r.station_route_code,"+
							"r.line_code,"+
							"r.station_code,"+
							"r.station_mark,"+
							"r.directions,"+
							"r.distances,"+
							"r.to_time," +
							"r.end_time," +
							"r.descriptions,"+
							"r.create_by,"+
							"r.create_date,"+
							"r.update_by,"+
							"r.first_time,"+
							"r.versions,"+
							"r.out_station_nmber,"+
							"r.update_date FROM bsth_c_stationroute r where r.line = ?1 and r.directions = ?2) a"+
							" LEFT JOIN bsth_c_station b on a.station=b.id", nativeQuery=true)
	List<Object[]> findPoints(int line,int directions);
}