diff --git a/src/main/java/Team5/SmartTowns/Data/location.java b/src/main/java/Team5/SmartTowns/Data/location.java index f74adb71039eb1a254e379e56a16ca16d7e3cf32..61df39a46df09e733fdcaa185adb9e596021bcb6 100644 --- a/src/main/java/Team5/SmartTowns/Data/location.java +++ b/src/main/java/Team5/SmartTowns/Data/location.java @@ -1,12 +1,18 @@ -//Holds variable data for the locations table +//Holds variable data for the locations table (landmarks) package Team5.SmartTowns.Data; import lombok.AllArgsConstructor; import lombok.Data; - +//insert into locations (locationID, locationName , locationEmail,locationDescription,locationPlace, +// locationTrailID +// ) value ('1', 'St Cenydd','','location description here','Caerphilly',0101); @Data @AllArgsConstructor public class location { private int locationID; - private String name; + private String locationName; + private String locationEmail; + private String locationDescription; + private String locationPlace; + private int locationTrailID; } diff --git a/src/main/java/Team5/SmartTowns/Data/locationRepository.java b/src/main/java/Team5/SmartTowns/Data/locationRepository.java index 772f335edeb43376b96a4a2045ceddbbb8bf9690..a169497813c9286e94d65657f43bd8d5ee81e509 100644 --- a/src/main/java/Team5/SmartTowns/Data/locationRepository.java +++ b/src/main/java/Team5/SmartTowns/Data/locationRepository.java @@ -1,8 +1,9 @@ -//Holds locations data repository +//Holds locations data repository (landmarks) package Team5.SmartTowns.Data; import java.util.List; + public interface locationRepository { List<location> getAllLocation(); diff --git a/src/main/java/Team5/SmartTowns/Data/locationRepositoryJDBC.java b/src/main/java/Team5/SmartTowns/Data/locationRepositoryJDBC.java index b11671ee54d102354431f6917b297ba179f388d9..d41141a3dea78a3d80a0e9607be7cd99771b9b65 100644 --- a/src/main/java/Team5/SmartTowns/Data/locationRepositoryJDBC.java +++ b/src/main/java/Team5/SmartTowns/Data/locationRepositoryJDBC.java @@ -19,7 +19,11 @@ public class locationRepositoryJDBC implements locationRepository { private void setlocationMapper(){ locationMapper = (rs, i) -> new location( rs.getInt("locationID"), - rs.getString("name") + rs.getString("locationName"), + rs.getString("locationEmail"), + rs.getString("locationDescription"), + rs.getString("locationPlace"), + rs.getInt("locationTrailID") ); } public List<location> getAllLocation(){ diff --git a/src/main/resources/data.sql b/src/main/resources/data.sql index f7656769c7d1b2afd5e78e3a93c3cd3ed44abe3b..e8a1fd0deda4e8a27557f7e935b42d1c6e4c1ed4 100644 --- a/src/main/resources/data.sql +++ b/src/main/resources/data.sql @@ -7,5 +7,35 @@ insert into trails (trailID, Name) value ('1', 'Caerphilly Coffee Trail'); insert into trails (trailID, Name) value ('2', 'Penarth Dragon Trail'); delete from locations; -insert into locations (locationID, Name) value ('1', 'Caerphilly'); -insert into locations (locationID, Name) value ('2', 'Penarth'); \ No newline at end of file +insert into locations (locationID, locationName , locationEmail,locationDescription,locationPlace, locationTrailID) value ('1', 'St Cenydd','','location description here','Caerphilly',0101); +insert into locations (locationID, locationName , locationEmail,locationDescription,locationPlace, locationTrailID) value ('2', 'The Castle','','location description here','Caerphilly',0101); +insert into locations (locationID, locationName , locationEmail,locationDescription,locationPlace, locationTrailID) value ('3', 'Medieval Trades','','location description here','Caerphilly',0101); +insert into locations (locationID, locationName , locationEmail,locationDescription,locationPlace, locationTrailID) value ('4', 'The Queen''s War','','location description here','Caerphilly',0101); +insert into locations (locationID, locationName , locationEmail,locationDescription,locationPlace, locationTrailID) value ('5', 'The Green Lady','','location description here','Caerphilly',0101); +insert into locations (locationID, locationName , locationEmail,locationDescription,locationPlace, locationTrailID) value ('6', 'Armoury','','location description here','Caerphilly',0101); +insert into locations (locationID, locationName , locationEmail,locationDescription,locationPlace, locationTrailID) value ('7', 'Architecture','','location description here','Caerphilly',0101); +insert into locations (locationID, locationName , locationEmail,locationDescription,locationPlace, locationTrailID) value ('8', '21st Century Landmark','','location description here','Caerphilly',0101); + +insert into locations (locationID, locationName , locationEmail,locationDescription,locationPlace, locationTrailID) value ('9', 'JD Wetherspoons-Malcolm Uphill','','location description here','Caerphilly',0102); +insert into locations (locationID, locationName , locationEmail,locationDescription,locationPlace, locationTrailID) value ('10', 'Caerphilly Cwtch','','location description here','Caerphilly',0102); +insert into locations (locationID, locationName , locationEmail,locationDescription,locationPlace, locationTrailID) value ('11', 'Caerphilly Conservative Club','','location description here','Caerphilly',0102); +insert into locations (locationID, locationName , locationEmail,locationDescription,locationPlace, locationTrailID) value ('12', 'The King''s Arms','','location description here','Caerphilly',0102); + +insert into locations (locationID, locationName , locationEmail,locationDescription,locationPlace, locationTrailID) value ('13', 'Caerphilly Bus Station','','location description here','Caerphilly',0103); +insert into locations (locationID, locationName , locationEmail,locationDescription,locationPlace, locationTrailID) value ('14', 'The Medieval Courthouse','','location description here','Caerphilly',0103); +insert into locations (locationID, locationName , locationEmail,locationDescription,locationPlace, locationTrailID) value ('15', 'Caerphilly Castle','','location description here','Caerphilly',0103); +insert into locations (locationID, locationName , locationEmail,locationDescription,locationPlace, locationTrailID) value ('16', 'Ty Vaughan House','','location description here','Caerphilly',0103); +# +# locationID bigint auto_increment primary key, +# locationName varchar(128), +# locationEmail varchar(128), +# locationDescription varchar(255), +# locationTrailID varchar(128) +# +# +# <option value=0 disabled selected>Select Trail</option> +# <option value=0101>(Caerphilly) Castle Trail</option> +# <option value=0102>(Caerphilly) Pub Trail</option> +# <option value=0103>(Caerphilly) Heritage Trail</option> +# <option value=0201>(Risca) Heritage and Culture Trail</option> +# <option value=0301>(Penarth) Esplanade Trail</option> \ No newline at end of file diff --git a/src/main/resources/schema.sql b/src/main/resources/schema.sql index 8d9e102d1f6b02b1f864e396f591a4a61aad8b41..ecbbaf28daf1c47b257b29f544df7d1b43c01b04 100644 --- a/src/main/resources/schema.sql +++ b/src/main/resources/schema.sql @@ -5,10 +5,15 @@ create table if not exists trails name varchar(128) ) engine=InnoDB; drop table if exists locations; + create table if not exists locations ( locationID bigint auto_increment primary key, - name varchar(128) + locationName varchar(128), + locationEmail varchar(128), + locationDescription varchar(255), + locationPlace varchar(255), + locationTrailID varchar(128) ) engine=InnoDB; drop table if exists users; create table if not exists users