【停车场车辆管理系统】从零搭建——AdminController搭建
【停车场车辆管理系统】从零搭建——UserController搭建
model类
model类和数据库是呈一一对应关系的,
里面的属性前期也是主要根据数据表中的字段来构建的,在后期可能因为功能所需而添加一些其他属性,但前期还是以与数据表吻合为主。
上一篇中提到的utilModel也是由于后期功能所需而添加的,等到相关部分再进行讲解。(其实我的utilModel这个方法用的并不好,只能算是实现了功能)
这一部分没什么好讲解的,首先根据数据库字段构造实体对象的属性,然后创建无参构造类和有参构造类,再创建getter、setter方法。当然,属性名可以和字段不一样,实体类名也可以和数据表名不一样,但是为了方便和清晰,尽量一一对应,不然后面写mapper的时候容易混淆。
这部分完全没难度,直接贴代码吧。
Admin
package com.example.vehiclemanagement.model;
public class Admin {
private Integer adminId;
private String adminName;
private String adminPhone;
private String adminPassword;
private Integer cityId;
public Admin() {
}
public Integer getAdminId() {
return adminId;
}
public void setAdminId(Integer adminId) {
this.adminId = adminId;
}
public String getAdminName() {
return adminName;
}
public void setAdminName(String adminName) {
this.adminName = adminName;
}
public String getAdminPassword() {
return adminPassword;
}
public void setAdminPassword(String adminPassword) {
this.adminPassword = adminPassword;
}
public String getAdminPhone() {
return adminPhone;
}
public void setAdminPhone(String adminPhone) {
this.adminPhone = adminPhone;
}
public Integer getCityId() {
return cityId;
}
public void setCityId(Integer cityId) {
this.cityId = cityId;
}
public Admin(String adminName, String adminPhone, String adminPassword, Integer cityId) {
this.adminName = adminName;
this.adminPhone = adminPhone;
this.adminPassword = adminPassword;
this.cityId = cityId;
}
public Admin(Integer adminId, String adminName, String adminPhone, String adminPassword, Integer cityId) {
this.adminId = adminId;
this.adminName = adminName;
this.adminPhone = adminPhone;
this.adminPassword = adminPassword;
this.cityId = cityId;
}
}
Car
package com.example.vehiclemanagement.model;
/**
* @BelongsProject: vehicle-management-java
* @BelongsPackage: com.example.vehiclemanagement.model
* @Author: ZhShy
* @CreateTime: 2022-03-08 14:39
* @Description:
*/
public class User {
private Integer userId;
private String userName;
private String userPhone;
private Integer cityId;
private String userAddress;
private String userPassword;
public Integer getUserId() {
return userId;
}
public void setUserId(Integer userId) {
this.userId = userId;
}
public String getUserName() {
return userName;
}
public void setUserName(String userName) {
this.userName = userName;
}
public String getUserPhone() {
return userPhone;
}
public void setUserPhone(String userPhone) {
this.userPhone = userPhone;
}
public Integer getCityId() {
return cityId;
}
public void setCityId(Integer cityId) {
this.cityId = cityId;
}
public String getUserAddress() {
return userAddress;
}
public void setUserAddress(String userAddress) {
this.userAddress = userAddress;
}
public String getUserPassword() {
return userPassword;
}
public void setUserPassword(String userPassword) {
this.userPassword = userPassword;
}
public User(Integer userId, String userName, String userPhone, String userAddress, String userPassword) {
this.userId = userId;
this.userName = userName;
this.userPhone = userPhone;
this.userAddress = userAddress;
this.userPassword = userPassword;
}
public User() {
}
public User(Integer userId, String userName, String userPhone, Integer cityId, String userAddress, String userPassword) {
this.userId = userId;
this.userName = userName;
this.userPhone = userPhone;
this.cityId = cityId;
this.userAddress = userAddress;
this.userPassword = userPassword;
}
}
City
package com.example.vehiclemanagement.model;
/**
* @BelongsProject: vehicle-management-java
* @BelongsPackage: com.example.vehiclemanagement.model
* @Author: ZhShy
* @CreateTime: 2022-03-08 14:34
* @Description:
*/
public class City {
private Integer cityId;
private String cityName;
public Integer getCityId() {
return cityId;
}
public void setCityId(Integer cityId) {
this.cityId = cityId;
}
public String getCityName() {
return cityName;
}
public void setCityName(String cityName) {
this.cityName = cityName;
}
public City(String cityName) {
this.cityName = cityName;
}
public City() {
}
public City(Integer cityId, String cityName) {
this.cityId = cityId;
this.cityName = cityName;
}
}
Park
package com.example.vehiclemanagement.model;
/**
* @BelongsProject: vehicle-management-java
* @BelongsPackage: com.example.vehiclemanagement.model
* @Author: ZhShy
* @CreateTime: 2022-03-08 14:30
* @Description:
*/
public class Park {
private Integer parkId;
private String parkNumber;
private Integer cityId;
private Integer parkState;
private Double rentPrice;
private Double parkingPrice;
private Integer carId;
public Park(String parkNumber, Integer cityId, Integer parkState, Double rentPrice, Double parkingPrice, Integer carId) {
this.parkNumber = parkNumber;
this.cityId = cityId;
this.parkState = parkState;
this.rentPrice = rentPrice;
this.parkingPrice = parkingPrice;
this.carId = carId;
}
public Park(String parkNumber, Integer cityId, Double rentPrice, Double parkingPrice) {
this.parkNumber = parkNumber;
this.cityId = cityId;
this.rentPrice = rentPrice;
this.parkingPrice = parkingPrice;
}
public Integer getParkId() {
return parkId;
}
public void setParkId(Integer parkId) {
this.parkId = parkId;
}
public String getParkNumber() {
return parkNumber;
}
public void setParkNumber(String parkNumber) {
this.parkNumber = parkNumber;
}
public Integer getCityId() {
return cityId;
}
public void setCityId(Integer cityId) {
this.cityId = cityId;
}
public Integer getParkState() {
return parkState;
}
public void setParkState(Integer parkState) {
this.parkState = parkState;
}
public Double getRentPrice() {
return rentPrice;
}
public void setRentPrice(Double rentPrice) {
this.rentPrice = rentPrice;
}
public Double getParkingPrice() {
return parkingPrice;
}
public void setParkingPrice(Double parkingPrice) {
this.parkingPrice = parkingPrice;
}
public Integer getCarId() {
return carId;
}
public void setCarId(Integer carId) {
this.carId = carId;
}
public Park(Integer parkId, String parkNumber, Integer cityId, Integer parkState, Double rentPrice, Double parkingPrice) {
this.parkId = parkId;
this.parkNumber = parkNumber;
this.cityId = cityId;
this.parkState = parkState;
this.rentPrice = rentPrice;
this.parkingPrice = parkingPrice;
}
public Park() {
}
public Park(Integer parkId, String parkNumber, Integer cityId, Integer parkState, Double rentPrice, Double parkingPrice, Integer carId) {
this.parkId = parkId;
this.parkNumber = parkNumber;
this.cityId = cityId;
this.parkState = parkState;
this.rentPrice = rentPrice;
this.parkingPrice = parkingPrice;
this.carId = carId;
}
}
ParkingOrder
package com.example.vehiclemanagement.model;
/**
* @BelongsProject: vehicle-management-java
* @BelongsPackage: com.example.vehiclemanagement.model
* @Author: ZhShy
* @CreateTime: 2022-03-08 14:36
* @Description:
*/
public class ParkingOrder {
private Integer parkingOrderId;
private Integer parkId;
private Integer carId;
private Integer userId;
private Double parkingOrderPrice;
private String parkingTime;
private String expirationTime;
private Integer parkingOrderState;
private Integer payState;
private Integer cityId;
@Override
public String toString() {
return "ParkingOrder{" +
"parkingOrderId=" + parkingOrderId +
", parkId=" + parkId +
", carId=" + carId +
", userId=" + userId +
", parkingOrderPrice=" + parkingOrderPrice +
", parkingTime='" + parkingTime + '\'' +
", expirationTime='" + expirationTime + '\'' +
", parkingOrderState=" + parkingOrderState +
", payState=" + payState +
", cityId=" + cityId +
'}';
}
public Integer getCityId() {
return cityId;
}
public void setCityId(Integer cityId) {
this.cityId = cityId;
}
public ParkingOrder(Integer parkId, Integer carId, Integer userId, Double parkingOrderPrice, String parkingTime, String expirationTime, Integer parkingOrderState, Integer payState, Integer cityId) {
this.parkId = parkId;
this.carId = carId;
this.userId = userId;
this.parkingOrderPrice = parkingOrderPrice;
this.parkingTime = parkingTime;
this.expirationTime = expirationTime;
this.parkingOrderState = parkingOrderState;
this.payState = payState;
this.cityId = cityId;
}
public ParkingOrder(Integer parkingOrderId, Integer parkId, Integer carId, Integer userId, Double parkingOrderPrice, String parkingTime, String expirationTime, Integer parkingOrderState, Integer payState, Integer cityId) {
this.parkingOrderId = parkingOrderId;
this.parkId = parkId;
this.carId = carId;
this.userId = userId;
this.parkingOrderPrice = parkingOrderPrice;
this.parkingTime = parkingTime;
this.expirationTime = expirationTime;
this.parkingOrderState = parkingOrderState;
this.payState = payState;
this.cityId = cityId;
}
public Integer getParkingOrderId() {
return parkingOrderId;
}
public void setParkingOrderId(Integer parkingOrderId) {
this.parkingOrderId = parkingOrderId;
}
public Integer getParkId() {
return parkId;
}
public void setParkId(Integer parkId) {
this.parkId = parkId;
}
public Integer getCarId() {
return carId;
}
public void setCarId(Integer carId) {
this.carId = carId;
}
public Integer getUserId() {
return userId;
}
public void setUserId(Integer userId) {
this.userId = userId;
}
public Double getParkingOrderPrice() {
return parkingOrderPrice;
}
public void setParkingOrderPrice(Double parkingOrderPrice) {
this.parkingOrderPrice = parkingOrderPrice;
}
public String getParkingTime() {
return parkingTime;
}
public void setParkingTime(String parkingTime) {
this.parkingTime = parkingTime;
}
public String getExpirationTime() {
return expirationTime;
}
public void setExpirationTime(String expirationTime) {
this.expirationTime = expirationTime;
}
public Integer getParkingOrderState() {
return parkingOrderState;
}
public void setParkingOrderState(Integer parkingOrderState) {
this.parkingOrderState = parkingOrderState;
}
public Integer getPayState() {
return payState;
}
public void setPayState(Integer payState) {
this.payState = payState;
}
public ParkingOrder(Integer parkingOrderId, Integer parkId, Integer userId, Double parkingOrderPrice, String parkingTime, String expirationTime, Integer parkingOrderState, Integer payState) {
this.parkingOrderId = parkingOrderId;
this.parkId = parkId;
this.userId = userId;
this.parkingOrderPrice = parkingOrderPrice;
this.parkingTime = parkingTime;
this.expirationTime = expirationTime;
this.parkingOrderState = parkingOrderState;
this.payState = payState;
}
public ParkingOrder() {
}
public ParkingOrder(Integer parkingOrderId, Integer parkId, Integer carId, Integer userId, Double parkingOrderPrice, String parkingTime, String expirationTime, Integer parkingOrderState, Integer payState) {
this.parkingOrderId = parkingOrderId;
this.parkId = parkId;
this.carId = carId;
this.userId = userId;
this.parkingOrderPrice = parkingOrderPrice;
this.parkingTime = parkingTime;
this.expirationTime = expirationTime;
this.parkingOrderState = parkingOrderState;
this.payState = payState;
}
}
RentApplication
package com.example.vehiclemanagement.model;
/**
* @BelongsProject: vehicle-management-java
* @BelongsPackage: com.example.vehiclemanagement.model
* @Author: ZhShy
* @CreateTime: 2022-03-08 14:38
* @Description:
*/
public class RentApplication {
private Integer rentApplicationId;
private Integer parkId;
private Integer carId;
private Integer userId;
private Integer rentApplicationState;
@Override
public String toString() {
return "RentApplication{" +
"rentApplicationId=" + rentApplicationId +
", parkId=" + parkId +
", carId=" + carId +
", userId=" + userId +
", rentApplicationState=" + rentApplicationState +
'}';
}
public Integer getRentApplicationId() {
return rentApplicationId;
}
public void setRentApplicationId(Integer rentApplicationId) {
this.rentApplicationId = rentApplicationId;
}
public Integer getParkId() {
return parkId;
}
public void setParkId(Integer parkId) {
this.parkId = parkId;
}
public Integer getCarId() {
return carId;
}
public void setCarId(Integer carId) {
this.carId = carId;
}
public Integer getUserId() {
return userId;
}
public void setUserId(Integer userId) {
this.userId = userId;
}
public Integer getRentApplicationState() {
return rentApplicationState;
}
public void setRentApplicationState(Integer rentApplicationState) {
this.rentApplicationState = rentApplicationState;
}
public RentApplication(Integer rentApplicationId, Integer parkId, Integer userId, Integer rentApplicationState) {
this.rentApplicationId = rentApplicationId;
this.parkId = parkId;
this.userId = userId;
this.rentApplicationState = rentApplicationState;
}
public RentApplication() {
}
public RentApplication(Integer rentApplicationId, Integer parkId, Integer carId, Integer userId, Integer rentApplicationState) {
this.rentApplicationId = rentApplicationId;
this.parkId = parkId;
this.carId = carId;
this.userId = userId;
this.rentApplicationState = rentApplicationState;
}
}
User
package com.example.vehiclemanagement.model;
/**
* @BelongsProject: vehicle-management-java
* @BelongsPackage: com.example.vehiclemanagement.model
* @Author: ZhShy
* @CreateTime: 2022-03-08 14:39
* @Description:
*/
public class User {
private Integer userId;
private String userName;
private String userPhone;
private Integer cityId;
private String userAddress;
private String userPassword;
public Integer getUserId() {
return userId;
}
public void setUserId(Integer userId) {
this.userId = userId;
}
public String getUserName() {
return userName;
}
public void setUserName(String userName) {
this.userName = userName;
}
public String getUserPhone() {
return userPhone;
}
public void setUserPhone(String userPhone) {
this.userPhone = userPhone;
}
public Integer getCityId() {
return cityId;
}
public void setCityId(Integer cityId) {
this.cityId = cityId;
}
public String getUserAddress() {
return userAddress;
}
public void setUserAddress(String userAddress) {
this.userAddress = userAddress;
}
public String getUserPassword() {
return userPassword;
}
public void setUserPassword(String userPassword) {
this.userPassword = userPassword;
}
public User(Integer userId, String userName, String userPhone, String userAddress, String userPassword) {
this.userId = userId;
this.userName = userName;
this.userPhone = userPhone;
this.userAddress = userAddress;
this.userPassword = userPassword;
}
public User() {
}
public User(Integer userId, String userName, String userPhone, Integer cityId, String userAddress, String userPassword) {
this.userId = userId;
this.userName = userName;
this.userPhone = userPhone;
this.cityId = cityId;
this.userAddress = userAddress;
this.userPassword = userPassword;
}
}