LsInoutSectionRouteRepository.java
1.84 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
package com.bsth.repository;
import com.bsth.entity.LsInoutSectionRoute;
import com.bsth.entity.LsSectionRoute;
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 java.util.List;
/**
*
* @Interface: SectionRouteRepository(路段路由Repository数据持久层接口)
*
* @Extends : BaseRepository
*
* @Description: TODO(路段路由Repository数据持久层接口)
*
* @Author bsth@lq
*
* @Version 公交调度系统BS版 0.1
*
*/
@Repository
public interface LsInoutSectionRouteRepository extends BaseRepository<LsInoutSectionRoute, Long> {
/**
* 查询待更新线路的路段路由
*/
@Query(value = "SELECT sr FROM LsInoutSectionRoute sr where sr.line.id =?1 and sr.versions=?2 and sr.start=?3 and sr.end=?4 and sr.destroy=0")
List<LsInoutSectionRoute> getRouteByStartEnd(int lineId, int version, String start, String end);
/**
*
* @param lineCode
* @param version
* @param start
* @param end
* @param sectionrouteCode
*/
@Modifying
@Query(value="UPDATE bsth_c_ls_inout_sectionroute set sectionroute_code = (sectionroute_code+1) where line_code = ?1 and versions = ?2 and start = ?3 and end = ?4 and sectionroute_code >=?5 and destroy = 0", nativeQuery=true)
public void sectionUpdSectionRouteCode(String lineCode, int version, String start, String end, Integer sectionrouteCode);
/**
* 撤销线路某版本进出场
* @param lineCode
* @param version
* @param start
* @param end
*/
@Modifying
@Query(value="UPDATE bsth_c_ls_inout_sectionroute set destroy = 1 where line_code = ?1 and versions = ?2 and start = ?3 and end = ?4", nativeQuery=true)
public void destroy(String lineCode, int version, String start, String end);
}