CarParkRepository.java
5.73 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
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
package com.bsth.repository;
import java.util.Date;
import java.util.List;
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.CarPark;
@Repository
public interface CarParkRepository extends BaseRepository<CarPark, Integer>{
// 查询最大ID
@Query(value = "SELECT IFNULL(num,0) as maxId from (SELECT MAX(id) as num FROM bsth_c_car_park) k"
, nativeQuery=true)
public long carParkMaxId();
@Transactional
@Modifying
@Query(value="INSERT INTO bsth_c_car_park (" +
" area , company , park_code , park_name , branche_company , " +
"create_by , create_date , descriptions , destroy, update_by, " +
"update_date , versions , b_center_point , b_park_point ,db_type, " +
"g_center_point, g_park_point, radius, shapes_type) " +
" VALUES(" +
"?1 , ?2 , ?3 , ?4 , ?5," +
"?6 , str_to_date(?7,'%Y-%m-%d %H:%i:%s') , ?8 , ?9 , ?10," +
"str_to_date(?11,'%Y-%m-%d %H:%i:%s'), ?12 ,?13,ST_GeomFromText(?14), ?15, " +
"?16, ST_GeomFromText(?17), ?18,?19)", nativeQuery=true)
public int carParkSave(Double area,String company,String parkCode,String parkName,
String brancheCompany,Integer createBy,String createDate,String descriptions,Integer destroy,
Integer updateBy,String updateDate,Integer versions,String bCenterPoint,String bParkPoint,
String dbType,String gCenterPoint,String gParkPoint,Integer radius,String shapesType);
/**
* @Description :TODO(查询路段信息)
*
* @param map <id:路段路由ID>
*
* @return List<Object[]>
*/
@Query(value ="SELECT k.id AS carParkId," +
"k.area AS carParkArea," +
"k.company AS carParkCompany," +
"k.park_code AS carParkCode," +
"k.park_name AS carParkName," +
"k.branche_company AS carParkBrancheCompany," +
"k.create_by AS carParkCreateBy," +
"k.create_date AS carParkCreateDate," +
"k.descriptions AS carParkDescriptions," +
"k.destroy AS carParkDestroy," +
"k.update_by AS carParkUpdate," +
"k.update_date AS carParkUpdateDate," +
"k.versions AS carParkVersions," +
"k.b_center_point AS carParkBcenterPoint," +
"ST_AsText(k.b_park_point) AS carParkBparkPoint," +
"k.g_center_point AS carParkGcenterPoint," +
"ST_AsText(k.g_park_point) AS carParkGparkPoint, " +
"k.db_type AS carParkDBtype," +
"k.radius AS carParkRadius," +
"k.shapes_type AS carParkShapesType FROM bsth_c_car_park k where k.id = ?1", nativeQuery=true)
List<Object[]> findCarParkInfoFormId(int id);
@Transactional
@Modifying
@Query(value="UPDATE bsth_c_car_park SET " +
"area = ?1 , " +
"company = ?2 , " +
"park_code = ?3 , " +
"park_name = ?4 , " +
"branche_company = ?5 , " +
"create_by = ?6 , " +
"create_date = str_to_date(?7,'%Y-%m-%d %H:%i:%s') , " +
"descriptions = ?8 , " +
"destroy = ?9 , " +
"update_by = ?10 , " +
"update_date =str_to_date(?11,'%Y-%m-%d %H:%i:%s') , " +
"versions = ?12 , " +
"b_center_point = ?13 , " +
"g_center_point = ?14 , " +
"b_park_point = ST_GeomFromText(?15) , " +
"g_park_point = ST_GeomFromText(?16) , " +
"db_type = ?17 , " +
"radius = ?18 , " +
"shapes_type = ?19 " +
" WHERE id = ?20 ", nativeQuery=true)
public void carParkUpdate(double area,String company,String parkCode,String parkName,String brancheCompany,
Integer createBy ,String createDate,String descriptions,Integer destroy,Integer updateBy,
String updateDate,Integer versions,String bCenterPoint,String gCenterPoint,String bParkPoint,
String gParkPoint,String dbType,Integer radius,String shapesType,Integer id );
@Query(value = "select st_astext(g_park_point), shapes_type, g_center_point, radius,park_code,park_name from bsth_c_car_park where park_code=?1", nativeQuery = true)
public Object[][] findBufferArea(String parkCode);
@Query(value ="SELECT p.park_name,p.park_code from bsth_c_car_park p where p.park_code = ?1", nativeQuery=true)
List<Object[]> selectTccInfoByCode(String parkCode);
@Query(value ="select c.id, c.area,c.company,c.park_code,c.park_name,c.branche_company,c.create_by,c.create_date,c.descriptions,c.destroy,c.update_by,c.update_date,c.versions,c.b_center_point,ST_AsText(c.b_park_point) b_park_point,c.g_center_point,ST_AsText(c.g_park_point) g_park_point,c.db_type,c.radius,c.shapes_type from bsth_c_line_information l left join bsth_c_car_park c on l.car_park = c.park_code where l.line = ?1", nativeQuery=true)
CarPark findByLineId(int lineId);
@Transactional
@Modifying
@Query(value="UPDATE bsth_c_car_park SET " +
"area = ?1 , " +
"company = ?2 , " +
"park_name = ?3 , " +
"branche_company = ?4 , " +
"descriptions = ?5 , " +
"destroy = ?6 , " +
"update_date =?7 , " +
"versions = ?8 , " +
"b_center_point = ?9 , " +
"g_center_point = ?10 , " +
"b_park_point = ST_GeomFromText(?11) , " +
"g_park_point = ST_GeomFromText(?12) , " +
"db_type = ?13 , " +
"radius = ?14 , " +
"shapes_type = ?15 " +
" WHERE park_code = ?16 ", nativeQuery=true)
public int update(double area, String company, String parkName, String brancheCompany,
String descriptions, Integer destroy, Date updateDate, Integer versions, String bCenterPoint,
String gCenterPoint, String bParkPoint,
String gParkPoint, String dbType, Integer radius, String shapesType, String parkCode );
}