SectionRepository.java
4.15 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
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
package com.bsth.repository;
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.Section;
/**
*
* @Interface: SectionRepository(路段Repository数据持久层接口)
*
* @Extends : BaseRepository
*
* @Description: TODO(路段Repository数据持久层接口)
*
* @Author bsth@lq
*
* @Date 2016年05月03日 上午9:21:17
*
* @Version 公交调度系统BS版 0.1
*
*/
@Repository
public interface SectionRepository extends BaseRepository<Section, Integer> {
// 查询最大ID
@Query(value = "SELECT IFNULL(num,0) as maxId from (SELECT MAX(id) as num FROM bsth_c_section) k"
, nativeQuery=true)
public long sectionMaxId();
/**
* @Description :TODO(系统规划路段保存)
*
* @param map <sectionCode: 路段编码;sectionName:路段名称;crosesRoad:交叉路;endNode:终止节点;startNode:起始节点;
*
* middleNode:线路ID;gsectionVector:路段矢量(空间坐标点集合)WGS坐标点;bsectionVector:路段矢量(空间坐标点集合)--百度原始坐标坐标点;
*
* sectionType:路段类型 ;csectionVector:路段矢量(空间坐标点集合)--城建坐标点;roadCoding:路段编码;sectionDistance:路段距离;
*
* sectionTime:路段时间;dbType: 经纬坐标类型;speedLimit:限速;descriptions:描述;versions:版本号>
*/
@Transactional
@Modifying
@Query(value="INSERT INTO bsth_c_section "+
"(section_code , section_name , croses_road , end_node, start_node ,"+
"middle_node , gsection_vector, bsection_vector , section_type , csection_vector,"+
"road_coding , section_distance , section_time , db_type, speed_limit ,"+
"descriptions , versions,id) "+
"VALUES (?1 , ?2 , ?3 , ?4 , ?5 , "+
"?6 , ST_GeomFromText(?7) , ST_GeomFromText(?8) , ?9 , ?10 ,"+
"?11 , ?12 , ?13 , ?14 , ?15 ,"+
"?16 , ?17, ?18"+
")", nativeQuery=true)
public void systemSave(String sectionCode , String sectionName , String crosesRoad , String endNode , String startNode,
String middleNode,String gsectionVector,String bsectionVector, String sectionType,String csectionVector,
String roadCoding,double sectionDistance,double sectionTime,String dbType,double speedLimit,
String descriptions, int versions,int id);
/**
* @Description :TODO(编辑线路走向)
*
* @param map <sectionId:路段ID; gsectionVector:折线WGS坐标;bsectionVector:折线百度坐标>
*
* @return Map<String, Object> <SUCCESS ; ERROR>
*/
@Transactional
@Modifying
@Query(value="UPDATE bsth_c_section SET " +
"gsection_vector = ST_GeomFromText(?2) , " +
"bsection_vector = ST_GeomFromText(?3)," +
"section_code = ?4," +
"section_name = ?5," +
"croses_road = ?6," +
"end_node = ?7," +
"start_node = ?8," +
"middle_node = ?9," +
"section_type = ?10," +
"csection_vector = ?11," +
"road_coding = ?12," +
"section_distance = ?13," +
"section_time = ?14," +
"db_type = ?15," +
"speed_limit = ?16," +
"descriptions = ?17," +
"versions = ?18," +
"create_by = ?19," +
"create_date = str_to_date(?20,'%Y-%m-%d %H:%i:%s')," +
"update_by = ?21," +
"update_date = str_to_date(?22,'%Y-%m-%d %H:%i:%s')" +
" WHERE id = ?1", nativeQuery=true)
public void sectionUpdate(Integer sectionId,String gsectionVector,String bsectionVector,String sectionCode,String sectionName,
String crosesRoad,String endNode,String startNode,String middleNode,String sectionType,
String csectionVector,String roadCoding,Double sectionDistance,Double sectionTime,String dbType,
Double speedLimit,String descriptions,Integer version,Integer createBy,String createDate,
Integer updateBy,String updateDate);
}