1.数据库重构

2.修改User注册登录接口
This commit is contained in:
freeebird 2018-11-12 10:44:54 +08:00
parent 643ef18f0a
commit 3ef7a1b88d
30 changed files with 1765 additions and 311 deletions

View File

@ -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;
}
/**
* 查看用户资料

View File

@ -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() {

View 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;
}
}

View File

@ -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;
}
}

View File

@ -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;
}

View 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;
}
}

View File

@ -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 +
'}';
}
}

View File

@ -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() {
@ -80,35 +112,4 @@ 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 +
'}';
}
}

View File

@ -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 +
'}';
}
}

View File

@ -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 +
'}';
}
}

View 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);
}

View File

@ -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);
}

View 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);
}

View File

@ -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);
}

View File

@ -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);
}

View File

@ -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);
}

View File

@ -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);
}

View File

@ -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);
}

View File

@ -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);
}

View File

@ -7,8 +7,8 @@ spring:
driver-class-name: com.mysql.jdbc.Driver
username: root
password: root
url: jdbc:mysql://localhost:3306/hotel?useUnicode=true&characterEncoding=UTF-8
url: jdbc:mysql://127.0.0.1:3306/hotel?useUnicode=true&characterEncoding=UTF-8
mybatis:
type-aliases-package: classpath*:cn.mafangui.hotel.entity
mapper-locations: classpath*:mybatis/mapper/*.xml
mapper-locations: classpath*:mapper/*.xml

View File

@ -22,7 +22,7 @@
<!-- JDBC连接 -->
<jdbcConnection
driverClass="com.mysql.jdbc.Driver"
connectionURL="jdbc:mysql://localhost:3306/hotel?useUnicode=true&amp;characterEncoding=UTF-8"
connectionURL="jdbc:mysql://127.0.0.1:3306/hotel?useUnicode=true&amp;characterEncoding=UTF-8"
userId="root"
password="root">
</jdbcConnection>
@ -44,7 +44,7 @@
</javaModelGenerator>
<!-- 生成mapper xml文件 -->
<sqlMapGenerator targetPackage="mybatis/mapper" targetProject="src/main/resources">
<sqlMapGenerator targetPackage="mapper" targetProject="src/main/resources">
<!-- enableSubPackages:是否让schema作为包的后缀 -->
<property name="enableSubPackages" value="false" />
</sqlMapGenerator>
@ -60,9 +60,9 @@
是否生成 example类 -->
<table schema="hotel" tableName="user_info"
domainObjectName="User" enableCountByExample="true"
enableDeleteByExample="true" enableSelectByExample="true"
enableUpdateByExample="true">
domainObjectName="User" enableCountByExample="false"
enableDeleteByExample="false" enableSelectByExample="false"
enableUpdateByExample="false">
</table>
<table schema="hotel" tableName="worker_info"
domainObjectName="Worker" enableCountByExample="false"

View File

@ -0,0 +1,153 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="cn.mafangui.hotel.mapper.CheckInMapper">
<resultMap id="BaseResultMap" type="cn.mafangui.hotel.entity.CheckIn">
<id column="check_in_id" jdbcType="INTEGER" property="checkInId" />
<result column="order_id" jdbcType="INTEGER" property="orderId" />
<result column="room_number" jdbcType="VARCHAR" property="roomNumber" />
<result column="room_type" jdbcType="VARCHAR" property="roomType" />
<result column="peo_count" jdbcType="INTEGER" property="peoCount" />
<result column="persons" jdbcType="VARCHAR" property="persons" />
<result column="ids" jdbcType="VARCHAR" property="ids" />
<result column="check_in_time" jdbcType="TIMESTAMP" property="checkInTime" />
<result column="create_time" jdbcType="TIMESTAMP" property="createTime" />
<result column="update_time" jdbcType="TIMESTAMP" property="updateTime" />
</resultMap>
<sql id="Base_Column_List">
check_in_id, order_id, room_number, room_type, peo_count, persons, ids, check_in_time,
create_time, update_time
</sql>
<select id="selectByPrimaryKey" parameterType="java.lang.Integer" resultMap="BaseResultMap">
select
<include refid="Base_Column_List" />
from check_in
where check_in_id = #{checkInId,jdbcType=INTEGER}
</select>
<delete id="deleteByPrimaryKey" parameterType="java.lang.Integer">
delete from check_in
where check_in_id = #{checkInId,jdbcType=INTEGER}
</delete>
<insert id="insert" parameterType="cn.mafangui.hotel.entity.CheckIn">
insert into check_in (check_in_id, order_id, room_number,
room_type, peo_count, persons,
ids, check_in_time, create_time,
update_time)
values (#{checkInId,jdbcType=INTEGER}, #{orderId,jdbcType=INTEGER}, #{roomNumber,jdbcType=VARCHAR},
#{roomType,jdbcType=VARCHAR}, #{peoCount,jdbcType=INTEGER}, #{persons,jdbcType=VARCHAR},
#{ids,jdbcType=VARCHAR}, #{checkInTime,jdbcType=TIMESTAMP}, #{createTime,jdbcType=TIMESTAMP},
#{updateTime,jdbcType=TIMESTAMP})
</insert>
<insert id="insertSelective" parameterType="cn.mafangui.hotel.entity.CheckIn">
insert into check_in
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="checkInId != null">
check_in_id,
</if>
<if test="orderId != null">
order_id,
</if>
<if test="roomNumber != null">
room_number,
</if>
<if test="roomType != null">
room_type,
</if>
<if test="peoCount != null">
peo_count,
</if>
<if test="persons != null">
persons,
</if>
<if test="ids != null">
ids,
</if>
<if test="checkInTime != null">
check_in_time,
</if>
<if test="createTime != null">
create_time,
</if>
<if test="updateTime != null">
update_time,
</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="checkInId != null">
#{checkInId,jdbcType=INTEGER},
</if>
<if test="orderId != null">
#{orderId,jdbcType=INTEGER},
</if>
<if test="roomNumber != null">
#{roomNumber,jdbcType=VARCHAR},
</if>
<if test="roomType != null">
#{roomType,jdbcType=VARCHAR},
</if>
<if test="peoCount != null">
#{peoCount,jdbcType=INTEGER},
</if>
<if test="persons != null">
#{persons,jdbcType=VARCHAR},
</if>
<if test="ids != null">
#{ids,jdbcType=VARCHAR},
</if>
<if test="checkInTime != null">
#{checkInTime,jdbcType=TIMESTAMP},
</if>
<if test="createTime != null">
#{createTime,jdbcType=TIMESTAMP},
</if>
<if test="updateTime != null">
#{updateTime,jdbcType=TIMESTAMP},
</if>
</trim>
</insert>
<update id="updateByPrimaryKeySelective" parameterType="cn.mafangui.hotel.entity.CheckIn">
update check_in
<set>
<if test="orderId != null">
order_id = #{orderId,jdbcType=INTEGER},
</if>
<if test="roomNumber != null">
room_number = #{roomNumber,jdbcType=VARCHAR},
</if>
<if test="roomType != null">
room_type = #{roomType,jdbcType=VARCHAR},
</if>
<if test="peoCount != null">
peo_count = #{peoCount,jdbcType=INTEGER},
</if>
<if test="persons != null">
persons = #{persons,jdbcType=VARCHAR},
</if>
<if test="ids != null">
ids = #{ids,jdbcType=VARCHAR},
</if>
<if test="checkInTime != null">
check_in_time = #{checkInTime,jdbcType=TIMESTAMP},
</if>
<if test="createTime != null">
create_time = #{createTime,jdbcType=TIMESTAMP},
</if>
<if test="updateTime != null">
update_time = #{updateTime,jdbcType=TIMESTAMP},
</if>
</set>
where check_in_id = #{checkInId,jdbcType=INTEGER}
</update>
<update id="updateByPrimaryKey" parameterType="cn.mafangui.hotel.entity.CheckIn">
update check_in
set order_id = #{orderId,jdbcType=INTEGER},
room_number = #{roomNumber,jdbcType=VARCHAR},
room_type = #{roomType,jdbcType=VARCHAR},
peo_count = #{peoCount,jdbcType=INTEGER},
persons = #{persons,jdbcType=VARCHAR},
ids = #{ids,jdbcType=VARCHAR},
check_in_time = #{checkInTime,jdbcType=TIMESTAMP},
create_time = #{createTime,jdbcType=TIMESTAMP},
update_time = #{updateTime,jdbcType=TIMESTAMP}
where check_in_id = #{checkInId,jdbcType=INTEGER}
</update>
</mapper>

View File

@ -0,0 +1,93 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="cn.mafangui.hotel.mapper.DepartmentMapper">
<resultMap id="BaseResultMap" type="cn.mafangui.hotel.entity.Department">
<id column="department_id" jdbcType="INTEGER" property="departmentId" />
<result column="department_name" jdbcType="VARCHAR" property="departmentName" />
<result column="remark" jdbcType="VARCHAR" property="remark" />
<result column="create_time" jdbcType="TIMESTAMP" property="createTime" />
<result column="update_time" jdbcType="TIMESTAMP" property="updateTime" />
</resultMap>
<sql id="Base_Column_List">
department_id, department_name, remark, create_time, update_time
</sql>
<select id="selectByPrimaryKey" parameterType="java.lang.Integer" resultMap="BaseResultMap">
select
<include refid="Base_Column_List" />
from department_info
where department_id = #{departmentId,jdbcType=INTEGER}
</select>
<delete id="deleteByPrimaryKey" parameterType="java.lang.Integer">
delete from department_info
where department_id = #{departmentId,jdbcType=INTEGER}
</delete>
<insert id="insert" parameterType="cn.mafangui.hotel.entity.Department">
insert into department_info (department_id, department_name, remark,
create_time, update_time)
values (#{departmentId,jdbcType=INTEGER}, #{departmentName,jdbcType=VARCHAR}, #{remark,jdbcType=VARCHAR},
#{createTime,jdbcType=TIMESTAMP}, #{updateTime,jdbcType=TIMESTAMP})
</insert>
<insert id="insertSelective" parameterType="cn.mafangui.hotel.entity.Department">
insert into department_info
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="departmentId != null">
department_id,
</if>
<if test="departmentName != null">
department_name,
</if>
<if test="remark != null">
remark,
</if>
<if test="createTime != null">
create_time,
</if>
<if test="updateTime != null">
update_time,
</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="departmentId != null">
#{departmentId,jdbcType=INTEGER},
</if>
<if test="departmentName != null">
#{departmentName,jdbcType=VARCHAR},
</if>
<if test="remark != null">
#{remark,jdbcType=VARCHAR},
</if>
<if test="createTime != null">
#{createTime,jdbcType=TIMESTAMP},
</if>
<if test="updateTime != null">
#{updateTime,jdbcType=TIMESTAMP},
</if>
</trim>
</insert>
<update id="updateByPrimaryKeySelective" parameterType="cn.mafangui.hotel.entity.Department">
update department_info
<set>
<if test="departmentName != null">
department_name = #{departmentName,jdbcType=VARCHAR},
</if>
<if test="remark != null">
remark = #{remark,jdbcType=VARCHAR},
</if>
<if test="createTime != null">
create_time = #{createTime,jdbcType=TIMESTAMP},
</if>
<if test="updateTime != null">
update_time = #{updateTime,jdbcType=TIMESTAMP},
</if>
</set>
where department_id = #{departmentId,jdbcType=INTEGER}
</update>
<update id="updateByPrimaryKey" parameterType="cn.mafangui.hotel.entity.Department">
update department_info
set department_name = #{departmentName,jdbcType=VARCHAR},
remark = #{remark,jdbcType=VARCHAR},
create_time = #{createTime,jdbcType=TIMESTAMP},
update_time = #{updateTime,jdbcType=TIMESTAMP}
where department_id = #{departmentId,jdbcType=INTEGER}
</update>
</mapper>

View File

@ -0,0 +1,141 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="cn.mafangui.hotel.mapper.HotelMapper">
<resultMap id="BaseResultMap" type="cn.mafangui.hotel.entity.Hotel">
<id column="hotel_id" jdbcType="INTEGER" property="hotelId" />
<result column="hotel_name" jdbcType="VARCHAR" property="hotelName" />
<result column="phone" jdbcType="VARCHAR" property="phone" />
<result column="telephone" jdbcType="VARCHAR" property="telephone" />
<result column="email" jdbcType="VARCHAR" property="email" />
<result column="address" jdbcType="VARCHAR" property="address" />
<result column="website" jdbcType="VARCHAR" property="website" />
<result column="create_time" jdbcType="TIMESTAMP" property="createTime" />
<result column="update_time" jdbcType="TIMESTAMP" property="updateTime" />
</resultMap>
<sql id="Base_Column_List">
hotel_id, hotel_name, phone, telephone, email, address, website, create_time, update_time
</sql>
<select id="selectByPrimaryKey" parameterType="java.lang.Integer" resultMap="BaseResultMap">
select
<include refid="Base_Column_List" />
from hotel_info
where hotel_id = #{hotelId,jdbcType=INTEGER}
</select>
<delete id="deleteByPrimaryKey" parameterType="java.lang.Integer">
delete from hotel_info
where hotel_id = #{hotelId,jdbcType=INTEGER}
</delete>
<insert id="insert" parameterType="cn.mafangui.hotel.entity.Hotel">
insert into hotel_info (hotel_id, hotel_name, phone,
telephone, email, address,
website, create_time, update_time
)
values (#{hotelId,jdbcType=INTEGER}, #{hotelName,jdbcType=VARCHAR}, #{phone,jdbcType=VARCHAR},
#{telephone,jdbcType=VARCHAR}, #{email,jdbcType=VARCHAR}, #{address,jdbcType=VARCHAR},
#{website,jdbcType=VARCHAR}, #{createTime,jdbcType=TIMESTAMP}, #{updateTime,jdbcType=TIMESTAMP}
)
</insert>
<insert id="insertSelective" parameterType="cn.mafangui.hotel.entity.Hotel">
insert into hotel_info
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="hotelId != null">
hotel_id,
</if>
<if test="hotelName != null">
hotel_name,
</if>
<if test="phone != null">
phone,
</if>
<if test="telephone != null">
telephone,
</if>
<if test="email != null">
email,
</if>
<if test="address != null">
address,
</if>
<if test="website != null">
website,
</if>
<if test="createTime != null">
create_time,
</if>
<if test="updateTime != null">
update_time,
</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="hotelId != null">
#{hotelId,jdbcType=INTEGER},
</if>
<if test="hotelName != null">
#{hotelName,jdbcType=VARCHAR},
</if>
<if test="phone != null">
#{phone,jdbcType=VARCHAR},
</if>
<if test="telephone != null">
#{telephone,jdbcType=VARCHAR},
</if>
<if test="email != null">
#{email,jdbcType=VARCHAR},
</if>
<if test="address != null">
#{address,jdbcType=VARCHAR},
</if>
<if test="website != null">
#{website,jdbcType=VARCHAR},
</if>
<if test="createTime != null">
#{createTime,jdbcType=TIMESTAMP},
</if>
<if test="updateTime != null">
#{updateTime,jdbcType=TIMESTAMP},
</if>
</trim>
</insert>
<update id="updateByPrimaryKeySelective" parameterType="cn.mafangui.hotel.entity.Hotel">
update hotel_info
<set>
<if test="hotelName != null">
hotel_name = #{hotelName,jdbcType=VARCHAR},
</if>
<if test="phone != null">
phone = #{phone,jdbcType=VARCHAR},
</if>
<if test="telephone != null">
telephone = #{telephone,jdbcType=VARCHAR},
</if>
<if test="email != null">
email = #{email,jdbcType=VARCHAR},
</if>
<if test="address != null">
address = #{address,jdbcType=VARCHAR},
</if>
<if test="website != null">
website = #{website,jdbcType=VARCHAR},
</if>
<if test="createTime != null">
create_time = #{createTime,jdbcType=TIMESTAMP},
</if>
<if test="updateTime != null">
update_time = #{updateTime,jdbcType=TIMESTAMP},
</if>
</set>
where hotel_id = #{hotelId,jdbcType=INTEGER}
</update>
<update id="updateByPrimaryKey" parameterType="cn.mafangui.hotel.entity.Hotel">
update hotel_info
set hotel_name = #{hotelName,jdbcType=VARCHAR},
phone = #{phone,jdbcType=VARCHAR},
telephone = #{telephone,jdbcType=VARCHAR},
email = #{email,jdbcType=VARCHAR},
address = #{address,jdbcType=VARCHAR},
website = #{website,jdbcType=VARCHAR},
create_time = #{createTime,jdbcType=TIMESTAMP},
update_time = #{updateTime,jdbcType=TIMESTAMP}
where hotel_id = #{hotelId,jdbcType=INTEGER}
</update>
</mapper>

View File

@ -0,0 +1,164 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="cn.mafangui.hotel.mapper.OrderMapper">
<resultMap id="BaseResultMap" type="cn.mafangui.hotel.entity.Order">
<id column="order_id" jdbcType="INTEGER" property="orderId" />
<result column="order_type" jdbcType="VARCHAR" property="orderType" />
<result column="phone" jdbcType="VARCHAR" property="phone" />
<result column="room_type" jdbcType="VARCHAR" property="roomType" />
<result column="num_of_room" jdbcType="INTEGER" property="numOfRoom" />
<result column="order_date" jdbcType="DATE" property="orderDate" />
<result column="order_days" jdbcType="INTEGER" property="orderDays" />
<result column="order_status" jdbcType="INTEGER" property="orderStatus" />
<result column="order_cost" jdbcType="DOUBLE" property="orderCost" />
<result column="create_time" jdbcType="TIMESTAMP" property="createTime" />
<result column="update_time" jdbcType="TIMESTAMP" property="updateTime" />
</resultMap>
<sql id="Base_Column_List">
order_id, order_type, phone, room_type, num_of_room, order_date, order_days, order_status,
order_cost, create_time, update_time
</sql>
<select id="selectByPrimaryKey" parameterType="java.lang.Integer" resultMap="BaseResultMap">
select
<include refid="Base_Column_List" />
from order_info
where order_id = #{orderId,jdbcType=INTEGER}
</select>
<delete id="deleteByPrimaryKey" parameterType="java.lang.Integer">
delete from order_info
where order_id = #{orderId,jdbcType=INTEGER}
</delete>
<insert id="insert" parameterType="cn.mafangui.hotel.entity.Order">
insert into order_info (order_id, order_type, phone,
room_type, num_of_room, order_date,
order_days, order_status, order_cost,
create_time, update_time)
values (#{orderId,jdbcType=INTEGER}, #{orderType,jdbcType=VARCHAR}, #{phone,jdbcType=VARCHAR},
#{roomType,jdbcType=VARCHAR}, #{numOfRoom,jdbcType=INTEGER}, #{orderDate,jdbcType=DATE},
#{orderDays,jdbcType=INTEGER}, #{orderStatus,jdbcType=INTEGER}, #{orderCost,jdbcType=DOUBLE},
#{createTime,jdbcType=TIMESTAMP}, #{updateTime,jdbcType=TIMESTAMP})
</insert>
<insert id="insertSelective" parameterType="cn.mafangui.hotel.entity.Order">
insert into order_info
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="orderId != null">
order_id,
</if>
<if test="orderType != null">
order_type,
</if>
<if test="phone != null">
phone,
</if>
<if test="roomType != null">
room_type,
</if>
<if test="numOfRoom != null">
num_of_room,
</if>
<if test="orderDate != null">
order_date,
</if>
<if test="orderDays != null">
order_days,
</if>
<if test="orderStatus != null">
order_status,
</if>
<if test="orderCost != null">
order_cost,
</if>
<if test="createTime != null">
create_time,
</if>
<if test="updateTime != null">
update_time,
</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="orderId != null">
#{orderId,jdbcType=INTEGER},
</if>
<if test="orderType != null">
#{orderType,jdbcType=VARCHAR},
</if>
<if test="phone != null">
#{phone,jdbcType=VARCHAR},
</if>
<if test="roomType != null">
#{roomType,jdbcType=VARCHAR},
</if>
<if test="numOfRoom != null">
#{numOfRoom,jdbcType=INTEGER},
</if>
<if test="orderDate != null">
#{orderDate,jdbcType=DATE},
</if>
<if test="orderDays != null">
#{orderDays,jdbcType=INTEGER},
</if>
<if test="orderStatus != null">
#{orderStatus,jdbcType=INTEGER},
</if>
<if test="orderCost != null">
#{orderCost,jdbcType=DOUBLE},
</if>
<if test="createTime != null">
#{createTime,jdbcType=TIMESTAMP},
</if>
<if test="updateTime != null">
#{updateTime,jdbcType=TIMESTAMP},
</if>
</trim>
</insert>
<update id="updateByPrimaryKeySelective" parameterType="cn.mafangui.hotel.entity.Order">
update order_info
<set>
<if test="orderType != null">
order_type = #{orderType,jdbcType=VARCHAR},
</if>
<if test="phone != null">
phone = #{phone,jdbcType=VARCHAR},
</if>
<if test="roomType != null">
room_type = #{roomType,jdbcType=VARCHAR},
</if>
<if test="numOfRoom != null">
num_of_room = #{numOfRoom,jdbcType=INTEGER},
</if>
<if test="orderDate != null">
order_date = #{orderDate,jdbcType=DATE},
</if>
<if test="orderDays != null">
order_days = #{orderDays,jdbcType=INTEGER},
</if>
<if test="orderStatus != null">
order_status = #{orderStatus,jdbcType=INTEGER},
</if>
<if test="orderCost != null">
order_cost = #{orderCost,jdbcType=DOUBLE},
</if>
<if test="createTime != null">
create_time = #{createTime,jdbcType=TIMESTAMP},
</if>
<if test="updateTime != null">
update_time = #{updateTime,jdbcType=TIMESTAMP},
</if>
</set>
where order_id = #{orderId,jdbcType=INTEGER}
</update>
<update id="updateByPrimaryKey" parameterType="cn.mafangui.hotel.entity.Order">
update order_info
set order_type = #{orderType,jdbcType=VARCHAR},
phone = #{phone,jdbcType=VARCHAR},
room_type = #{roomType,jdbcType=VARCHAR},
num_of_room = #{numOfRoom,jdbcType=INTEGER},
order_date = #{orderDate,jdbcType=DATE},
order_days = #{orderDays,jdbcType=INTEGER},
order_status = #{orderStatus,jdbcType=INTEGER},
order_cost = #{orderCost,jdbcType=DOUBLE},
create_time = #{createTime,jdbcType=TIMESTAMP},
update_time = #{updateTime,jdbcType=TIMESTAMP}
where order_id = #{orderId,jdbcType=INTEGER}
</update>
</mapper>

View File

@ -0,0 +1,93 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="cn.mafangui.hotel.mapper.OrderTypeMapper">
<resultMap id="BaseResultMap" type="cn.mafangui.hotel.entity.OrderType">
<id column="type_id" jdbcType="INTEGER" property="typeId" />
<result column="type" jdbcType="VARCHAR" property="type" />
<result column="remark" jdbcType="VARCHAR" property="remark" />
<result column="create_time" jdbcType="TIMESTAMP" property="createTime" />
<result column="update_time" jdbcType="TIMESTAMP" property="updateTime" />
</resultMap>
<sql id="Base_Column_List">
type_id, type, remark, create_time, update_time
</sql>
<select id="selectByPrimaryKey" parameterType="java.lang.Integer" resultMap="BaseResultMap">
select
<include refid="Base_Column_List" />
from order_type
where type_id = #{typeId,jdbcType=INTEGER}
</select>
<delete id="deleteByPrimaryKey" parameterType="java.lang.Integer">
delete from order_type
where type_id = #{typeId,jdbcType=INTEGER}
</delete>
<insert id="insert" parameterType="cn.mafangui.hotel.entity.OrderType">
insert into order_type (type_id, type, remark,
create_time, update_time)
values (#{typeId,jdbcType=INTEGER}, #{type,jdbcType=VARCHAR}, #{remark,jdbcType=VARCHAR},
#{createTime,jdbcType=TIMESTAMP}, #{updateTime,jdbcType=TIMESTAMP})
</insert>
<insert id="insertSelective" parameterType="cn.mafangui.hotel.entity.OrderType">
insert into order_type
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="typeId != null">
type_id,
</if>
<if test="type != null">
type,
</if>
<if test="remark != null">
remark,
</if>
<if test="createTime != null">
create_time,
</if>
<if test="updateTime != null">
update_time,
</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="typeId != null">
#{typeId,jdbcType=INTEGER},
</if>
<if test="type != null">
#{type,jdbcType=VARCHAR},
</if>
<if test="remark != null">
#{remark,jdbcType=VARCHAR},
</if>
<if test="createTime != null">
#{createTime,jdbcType=TIMESTAMP},
</if>
<if test="updateTime != null">
#{updateTime,jdbcType=TIMESTAMP},
</if>
</trim>
</insert>
<update id="updateByPrimaryKeySelective" parameterType="cn.mafangui.hotel.entity.OrderType">
update order_type
<set>
<if test="type != null">
type = #{type,jdbcType=VARCHAR},
</if>
<if test="remark != null">
remark = #{remark,jdbcType=VARCHAR},
</if>
<if test="createTime != null">
create_time = #{createTime,jdbcType=TIMESTAMP},
</if>
<if test="updateTime != null">
update_time = #{updateTime,jdbcType=TIMESTAMP},
</if>
</set>
where type_id = #{typeId,jdbcType=INTEGER}
</update>
<update id="updateByPrimaryKey" parameterType="cn.mafangui.hotel.entity.OrderType">
update order_type
set type = #{type,jdbcType=VARCHAR},
remark = #{remark,jdbcType=VARCHAR},
create_time = #{createTime,jdbcType=TIMESTAMP},
update_time = #{updateTime,jdbcType=TIMESTAMP}
where type_id = #{typeId,jdbcType=INTEGER}
</update>
</mapper>

View File

@ -0,0 +1,153 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="cn.mafangui.hotel.mapper.RoomMapper">
<resultMap id="BaseResultMap" type="cn.mafangui.hotel.entity.Room">
<id column="room_id" jdbcType="INTEGER" property="roomId" />
<result column="room_number" jdbcType="VARCHAR" property="roomNumber" />
<result column="type_id" jdbcType="INTEGER" property="typeId" />
<result column="room_type" jdbcType="VARCHAR" property="roomType" />
<result column="room_price" jdbcType="DOUBLE" property="roomPrice" />
<result column="room_discount" jdbcType="DOUBLE" property="roomDiscount" />
<result column="room_status" jdbcType="INTEGER" property="roomStatus" />
<result column="remark" jdbcType="VARCHAR" property="remark" />
<result column="create_time" jdbcType="TIMESTAMP" property="createTime" />
<result column="update_time" jdbcType="TIMESTAMP" property="updateTime" />
</resultMap>
<sql id="Base_Column_List">
room_id, room_number, type_id, room_type, room_price, room_discount, room_status,
remark, create_time, update_time
</sql>
<select id="selectByPrimaryKey" parameterType="java.lang.Integer" resultMap="BaseResultMap">
select
<include refid="Base_Column_List" />
from room_info
where room_id = #{roomId,jdbcType=INTEGER}
</select>
<delete id="deleteByPrimaryKey" parameterType="java.lang.Integer">
delete from room_info
where room_id = #{roomId,jdbcType=INTEGER}
</delete>
<insert id="insert" parameterType="cn.mafangui.hotel.entity.Room">
insert into room_info (room_id, room_number, type_id,
room_type, room_price, room_discount,
room_status, remark, create_time,
update_time)
values (#{roomId,jdbcType=INTEGER}, #{roomNumber,jdbcType=VARCHAR}, #{typeId,jdbcType=INTEGER},
#{roomType,jdbcType=VARCHAR}, #{roomPrice,jdbcType=DOUBLE}, #{roomDiscount,jdbcType=DOUBLE},
#{roomStatus,jdbcType=INTEGER}, #{remark,jdbcType=VARCHAR}, #{createTime,jdbcType=TIMESTAMP},
#{updateTime,jdbcType=TIMESTAMP})
</insert>
<insert id="insertSelective" parameterType="cn.mafangui.hotel.entity.Room">
insert into room_info
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="roomId != null">
room_id,
</if>
<if test="roomNumber != null">
room_number,
</if>
<if test="typeId != null">
type_id,
</if>
<if test="roomType != null">
room_type,
</if>
<if test="roomPrice != null">
room_price,
</if>
<if test="roomDiscount != null">
room_discount,
</if>
<if test="roomStatus != null">
room_status,
</if>
<if test="remark != null">
remark,
</if>
<if test="createTime != null">
create_time,
</if>
<if test="updateTime != null">
update_time,
</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="roomId != null">
#{roomId,jdbcType=INTEGER},
</if>
<if test="roomNumber != null">
#{roomNumber,jdbcType=VARCHAR},
</if>
<if test="typeId != null">
#{typeId,jdbcType=INTEGER},
</if>
<if test="roomType != null">
#{roomType,jdbcType=VARCHAR},
</if>
<if test="roomPrice != null">
#{roomPrice,jdbcType=DOUBLE},
</if>
<if test="roomDiscount != null">
#{roomDiscount,jdbcType=DOUBLE},
</if>
<if test="roomStatus != null">
#{roomStatus,jdbcType=INTEGER},
</if>
<if test="remark != null">
#{remark,jdbcType=VARCHAR},
</if>
<if test="createTime != null">
#{createTime,jdbcType=TIMESTAMP},
</if>
<if test="updateTime != null">
#{updateTime,jdbcType=TIMESTAMP},
</if>
</trim>
</insert>
<update id="updateByPrimaryKeySelective" parameterType="cn.mafangui.hotel.entity.Room">
update room_info
<set>
<if test="roomNumber != null">
room_number = #{roomNumber,jdbcType=VARCHAR},
</if>
<if test="typeId != null">
type_id = #{typeId,jdbcType=INTEGER},
</if>
<if test="roomType != null">
room_type = #{roomType,jdbcType=VARCHAR},
</if>
<if test="roomPrice != null">
room_price = #{roomPrice,jdbcType=DOUBLE},
</if>
<if test="roomDiscount != null">
room_discount = #{roomDiscount,jdbcType=DOUBLE},
</if>
<if test="roomStatus != null">
room_status = #{roomStatus,jdbcType=INTEGER},
</if>
<if test="remark != null">
remark = #{remark,jdbcType=VARCHAR},
</if>
<if test="createTime != null">
create_time = #{createTime,jdbcType=TIMESTAMP},
</if>
<if test="updateTime != null">
update_time = #{updateTime,jdbcType=TIMESTAMP},
</if>
</set>
where room_id = #{roomId,jdbcType=INTEGER}
</update>
<update id="updateByPrimaryKey" parameterType="cn.mafangui.hotel.entity.Room">
update room_info
set room_number = #{roomNumber,jdbcType=VARCHAR},
type_id = #{typeId,jdbcType=INTEGER},
room_type = #{roomType,jdbcType=VARCHAR},
room_price = #{roomPrice,jdbcType=DOUBLE},
room_discount = #{roomDiscount,jdbcType=DOUBLE},
room_status = #{roomStatus,jdbcType=INTEGER},
remark = #{remark,jdbcType=VARCHAR},
create_time = #{createTime,jdbcType=TIMESTAMP},
update_time = #{updateTime,jdbcType=TIMESTAMP}
where room_id = #{roomId,jdbcType=INTEGER}
</update>
</mapper>

View File

@ -0,0 +1,164 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="cn.mafangui.hotel.mapper.RoomTypeMapper">
<resultMap id="BaseResultMap" type="cn.mafangui.hotel.entity.RoomType">
<id column="type_id" jdbcType="BIGINT" property="typeId" />
<result column="room_type" jdbcType="VARCHAR" property="roomType" />
<result column="remark" jdbcType="VARCHAR" property="remark" />
<result column="price" jdbcType="DOUBLE" property="price" />
<result column="discount" jdbcType="DOUBLE" property="discount" />
<result column="area" jdbcType="INTEGER" property="area" />
<result column="bed_num" jdbcType="INTEGER" property="bedNum" />
<result column="bed_size" jdbcType="VARCHAR" property="bedSize" />
<result column="window" jdbcType="INTEGER" property="window" />
<result column="create_time" jdbcType="TIMESTAMP" property="createTime" />
<result column="update_time" jdbcType="TIMESTAMP" property="updateTime" />
</resultMap>
<sql id="Base_Column_List">
type_id, room_type, remark, price, discount, area, bed_num, bed_size, window, create_time,
update_time
</sql>
<select id="selectByPrimaryKey" parameterType="java.lang.Long" resultMap="BaseResultMap">
select
<include refid="Base_Column_List" />
from room_type
where type_id = #{typeId,jdbcType=BIGINT}
</select>
<delete id="deleteByPrimaryKey" parameterType="java.lang.Long">
delete from room_type
where type_id = #{typeId,jdbcType=BIGINT}
</delete>
<insert id="insert" parameterType="cn.mafangui.hotel.entity.RoomType">
insert into room_type (type_id, room_type, remark,
price, discount, area,
bed_num, bed_size, window,
create_time, update_time)
values (#{typeId,jdbcType=BIGINT}, #{roomType,jdbcType=VARCHAR}, #{remark,jdbcType=VARCHAR},
#{price,jdbcType=DOUBLE}, #{discount,jdbcType=DOUBLE}, #{area,jdbcType=INTEGER},
#{bedNum,jdbcType=INTEGER}, #{bedSize,jdbcType=VARCHAR}, #{window,jdbcType=INTEGER},
#{createTime,jdbcType=TIMESTAMP}, #{updateTime,jdbcType=TIMESTAMP})
</insert>
<insert id="insertSelective" parameterType="cn.mafangui.hotel.entity.RoomType">
insert into room_type
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="typeId != null">
type_id,
</if>
<if test="roomType != null">
room_type,
</if>
<if test="remark != null">
remark,
</if>
<if test="price != null">
price,
</if>
<if test="discount != null">
discount,
</if>
<if test="area != null">
area,
</if>
<if test="bedNum != null">
bed_num,
</if>
<if test="bedSize != null">
bed_size,
</if>
<if test="window != null">
window,
</if>
<if test="createTime != null">
create_time,
</if>
<if test="updateTime != null">
update_time,
</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="typeId != null">
#{typeId,jdbcType=BIGINT},
</if>
<if test="roomType != null">
#{roomType,jdbcType=VARCHAR},
</if>
<if test="remark != null">
#{remark,jdbcType=VARCHAR},
</if>
<if test="price != null">
#{price,jdbcType=DOUBLE},
</if>
<if test="discount != null">
#{discount,jdbcType=DOUBLE},
</if>
<if test="area != null">
#{area,jdbcType=INTEGER},
</if>
<if test="bedNum != null">
#{bedNum,jdbcType=INTEGER},
</if>
<if test="bedSize != null">
#{bedSize,jdbcType=VARCHAR},
</if>
<if test="window != null">
#{window,jdbcType=INTEGER},
</if>
<if test="createTime != null">
#{createTime,jdbcType=TIMESTAMP},
</if>
<if test="updateTime != null">
#{updateTime,jdbcType=TIMESTAMP},
</if>
</trim>
</insert>
<update id="updateByPrimaryKeySelective" parameterType="cn.mafangui.hotel.entity.RoomType">
update room_type
<set>
<if test="roomType != null">
room_type = #{roomType,jdbcType=VARCHAR},
</if>
<if test="remark != null">
remark = #{remark,jdbcType=VARCHAR},
</if>
<if test="price != null">
price = #{price,jdbcType=DOUBLE},
</if>
<if test="discount != null">
discount = #{discount,jdbcType=DOUBLE},
</if>
<if test="area != null">
area = #{area,jdbcType=INTEGER},
</if>
<if test="bedNum != null">
bed_num = #{bedNum,jdbcType=INTEGER},
</if>
<if test="bedSize != null">
bed_size = #{bedSize,jdbcType=VARCHAR},
</if>
<if test="window != null">
window = #{window,jdbcType=INTEGER},
</if>
<if test="createTime != null">
create_time = #{createTime,jdbcType=TIMESTAMP},
</if>
<if test="updateTime != null">
update_time = #{updateTime,jdbcType=TIMESTAMP},
</if>
</set>
where type_id = #{typeId,jdbcType=BIGINT}
</update>
<update id="updateByPrimaryKey" parameterType="cn.mafangui.hotel.entity.RoomType">
update room_type
set room_type = #{roomType,jdbcType=VARCHAR},
remark = #{remark,jdbcType=VARCHAR},
price = #{price,jdbcType=DOUBLE},
discount = #{discount,jdbcType=DOUBLE},
area = #{area,jdbcType=INTEGER},
bed_num = #{bedNum,jdbcType=INTEGER},
bed_size = #{bedSize,jdbcType=VARCHAR},
window = #{window,jdbcType=INTEGER},
create_time = #{createTime,jdbcType=TIMESTAMP},
update_time = #{updateTime,jdbcType=TIMESTAMP}
where type_id = #{typeId,jdbcType=BIGINT}
</update>
</mapper>

View File

@ -0,0 +1,160 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="cn.mafangui.hotel.mapper.UserMapper">
<resultMap id="BaseResultMap" type="cn.mafangui.hotel.entity.User">
<id column="user_id" jdbcType="INTEGER" property="userId" />
<result column="username" jdbcType="VARCHAR" property="username" />
<result column="password" jdbcType="VARCHAR" property="password" />
<result column="name" jdbcType="VARCHAR" property="name" />
<result column="gender" jdbcType="CHAR" property="gender" />
<result column="phone" jdbcType="VARCHAR" property="phone" />
<result column="email" jdbcType="VARCHAR" property="email" />
<result column="address" jdbcType="VARCHAR" property="address" />
<result column="idcard" jdbcType="VARCHAR" property="idcard" />
<result column="create_time" jdbcType="TIMESTAMP" property="createTime" />
<result column="update_time" jdbcType="TIMESTAMP" property="updateTime" />
</resultMap>
<sql id="Base_Column_List">
user_id, username, password, name, gender, phone, email, address, idcard, create_time,
update_time
</sql>
<select id="selectByPrimaryKey" parameterType="java.lang.Integer" resultMap="BaseResultMap">
select
<include refid="Base_Column_List" />
from user_info
where user_id = #{userId,jdbcType=INTEGER}
</select>
<delete id="deleteByPrimaryKey" parameterType="java.lang.Integer">
delete from user_info
where user_id = #{userId,jdbcType=INTEGER}
</delete>
<insert id="insert" parameterType="cn.mafangui.hotel.entity.User">
insert into user_info (user_id, username, password,
name, gender, phone, email,
address, idcard, create_time,
update_time)
values (#{userId,jdbcType=INTEGER}, #{username,jdbcType=VARCHAR}, #{password,jdbcType=VARCHAR},
#{name,jdbcType=VARCHAR}, #{gender,jdbcType=CHAR}, #{phone,jdbcType=VARCHAR}, #{email,jdbcType=VARCHAR},
#{address,jdbcType=VARCHAR}, #{idcard,jdbcType=VARCHAR},now(),
now())
</insert>
<insert id="insertSelective" parameterType="cn.mafangui.hotel.entity.User">
insert into user_info
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="userId != null">
user_id,
</if>
<if test="username != null">
username,
</if>
<if test="password != null">
password,
</if>
<if test="name != null">
name,
</if>
<if test="gender != null">
gender,
</if>
<if test="phone != null">
phone,
</if>
<if test="email != null">
email,
</if>
<if test="address != null">
address,
</if>
<if test="idcard != null">
idcard,
</if>
create_time,
update_time,
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="userId != null">
#{userId,jdbcType=INTEGER},
</if>
<if test="username != null">
#{username,jdbcType=VARCHAR},
</if>
<if test="password != null">
#{password,jdbcType=VARCHAR},
</if>
<if test="name != null">
#{name,jdbcType=VARCHAR},
</if>
<if test="gender != null">
#{gender,jdbcType=CHAR},
</if>
<if test="phone != null">
#{phone,jdbcType=VARCHAR},
</if>
<if test="email != null">
#{email,jdbcType=VARCHAR},
</if>
<if test="address != null">
#{address,jdbcType=VARCHAR},
</if>
<if test="idcard != null">
#{idcard,jdbcType=VARCHAR},
</if>
now(),
now(),
</trim>
</insert>
<update id="updateByPrimaryKeySelective" parameterType="cn.mafangui.hotel.entity.User">
update user_info
<set>
<if test="username != null">
username = #{username,jdbcType=VARCHAR},
</if>
<if test="password != null">
password = #{password,jdbcType=VARCHAR},
</if>
<if test="name != null">
name = #{name,jdbcType=VARCHAR},
</if>
<if test="gender != null">
gender = #{gender,jdbcType=CHAR},
</if>
<if test="phone != null">
phone = #{phone,jdbcType=VARCHAR},
</if>
<if test="email != null">
email = #{email,jdbcType=VARCHAR},
</if>
<if test="address != null">
address = #{address,jdbcType=VARCHAR},
</if>
<if test="idcard != null">
idcard = #{idcard,jdbcType=VARCHAR},
</if>
update_time = now(),
</set>
where user_id = #{userId,jdbcType=INTEGER}
</update>
<update id="updateByPrimaryKey" parameterType="cn.mafangui.hotel.entity.User">
update user_info
set username = #{username,jdbcType=VARCHAR},
password = #{password,jdbcType=VARCHAR},
name = #{name,jdbcType=VARCHAR},
gender = #{gender,jdbcType=CHAR},
phone = #{phone,jdbcType=VARCHAR},
email = #{email,jdbcType=VARCHAR},
address = #{address,jdbcType=VARCHAR},
idcard = #{idcard,jdbcType=VARCHAR},
update_time = now()
where user_id = #{userId,jdbcType=INTEGER}
</update>
<select id="count">
select count(*) from user_info
</select>
<select id="selectAll" resultMap="cn.mafangui.hotel.entity.User">
select * from user_info
</select>
<select id="selectByUsernameAndPassword" resultMap="cn.mafangui.hotel.entity.User">
select * from user_info
where username = #{username,jdbcType=VARCHAR} and password = #{password,jdbcType=VARCHAR}
</select>
</mapper>

View File

@ -0,0 +1,177 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="cn.mafangui.hotel.mapper.WorkerMapper">
<resultMap id="BaseResultMap" type="cn.mafangui.hotel.entity.Worker">
<id column="worker_id" jdbcType="INTEGER" property="workerId" />
<result column="role" jdbcType="VARCHAR" property="role" />
<result column="username" jdbcType="VARCHAR" property="username" />
<result column="password" jdbcType="VARCHAR" property="password" />
<result column="name" jdbcType="VARCHAR" property="name" />
<result column="gender" jdbcType="CHAR" property="gender" />
<result column="phone" jdbcType="VARCHAR" property="phone" />
<result column="department" jdbcType="INTEGER" property="department" />
<result column="email" jdbcType="VARCHAR" property="email" />
<result column="address" jdbcType="VARCHAR" property="address" />
<result column="create_time" jdbcType="TIMESTAMP" property="createTime" />
<result column="update_time" jdbcType="TIMESTAMP" property="updateTime" />
</resultMap>
<sql id="Base_Column_List">
worker_id, role, username, password, name, gender, phone, department, email, address,
create_time, update_time
</sql>
<select id="selectByPrimaryKey" parameterType="java.lang.Integer" resultMap="BaseResultMap">
select
<include refid="Base_Column_List" />
from worker_info
where worker_id = #{workerId,jdbcType=INTEGER}
</select>
<delete id="deleteByPrimaryKey" parameterType="java.lang.Integer">
delete from worker_info
where worker_id = #{workerId,jdbcType=INTEGER}
</delete>
<insert id="insert" parameterType="cn.mafangui.hotel.entity.Worker">
insert into worker_info (worker_id, role, username,
password, name, gender,
phone, department, email,
address, create_time, update_time
)
values (#{workerId,jdbcType=INTEGER}, #{role,jdbcType=VARCHAR}, #{username,jdbcType=VARCHAR},
#{password,jdbcType=VARCHAR}, #{name,jdbcType=VARCHAR}, #{gender,jdbcType=CHAR},
#{phone,jdbcType=VARCHAR}, #{department,jdbcType=INTEGER}, #{email,jdbcType=VARCHAR},
#{address,jdbcType=VARCHAR}, #{createTime,jdbcType=TIMESTAMP}, #{updateTime,jdbcType=TIMESTAMP}
)
</insert>
<insert id="insertSelective" parameterType="cn.mafangui.hotel.entity.Worker">
insert into worker_info
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="workerId != null">
worker_id,
</if>
<if test="role != null">
role,
</if>
<if test="username != null">
username,
</if>
<if test="password != null">
password,
</if>
<if test="name != null">
name,
</if>
<if test="gender != null">
gender,
</if>
<if test="phone != null">
phone,
</if>
<if test="department != null">
department,
</if>
<if test="email != null">
email,
</if>
<if test="address != null">
address,
</if>
<if test="createTime != null">
create_time,
</if>
<if test="updateTime != null">
update_time,
</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="workerId != null">
#{workerId,jdbcType=INTEGER},
</if>
<if test="role != null">
#{role,jdbcType=VARCHAR},
</if>
<if test="username != null">
#{username,jdbcType=VARCHAR},
</if>
<if test="password != null">
#{password,jdbcType=VARCHAR},
</if>
<if test="name != null">
#{name,jdbcType=VARCHAR},
</if>
<if test="gender != null">
#{gender,jdbcType=CHAR},
</if>
<if test="phone != null">
#{phone,jdbcType=VARCHAR},
</if>
<if test="department != null">
#{department,jdbcType=INTEGER},
</if>
<if test="email != null">
#{email,jdbcType=VARCHAR},
</if>
<if test="address != null">
#{address,jdbcType=VARCHAR},
</if>
<if test="createTime != null">
#{createTime,jdbcType=TIMESTAMP},
</if>
<if test="updateTime != null">
#{updateTime,jdbcType=TIMESTAMP},
</if>
</trim>
</insert>
<update id="updateByPrimaryKeySelective" parameterType="cn.mafangui.hotel.entity.Worker">
update worker_info
<set>
<if test="role != null">
role = #{role,jdbcType=VARCHAR},
</if>
<if test="username != null">
username = #{username,jdbcType=VARCHAR},
</if>
<if test="password != null">
password = #{password,jdbcType=VARCHAR},
</if>
<if test="name != null">
name = #{name,jdbcType=VARCHAR},
</if>
<if test="gender != null">
gender = #{gender,jdbcType=CHAR},
</if>
<if test="phone != null">
phone = #{phone,jdbcType=VARCHAR},
</if>
<if test="department != null">
department = #{department,jdbcType=INTEGER},
</if>
<if test="email != null">
email = #{email,jdbcType=VARCHAR},
</if>
<if test="address != null">
address = #{address,jdbcType=VARCHAR},
</if>
<if test="createTime != null">
create_time = #{createTime,jdbcType=TIMESTAMP},
</if>
<if test="updateTime != null">
update_time = #{updateTime,jdbcType=TIMESTAMP},
</if>
</set>
where worker_id = #{workerId,jdbcType=INTEGER}
</update>
<update id="updateByPrimaryKey" parameterType="cn.mafangui.hotel.entity.Worker">
update worker_info
set role = #{role,jdbcType=VARCHAR},
username = #{username,jdbcType=VARCHAR},
password = #{password,jdbcType=VARCHAR},
name = #{name,jdbcType=VARCHAR},
gender = #{gender,jdbcType=CHAR},
phone = #{phone,jdbcType=VARCHAR},
department = #{department,jdbcType=INTEGER},
email = #{email,jdbcType=VARCHAR},
address = #{address,jdbcType=VARCHAR},
create_time = #{createTime,jdbcType=TIMESTAMP},
update_time = #{updateTime,jdbcType=TIMESTAMP}
where worker_id = #{workerId,jdbcType=INTEGER}
</update>
</mapper>