mirror of
https://github.com/FreeeBird/hotel.git
synced 2025-11-02 05:24:46 +08:00
1.数据库重构
2.修改User注册登录接口
This commit is contained in:
@@ -3,11 +3,13 @@ package cn.mafangui.hotel.controller;
|
||||
|
||||
import cn.mafangui.hotel.entity.User;
|
||||
import cn.mafangui.hotel.service.UserService;
|
||||
import cn.mafangui.hotel.utils.StaticString;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMethod;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
|
||||
@RestController
|
||||
@@ -18,50 +20,70 @@ public class UserController {
|
||||
private UserService userService;
|
||||
/**
|
||||
* 更新资料
|
||||
* @param userName
|
||||
* @param username
|
||||
* @param password
|
||||
* @param name
|
||||
* @param phone
|
||||
* @param email
|
||||
* @param address
|
||||
* @param idNumber
|
||||
* @param idcard
|
||||
* @return
|
||||
*/
|
||||
@RequestMapping(method = RequestMethod.POST,value = "/updateProfile")
|
||||
public int updateProfile(String userName, String password, String name,
|
||||
String phone, String email, String address, String idNumber){
|
||||
User user = new User(userName,password,name,phone,email,address,idNumber);
|
||||
public int updateProfile(String username, String password, String name,String gender,
|
||||
String phone, String email, String address, String idcard){
|
||||
User user = new User(username,password,name,gender,phone,email,address,idcard);
|
||||
return userService.updateProfile(user);
|
||||
}
|
||||
|
||||
|
||||
public HashMap updatePassword(String username, String oldPassword, String newPassword){
|
||||
HashMap response = new HashMap();
|
||||
if (userService.login(username,oldPassword) == null){
|
||||
response.put(StaticString.CODE,200);
|
||||
response.put(StaticString.STATUS,"密码错误");
|
||||
}else {
|
||||
User user = new User();
|
||||
user.setPassword(newPassword);
|
||||
int result = userService.updateProfile(user);
|
||||
response.put(StaticString.DATA,result);
|
||||
}
|
||||
return response;
|
||||
}
|
||||
|
||||
/**
|
||||
* 注册
|
||||
* @param userName
|
||||
*
|
||||
* @param username
|
||||
* @param password
|
||||
* @param name
|
||||
* @param gender
|
||||
* @param phone
|
||||
* @param email
|
||||
* @param address
|
||||
* @param idNumber
|
||||
* @param idcard
|
||||
* @return
|
||||
*/
|
||||
@RequestMapping(method = RequestMethod.POST, value = "/register")
|
||||
public int userRegister(String userName, String password, String name,
|
||||
String phone, String email, String address, String idNumber){
|
||||
User user = new User(userName,password,name,phone,email,address,idNumber);
|
||||
return userService.register(user);
|
||||
public HashMap userRegister(String username, String password, String name,String gender,
|
||||
String phone, String email, String address, String idcard){
|
||||
HashMap response = new HashMap();
|
||||
User user = new User(username,password,name,phone,gender,email,address,idcard);
|
||||
response.put(StaticString.CODE,200);
|
||||
response.put(StaticString.DATA,userService.register(user));
|
||||
return response;
|
||||
}
|
||||
/**
|
||||
* 登录
|
||||
* @param userName
|
||||
* @param username
|
||||
* @param password
|
||||
* @return
|
||||
*/
|
||||
@RequestMapping(method = RequestMethod.POST, value = "/login")
|
||||
public int userLogin(String userName, String password){
|
||||
if (userService.login(userName,password) == null){
|
||||
return -1;
|
||||
}
|
||||
return 1;
|
||||
public HashMap userLogin(String username, String password){
|
||||
HashMap response = new HashMap();
|
||||
response.put(StaticString.CODE,200);
|
||||
response.put(StaticString.DATA,userService.login(username,password));
|
||||
return response;
|
||||
}
|
||||
/**
|
||||
* 查看用户资料
|
||||
|
@@ -9,13 +9,13 @@ public class CheckIn {
|
||||
|
||||
private String roomNumber;
|
||||
|
||||
private Integer roomType;
|
||||
private String roomType;
|
||||
|
||||
private Integer personNum;
|
||||
private Integer peoCount;
|
||||
|
||||
private String personName;
|
||||
private String persons;
|
||||
|
||||
private String idNumbers;
|
||||
private String ids;
|
||||
|
||||
private Date checkInTime;
|
||||
|
||||
@@ -47,36 +47,36 @@ public class CheckIn {
|
||||
this.roomNumber = roomNumber == null ? null : roomNumber.trim();
|
||||
}
|
||||
|
||||
public Integer getRoomType() {
|
||||
public String getRoomType() {
|
||||
return roomType;
|
||||
}
|
||||
|
||||
public void setRoomType(Integer roomType) {
|
||||
this.roomType = roomType;
|
||||
public void setRoomType(String roomType) {
|
||||
this.roomType = roomType == null ? null : roomType.trim();
|
||||
}
|
||||
|
||||
public Integer getPersonNum() {
|
||||
return personNum;
|
||||
public Integer getPeoCount() {
|
||||
return peoCount;
|
||||
}
|
||||
|
||||
public void setPersonNum(Integer personNum) {
|
||||
this.personNum = personNum;
|
||||
public void setPeoCount(Integer peoCount) {
|
||||
this.peoCount = peoCount;
|
||||
}
|
||||
|
||||
public String getPersonName() {
|
||||
return personName;
|
||||
public String getPersons() {
|
||||
return persons;
|
||||
}
|
||||
|
||||
public void setPersonName(String personName) {
|
||||
this.personName = personName == null ? null : personName.trim();
|
||||
public void setPersons(String persons) {
|
||||
this.persons = persons == null ? null : persons.trim();
|
||||
}
|
||||
|
||||
public String getIdNumbers() {
|
||||
return idNumbers;
|
||||
public String getIds() {
|
||||
return ids;
|
||||
}
|
||||
|
||||
public void setIdNumbers(String idNumbers) {
|
||||
this.idNumbers = idNumbers == null ? null : idNumbers.trim();
|
||||
public void setIds(String ids) {
|
||||
this.ids = ids == null ? null : ids.trim();
|
||||
}
|
||||
|
||||
public Date getCheckInTime() {
|
||||
|
55
src/main/java/cn/mafangui/hotel/entity/Department.java
Normal file
55
src/main/java/cn/mafangui/hotel/entity/Department.java
Normal file
@@ -0,0 +1,55 @@
|
||||
package cn.mafangui.hotel.entity;
|
||||
|
||||
import java.util.Date;
|
||||
|
||||
public class Department {
|
||||
private Integer departmentId;
|
||||
|
||||
private String departmentName;
|
||||
|
||||
private String remark;
|
||||
|
||||
private Date createTime;
|
||||
|
||||
private Date updateTime;
|
||||
|
||||
public Integer getDepartmentId() {
|
||||
return departmentId;
|
||||
}
|
||||
|
||||
public void setDepartmentId(Integer departmentId) {
|
||||
this.departmentId = departmentId;
|
||||
}
|
||||
|
||||
public String getDepartmentName() {
|
||||
return departmentName;
|
||||
}
|
||||
|
||||
public void setDepartmentName(String departmentName) {
|
||||
this.departmentName = departmentName == null ? null : departmentName.trim();
|
||||
}
|
||||
|
||||
public String getRemark() {
|
||||
return remark;
|
||||
}
|
||||
|
||||
public void setRemark(String remark) {
|
||||
this.remark = remark == null ? null : remark.trim();
|
||||
}
|
||||
|
||||
public Date getCreateTime() {
|
||||
return createTime;
|
||||
}
|
||||
|
||||
public void setCreateTime(Date createTime) {
|
||||
this.createTime = createTime;
|
||||
}
|
||||
|
||||
public Date getUpdateTime() {
|
||||
return updateTime;
|
||||
}
|
||||
|
||||
public void setUpdateTime(Date updateTime) {
|
||||
this.updateTime = updateTime;
|
||||
}
|
||||
}
|
@@ -92,16 +92,4 @@ public class Hotel {
|
||||
public void setUpdateTime(Date updateTime) {
|
||||
this.updateTime = updateTime;
|
||||
}
|
||||
|
||||
public Hotel() {
|
||||
}
|
||||
|
||||
public Hotel(String hotelName, String phone, String telephone, String email, String address, String website) {
|
||||
this.hotelName = hotelName;
|
||||
this.phone = phone;
|
||||
this.telephone = telephone;
|
||||
this.email = email;
|
||||
this.address = address;
|
||||
this.website = website;
|
||||
}
|
||||
}
|
@@ -1,26 +1,25 @@
|
||||
package cn.mafangui.hotel.entity;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.util.Date;
|
||||
|
||||
public class Order {
|
||||
private Integer orderId;
|
||||
|
||||
private String bookingType;
|
||||
private String orderType;
|
||||
|
||||
private String phone;
|
||||
|
||||
private String roomNumber;
|
||||
private String roomType;
|
||||
|
||||
private Integer roomType;
|
||||
private Integer numOfRoom;
|
||||
|
||||
private Date bookingDate;
|
||||
private Date orderDate;
|
||||
|
||||
private Integer bookingDays;
|
||||
private Integer orderDays;
|
||||
|
||||
private Integer orderStatus;
|
||||
|
||||
private BigDecimal orderCost;
|
||||
private Double orderCost;
|
||||
|
||||
private Date createTime;
|
||||
|
||||
@@ -34,12 +33,12 @@ public class Order {
|
||||
this.orderId = orderId;
|
||||
}
|
||||
|
||||
public String getBookingType() {
|
||||
return bookingType;
|
||||
public String getOrderType() {
|
||||
return orderType;
|
||||
}
|
||||
|
||||
public void setBookingType(String bookingType) {
|
||||
this.bookingType = bookingType == null ? null : bookingType.trim();
|
||||
public void setOrderType(String orderType) {
|
||||
this.orderType = orderType == null ? null : orderType.trim();
|
||||
}
|
||||
|
||||
public String getPhone() {
|
||||
@@ -50,36 +49,36 @@ public class Order {
|
||||
this.phone = phone == null ? null : phone.trim();
|
||||
}
|
||||
|
||||
public String getRoomNumber() {
|
||||
return roomNumber;
|
||||
}
|
||||
|
||||
public void setRoomNumber(String roomNumber) {
|
||||
this.roomNumber = roomNumber == null ? null : roomNumber.trim();
|
||||
}
|
||||
|
||||
public Integer getRoomType() {
|
||||
public String getRoomType() {
|
||||
return roomType;
|
||||
}
|
||||
|
||||
public void setRoomType(Integer roomType) {
|
||||
this.roomType = roomType;
|
||||
public void setRoomType(String roomType) {
|
||||
this.roomType = roomType == null ? null : roomType.trim();
|
||||
}
|
||||
|
||||
public Date getBookingDate() {
|
||||
return bookingDate;
|
||||
public Integer getNumOfRoom() {
|
||||
return numOfRoom;
|
||||
}
|
||||
|
||||
public void setBookingDate(Date bookingDate) {
|
||||
this.bookingDate = bookingDate;
|
||||
public void setNumOfRoom(Integer numOfRoom) {
|
||||
this.numOfRoom = numOfRoom;
|
||||
}
|
||||
|
||||
public Integer getBookingDays() {
|
||||
return bookingDays;
|
||||
public Date getOrderDate() {
|
||||
return orderDate;
|
||||
}
|
||||
|
||||
public void setBookingDays(Integer bookingDays) {
|
||||
this.bookingDays = bookingDays;
|
||||
public void setOrderDate(Date orderDate) {
|
||||
this.orderDate = orderDate;
|
||||
}
|
||||
|
||||
public Integer getOrderDays() {
|
||||
return orderDays;
|
||||
}
|
||||
|
||||
public void setOrderDays(Integer orderDays) {
|
||||
this.orderDays = orderDays;
|
||||
}
|
||||
|
||||
public Integer getOrderStatus() {
|
||||
@@ -90,11 +89,11 @@ public class Order {
|
||||
this.orderStatus = orderStatus;
|
||||
}
|
||||
|
||||
public BigDecimal getOrderCost() {
|
||||
public Double getOrderCost() {
|
||||
return orderCost;
|
||||
}
|
||||
|
||||
public void setOrderCost(BigDecimal orderCost) {
|
||||
public void setOrderCost(Double orderCost) {
|
||||
this.orderCost = orderCost;
|
||||
}
|
||||
|
||||
|
55
src/main/java/cn/mafangui/hotel/entity/OrderType.java
Normal file
55
src/main/java/cn/mafangui/hotel/entity/OrderType.java
Normal file
@@ -0,0 +1,55 @@
|
||||
package cn.mafangui.hotel.entity;
|
||||
|
||||
import java.util.Date;
|
||||
|
||||
public class OrderType {
|
||||
private Integer typeId;
|
||||
|
||||
private String type;
|
||||
|
||||
private String remark;
|
||||
|
||||
private Date createTime;
|
||||
|
||||
private Date updateTime;
|
||||
|
||||
public Integer getTypeId() {
|
||||
return typeId;
|
||||
}
|
||||
|
||||
public void setTypeId(Integer typeId) {
|
||||
this.typeId = typeId;
|
||||
}
|
||||
|
||||
public String getType() {
|
||||
return type;
|
||||
}
|
||||
|
||||
public void setType(String type) {
|
||||
this.type = type == null ? null : type.trim();
|
||||
}
|
||||
|
||||
public String getRemark() {
|
||||
return remark;
|
||||
}
|
||||
|
||||
public void setRemark(String remark) {
|
||||
this.remark = remark == null ? null : remark.trim();
|
||||
}
|
||||
|
||||
public Date getCreateTime() {
|
||||
return createTime;
|
||||
}
|
||||
|
||||
public void setCreateTime(Date createTime) {
|
||||
this.createTime = createTime;
|
||||
}
|
||||
|
||||
public Date getUpdateTime() {
|
||||
return updateTime;
|
||||
}
|
||||
|
||||
public void setUpdateTime(Date updateTime) {
|
||||
this.updateTime = updateTime;
|
||||
}
|
||||
}
|
@@ -1,6 +1,5 @@
|
||||
package cn.mafangui.hotel.entity;
|
||||
|
||||
import java.math.BigInteger;
|
||||
import java.util.Date;
|
||||
|
||||
public class Room {
|
||||
@@ -8,7 +7,7 @@ public class Room {
|
||||
|
||||
private String roomNumber;
|
||||
|
||||
private Integer roomFloor;
|
||||
private Integer typeId;
|
||||
|
||||
private String roomType;
|
||||
|
||||
@@ -16,7 +15,7 @@ public class Room {
|
||||
|
||||
private Double roomDiscount;
|
||||
|
||||
private String roomStatus;
|
||||
private Integer roomStatus;
|
||||
|
||||
private String remark;
|
||||
|
||||
@@ -40,12 +39,12 @@ public class Room {
|
||||
this.roomNumber = roomNumber == null ? null : roomNumber.trim();
|
||||
}
|
||||
|
||||
public Integer getRoomFloor() {
|
||||
return roomFloor;
|
||||
public Integer getTypeId() {
|
||||
return typeId;
|
||||
}
|
||||
|
||||
public void setRoomFloor(Integer roomFloor) {
|
||||
this.roomFloor = roomFloor;
|
||||
public void setTypeId(Integer typeId) {
|
||||
this.typeId = typeId;
|
||||
}
|
||||
|
||||
public String getRoomType() {
|
||||
@@ -53,7 +52,7 @@ public class Room {
|
||||
}
|
||||
|
||||
public void setRoomType(String roomType) {
|
||||
this.roomType = roomType;
|
||||
this.roomType = roomType == null ? null : roomType.trim();
|
||||
}
|
||||
|
||||
public Double getRoomPrice() {
|
||||
@@ -72,12 +71,12 @@ public class Room {
|
||||
this.roomDiscount = roomDiscount;
|
||||
}
|
||||
|
||||
public String getRoomStatus() {
|
||||
public Integer getRoomStatus() {
|
||||
return roomStatus;
|
||||
}
|
||||
|
||||
public void setRoomStatus(String roomStatus) {
|
||||
this.roomStatus = roomStatus == null ? null : roomStatus.trim();
|
||||
public void setRoomStatus(Integer roomStatus) {
|
||||
this.roomStatus = roomStatus;
|
||||
}
|
||||
|
||||
public String getRemark() {
|
||||
@@ -85,7 +84,7 @@ public class Room {
|
||||
}
|
||||
|
||||
public void setRemark(String remark) {
|
||||
this.remark = remark;
|
||||
this.remark = remark == null ? null : remark.trim();
|
||||
}
|
||||
|
||||
public Date getCreateTime() {
|
||||
@@ -103,32 +102,4 @@ public class Room {
|
||||
public void setUpdateTime(Date updateTime) {
|
||||
this.updateTime = updateTime;
|
||||
}
|
||||
|
||||
public Room() {
|
||||
}
|
||||
|
||||
public Room(String roomNumber, Integer roomFloor, String roomType, Double roomPrice, Double roomDiscount, String roomStatus,String remark) {
|
||||
this.roomNumber = roomNumber;
|
||||
this.roomFloor = roomFloor;
|
||||
this.roomType = roomType;
|
||||
this.roomPrice = roomPrice;
|
||||
this.roomDiscount = roomDiscount;
|
||||
this.roomStatus = roomStatus;
|
||||
this.remark = remark;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "Room{" +
|
||||
"roomId=" + roomId +
|
||||
", roomNumber='" + roomNumber + '\'' +
|
||||
", roomFloor=" + roomFloor +
|
||||
", roomType='" + roomType + '\'' +
|
||||
", roomPrice=" + roomPrice +
|
||||
", roomDiscount=" + roomDiscount +
|
||||
", roomStatus='" + roomStatus + '\'' +
|
||||
", createTime=" + createTime +
|
||||
", updateTime=" + updateTime +
|
||||
'}';
|
||||
}
|
||||
}
|
@@ -1,68 +1,100 @@
|
||||
package cn.mafangui.hotel.entity;
|
||||
|
||||
|
||||
import cn.mafangui.hotel.utils.MyDateTimeFormat;
|
||||
|
||||
import java.text.ParseException;
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.Date;
|
||||
|
||||
public class RoomType {
|
||||
private Integer typeId;
|
||||
private Long typeId;
|
||||
|
||||
private Integer roomType;
|
||||
|
||||
private String typeName;
|
||||
|
||||
private Double bookingPrice;
|
||||
|
||||
private Double bookingDiscount;
|
||||
private String roomType;
|
||||
|
||||
private String remark;
|
||||
|
||||
private Double price;
|
||||
|
||||
private Double discount;
|
||||
|
||||
private Integer area;
|
||||
|
||||
private Integer bedNum;
|
||||
|
||||
private String bedSize;
|
||||
|
||||
private Integer window;
|
||||
|
||||
private Date createTime;
|
||||
|
||||
private Date updateTime;
|
||||
|
||||
|
||||
public Integer getTypeId() {
|
||||
public Long getTypeId() {
|
||||
return typeId;
|
||||
}
|
||||
|
||||
public void setTypeId(Integer typeId) {
|
||||
public void setTypeId(Long typeId) {
|
||||
this.typeId = typeId;
|
||||
}
|
||||
|
||||
public Integer getRoomType() {
|
||||
public String getRoomType() {
|
||||
return roomType;
|
||||
}
|
||||
|
||||
public void setRoomType(Integer roomType) {
|
||||
this.roomType = roomType;
|
||||
public void setRoomType(String roomType) {
|
||||
this.roomType = roomType == null ? null : roomType.trim();
|
||||
}
|
||||
|
||||
public String getTypeName() {
|
||||
return typeName;
|
||||
public String getRemark() {
|
||||
return remark;
|
||||
}
|
||||
|
||||
public void setTypeName(String typeName) {
|
||||
this.typeName = typeName == null ? null : typeName.trim();
|
||||
public void setRemark(String remark) {
|
||||
this.remark = remark == null ? null : remark.trim();
|
||||
}
|
||||
|
||||
public Double getBookingPrice() {
|
||||
return bookingPrice;
|
||||
public Double getPrice() {
|
||||
return price;
|
||||
}
|
||||
|
||||
public void setBookingPrice(Double bookingPrice) {
|
||||
this.bookingPrice = bookingPrice;
|
||||
public void setPrice(Double price) {
|
||||
this.price = price;
|
||||
}
|
||||
|
||||
public Double getBookingDiscount() {
|
||||
return bookingDiscount;
|
||||
public Double getDiscount() {
|
||||
return discount;
|
||||
}
|
||||
|
||||
public void setBookingDiscount(Double bookingDiscount) {
|
||||
this.bookingDiscount = bookingDiscount;
|
||||
public void setDiscount(Double discount) {
|
||||
this.discount = discount;
|
||||
}
|
||||
|
||||
public Integer getArea() {
|
||||
return area;
|
||||
}
|
||||
|
||||
public void setArea(Integer area) {
|
||||
this.area = area;
|
||||
}
|
||||
|
||||
public Integer getBedNum() {
|
||||
return bedNum;
|
||||
}
|
||||
|
||||
public void setBedNum(Integer bedNum) {
|
||||
this.bedNum = bedNum;
|
||||
}
|
||||
|
||||
public String getBedSize() {
|
||||
return bedSize;
|
||||
}
|
||||
|
||||
public void setBedSize(String bedSize) {
|
||||
this.bedSize = bedSize == null ? null : bedSize.trim();
|
||||
}
|
||||
|
||||
public Integer getWindow() {
|
||||
return window;
|
||||
}
|
||||
|
||||
public void setWindow(Integer window) {
|
||||
this.window = window;
|
||||
}
|
||||
|
||||
public Date getCreateTime() {
|
||||
@@ -78,37 +110,6 @@ public class RoomType {
|
||||
}
|
||||
|
||||
public void setUpdateTime(Date updateTime) {
|
||||
this.updateTime = updateTime;
|
||||
}
|
||||
|
||||
public String getRemark() {
|
||||
return remark;
|
||||
}
|
||||
|
||||
public void setRemark(String remark) {
|
||||
this.remark = remark;
|
||||
}
|
||||
|
||||
public RoomType(Integer roomType, String typeName, Double bookingPrice, Double bookingDiscount,String remark) {
|
||||
this.roomType = roomType;
|
||||
this.typeName = typeName;
|
||||
this.bookingPrice = bookingPrice;
|
||||
this.bookingDiscount = bookingDiscount;
|
||||
this.remark = remark;
|
||||
}
|
||||
public RoomType(){}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "RoomType{" +
|
||||
"typeId=" + typeId +
|
||||
", roomType=" + roomType +
|
||||
", typeName='" + typeName + '\'' +
|
||||
", bookingPrice=" + bookingPrice +
|
||||
", bookingDiscount=" + bookingDiscount +
|
||||
", remark='" + remark + '\'' +
|
||||
", createTime=" + createTime +
|
||||
", updateTime=" + updateTime +
|
||||
'}';
|
||||
this.updateTime = updateTime;
|
||||
}
|
||||
}
|
@@ -5,24 +5,40 @@ import java.util.Date;
|
||||
public class User {
|
||||
private Integer userId;
|
||||
|
||||
private String userName;
|
||||
private String username;
|
||||
|
||||
private String password;
|
||||
|
||||
private String name;
|
||||
|
||||
private String gender;
|
||||
|
||||
private String phone;
|
||||
|
||||
private String email;
|
||||
|
||||
private String address;
|
||||
|
||||
private String idNumber;
|
||||
private String idcard;
|
||||
|
||||
private Date createTime;
|
||||
|
||||
private Date updateTime;
|
||||
|
||||
public User() {
|
||||
}
|
||||
|
||||
public User(String username, String password, String name, String gender, String phone, String email, String address, String idcard) {
|
||||
this.username = username;
|
||||
this.password = password;
|
||||
this.name = name;
|
||||
this.gender = gender;
|
||||
this.phone = phone;
|
||||
this.email = email;
|
||||
this.address = address;
|
||||
this.idcard = idcard;
|
||||
}
|
||||
|
||||
public Integer getUserId() {
|
||||
return userId;
|
||||
}
|
||||
@@ -31,12 +47,12 @@ public class User {
|
||||
this.userId = userId;
|
||||
}
|
||||
|
||||
public String getUserName() {
|
||||
return userName;
|
||||
public String getUsername() {
|
||||
return username;
|
||||
}
|
||||
|
||||
public void setUserName(String userName) {
|
||||
this.userName = userName == null ? null : userName.trim();
|
||||
public void setUsername(String username) {
|
||||
this.username = username == null ? null : username.trim();
|
||||
}
|
||||
|
||||
public String getPassword() {
|
||||
@@ -55,6 +71,14 @@ public class User {
|
||||
this.name = name == null ? null : name.trim();
|
||||
}
|
||||
|
||||
public String getGender() {
|
||||
return gender;
|
||||
}
|
||||
|
||||
public void setGender(String gender) {
|
||||
this.gender = gender == null ? null : gender.trim();
|
||||
}
|
||||
|
||||
public String getPhone() {
|
||||
return phone;
|
||||
}
|
||||
@@ -79,28 +103,18 @@ public class User {
|
||||
this.address = address == null ? null : address.trim();
|
||||
}
|
||||
|
||||
public String getIdNumber() {
|
||||
return idNumber;
|
||||
public String getIdcard() {
|
||||
return idcard;
|
||||
}
|
||||
|
||||
public void setIdNumber(String idNumber) {
|
||||
this.idNumber = idNumber == null ? null : idNumber.trim();
|
||||
public void setIdcard(String idcard) {
|
||||
this.idcard = idcard == null ? null : idcard.trim();
|
||||
}
|
||||
|
||||
public Date getCreateTime() {
|
||||
return createTime;
|
||||
}
|
||||
|
||||
public User(String userName, String password, String name, String phone, String email, String address, String idNumber) {
|
||||
this.userName = userName;
|
||||
this.password = password;
|
||||
this.name = name;
|
||||
this.phone = phone;
|
||||
this.email = email;
|
||||
this.address = address;
|
||||
this.idNumber = idNumber;
|
||||
}
|
||||
|
||||
public void setCreateTime(Date createTime) {
|
||||
this.createTime = createTime;
|
||||
}
|
||||
@@ -113,6 +127,20 @@ public class User {
|
||||
this.updateTime = updateTime;
|
||||
}
|
||||
|
||||
public User() {
|
||||
@Override
|
||||
public String toString() {
|
||||
return "User{" +
|
||||
"userId=" + userId +
|
||||
", username='" + username + '\'' +
|
||||
", password='" + password + '\'' +
|
||||
", name='" + name + '\'' +
|
||||
", gender='" + gender + '\'' +
|
||||
", phone='" + phone + '\'' +
|
||||
", email='" + email + '\'' +
|
||||
", address='" + address + '\'' +
|
||||
", idcard='" + idcard + '\'' +
|
||||
", createTime=" + createTime +
|
||||
", updateTime=" + updateTime +
|
||||
'}';
|
||||
}
|
||||
}
|
@@ -5,14 +5,20 @@ import java.util.Date;
|
||||
public class Worker {
|
||||
private Integer workerId;
|
||||
|
||||
private String userName;
|
||||
private String role;
|
||||
|
||||
private String username;
|
||||
|
||||
private String password;
|
||||
|
||||
private String workerName;
|
||||
private String name;
|
||||
|
||||
private String gender;
|
||||
|
||||
private String phone;
|
||||
|
||||
private Integer department;
|
||||
|
||||
private String email;
|
||||
|
||||
private String address;
|
||||
@@ -29,12 +35,20 @@ public class Worker {
|
||||
this.workerId = workerId;
|
||||
}
|
||||
|
||||
public String getUserName() {
|
||||
return userName;
|
||||
public String getRole() {
|
||||
return role;
|
||||
}
|
||||
|
||||
public void setUserName(String userName) {
|
||||
this.userName = userName == null ? null : userName.trim();
|
||||
public void setRole(String role) {
|
||||
this.role = role == null ? null : role.trim();
|
||||
}
|
||||
|
||||
public String getUsername() {
|
||||
return username;
|
||||
}
|
||||
|
||||
public void setUsername(String username) {
|
||||
this.username = username == null ? null : username.trim();
|
||||
}
|
||||
|
||||
public String getPassword() {
|
||||
@@ -45,12 +59,20 @@ public class Worker {
|
||||
this.password = password == null ? null : password.trim();
|
||||
}
|
||||
|
||||
public String getWorkerName() {
|
||||
return workerName;
|
||||
public String getName() {
|
||||
return name;
|
||||
}
|
||||
|
||||
public void setWorkerName(String workerName) {
|
||||
this.workerName = workerName == null ? null : workerName.trim();
|
||||
public void setName(String name) {
|
||||
this.name = name == null ? null : name.trim();
|
||||
}
|
||||
|
||||
public String getGender() {
|
||||
return gender;
|
||||
}
|
||||
|
||||
public void setGender(String gender) {
|
||||
this.gender = gender == null ? null : gender.trim();
|
||||
}
|
||||
|
||||
public String getPhone() {
|
||||
@@ -61,6 +83,14 @@ public class Worker {
|
||||
this.phone = phone == null ? null : phone.trim();
|
||||
}
|
||||
|
||||
public Integer getDepartment() {
|
||||
return department;
|
||||
}
|
||||
|
||||
public void setDepartment(Integer department) {
|
||||
this.department = department;
|
||||
}
|
||||
|
||||
public String getEmail() {
|
||||
return email;
|
||||
}
|
||||
@@ -92,36 +122,4 @@ public class Worker {
|
||||
public void setUpdateTime(Date updateTime) {
|
||||
this.updateTime = updateTime;
|
||||
}
|
||||
|
||||
public Worker() {
|
||||
}
|
||||
|
||||
public Worker(String userName, String password) {
|
||||
this.userName = userName;
|
||||
this.password = password;
|
||||
}
|
||||
|
||||
public Worker(String userName, String password, String workerName, String phone, String email, String address) {
|
||||
this.userName = userName;
|
||||
this.password = password;
|
||||
this.workerName = workerName;
|
||||
this.phone = phone;
|
||||
this.email = email;
|
||||
this.address = address;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "Worker{" +
|
||||
"workerId=" + workerId +
|
||||
", userName='" + userName + '\'' +
|
||||
", password='" + password + '\'' +
|
||||
", workerName='" + workerName + '\'' +
|
||||
", phone='" + phone + '\'' +
|
||||
", email='" + email + '\'' +
|
||||
", address='" + address + '\'' +
|
||||
", createTime=" + createTime +
|
||||
", updateTime=" + updateTime +
|
||||
'}';
|
||||
}
|
||||
}
|
17
src/main/java/cn/mafangui/hotel/mapper/DepartmentMapper.java
Normal file
17
src/main/java/cn/mafangui/hotel/mapper/DepartmentMapper.java
Normal file
@@ -0,0 +1,17 @@
|
||||
package cn.mafangui.hotel.mapper;
|
||||
|
||||
import cn.mafangui.hotel.entity.Department;
|
||||
|
||||
public interface DepartmentMapper {
|
||||
int deleteByPrimaryKey(Integer departmentId);
|
||||
|
||||
int insert(Department record);
|
||||
|
||||
int insertSelective(Department record);
|
||||
|
||||
Department selectByPrimaryKey(Integer departmentId);
|
||||
|
||||
int updateByPrimaryKeySelective(Department record);
|
||||
|
||||
int updateByPrimaryKey(Department record);
|
||||
}
|
@@ -1,20 +1,17 @@
|
||||
package cn.mafangui.hotel.mapper;
|
||||
|
||||
import cn.mafangui.hotel.entity.Hotel;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@Component
|
||||
public interface HotelMapper {
|
||||
int deleteByPrimaryKey(Integer hotelId);
|
||||
|
||||
int updateByPrimaryKey(Hotel record);
|
||||
|
||||
int insert(Hotel record);
|
||||
|
||||
int insertSelective(Hotel record);
|
||||
int updateByPrimaryKeySelective(Hotel record);
|
||||
|
||||
Hotel selectByPrimaryKey(Integer hotelId);
|
||||
Hotel selectByName(String hotelName);
|
||||
List<Hotel> selectAll();
|
||||
|
||||
int updateByPrimaryKeySelective(Hotel record);
|
||||
|
||||
int updateByPrimaryKey(Hotel record);
|
||||
}
|
17
src/main/java/cn/mafangui/hotel/mapper/OrderTypeMapper.java
Normal file
17
src/main/java/cn/mafangui/hotel/mapper/OrderTypeMapper.java
Normal file
@@ -0,0 +1,17 @@
|
||||
package cn.mafangui.hotel.mapper;
|
||||
|
||||
import cn.mafangui.hotel.entity.OrderType;
|
||||
|
||||
public interface OrderTypeMapper {
|
||||
int deleteByPrimaryKey(Integer typeId);
|
||||
|
||||
int insert(OrderType record);
|
||||
|
||||
int insertSelective(OrderType record);
|
||||
|
||||
OrderType selectByPrimaryKey(Integer typeId);
|
||||
|
||||
int updateByPrimaryKeySelective(OrderType record);
|
||||
|
||||
int updateByPrimaryKey(OrderType record);
|
||||
}
|
@@ -1,25 +1,17 @@
|
||||
package cn.mafangui.hotel.mapper;
|
||||
|
||||
import cn.mafangui.hotel.entity.Room;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@Component
|
||||
public interface RoomMapper {
|
||||
|
||||
int insertSelective(Room record);
|
||||
Room selectByPrimaryKey(Integer roomId);
|
||||
int updateByPrimaryKey(Room record);
|
||||
int deleteByPrimaryKey(Integer roomId);
|
||||
|
||||
int insert(Room record);
|
||||
int deleteByPrimaryKey(Integer roomId);
|
||||
int deleteByRoomNumber(String roomNumber);
|
||||
int updateByPrimaryKeySelective(Room record);
|
||||
Room selectByRoomId(Integer roomId);
|
||||
Room selectByRoomNumber(String roomNumber);
|
||||
List<Room> selectAllRoom();
|
||||
List<Room> selectByType(String typeName);
|
||||
List<Room> selectByStatus(String status);
|
||||
|
||||
int insertSelective(Room record);
|
||||
|
||||
Room selectByPrimaryKey(Integer roomId);
|
||||
|
||||
int updateByPrimaryKeySelective(Room record);
|
||||
|
||||
int updateByPrimaryKey(Room record);
|
||||
}
|
@@ -1,21 +1,17 @@
|
||||
package cn.mafangui.hotel.mapper;
|
||||
|
||||
import cn.mafangui.hotel.entity.RoomType;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@Component
|
||||
public interface RoomTypeMapper {
|
||||
int deleteByPrimaryKey(Integer typeId);
|
||||
int deleteByPrimaryKey(Long typeId);
|
||||
|
||||
int insert(RoomType record);
|
||||
RoomType selectByPrimaryKey(Integer typeId);
|
||||
int updateByPrimaryKeySelective(RoomType record);
|
||||
int updateByPrimaryKey(RoomType record);
|
||||
|
||||
int insertSelective(RoomType record);
|
||||
int updateByRoomTypeSelective(RoomType record);
|
||||
int deleteByRoomType(RoomType roomType);
|
||||
RoomType selectByRoomType(RoomType roomType);
|
||||
List<RoomType> findAll();
|
||||
|
||||
RoomType selectByPrimaryKey(Long typeId);
|
||||
|
||||
int updateByPrimaryKeySelective(RoomType record);
|
||||
|
||||
int updateByPrimaryKey(RoomType record);
|
||||
}
|
@@ -1,17 +1,30 @@
|
||||
package cn.mafangui.hotel.mapper;
|
||||
|
||||
import cn.mafangui.hotel.entity.User;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@Component
|
||||
public interface UserMapper {
|
||||
int deleteByPrimaryKey(Integer userId);
|
||||
|
||||
int insert(User record);
|
||||
|
||||
int insertSelective(User record);
|
||||
|
||||
User selectByPrimaryKey(Integer userId);
|
||||
|
||||
int updateByPrimaryKeySelective(User record);
|
||||
|
||||
int updateByPrimaryKey(User record);
|
||||
User selectByUserNameAndPassword(User user);
|
||||
User selectByUserName(String userName);
|
||||
int updateByUserNameSelective(User record);
|
||||
|
||||
int count();
|
||||
|
||||
List<User> selectAll();
|
||||
|
||||
User selectByUsernameAndPassword(@Param("username") String username, @Param("password") String password);
|
||||
|
||||
|
||||
}
|
@@ -1,11 +1,7 @@
|
||||
package cn.mafangui.hotel.mapper;
|
||||
|
||||
import cn.mafangui.hotel.entity.Worker;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@Component
|
||||
public interface WorkerMapper {
|
||||
int deleteByPrimaryKey(Integer workerId);
|
||||
|
||||
@@ -18,10 +14,4 @@ public interface WorkerMapper {
|
||||
int updateByPrimaryKeySelective(Worker record);
|
||||
|
||||
int updateByPrimaryKey(Worker record);
|
||||
|
||||
int deleteByUserName(String userName);
|
||||
int updateByUserNameSelective(Worker record);
|
||||
Worker selectByUserName(String userName);
|
||||
List<Worker> findAll();
|
||||
Worker selectByUserNameAndPassword(Worker worker);
|
||||
}
|
@@ -3,6 +3,8 @@ package cn.mafangui.hotel.service;
|
||||
|
||||
import cn.mafangui.hotel.entity.User;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public interface UserService {
|
||||
|
||||
User selectById(int id);
|
||||
@@ -13,5 +15,10 @@ public interface UserService {
|
||||
|
||||
User selectByUserName(String userName);
|
||||
|
||||
int count();
|
||||
|
||||
List<User> findAll();
|
||||
|
||||
int updateProfile(User user);
|
||||
|
||||
}
|
||||
|
@@ -1,11 +1,14 @@
|
||||
package cn.mafangui.hotel.service.impl;
|
||||
|
||||
import cn.mafangui.hotel.entity.User;
|
||||
|
||||
import cn.mafangui.hotel.mapper.UserMapper;
|
||||
import cn.mafangui.hotel.service.UserService;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@Service
|
||||
public class UserServiceImpl implements UserService {
|
||||
|
||||
@@ -23,21 +26,28 @@ public class UserServiceImpl implements UserService {
|
||||
}
|
||||
|
||||
@Override
|
||||
public User login(String userName, String password) {
|
||||
User user = new User();
|
||||
user.setUserName(userName);
|
||||
user.setPassword(password);
|
||||
return userMapper.selectByUserNameAndPassword(user);
|
||||
public User login(String username, String password) {
|
||||
return userMapper.selectByUsernameAndPassword(username,password);
|
||||
}
|
||||
|
||||
@Override
|
||||
public User selectByUserName(String userName) {
|
||||
return userMapper.selectByUserName(userName);
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int count() {
|
||||
return userMapper.count();
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<User> findAll() {
|
||||
return userMapper.selectAll();
|
||||
}
|
||||
|
||||
@Override
|
||||
public int updateProfile(User user) {
|
||||
return userMapper.updateByUserNameSelective(user);
|
||||
return userMapper.updateByPrimaryKeySelective(user);
|
||||
}
|
||||
|
||||
|
||||
|
Reference in New Issue
Block a user