CarParkRepository.java
4.27 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
package com.bsth.repository;
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,GeomFromText(?14), ?15, " +
"?16, GeomFromText(?17), ?18,?19)", nativeQuery=true)
public void 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," +
"AsText(k.b_park_point) AS carParkBparkPoint," +
"k.g_center_point AS carParkGcenterPoint," +
"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 = GeomFromText(?15) , " +
"g_park_point = 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[][] bufferAera(String parkCode);
}