SectionRepository.java
1.88 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
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 int sectionMaxId();
@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) "+
"VALUES (?1 , ?2 , ?3 , ?4 , ?5 , "+
"?6 , GEOMFROMTEXT(?7) , GEOMFROMTEXT(?8) , ?9 , ?10 ,"+
"?11 , ?12 , ?13 , ?14 , ?15 ,"+
"?16 , ?17 "+
")", 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);
}