LsSectionRouteRepository.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
package com.bsth.repository;
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 java.util.List;
/**
*
* @Interface: SectionRouteRepository(路段路由Repository数据持久层接口)
*
* @Extends : BaseRepository
*
* @Description: TODO(路段路由Repository数据持久层接口)
*
* @Author bsth@lq
*
* @Version 公交调度系统BS版 0.1
*
*/
@Repository
public interface LsSectionRouteRepository extends BaseRepository<LsSectionRoute, Integer> {
/**
* 查询待更新线路的路段路由
*/
@Query(value = "SELECT sr FROM LsSectionRoute sr where sr.line.id =?1 and sr.lineCode=?2 and sr.versions=?3 and sr.destroy=0")
public List<LsSectionRoute> findupdated(Integer lineId,String lineCode,Integer versions);
/**
* 更新路线前删除线路版本下历史原有路段路由
*/
@Modifying
@Query(value="DELETE from bsth_c_ls_sectionroute where line = ?1 and directions = ?2 and versions=?3", nativeQuery=true)
public void batchDelete(Integer line, Integer dir, Integer versions);
/**
* 更新路线前撤销线路版本下历史原有路段路由
*/
@Modifying
@Query(value="UPDATE bsth_c_ls_sectionroute set destroy = 1 where line = ?1 and directions = ?2 and versions=?3", nativeQuery=true)
public void batchDestroy(Integer sectionRouteLine, Integer directions, Integer versions);
@Modifying
@Query(value="UPDATE bsth_c_ls_sectionroute set sectionroute_code = (sectionroute_code+100) where line_code = ?1 and directions = ?2 and sectionroute_code >=?3 and destroy = 0", nativeQuery=true)
public void sectionUpdSectionRouteCode(String lineCode,Integer dir,Integer routeCod);
}