mirror of
https://github.com/spring-projects/spring-petclinic.git
synced 2025-07-23 16:25:49 +00:00
Adding email field
This commit is contained in:
parent
a30b0bd143
commit
d74b9245e2
5 changed files with 28 additions and 1 deletions
|
@ -58,6 +58,11 @@ public class Owner extends Person {
|
|||
@NotEmpty
|
||||
@Digits(fraction = 0, integer = 10)
|
||||
private String telephone;
|
||||
|
||||
|
||||
@Column(name = "email")
|
||||
@NotEmpty
|
||||
private String email;
|
||||
|
||||
@OneToMany(cascade = CascadeType.ALL, fetch = FetchType.EAGER)
|
||||
@JoinColumn(name = "owner_id")
|
||||
|
@ -87,6 +92,17 @@ public class Owner extends Person {
|
|||
public void setTelephone(String telephone) {
|
||||
this.telephone = telephone;
|
||||
}
|
||||
|
||||
|
||||
public String getEmail() {
|
||||
return email;
|
||||
}
|
||||
|
||||
public void setEmail(String email) {
|
||||
this.email = email;
|
||||
}
|
||||
|
||||
|
||||
|
||||
public List<Pet> getPets() {
|
||||
return this.pets;
|
||||
|
|
|
@ -29,7 +29,8 @@ CREATE TABLE IF NOT EXISTS owners (
|
|||
last_name TEXT,
|
||||
address TEXT,
|
||||
city TEXT,
|
||||
telephone TEXT
|
||||
telephone TEXT,
|
||||
Email TEXT
|
||||
);
|
||||
CREATE INDEX ON owners (last_name);
|
||||
|
||||
|
|
|
@ -16,6 +16,9 @@
|
|||
th:replace="~{fragments/inputField :: input ('City', 'city', 'text')}" />
|
||||
<input
|
||||
th:replace="~{fragments/inputField :: input ('Telephone', 'telephone', 'text')}" />
|
||||
|
||||
<input
|
||||
th:replace="~{fragments/inputField :: input ('Email', 'email', 'text')}" />
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<div class="col-sm-offset-2 col-sm-10">
|
||||
|
|
|
@ -26,6 +26,11 @@
|
|||
<th>Telephone</th>
|
||||
<td th:text="*{telephone}"></td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<th>Email</th>
|
||||
<td th:text="*{email}"></td>
|
||||
</tr>
|
||||
</table>
|
||||
|
||||
<a th:href="@{__${owner.id}__/edit}" class="btn btn-primary">Edit
|
||||
|
|
|
@ -13,6 +13,7 @@
|
|||
<th style="width: 200px;">Address</th>
|
||||
<th>City</th>
|
||||
<th style="width: 120px">Telephone</th>
|
||||
<th style="width: 200px">Email</th>
|
||||
<th>Pets</th>
|
||||
</tr>
|
||||
</thead>
|
||||
|
@ -24,6 +25,7 @@
|
|||
<td th:text="${owner.address}"/>
|
||||
<td th:text="${owner.city}"/>
|
||||
<td th:text="${owner.telephone}"/>
|
||||
<td th:text="${owner.email}"/>
|
||||
<td><span th:text="${#strings.listJoin(owner.pets, ', ')}"/></td>
|
||||
</tr>
|
||||
</tbody>
|
||||
|
|
Loading…
Reference in a new issue