mirror of
				https://github.com/FreeeBird/hotel.git
				synced 2025-10-31 20:44:52 +08:00 
			
		
		
		
	完成WorkerService类编写,通过单元测试
This commit is contained in:
		| @@ -1,132 +0,0 @@ | |||||||
| package cn.mafangui.hotel.controller; |  | ||||||
|  |  | ||||||
| import cn.mafangui.hotel.entity.Admin; |  | ||||||
| import cn.mafangui.hotel.service.AdminService; |  | ||||||
| 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; |  | ||||||
|  |  | ||||||
| @RestController |  | ||||||
| @RequestMapping(value = "/admin") |  | ||||||
| public class AdminController { |  | ||||||
|     @Autowired |  | ||||||
|     private AdminService adminService; |  | ||||||
|  |  | ||||||
|     /** |  | ||||||
|      * 管理员登录 |  | ||||||
|      * @param username |  | ||||||
|      * @param password |  | ||||||
|      * @return |  | ||||||
|      */ |  | ||||||
|     @RequestMapping(method = RequestMethod.POST, value = "/login") |  | ||||||
|     public HashMap login(String username, String password){ |  | ||||||
|         HashMap result = new HashMap(); |  | ||||||
|         Admin admin = new Admin(); |  | ||||||
|         admin.setUserName(username); |  | ||||||
|         admin.setPassword(password); |  | ||||||
|         System.out.println(admin); |  | ||||||
|         if (adminService.selectByUserName(username) == null){ |  | ||||||
|             result.put("data","用户名不存在!"); |  | ||||||
|         }else if (adminService.login(admin) == null){ |  | ||||||
|             result.put("data","用户名或密码不正确!"); |  | ||||||
|         }else { |  | ||||||
|             result.put("data","登录成功!"); |  | ||||||
|         } |  | ||||||
|         result.put("code",20000); |  | ||||||
|         result.put("token","admin"); |  | ||||||
|         return result; |  | ||||||
|     } |  | ||||||
|  |  | ||||||
|     @RequestMapping(value = "/logout") |  | ||||||
|     public HashMap logout(String token) { |  | ||||||
|         HashMap result = new HashMap(); |  | ||||||
|         result.put("code",20000); |  | ||||||
|         result.put("data",token); |  | ||||||
|         return result; |  | ||||||
|     } |  | ||||||
|  |  | ||||||
|     @RequestMapping(value = "/info") |  | ||||||
|     public HashMap info(String token, String username) { |  | ||||||
|         HashMap result = new HashMap(); |  | ||||||
|         HashMap data = new HashMap(); |  | ||||||
|         Admin admin = adminService.selectByUserName(username); |  | ||||||
|         if (admin == null){ |  | ||||||
|             data.put("data","用户名不存在!"); |  | ||||||
|         }else { |  | ||||||
|             data.put("data",admin); |  | ||||||
|         } |  | ||||||
|         result.put("code",20000); |  | ||||||
|         String[] roles = {"admin"}; |  | ||||||
|         data.put("roles",roles); |  | ||||||
|         result.put("data",data); |  | ||||||
|         return result; |  | ||||||
|     } |  | ||||||
|  |  | ||||||
|     /** |  | ||||||
|      * 管理员注册 |  | ||||||
|      * @param userName |  | ||||||
|      * @param password |  | ||||||
|      * @return |  | ||||||
|      */ |  | ||||||
|     @RequestMapping(method = RequestMethod.POST, value = "/register") |  | ||||||
|     public int register(String userName, String password){ |  | ||||||
|         Admin admin = new Admin(); |  | ||||||
|         admin.setUserName(userName); |  | ||||||
|         admin.setPassword(password); |  | ||||||
|         return adminService.register(admin); |  | ||||||
|     } |  | ||||||
|  |  | ||||||
|     /** |  | ||||||
|      * 更新资料 |  | ||||||
|      * @param userName |  | ||||||
|      * @param password |  | ||||||
|      * @return |  | ||||||
|      */ |  | ||||||
|     @RequestMapping(method = RequestMethod.POST, value = "/updateProfile") |  | ||||||
|     public int updateProfile(String userName, String password){ |  | ||||||
|         Admin admin = new Admin(); |  | ||||||
|         admin.setUserName(userName); |  | ||||||
|         admin.setPassword(password); |  | ||||||
|         return adminService.updateProfile(admin); |  | ||||||
|     } |  | ||||||
|  |  | ||||||
|     /** |  | ||||||
|      * 更改密码 |  | ||||||
|      * @param userName |  | ||||||
|      * @param password |  | ||||||
|      * @param newPassword |  | ||||||
|      * @return |  | ||||||
|      */ |  | ||||||
|     @RequestMapping(method = RequestMethod.POST,value = "/updatePassword") |  | ||||||
|     public int updatePassword(String userName, String password,String newPassword){ |  | ||||||
|         Admin admin = new Admin(); |  | ||||||
|         admin.setUserName(userName); |  | ||||||
|         admin.setPassword(password); |  | ||||||
|         return adminService.updatePassword(admin,newPassword); |  | ||||||
|     } |  | ||||||
|  |  | ||||||
|     /** |  | ||||||
|      * 查找管理员 |  | ||||||
|      * @param userName |  | ||||||
|      * @return |  | ||||||
|      */ |  | ||||||
|     @RequestMapping(value = "/getAdmin") |  | ||||||
|     public Admin getAdmin(String userName){ |  | ||||||
|         return adminService.selectByUserName(userName); |  | ||||||
|     } |  | ||||||
|  |  | ||||||
|     /** |  | ||||||
|      * 查找所有管理员 |  | ||||||
|      * @return |  | ||||||
|      */ |  | ||||||
|     @RequestMapping(value = "/getAllAdmin") |  | ||||||
|     public HashMap getAllAdmin(){ |  | ||||||
|         HashMap result = new HashMap(); |  | ||||||
|         result.put("code",1); |  | ||||||
|         result.put("data",adminService.findAll()); |  | ||||||
|         return result; |  | ||||||
|     } |  | ||||||
| } |  | ||||||
| @@ -1,114 +0,0 @@ | |||||||
| package cn.mafangui.hotel.controller; |  | ||||||
|  |  | ||||||
|  |  | ||||||
| import cn.mafangui.hotel.entity.Hotel; |  | ||||||
| import cn.mafangui.hotel.service.HotelService; |  | ||||||
| import org.springframework.beans.factory.annotation.Autowired; |  | ||||||
| import org.springframework.web.bind.annotation.RequestMapping; |  | ||||||
| import org.springframework.web.bind.annotation.RestController; |  | ||||||
|  |  | ||||||
| import java.util.List; |  | ||||||
|  |  | ||||||
| @RestController |  | ||||||
| @RequestMapping(value = "/hotelInfo") |  | ||||||
| public class HotelController { |  | ||||||
|     @Autowired |  | ||||||
|     private HotelService hotelService; |  | ||||||
|     /** |  | ||||||
|      * 添加酒店信息 |  | ||||||
|      * @param hotelName |  | ||||||
|      * @param phone |  | ||||||
|      * @param telephone |  | ||||||
|      * @param email |  | ||||||
|      * @param address |  | ||||||
|      * @param website |  | ||||||
|      * @return |  | ||||||
|      */ |  | ||||||
|     @RequestMapping(value = "/add") |  | ||||||
|     public int addHotel(String hotelName,String phone,String telephone,String email,String address,String website){ |  | ||||||
|         int result = 0; |  | ||||||
|         Hotel hotel = new Hotel(hotelName,phone,telephone,email,address,website); |  | ||||||
|         try { |  | ||||||
|             result = hotelService.addHotel(hotel); |  | ||||||
|         }catch (Exception e){ |  | ||||||
|             result = -1; |  | ||||||
|         } |  | ||||||
|         return result; |  | ||||||
|     } |  | ||||||
|  |  | ||||||
|     /** |  | ||||||
|      * 删除酒店信息 |  | ||||||
|      * @param hotelId |  | ||||||
|      * @return |  | ||||||
|      */ |  | ||||||
|     @RequestMapping(value = "/delete") |  | ||||||
|     public int deleteHotel(int hotelId){ |  | ||||||
|         int result = 0; |  | ||||||
|         try { |  | ||||||
|             result = hotelService.deleteHotel(hotelId); |  | ||||||
|         }catch (Exception e){ |  | ||||||
|             result = -1; |  | ||||||
|         } |  | ||||||
|         return result; |  | ||||||
|     } |  | ||||||
|  |  | ||||||
|     /** |  | ||||||
|      * 更改酒店信息 |  | ||||||
|      * @param hotelName |  | ||||||
|      * @param phone |  | ||||||
|      * @param telephone |  | ||||||
|      * @param email |  | ||||||
|      * @param address |  | ||||||
|      * @param website |  | ||||||
|      * @return |  | ||||||
|      */ |  | ||||||
|     @RequestMapping(value = "/update") |  | ||||||
|     public int updateHotel(int hotelId,String hotelName,String phone,String telephone,String email,String address,String website){ |  | ||||||
|         int result = 0; |  | ||||||
|         Hotel hotel = new Hotel(hotelName,phone,telephone,email,address,website); |  | ||||||
|         hotel.setHotelId(hotelId); |  | ||||||
|         try{ |  | ||||||
|             result = hotelService.updateHotel(hotel); |  | ||||||
|         }catch (Exception e){ |  | ||||||
|             result = -1; |  | ||||||
|         } |  | ||||||
|         return result; |  | ||||||
|     } |  | ||||||
|  |  | ||||||
|     /** |  | ||||||
|      * 根据id查询 |  | ||||||
|      * @param hotelId |  | ||||||
|      * @return |  | ||||||
|      */ |  | ||||||
|     @RequestMapping(value = "/withId") |  | ||||||
|     public Hotel selectHotel(int hotelId){ |  | ||||||
|         try { |  | ||||||
|             return hotelService.selectHotelById(hotelId); |  | ||||||
|         }catch (Exception e){ |  | ||||||
|             return null; |  | ||||||
|         } |  | ||||||
|     } |  | ||||||
|  |  | ||||||
|     /** |  | ||||||
|      * 根据酒店名查询 |  | ||||||
|      * @param hotelName |  | ||||||
|      * @return |  | ||||||
|      */ |  | ||||||
|     @RequestMapping(value = "/withName") |  | ||||||
|     public Hotel selectHotel(String hotelName){ |  | ||||||
|         try { |  | ||||||
|             return hotelService.selectHotelByName(hotelName); |  | ||||||
|         }catch (Exception e){ |  | ||||||
|             return null; |  | ||||||
|         } |  | ||||||
|     } |  | ||||||
|  |  | ||||||
|     /** |  | ||||||
|      * 所有酒店信息 |  | ||||||
|      * @return |  | ||||||
|      */ |  | ||||||
|     @RequestMapping(value = "/all") |  | ||||||
|     public List<Hotel> allHotel(){ |  | ||||||
|         return hotelService.findAllHotel(); |  | ||||||
|     } |  | ||||||
| } |  | ||||||
| @@ -1,179 +0,0 @@ | |||||||
| package cn.mafangui.hotel.controller; |  | ||||||
|  |  | ||||||
|  |  | ||||||
| import cn.mafangui.hotel.entity.Room; |  | ||||||
| import cn.mafangui.hotel.service.RoomService; |  | ||||||
| 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.RestController; |  | ||||||
|  |  | ||||||
| import java.util.HashMap; |  | ||||||
|  |  | ||||||
| @RestController |  | ||||||
| @RequestMapping(value = "/roomInfo") |  | ||||||
| public class RoomController { |  | ||||||
|     @Autowired |  | ||||||
|     private RoomService roomService; |  | ||||||
|  |  | ||||||
|     /** |  | ||||||
|      * 增加房间 |  | ||||||
|      * @param roomNumber |  | ||||||
|      * @param roomFloor |  | ||||||
|      * @param typeName |  | ||||||
|      * @param roomPrice |  | ||||||
|      * @param roomDiscount |  | ||||||
|      * @param roomStatus |  | ||||||
|      * @param remark |  | ||||||
|      * @return |  | ||||||
|      */ |  | ||||||
|     @RequestMapping(value = "/add") |  | ||||||
|     public HashMap addRoom(String roomNumber, int roomFloor, String typeName, |  | ||||||
|                            double roomPrice,double roomDiscount,String roomStatus,String remark){ |  | ||||||
|         HashMap result = new HashMap(); |  | ||||||
|         int data = 0; |  | ||||||
|         Room room = new Room(roomNumber,roomFloor,typeName,roomPrice,roomDiscount,roomStatus,remark); |  | ||||||
|         try { |  | ||||||
|             data = roomService.addRoom(room); |  | ||||||
|         }catch (Exception e){ |  | ||||||
|             data = -1; |  | ||||||
|         } |  | ||||||
|         result.put(StaticString.CODE,20000); |  | ||||||
|         result.put(StaticString.DATA,data); |  | ||||||
|         return result; |  | ||||||
|     } |  | ||||||
|  |  | ||||||
|     /** |  | ||||||
|      * 根据房间id或者房间号码删除房间 |  | ||||||
|      * @param roomId |  | ||||||
|      * @param roomNumber |  | ||||||
|      * @return |  | ||||||
|      */ |  | ||||||
|     @RequestMapping(value = "/delete") |  | ||||||
|     public HashMap deleteRoom(int roomId,String roomNumber){ |  | ||||||
|         HashMap result = new HashMap(); |  | ||||||
|         int data = 0; |  | ||||||
|         try { |  | ||||||
|             if (roomNumber == null || "".equals(roomNumber)){ |  | ||||||
|                 data = roomService.deleteRoom(roomId); |  | ||||||
|             }else { |  | ||||||
|                 data = roomService.deleteRoom(roomNumber); |  | ||||||
|             } |  | ||||||
|         }catch (Exception e){ |  | ||||||
|             data = -1; |  | ||||||
|         } |  | ||||||
|         result.put(StaticString.CODE,20000); |  | ||||||
|         result.put(StaticString.DATA,data); |  | ||||||
|         return result; |  | ||||||
|     } |  | ||||||
|  |  | ||||||
|     /** |  | ||||||
|      * 更改房间信息 |  | ||||||
|      * @param roomId |  | ||||||
|      * @param roomNumber |  | ||||||
|      * @param roomFloor |  | ||||||
|      * @param typeName |  | ||||||
|      * @param roomPrice |  | ||||||
|      * @param roomDiscount |  | ||||||
|      * @param roomStatus |  | ||||||
|      * @param remark |  | ||||||
|      * @return |  | ||||||
|      */ |  | ||||||
|     @RequestMapping(value = "/update") |  | ||||||
|     public HashMap updateRoom(int roomId,String roomNumber, int roomFloor, String typeName, |  | ||||||
|                               double roomPrice,double roomDiscount,String roomStatus,String remark){ |  | ||||||
|         HashMap result = new HashMap(); |  | ||||||
|         int data = 0; |  | ||||||
|         Room room = new Room(roomNumber,roomFloor,typeName,roomPrice,roomDiscount,roomStatus,remark); |  | ||||||
|         room.setRoomId(roomId); |  | ||||||
|         try { |  | ||||||
|             data = roomService.updateRoom(room); |  | ||||||
|         }catch (Exception e){ |  | ||||||
|             data = -1; |  | ||||||
|         } |  | ||||||
|         result.put(StaticString.CODE,20000); |  | ||||||
|         result.put(StaticString.DATA,data); |  | ||||||
|         return result; |  | ||||||
|     } |  | ||||||
|  |  | ||||||
|     /** |  | ||||||
|      * 查询所有房间 |  | ||||||
|      * @return |  | ||||||
|      */ |  | ||||||
|     @RequestMapping(value = "/all") |  | ||||||
|     public HashMap allRoom(){ |  | ||||||
|         HashMap result = new HashMap(); |  | ||||||
|         result.put(StaticString.DATA,roomService.findAll()); |  | ||||||
|         result.put(StaticString.CODE,20000); |  | ||||||
|         return result; |  | ||||||
|     } |  | ||||||
|  |  | ||||||
|     /** |  | ||||||
|      * 根据id |  | ||||||
|      * 查询房间信息 |  | ||||||
|      * @param roomId |  | ||||||
|      * @return |  | ||||||
|      */ |  | ||||||
|     @RequestMapping(value = "/withId") |  | ||||||
|     public HashMap findRoomById(int roomId){ |  | ||||||
|         HashMap result = new HashMap(); |  | ||||||
|         result.put(StaticString.CODE,20000); |  | ||||||
|         try{ |  | ||||||
|             result.put(StaticString.DATA,roomService.findById(roomId)); |  | ||||||
|         }catch (Exception e){ |  | ||||||
|             result.put(StaticString.DATA,-1); |  | ||||||
|         } |  | ||||||
|         return result; |  | ||||||
|     } |  | ||||||
|  |  | ||||||
|     /** |  | ||||||
|      * 根据房号查询房间信息 |  | ||||||
|      * @param roomNumber |  | ||||||
|      * @return |  | ||||||
|      */ |  | ||||||
|     @RequestMapping(value = "/withRoomNumber") |  | ||||||
|     public HashMap findRoomByNumber(String roomNumber){ |  | ||||||
|         HashMap result = new HashMap(); |  | ||||||
|         result.put(StaticString.CODE,20000); |  | ||||||
|         try{ |  | ||||||
|             result.put(StaticString.DATA,roomService.findByNumber(roomNumber)); |  | ||||||
|         }catch (Exception e){ |  | ||||||
|             result.put(StaticString.DATA,-1); |  | ||||||
|         } |  | ||||||
|         return result; |  | ||||||
|     } |  | ||||||
|  |  | ||||||
|     /** |  | ||||||
|      * 根据状态查询房间信息 |  | ||||||
|      * @param roomStatus |  | ||||||
|      * @return |  | ||||||
|      */ |  | ||||||
|     @RequestMapping(value = "/withStatus") |  | ||||||
|     public HashMap findRoomByStatus(String roomStatus){ |  | ||||||
|         HashMap result = new HashMap(); |  | ||||||
|         result.put(StaticString.CODE,20000); |  | ||||||
|         try{ |  | ||||||
|             result.put(StaticString.DATA,roomService.findByStatus(roomStatus)); |  | ||||||
|         }catch (Exception e){ |  | ||||||
|             result.put(StaticString.DATA,-1); |  | ||||||
|         } |  | ||||||
|         return result; |  | ||||||
|     } |  | ||||||
|  |  | ||||||
|     /** |  | ||||||
|      * 根据类型查询房间信息 |  | ||||||
|      * @param typeName |  | ||||||
|      * @return |  | ||||||
|      */ |  | ||||||
|     @RequestMapping(value = "/withType") |  | ||||||
|     public HashMap findRoomByType(String typeName){ |  | ||||||
|         HashMap result = new HashMap(); |  | ||||||
|         result.put(StaticString.CODE,20000); |  | ||||||
|         try{ |  | ||||||
|             result.put(StaticString.DATA,roomService.findByType(typeName)); |  | ||||||
|         }catch (Exception e){ |  | ||||||
|             result.put(StaticString.DATA,-1); |  | ||||||
|         } |  | ||||||
|         return result; |  | ||||||
|     } |  | ||||||
| } |  | ||||||
| @@ -1,101 +0,0 @@ | |||||||
| package cn.mafangui.hotel.controller; |  | ||||||
|  |  | ||||||
| import cn.mafangui.hotel.entity.RoomType; |  | ||||||
| import cn.mafangui.hotel.service.RoomTypeService; |  | ||||||
| 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; |  | ||||||
|  |  | ||||||
| @RestController |  | ||||||
| @RequestMapping(value = "/roomType") |  | ||||||
| public class RoomTypeController { |  | ||||||
|     private final String CODE = "code"; |  | ||||||
|     private final String DATA = "data"; |  | ||||||
|  |  | ||||||
|     @Autowired |  | ||||||
|     private RoomTypeService roomTypeService; |  | ||||||
|  |  | ||||||
|     /** |  | ||||||
|      * 添加房间类型 |  | ||||||
|      * @param roomType |  | ||||||
|      * @param typeName |  | ||||||
|      * @param bookingPrice |  | ||||||
|      * @param bookingDiscount |  | ||||||
|      * @param remark |  | ||||||
|      * @return |  | ||||||
|      */ |  | ||||||
|     @RequestMapping(method = RequestMethod.POST,value = "/add") |  | ||||||
|     public HashMap addNewType(int roomType,String typeName,double bookingPrice,double bookingDiscount,String remark){ |  | ||||||
|         HashMap result = new HashMap(); |  | ||||||
|         result.put(CODE,20000); |  | ||||||
|         RoomType rt = new RoomType(roomType,typeName,bookingPrice,bookingDiscount,remark); |  | ||||||
|         result.put(DATA,roomTypeService.addRoomType(rt)); |  | ||||||
|         return result; |  | ||||||
|     } |  | ||||||
|  |  | ||||||
|     /** |  | ||||||
|      * 根据id |  | ||||||
|      * 删除房间类型 |  | ||||||
|      * @param typeId |  | ||||||
|      * @return |  | ||||||
|      */ |  | ||||||
|     @RequestMapping(method = RequestMethod.POST,value = "/del") |  | ||||||
|     public HashMap delType(int typeId){ |  | ||||||
|         HashMap result = new HashMap(); |  | ||||||
|         result.put(CODE,20000); |  | ||||||
|         result.put(DATA,roomTypeService.delById(typeId)); |  | ||||||
|         return result; |  | ||||||
|     } |  | ||||||
|  |  | ||||||
|     public HashMap massDeletion(int[] typeId){ |  | ||||||
|         HashMap result = new HashMap(); |  | ||||||
|         result.put(CODE,20000); |  | ||||||
|         return result; |  | ||||||
|     } |  | ||||||
|  |  | ||||||
|     /** |  | ||||||
|      * 更改房间类型 |  | ||||||
|      * @param roomType |  | ||||||
|      * @param typeName |  | ||||||
|      * @param bookingPrice |  | ||||||
|      * @param bookingDiscount |  | ||||||
|      * @return |  | ||||||
|      */ |  | ||||||
|     @RequestMapping(method = RequestMethod.POST,value = "/update") |  | ||||||
|     public HashMap updateType(int typeId,int roomType,String typeName,double bookingPrice,double bookingDiscount,String remark){ |  | ||||||
|         HashMap result = new HashMap(); |  | ||||||
|         result.put(CODE,20000); |  | ||||||
|         RoomType rt = new RoomType(roomType,typeName,bookingPrice,bookingDiscount,remark); |  | ||||||
|         rt.setTypeId(typeId); |  | ||||||
|         result.put(DATA,roomTypeService.updateRoomType(rt)); |  | ||||||
|         return result; |  | ||||||
|     } |  | ||||||
|  |  | ||||||
|     /** |  | ||||||
|      * 查询房间类型 |  | ||||||
|      * @param typeId |  | ||||||
|      * @return |  | ||||||
|      */ |  | ||||||
|     @RequestMapping(value = "/withId") |  | ||||||
|     public HashMap findByRoomType(int typeId){ |  | ||||||
|         HashMap result = new HashMap(); |  | ||||||
|         result.put(CODE,20000); |  | ||||||
|         result.put(DATA, roomTypeService.selectById(typeId)); |  | ||||||
|         return result; |  | ||||||
|     } |  | ||||||
|  |  | ||||||
|     /** |  | ||||||
|      * 查询所有房间类型 |  | ||||||
|      * @return |  | ||||||
|      */ |  | ||||||
|     @RequestMapping(value = "/all") |  | ||||||
|     public HashMap findAllRoomType(){ |  | ||||||
|         HashMap result = new HashMap(); |  | ||||||
|         result.put("code",20000); |  | ||||||
|         result.put("data",roomTypeService.findAllType()); |  | ||||||
|         return result; |  | ||||||
|     } |  | ||||||
| } |  | ||||||
| @@ -1,98 +0,0 @@ | |||||||
| 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 |  | ||||||
| @RequestMapping(value = "/user") |  | ||||||
| public class UserController { |  | ||||||
|  |  | ||||||
|     @Autowired |  | ||||||
|     private UserService userService; |  | ||||||
|     /** |  | ||||||
|      * 更新资料 |  | ||||||
|      * @param username |  | ||||||
|      * @param password |  | ||||||
|      * @param name |  | ||||||
|      * @param phone |  | ||||||
|      * @param email |  | ||||||
|      * @param address |  | ||||||
|      * @param idcard |  | ||||||
|      * @return |  | ||||||
|      */ |  | ||||||
|     @RequestMapping(method = RequestMethod.POST,value = "/updateProfile") |  | ||||||
|     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 password |  | ||||||
|      * @param name |  | ||||||
|      * @param gender |  | ||||||
|      * @param phone |  | ||||||
|      * @param email |  | ||||||
|      * @param address |  | ||||||
|      * @param idcard |  | ||||||
|      * @return |  | ||||||
|      */ |  | ||||||
|     @RequestMapping(method = RequestMethod.POST, value = "/register") |  | ||||||
|     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 password |  | ||||||
|      * @return |  | ||||||
|      */ |  | ||||||
|     @RequestMapping(method = RequestMethod.POST, value = "/login") |  | ||||||
|     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; |  | ||||||
|     } |  | ||||||
|     /** |  | ||||||
|      * 查看用户资料 |  | ||||||
|      * @param userName |  | ||||||
|      * @return |  | ||||||
|      */ |  | ||||||
|     @RequestMapping(method = RequestMethod.POST, value = "/getProfile") |  | ||||||
|     public User getProfile(String userName){ |  | ||||||
|         return userService.selectByUserName(userName); |  | ||||||
|     } |  | ||||||
|  |  | ||||||
| } |  | ||||||
| @@ -1,101 +0,0 @@ | |||||||
| package cn.mafangui.hotel.controller; |  | ||||||
|  |  | ||||||
| import cn.mafangui.hotel.entity.Worker; |  | ||||||
| import cn.mafangui.hotel.service.WorkerService; |  | ||||||
| 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 |  | ||||||
| @RequestMapping(value = "/worker") |  | ||||||
| public class WorkerController { |  | ||||||
|     private final String CODE = "code"; |  | ||||||
|     private final String DATA = "data"; |  | ||||||
|     @Autowired |  | ||||||
|     private WorkerService workerService; |  | ||||||
|  |  | ||||||
|     /** |  | ||||||
|      * 操作员登录 |  | ||||||
|      * @param userName |  | ||||||
|      * @param password |  | ||||||
|      * @return |  | ||||||
|      */ |  | ||||||
|     @RequestMapping(method = RequestMethod.POST,value = "/login") |  | ||||||
|     public int login(String userName,String password){ |  | ||||||
|         Worker worker = new Worker(userName,password); |  | ||||||
|         if (workerService.login(worker) !=null ){ |  | ||||||
|             return 1; |  | ||||||
|         }else { |  | ||||||
|             return 0; |  | ||||||
|         } |  | ||||||
|     } |  | ||||||
|  |  | ||||||
|     /** |  | ||||||
|      * 添加操作员 |  | ||||||
|      * @param userName |  | ||||||
|      * @param password |  | ||||||
|      * @param workerName |  | ||||||
|      * @param phone |  | ||||||
|      * @param email |  | ||||||
|      * @param address |  | ||||||
|      * @return |  | ||||||
|      */ |  | ||||||
|     @RequestMapping(method = RequestMethod.POST,value = "/add") |  | ||||||
|     public int addWorker(String userName,String password,String workerName,String phone,String email,String address){ |  | ||||||
|         Worker worker = new Worker(userName,password,workerName,phone,email,address); |  | ||||||
|         return workerService.addWorker(worker); |  | ||||||
|     } |  | ||||||
|  |  | ||||||
|     /** |  | ||||||
|      * 删除操作员 |  | ||||||
|      * @param userName |  | ||||||
|      * @return |  | ||||||
|      */ |  | ||||||
|     @RequestMapping(method = RequestMethod.POST,value = "/del") |  | ||||||
|     public int delWorker(String userName){ |  | ||||||
|         return workerService.delWorker(userName); |  | ||||||
|     } |  | ||||||
|  |  | ||||||
|     /** |  | ||||||
|      * 更改操作员信息 |  | ||||||
|      * @param userName |  | ||||||
|      * @param password |  | ||||||
|      * @param workerName |  | ||||||
|      * @param phone |  | ||||||
|      * @param email |  | ||||||
|      * @param address |  | ||||||
|      * @return |  | ||||||
|      */ |  | ||||||
|     @RequestMapping(method = RequestMethod.POST,value = "/update") |  | ||||||
|     public int updateWorker(String userName,String password,String workerName,String phone,String email,String address){ |  | ||||||
|         Worker worker = new Worker(userName,password,workerName,phone,email,address); |  | ||||||
|         return workerService.updateWorker(worker); |  | ||||||
|     } |  | ||||||
|  |  | ||||||
|     /** |  | ||||||
|      * 查找操作员 |  | ||||||
|      * @param userName |  | ||||||
|      * @return |  | ||||||
|      */ |  | ||||||
|     @RequestMapping(value = "/query") |  | ||||||
|     public Worker queryWorker(String userName){ |  | ||||||
|         return workerService.selectWorker(userName); |  | ||||||
|     } |  | ||||||
|  |  | ||||||
|     /** |  | ||||||
|      * 查找所有操作员 |  | ||||||
|      * @return |  | ||||||
|      */ |  | ||||||
|     @RequestMapping(value = "/all") |  | ||||||
|     public HashMap findAllWorkers(){ |  | ||||||
|         HashMap result = new HashMap(); |  | ||||||
|         result.put(CODE,20000); |  | ||||||
|         result.put(DATA,workerService.findAllWorker()); |  | ||||||
|         return result; |  | ||||||
|     } |  | ||||||
|  |  | ||||||
| } |  | ||||||
| @@ -1,66 +0,0 @@ | |||||||
| package cn.mafangui.hotel.entity; |  | ||||||
|  |  | ||||||
| import java.util.Date; |  | ||||||
|  |  | ||||||
| public class Admin { |  | ||||||
|     private Integer adminId; |  | ||||||
|  |  | ||||||
|     private String userName; |  | ||||||
|  |  | ||||||
|     private String password; |  | ||||||
|  |  | ||||||
|     private Date createTime; |  | ||||||
|  |  | ||||||
|     private Date updateTime; |  | ||||||
|  |  | ||||||
|     public Integer getAdminId() { |  | ||||||
|         return adminId; |  | ||||||
|     } |  | ||||||
|  |  | ||||||
|     public void setAdminId(Integer adminId) { |  | ||||||
|         this.adminId = adminId; |  | ||||||
|     } |  | ||||||
|  |  | ||||||
|     public String getUserName() { |  | ||||||
|         return userName; |  | ||||||
|     } |  | ||||||
|  |  | ||||||
|     public void setUserName(String userName) { |  | ||||||
|         this.userName = userName == null ? null : userName.trim(); |  | ||||||
|     } |  | ||||||
|  |  | ||||||
|     public String getPassword() { |  | ||||||
|         return password; |  | ||||||
|     } |  | ||||||
|  |  | ||||||
|     public void setPassword(String password) { |  | ||||||
|         this.password = password == null ? null : password.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; |  | ||||||
|     } |  | ||||||
|  |  | ||||||
|     @Override |  | ||||||
|     public String toString() { |  | ||||||
|         return "Admin{" + |  | ||||||
|                 "adminId=" + adminId + |  | ||||||
|                 ", userName='" + userName + '\'' + |  | ||||||
|                 ", password='" + password + '\'' + |  | ||||||
|                 ", createTime=" + createTime + |  | ||||||
|                 ", updateTime=" + updateTime + |  | ||||||
|                 '}'; |  | ||||||
|     } |  | ||||||
| } |  | ||||||
| @@ -25,20 +25,6 @@ public class User { | |||||||
|  |  | ||||||
|     private Date updateTime; |     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() { |     public Integer getUserId() { | ||||||
|         return userId; |         return userId; | ||||||
|     } |     } | ||||||
|   | |||||||
| @@ -122,4 +122,22 @@ public class Worker { | |||||||
|     public void setUpdateTime(Date updateTime) { |     public void setUpdateTime(Date updateTime) { | ||||||
|         this.updateTime = updateTime; |         this.updateTime = updateTime; | ||||||
|     } |     } | ||||||
|  |  | ||||||
|  |     @Override | ||||||
|  |     public String toString() { | ||||||
|  |         return "Worker{" + | ||||||
|  |                 "workerId=" + workerId + | ||||||
|  |                 ", role='" + role + '\'' + | ||||||
|  |                 ", username='" + username + '\'' + | ||||||
|  |                 ", password='" + password + '\'' + | ||||||
|  |                 ", name='" + name + '\'' + | ||||||
|  |                 ", gender='" + gender + '\'' + | ||||||
|  |                 ", phone='" + phone + '\'' + | ||||||
|  |                 ", department=" + department + | ||||||
|  |                 ", email='" + email + '\'' + | ||||||
|  |                 ", address='" + address + '\'' + | ||||||
|  |                 ", createTime=" + createTime + | ||||||
|  |                 ", updateTime=" + updateTime + | ||||||
|  |                 '}'; | ||||||
|  |     } | ||||||
| } | } | ||||||
| @@ -1,21 +0,0 @@ | |||||||
| package cn.mafangui.hotel.mapper; |  | ||||||
|  |  | ||||||
| import cn.mafangui.hotel.entity.Admin; |  | ||||||
| import jdk.internal.dynalink.linker.LinkerServices; |  | ||||||
| import org.springframework.stereotype.Component; |  | ||||||
|  |  | ||||||
| import java.util.List; |  | ||||||
|  |  | ||||||
| @Component |  | ||||||
| public interface AdminMapper { |  | ||||||
|     int deleteByPrimaryKey(Integer adminId); |  | ||||||
|     int insert(Admin record); |  | ||||||
|     int insertSelective(Admin record); |  | ||||||
|     Admin selectByPrimaryKey(Integer adminId); |  | ||||||
|     int updateByPrimaryKeySelective(Admin record); |  | ||||||
|     int updateByPrimaryKey(Admin record); |  | ||||||
|     Admin selectByUserName(String userName); |  | ||||||
|     Admin selectByUserNameAndPassword(Admin record); |  | ||||||
|     int updateByUserNameSelective(Admin record); |  | ||||||
|     List<Admin> findAll(); |  | ||||||
| } |  | ||||||
| @@ -1,11 +1,8 @@ | |||||||
| package cn.mafangui.hotel.mapper; | package cn.mafangui.hotel.mapper; | ||||||
|  |  | ||||||
| import cn.mafangui.hotel.entity.User; | import cn.mafangui.hotel.entity.User; | ||||||
| import org.apache.ibatis.annotations.Param; |  | ||||||
| import org.springframework.stereotype.Component; | import org.springframework.stereotype.Component; | ||||||
|  |  | ||||||
| import java.util.List; |  | ||||||
|  |  | ||||||
| @Component | @Component | ||||||
| public interface UserMapper { | public interface UserMapper { | ||||||
|     int deleteByPrimaryKey(Integer userId); |     int deleteByPrimaryKey(Integer userId); | ||||||
| @@ -19,12 +16,4 @@ public interface UserMapper { | |||||||
|     int updateByPrimaryKeySelective(User record); |     int updateByPrimaryKeySelective(User record); | ||||||
|  |  | ||||||
|     int updateByPrimaryKey(User record); |     int updateByPrimaryKey(User record); | ||||||
|  |  | ||||||
|     int count(); |  | ||||||
|  |  | ||||||
|     List<User> selectAll(); |  | ||||||
|  |  | ||||||
|     User selectByUsernameAndPassword(@Param("username") String username, @Param("password") String password); |  | ||||||
|  |  | ||||||
|  |  | ||||||
| } | } | ||||||
| @@ -1,7 +1,12 @@ | |||||||
| package cn.mafangui.hotel.mapper; | package cn.mafangui.hotel.mapper; | ||||||
|  |  | ||||||
| import cn.mafangui.hotel.entity.Worker; | import cn.mafangui.hotel.entity.Worker; | ||||||
|  | import org.apache.ibatis.annotations.Param; | ||||||
|  | import org.springframework.stereotype.Component; | ||||||
|  |  | ||||||
|  | import java.util.List; | ||||||
|  |  | ||||||
|  | @Component | ||||||
| public interface WorkerMapper { | public interface WorkerMapper { | ||||||
|     int deleteByPrimaryKey(Integer workerId); |     int deleteByPrimaryKey(Integer workerId); | ||||||
|  |  | ||||||
| @@ -14,4 +19,10 @@ public interface WorkerMapper { | |||||||
|     int updateByPrimaryKeySelective(Worker record); |     int updateByPrimaryKeySelective(Worker record); | ||||||
|  |  | ||||||
|     int updateByPrimaryKey(Worker record); |     int updateByPrimaryKey(Worker record); | ||||||
|  |  | ||||||
|  |     Worker selectByUsernameAndPassword(@Param("username") String username, @Param("password") String password); | ||||||
|  |  | ||||||
|  |     List<Worker> selectByRole(String role); | ||||||
|  |  | ||||||
|  |     List<Worker> selectAll(); | ||||||
| } | } | ||||||
| @@ -1,14 +0,0 @@ | |||||||
| package cn.mafangui.hotel.service; |  | ||||||
|  |  | ||||||
| import cn.mafangui.hotel.entity.Admin; |  | ||||||
|  |  | ||||||
| import java.util.List; |  | ||||||
|  |  | ||||||
| public interface AdminService { |  | ||||||
|     Admin login(Admin admin); |  | ||||||
|     int register(Admin admin); |  | ||||||
|     Admin selectByUserName(String userName); |  | ||||||
|     int updateProfile(Admin admin); |  | ||||||
|     int updatePassword(Admin admin,String newPassword); |  | ||||||
|     List<Admin> findAll(); |  | ||||||
| } |  | ||||||
| @@ -15,10 +15,10 @@ public interface UserService { | |||||||
|  |  | ||||||
|     User selectByUserName(String userName); |     User selectByUserName(String userName); | ||||||
|  |  | ||||||
|     int count(); | //    int count(); | ||||||
|  | // | ||||||
|     List<User> findAll(); | //    List<User> findAll(); | ||||||
|  | // | ||||||
|     int updateProfile(User user); | //    int updateProfile(User user); | ||||||
|  |  | ||||||
| } | } | ||||||
|   | |||||||
| @@ -5,13 +5,11 @@ import cn.mafangui.hotel.entity.Worker; | |||||||
| import java.util.List; | import java.util.List; | ||||||
|  |  | ||||||
| public interface WorkerService { | public interface WorkerService { | ||||||
|  |     int insert(Worker worker); | ||||||
|     int addWorker(Worker worker); |     int delete(int workerId); | ||||||
|     int delWorker(String userName); |     int updateById(Worker worker); | ||||||
|     int updateWorker(Worker worker); |     Worker selectById(int workerId); | ||||||
|     Worker selectWorker(String userName); |     List<Worker> findAll(); | ||||||
|     List<Worker> findAllWorker(); |     List<Worker> selectByRole(String role); | ||||||
|     Worker login(Worker worker); |     Worker login(String username,String password); | ||||||
|     int logout(Worker worker); |  | ||||||
|  |  | ||||||
| } | } | ||||||
|   | |||||||
| @@ -1,90 +0,0 @@ | |||||||
| package cn.mafangui.hotel.service.impl; |  | ||||||
|  |  | ||||||
| import cn.mafangui.hotel.entity.Admin; |  | ||||||
| import cn.mafangui.hotel.mapper.AdminMapper; |  | ||||||
| import cn.mafangui.hotel.service.AdminService; |  | ||||||
| import org.springframework.beans.factory.annotation.Autowired; |  | ||||||
| import org.springframework.stereotype.Service; |  | ||||||
|  |  | ||||||
| import java.util.List; |  | ||||||
|  |  | ||||||
| @Service |  | ||||||
| public class AdminServiceImpl implements AdminService { |  | ||||||
|     @Autowired |  | ||||||
|     private AdminMapper adminMapper; |  | ||||||
|  |  | ||||||
|     /** |  | ||||||
|      * 登录 |  | ||||||
|      * @param admin |  | ||||||
|      * @return |  | ||||||
|      */ |  | ||||||
|     @Override |  | ||||||
|     public Admin login(Admin admin) { |  | ||||||
|         return adminMapper.selectByUserNameAndPassword(admin); |  | ||||||
|     } |  | ||||||
|  |  | ||||||
|     /** |  | ||||||
|      * 注册 |  | ||||||
|      * @param admin |  | ||||||
|      * @return |  | ||||||
|      */ |  | ||||||
|     @Override |  | ||||||
|     public int register(Admin admin) { |  | ||||||
|         return adminMapper.insertSelective(admin); |  | ||||||
|     } |  | ||||||
|  |  | ||||||
|     /** |  | ||||||
|      * 根据username查找 |  | ||||||
|      * @param userName |  | ||||||
|      * @return |  | ||||||
|      */ |  | ||||||
|     @Override |  | ||||||
|     public Admin selectByUserName(String userName) { |  | ||||||
|         Admin result = adminMapper.selectByUserName(userName); |  | ||||||
|         if (result != null){ |  | ||||||
|             result.setPassword(null); |  | ||||||
|         } |  | ||||||
|         return result; |  | ||||||
|     } |  | ||||||
|  |  | ||||||
|     /** |  | ||||||
|      * 更新信息 |  | ||||||
|      * @param admin |  | ||||||
|      * @return |  | ||||||
|      */ |  | ||||||
|     @Override |  | ||||||
|     public int updateProfile(Admin admin) { |  | ||||||
|         return adminMapper.updateByUserNameSelective(admin); |  | ||||||
|     } |  | ||||||
|  |  | ||||||
|     /** |  | ||||||
|      * 更改密码 |  | ||||||
|      * @param admin |  | ||||||
|      * @param newPassword |  | ||||||
|      * @return |  | ||||||
|      */ |  | ||||||
|     @Override |  | ||||||
|     public int updatePassword(Admin admin, String newPassword) { |  | ||||||
|         int result = 0; |  | ||||||
|         if(adminMapper.selectByUserNameAndPassword(admin) != null){ |  | ||||||
|             admin.setPassword(newPassword); |  | ||||||
|             result = adminMapper.updateByUserNameSelective(admin); |  | ||||||
|         } |  | ||||||
|         return result; |  | ||||||
|     } |  | ||||||
|  |  | ||||||
|  |  | ||||||
|     /** |  | ||||||
|      * 列出所有管理员 |  | ||||||
|      * @return |  | ||||||
|      */ |  | ||||||
|     @Override |  | ||||||
|     public List<Admin> findAll() { |  | ||||||
|         List<Admin> result; |  | ||||||
|         result = adminMapper.findAll(); |  | ||||||
|         for (Admin admin : result) { |  | ||||||
|             admin.setPassword(null); |  | ||||||
|         } |  | ||||||
|         return result; |  | ||||||
|     } |  | ||||||
| } |  | ||||||
| @@ -1,45 +0,0 @@ | |||||||
| package cn.mafangui.hotel.service.impl; |  | ||||||
|  |  | ||||||
| import cn.mafangui.hotel.entity.Hotel; |  | ||||||
| import cn.mafangui.hotel.mapper.HotelMapper; |  | ||||||
| import cn.mafangui.hotel.service.HotelService; |  | ||||||
| import org.springframework.beans.factory.annotation.Autowired; |  | ||||||
| import org.springframework.stereotype.Service; |  | ||||||
|  |  | ||||||
| import java.util.List; |  | ||||||
|  |  | ||||||
| @Service |  | ||||||
| public class HotelServiceImpl implements HotelService { |  | ||||||
|     @Autowired |  | ||||||
|     private HotelMapper hotelMapper; |  | ||||||
|  |  | ||||||
|     @Override |  | ||||||
|     public int addHotel(Hotel hotel) { |  | ||||||
|         return hotelMapper.insertSelective(hotel); |  | ||||||
|     } |  | ||||||
|  |  | ||||||
|     @Override |  | ||||||
|     public int deleteHotel(int hotelId) { |  | ||||||
|         return hotelMapper.deleteByPrimaryKey(hotelId); |  | ||||||
|     } |  | ||||||
|  |  | ||||||
|     @Override |  | ||||||
|     public int updateHotel(Hotel hotel) { |  | ||||||
|         return hotelMapper.updateByPrimaryKeySelective(hotel); |  | ||||||
|     } |  | ||||||
|  |  | ||||||
|     @Override |  | ||||||
|     public Hotel selectHotelByName(String hotelName) { |  | ||||||
|         return hotelMapper.selectByName(hotelName); |  | ||||||
|     } |  | ||||||
|  |  | ||||||
|     @Override |  | ||||||
|     public Hotel selectHotelById(int hotelId) { |  | ||||||
|         return hotelMapper.selectByPrimaryKey(hotelId); |  | ||||||
|     } |  | ||||||
|  |  | ||||||
|     @Override |  | ||||||
|     public List<Hotel> findAllHotel() { |  | ||||||
|         return hotelMapper.selectAll(); |  | ||||||
|     } |  | ||||||
| } |  | ||||||
| @@ -1,60 +0,0 @@ | |||||||
| package cn.mafangui.hotel.service.impl; |  | ||||||
|  |  | ||||||
| import cn.mafangui.hotel.entity.Room; |  | ||||||
| import cn.mafangui.hotel.mapper.RoomMapper; |  | ||||||
| import cn.mafangui.hotel.service.RoomService; |  | ||||||
| import org.springframework.beans.factory.annotation.Autowired; |  | ||||||
| import org.springframework.stereotype.Service; |  | ||||||
|  |  | ||||||
| import java.util.List; |  | ||||||
|  |  | ||||||
| @Service |  | ||||||
| public class RoomServiceImpl implements RoomService { |  | ||||||
|     @Autowired |  | ||||||
|     private RoomMapper roomMapper; |  | ||||||
|  |  | ||||||
|     @Override |  | ||||||
|     public int addRoom(Room room) { |  | ||||||
|         return roomMapper.insert(room); |  | ||||||
|     } |  | ||||||
|  |  | ||||||
|     @Override |  | ||||||
|     public int deleteRoom(int roomId) { |  | ||||||
|         return roomMapper.deleteByPrimaryKey(roomId); |  | ||||||
|     } |  | ||||||
|  |  | ||||||
|     @Override |  | ||||||
|     public int deleteRoom(String roomNumber) { |  | ||||||
|         return roomMapper.deleteByRoomNumber(roomNumber); |  | ||||||
|     } |  | ||||||
|  |  | ||||||
|     @Override |  | ||||||
|     public int updateRoom(Room room) { |  | ||||||
|         return roomMapper.updateByPrimaryKeySelective(room); |  | ||||||
|     } |  | ||||||
|  |  | ||||||
|     @Override |  | ||||||
|     public Room findById(int roomId) { |  | ||||||
|         return roomMapper.selectByPrimaryKey(roomId); |  | ||||||
|     } |  | ||||||
|  |  | ||||||
|     @Override |  | ||||||
|     public Room findByNumber(String roomNumber) { |  | ||||||
|         return roomMapper.selectByRoomNumber(roomNumber); |  | ||||||
|     } |  | ||||||
|  |  | ||||||
|     @Override |  | ||||||
|     public List<Room> findByStatus(String status) { |  | ||||||
|         return roomMapper.selectByStatus(status); |  | ||||||
|     } |  | ||||||
|  |  | ||||||
|     @Override |  | ||||||
|     public List<Room> findByType(String typeName) { |  | ||||||
|         return roomMapper.selectByType(typeName); |  | ||||||
|     } |  | ||||||
|  |  | ||||||
|     @Override |  | ||||||
|     public List<Room> findAll() { |  | ||||||
|         return roomMapper.selectAllRoom(); |  | ||||||
|     } |  | ||||||
| } |  | ||||||
| @@ -1,50 +0,0 @@ | |||||||
| package cn.mafangui.hotel.service.impl; |  | ||||||
|  |  | ||||||
| import cn.mafangui.hotel.entity.RoomType; |  | ||||||
| import cn.mafangui.hotel.mapper.RoomTypeMapper; |  | ||||||
| import cn.mafangui.hotel.service.RoomTypeService; |  | ||||||
| import org.springframework.beans.factory.annotation.Autowired; |  | ||||||
| import org.springframework.stereotype.Service; |  | ||||||
|  |  | ||||||
| import java.util.List; |  | ||||||
|  |  | ||||||
| @Service |  | ||||||
| public class RoomTypeServiceImpl implements RoomTypeService { |  | ||||||
|     @Autowired |  | ||||||
|     private RoomTypeMapper roomTypeMapper; |  | ||||||
|  |  | ||||||
|     @Override |  | ||||||
|     public int addRoomType(RoomType roomType) { |  | ||||||
|         return roomTypeMapper.insertSelective(roomType); |  | ||||||
|     } |  | ||||||
|  |  | ||||||
|     @Override |  | ||||||
|     public int delRoomType(RoomType roomType) { |  | ||||||
|         return roomTypeMapper.deleteByRoomType(roomType); |  | ||||||
|     } |  | ||||||
|  |  | ||||||
|     @Override |  | ||||||
|     public int delById(int typeId) { |  | ||||||
|         return roomTypeMapper.deleteByPrimaryKey(typeId); |  | ||||||
|     } |  | ||||||
|  |  | ||||||
|     @Override |  | ||||||
|     public int updateRoomType(RoomType roomType) { |  | ||||||
|         return roomTypeMapper.updateByPrimaryKeySelective(roomType); |  | ||||||
|     } |  | ||||||
|  |  | ||||||
|     @Override |  | ||||||
|     public RoomType selectByName(RoomType roomType) { |  | ||||||
|         return roomTypeMapper.selectByRoomType(roomType); |  | ||||||
|     } |  | ||||||
|  |  | ||||||
|     @Override |  | ||||||
|     public RoomType selectById(int typeId) { |  | ||||||
|         return roomTypeMapper.selectByPrimaryKey(typeId); |  | ||||||
|     } |  | ||||||
|  |  | ||||||
|     @Override |  | ||||||
|     public List<RoomType> findAllType() { |  | ||||||
|         return roomTypeMapper.findAll(); |  | ||||||
|     } |  | ||||||
| } |  | ||||||
| @@ -1,54 +0,0 @@ | |||||||
| 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 { |  | ||||||
|  |  | ||||||
|     @Autowired |  | ||||||
|     private UserMapper userMapper; |  | ||||||
|  |  | ||||||
|     @Override |  | ||||||
|     public User selectById(int id) { |  | ||||||
|         return userMapper.selectByPrimaryKey(id); |  | ||||||
|     } |  | ||||||
|  |  | ||||||
|     @Override |  | ||||||
|     public int register(User user) { |  | ||||||
|         return userMapper.insertSelective(user); |  | ||||||
|     } |  | ||||||
|  |  | ||||||
|     @Override |  | ||||||
|     public User login(String username, String password) { |  | ||||||
|         return userMapper.selectByUsernameAndPassword(username,password); |  | ||||||
|     } |  | ||||||
|  |  | ||||||
|     @Override |  | ||||||
|     public User selectByUserName(String 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.updateByPrimaryKeySelective(user); |  | ||||||
|     } |  | ||||||
|  |  | ||||||
|  |  | ||||||
| } |  | ||||||
| @@ -15,37 +15,37 @@ public class WorkerServiceImpl implements WorkerService { | |||||||
|     private WorkerMapper workerMapper; |     private WorkerMapper workerMapper; | ||||||
|  |  | ||||||
|     @Override |     @Override | ||||||
|     public int addWorker(Worker worker) { |     public int insert(Worker worker) { | ||||||
|         return workerMapper.insertSelective(worker); |         return workerMapper.insertSelective(worker); | ||||||
|     } |     } | ||||||
|  |  | ||||||
|     @Override |     @Override | ||||||
|     public int delWorker(String userName) { |     public int delete(int workerId) { | ||||||
|         return workerMapper.deleteByUserName(userName); |         return workerMapper.deleteByPrimaryKey(workerId); | ||||||
|     } |     } | ||||||
|  |  | ||||||
|     @Override |     @Override | ||||||
|     public int updateWorker(Worker worker) { |     public int updateById(Worker worker) { | ||||||
|         return workerMapper.updateByUserNameSelective(worker); |         return workerMapper.updateByPrimaryKeySelective(worker); | ||||||
|     } |     } | ||||||
|  |  | ||||||
|     @Override |     @Override | ||||||
|     public Worker selectWorker(String userName) { |     public Worker selectById(int workerId) { | ||||||
|         return workerMapper.selectByUserName(userName); |         return workerMapper.selectByPrimaryKey(workerId); | ||||||
|     } |     } | ||||||
|  |  | ||||||
|     @Override |     @Override | ||||||
|     public List<Worker> findAllWorker() { |     public List<Worker> findAll() { | ||||||
|         return workerMapper.findAll(); |         return workerMapper.selectAll(); | ||||||
|     } |     } | ||||||
|  |  | ||||||
|     @Override |     @Override | ||||||
|     public Worker login(Worker worker) { |     public List<Worker> selectByRole(String role) { | ||||||
|         return workerMapper.selectByUserNameAndPassword(worker); |         return workerMapper.selectByRole(role); | ||||||
|     } |     } | ||||||
|  |  | ||||||
|     @Override |     @Override | ||||||
|     public int logout(Worker worker) { |     public Worker login(String username, String password) { | ||||||
|         return 0; |         return workerMapper.selectByUsernameAndPassword(username,password); | ||||||
|     } |     } | ||||||
| } | } | ||||||
|   | |||||||
| @@ -5,4 +5,9 @@ public class StaticString { | |||||||
|     public static final String STATUS = "status"; |     public static final String STATUS = "status"; | ||||||
|     public static final String DATA = "data"; |     public static final String DATA = "data"; | ||||||
|  |  | ||||||
|  |     /** | ||||||
|  |      * 工作人员角色 | ||||||
|  |      */ | ||||||
|  |     public static final String ADMIN = "admin"; | ||||||
|  |     public static final String OPERATOR = "operator"; | ||||||
| } | } | ||||||
|   | |||||||
| @@ -10,5 +10,5 @@ spring: | |||||||
|     url: jdbc:mysql://127.0.0.1:3306/hotel?useUnicode=true&characterEncoding=UTF-8 |     url: jdbc:mysql://127.0.0.1:3306/hotel?useUnicode=true&characterEncoding=UTF-8 | ||||||
| mybatis: | mybatis: | ||||||
|   type-aliases-package: classpath*:cn.mafangui.hotel.entity |   type-aliases-package: classpath*:cn.mafangui.hotel.entity | ||||||
|   mapper-locations: classpath*:mapper/*.xml |   mapper-locations: classpath*:mybatis/mapper/*.xml | ||||||
|  |  | ||||||
|   | |||||||
| @@ -44,7 +44,7 @@ | |||||||
|         </javaModelGenerator> |         </javaModelGenerator> | ||||||
|  |  | ||||||
|         <!-- 生成mapper xml文件 --> |         <!-- 生成mapper xml文件 --> | ||||||
|         <sqlMapGenerator targetPackage="mapper"  targetProject="src/main/resources"> |         <sqlMapGenerator targetPackage="mybatis/mapper"  targetProject="src/main/resources"> | ||||||
|             <!-- enableSubPackages:是否让schema作为包的后缀 --> |             <!-- enableSubPackages:是否让schema作为包的后缀 --> | ||||||
|             <property name="enableSubPackages" value="false" /> |             <property name="enableSubPackages" value="false" /> | ||||||
|         </sqlMapGenerator> |         </sqlMapGenerator> | ||||||
|   | |||||||
| @@ -1,153 +0,0 @@ | |||||||
| <?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> |  | ||||||
| @@ -1,141 +0,0 @@ | |||||||
| <?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> |  | ||||||
| @@ -1,164 +0,0 @@ | |||||||
| <?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> |  | ||||||
| @@ -1,153 +0,0 @@ | |||||||
| <?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> |  | ||||||
| @@ -1,164 +0,0 @@ | |||||||
| <?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> |  | ||||||
| @@ -1,160 +0,0 @@ | |||||||
| <?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> |  | ||||||
| @@ -1,177 +0,0 @@ | |||||||
| <?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> |  | ||||||
| @@ -1,106 +0,0 @@ | |||||||
| <?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.AdminMapper"> |  | ||||||
|   <resultMap id="BaseResultMap" type="cn.mafangui.hotel.entity.Admin"> |  | ||||||
|     <id column="admin_id" jdbcType="INTEGER" property="adminId" /> |  | ||||||
|     <result column="user_name" jdbcType="VARCHAR" property="userName" /> |  | ||||||
|     <result column="password" jdbcType="VARCHAR" property="password" /> |  | ||||||
|     <result column="create_time" jdbcType="TIMESTAMP" property="createTime" /> |  | ||||||
|     <result column="update_time" jdbcType="TIMESTAMP" property="updateTime" /> |  | ||||||
|   </resultMap> |  | ||||||
|   <sql id="Base_Column_List"> |  | ||||||
|     admin_id, user_name, password, create_time, update_time |  | ||||||
|   </sql> |  | ||||||
|   <select id="selectByPrimaryKey" parameterType="java.lang.Integer" resultMap="BaseResultMap"> |  | ||||||
|     select  |  | ||||||
|     <include refid="Base_Column_List" /> |  | ||||||
|     from admin |  | ||||||
|     where admin_id = #{adminId,jdbcType=INTEGER} |  | ||||||
|   </select> |  | ||||||
|   <delete id="deleteByPrimaryKey" parameterType="java.lang.Integer"> |  | ||||||
|     delete from admin |  | ||||||
|     where admin_id = #{adminId,jdbcType=INTEGER} |  | ||||||
|   </delete> |  | ||||||
|   <insert id="insert" parameterType="cn.mafangui.hotel.entity.Admin"> |  | ||||||
|     insert into admin (admin_id, user_name, password,  |  | ||||||
|       create_time, update_time) |  | ||||||
|     values (#{adminId,jdbcType=INTEGER}, #{userName,jdbcType=VARCHAR}, #{password,jdbcType=VARCHAR},  |  | ||||||
|       #{createTime,jdbcType=TIMESTAMP}, #{updateTime,jdbcType=TIMESTAMP}) |  | ||||||
|   </insert> |  | ||||||
|   <insert id="insertSelective" parameterType="cn.mafangui.hotel.entity.Admin"> |  | ||||||
|     insert into admin |  | ||||||
|     <trim prefix="(" suffix=")" suffixOverrides=","> |  | ||||||
|       <if test="adminId != null"> |  | ||||||
|         admin_id, |  | ||||||
|       </if> |  | ||||||
|       <if test="userName != null"> |  | ||||||
|         user_name, |  | ||||||
|       </if> |  | ||||||
|       <if test="password != null"> |  | ||||||
|         password, |  | ||||||
|       </if> |  | ||||||
|         create_time, |  | ||||||
|         update_time, |  | ||||||
|     </trim> |  | ||||||
|     <trim prefix="values (" suffix=")" suffixOverrides=","> |  | ||||||
|       <if test="adminId != null"> |  | ||||||
|         #{adminId,jdbcType=INTEGER}, |  | ||||||
|       </if> |  | ||||||
|       <if test="userName != null"> |  | ||||||
|         #{userName,jdbcType=VARCHAR}, |  | ||||||
|       </if> |  | ||||||
|       <if test="password != null"> |  | ||||||
|         #{password,jdbcType=VARCHAR}, |  | ||||||
|       </if> |  | ||||||
|       now(), |  | ||||||
|       now() |  | ||||||
|     </trim> |  | ||||||
|   </insert> |  | ||||||
|   <update id="updateByPrimaryKeySelective" parameterType="cn.mafangui.hotel.entity.Admin"> |  | ||||||
|     update admin |  | ||||||
|     <set> |  | ||||||
|       <if test="userName != null"> |  | ||||||
|         user_name = #{userName,jdbcType=VARCHAR}, |  | ||||||
|       </if> |  | ||||||
|       <if test="password != null"> |  | ||||||
|         password = #{password,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 admin_id = #{adminId,jdbcType=INTEGER} |  | ||||||
|   </update> |  | ||||||
|   <update id="updateByPrimaryKey" parameterType="cn.mafangui.hotel.entity.Admin"> |  | ||||||
|     update admin |  | ||||||
|     set user_name = #{userName,jdbcType=VARCHAR}, |  | ||||||
|       password = #{password,jdbcType=VARCHAR}, |  | ||||||
|       create_time = #{createTime,jdbcType=TIMESTAMP}, |  | ||||||
|       update_time = #{updateTime,jdbcType=TIMESTAMP} |  | ||||||
|     where admin_id = #{adminId,jdbcType=INTEGER} |  | ||||||
|   </update> |  | ||||||
|   <select id="selectByUserName" parameterType="java.lang.String" resultMap="BaseResultMap"> |  | ||||||
|     select * from admin |  | ||||||
|     where user_name = #{userName,jdbcType=VARCHAR} |  | ||||||
|   </select> |  | ||||||
|   <select id="selectByUserNameAndPassword" parameterType="cn.mafangui.hotel.entity.Admin" resultMap="BaseResultMap"> |  | ||||||
|     select * from admin |  | ||||||
|     where user_name = #{userName,jdbcType=VARCHAR} and password = #{password,jdbcType=VARCHAR} |  | ||||||
|   </select> |  | ||||||
|   <select id="findAll" resultMap="BaseResultMap"> |  | ||||||
|     select * from admin |  | ||||||
|   </select> |  | ||||||
|   <update id="updateByUserNameSelective" parameterType="cn.mafangui.hotel.entity.Admin"> |  | ||||||
|     update admin |  | ||||||
|     <set> |  | ||||||
|       <if test="password != null"> |  | ||||||
|         password = #{password,jdbcType=VARCHAR}, |  | ||||||
|       </if> |  | ||||||
|         update_time = now(), |  | ||||||
|     </set> |  | ||||||
|     where user_name = #{userName,jdbcType=VARCHAR} |  | ||||||
|   </update> |  | ||||||
| </mapper> |  | ||||||
| @@ -5,17 +5,17 @@ | |||||||
|     <id column="check_in_id" jdbcType="INTEGER" property="checkInId" /> |     <id column="check_in_id" jdbcType="INTEGER" property="checkInId" /> | ||||||
|     <result column="order_id" jdbcType="INTEGER" property="orderId" /> |     <result column="order_id" jdbcType="INTEGER" property="orderId" /> | ||||||
|     <result column="room_number" jdbcType="VARCHAR" property="roomNumber" /> |     <result column="room_number" jdbcType="VARCHAR" property="roomNumber" /> | ||||||
|     <result column="room_type" jdbcType="INTEGER" property="roomType" /> |     <result column="room_type" jdbcType="VARCHAR" property="roomType" /> | ||||||
|     <result column="person_num" jdbcType="INTEGER" property="personNum" /> |     <result column="peo_count" jdbcType="INTEGER" property="peoCount" /> | ||||||
|     <result column="person_name" jdbcType="VARCHAR" property="personName" /> |     <result column="persons" jdbcType="VARCHAR" property="persons" /> | ||||||
|     <result column="id_numbers" jdbcType="VARCHAR" property="idNumbers" /> |     <result column="ids" jdbcType="VARCHAR" property="ids" /> | ||||||
|     <result column="check_in_time" jdbcType="TIMESTAMP" property="checkInTime" /> |     <result column="check_in_time" jdbcType="TIMESTAMP" property="checkInTime" /> | ||||||
|     <result column="create_time" jdbcType="TIMESTAMP" property="createTime" /> |     <result column="create_time" jdbcType="TIMESTAMP" property="createTime" /> | ||||||
|     <result column="update_time" jdbcType="TIMESTAMP" property="updateTime" /> |     <result column="update_time" jdbcType="TIMESTAMP" property="updateTime" /> | ||||||
|   </resultMap> |   </resultMap> | ||||||
|   <sql id="Base_Column_List"> |   <sql id="Base_Column_List"> | ||||||
|     check_in_id, order_id, room_number, room_type, person_num, person_name, id_numbers,  |     check_in_id, order_id, room_number, room_type, peo_count, persons, ids, check_in_time,  | ||||||
|     check_in_time, create_time, update_time |     create_time, update_time | ||||||
|   </sql> |   </sql> | ||||||
|   <select id="selectByPrimaryKey" parameterType="java.lang.Integer" resultMap="BaseResultMap"> |   <select id="selectByPrimaryKey" parameterType="java.lang.Integer" resultMap="BaseResultMap"> | ||||||
|     select  |     select  | ||||||
| @@ -29,12 +29,12 @@ | |||||||
|   </delete> |   </delete> | ||||||
|   <insert id="insert" parameterType="cn.mafangui.hotel.entity.CheckIn"> |   <insert id="insert" parameterType="cn.mafangui.hotel.entity.CheckIn"> | ||||||
|     insert into check_in (check_in_id, order_id, room_number,  |     insert into check_in (check_in_id, order_id, room_number,  | ||||||
|       room_type, person_num, person_name,  |       room_type, peo_count, persons,  | ||||||
|       id_numbers, check_in_time, create_time,  |       ids, check_in_time, create_time,  | ||||||
|       update_time) |       update_time) | ||||||
|     values (#{checkInId,jdbcType=INTEGER}, #{orderId,jdbcType=INTEGER}, #{roomNumber,jdbcType=VARCHAR},  |     values (#{checkInId,jdbcType=INTEGER}, #{orderId,jdbcType=INTEGER}, #{roomNumber,jdbcType=VARCHAR},  | ||||||
|       #{roomType,jdbcType=INTEGER}, #{personNum,jdbcType=INTEGER}, #{personName,jdbcType=VARCHAR},  |       #{roomType,jdbcType=VARCHAR}, #{peoCount,jdbcType=INTEGER}, #{persons,jdbcType=VARCHAR},  | ||||||
|       #{idNumbers,jdbcType=VARCHAR}, #{checkInTime,jdbcType=TIMESTAMP}, #{createTime,jdbcType=TIMESTAMP},  |       #{ids,jdbcType=VARCHAR}, #{checkInTime,jdbcType=TIMESTAMP}, #{createTime,jdbcType=TIMESTAMP},  | ||||||
|       #{updateTime,jdbcType=TIMESTAMP}) |       #{updateTime,jdbcType=TIMESTAMP}) | ||||||
|   </insert> |   </insert> | ||||||
|   <insert id="insertSelective" parameterType="cn.mafangui.hotel.entity.CheckIn"> |   <insert id="insertSelective" parameterType="cn.mafangui.hotel.entity.CheckIn"> | ||||||
| @@ -52,14 +52,14 @@ | |||||||
|       <if test="roomType != null"> |       <if test="roomType != null"> | ||||||
|         room_type, |         room_type, | ||||||
|       </if> |       </if> | ||||||
|       <if test="personNum != null"> |       <if test="peoCount != null"> | ||||||
|         person_num, |         peo_count, | ||||||
|       </if> |       </if> | ||||||
|       <if test="personName != null"> |       <if test="persons != null"> | ||||||
|         person_name, |         persons, | ||||||
|       </if> |       </if> | ||||||
|       <if test="idNumbers != null"> |       <if test="ids != null"> | ||||||
|         id_numbers, |         ids, | ||||||
|       </if> |       </if> | ||||||
|       <if test="checkInTime != null"> |       <if test="checkInTime != null"> | ||||||
|         check_in_time, |         check_in_time, | ||||||
| @@ -82,16 +82,16 @@ | |||||||
|         #{roomNumber,jdbcType=VARCHAR}, |         #{roomNumber,jdbcType=VARCHAR}, | ||||||
|       </if> |       </if> | ||||||
|       <if test="roomType != null"> |       <if test="roomType != null"> | ||||||
|         #{roomType,jdbcType=INTEGER}, |         #{roomType,jdbcType=VARCHAR}, | ||||||
|       </if> |       </if> | ||||||
|       <if test="personNum != null"> |       <if test="peoCount != null"> | ||||||
|         #{personNum,jdbcType=INTEGER}, |         #{peoCount,jdbcType=INTEGER}, | ||||||
|       </if> |       </if> | ||||||
|       <if test="personName != null"> |       <if test="persons != null"> | ||||||
|         #{personName,jdbcType=VARCHAR}, |         #{persons,jdbcType=VARCHAR}, | ||||||
|       </if> |       </if> | ||||||
|       <if test="idNumbers != null"> |       <if test="ids != null"> | ||||||
|         #{idNumbers,jdbcType=VARCHAR}, |         #{ids,jdbcType=VARCHAR}, | ||||||
|       </if> |       </if> | ||||||
|       <if test="checkInTime != null"> |       <if test="checkInTime != null"> | ||||||
|         #{checkInTime,jdbcType=TIMESTAMP}, |         #{checkInTime,jdbcType=TIMESTAMP}, | ||||||
| @@ -114,16 +114,16 @@ | |||||||
|         room_number = #{roomNumber,jdbcType=VARCHAR}, |         room_number = #{roomNumber,jdbcType=VARCHAR}, | ||||||
|       </if> |       </if> | ||||||
|       <if test="roomType != null"> |       <if test="roomType != null"> | ||||||
|         room_type = #{roomType,jdbcType=INTEGER}, |         room_type = #{roomType,jdbcType=VARCHAR}, | ||||||
|       </if> |       </if> | ||||||
|       <if test="personNum != null"> |       <if test="peoCount != null"> | ||||||
|         person_num = #{personNum,jdbcType=INTEGER}, |         peo_count = #{peoCount,jdbcType=INTEGER}, | ||||||
|       </if> |       </if> | ||||||
|       <if test="personName != null"> |       <if test="persons != null"> | ||||||
|         person_name = #{personName,jdbcType=VARCHAR}, |         persons = #{persons,jdbcType=VARCHAR}, | ||||||
|       </if> |       </if> | ||||||
|       <if test="idNumbers != null"> |       <if test="ids != null"> | ||||||
|         id_numbers = #{idNumbers,jdbcType=VARCHAR}, |         ids = #{ids,jdbcType=VARCHAR}, | ||||||
|       </if> |       </if> | ||||||
|       <if test="checkInTime != null"> |       <if test="checkInTime != null"> | ||||||
|         check_in_time = #{checkInTime,jdbcType=TIMESTAMP}, |         check_in_time = #{checkInTime,jdbcType=TIMESTAMP}, | ||||||
| @@ -141,10 +141,10 @@ | |||||||
|     update check_in |     update check_in | ||||||
|     set order_id = #{orderId,jdbcType=INTEGER}, |     set order_id = #{orderId,jdbcType=INTEGER}, | ||||||
|       room_number = #{roomNumber,jdbcType=VARCHAR}, |       room_number = #{roomNumber,jdbcType=VARCHAR}, | ||||||
|       room_type = #{roomType,jdbcType=INTEGER}, |       room_type = #{roomType,jdbcType=VARCHAR}, | ||||||
|       person_num = #{personNum,jdbcType=INTEGER}, |       peo_count = #{peoCount,jdbcType=INTEGER}, | ||||||
|       person_name = #{personName,jdbcType=VARCHAR}, |       persons = #{persons,jdbcType=VARCHAR}, | ||||||
|       id_numbers = #{idNumbers,jdbcType=VARCHAR}, |       ids = #{ids,jdbcType=VARCHAR}, | ||||||
|       check_in_time = #{checkInTime,jdbcType=TIMESTAMP}, |       check_in_time = #{checkInTime,jdbcType=TIMESTAMP}, | ||||||
|       create_time = #{createTime,jdbcType=TIMESTAMP}, |       create_time = #{createTime,jdbcType=TIMESTAMP}, | ||||||
|       update_time = #{updateTime,jdbcType=TIMESTAMP} |       update_time = #{updateTime,jdbcType=TIMESTAMP} | ||||||
|   | |||||||
| @@ -32,7 +32,7 @@ | |||||||
|       ) |       ) | ||||||
|     values (#{hotelId,jdbcType=INTEGER}, #{hotelName,jdbcType=VARCHAR}, #{phone,jdbcType=VARCHAR},  |     values (#{hotelId,jdbcType=INTEGER}, #{hotelName,jdbcType=VARCHAR}, #{phone,jdbcType=VARCHAR},  | ||||||
|       #{telephone,jdbcType=VARCHAR}, #{email,jdbcType=VARCHAR}, #{address,jdbcType=VARCHAR},  |       #{telephone,jdbcType=VARCHAR}, #{email,jdbcType=VARCHAR}, #{address,jdbcType=VARCHAR},  | ||||||
|       #{website,jdbcType=VARCHAR}, now(),now() |       #{website,jdbcType=VARCHAR}, #{createTime,jdbcType=TIMESTAMP}, #{updateTime,jdbcType=TIMESTAMP} | ||||||
|       ) |       ) | ||||||
|   </insert> |   </insert> | ||||||
|   <insert id="insertSelective" parameterType="cn.mafangui.hotel.entity.Hotel"> |   <insert id="insertSelective" parameterType="cn.mafangui.hotel.entity.Hotel"> | ||||||
| @@ -59,8 +59,12 @@ | |||||||
|       <if test="website != null"> |       <if test="website != null"> | ||||||
|         website, |         website, | ||||||
|       </if> |       </if> | ||||||
|  |       <if test="createTime != null"> | ||||||
|         create_time, |         create_time, | ||||||
|  |       </if> | ||||||
|  |       <if test="updateTime != null"> | ||||||
|         update_time, |         update_time, | ||||||
|  |       </if> | ||||||
|     </trim> |     </trim> | ||||||
|     <trim prefix="values (" suffix=")" suffixOverrides=","> |     <trim prefix="values (" suffix=")" suffixOverrides=","> | ||||||
|       <if test="hotelId != null"> |       <if test="hotelId != null"> | ||||||
| @@ -84,8 +88,12 @@ | |||||||
|       <if test="website != null"> |       <if test="website != null"> | ||||||
|         #{website,jdbcType=VARCHAR}, |         #{website,jdbcType=VARCHAR}, | ||||||
|       </if> |       </if> | ||||||
|         now(), |       <if test="createTime != null"> | ||||||
|         now(), |         #{createTime,jdbcType=TIMESTAMP}, | ||||||
|  |       </if> | ||||||
|  |       <if test="updateTime != null"> | ||||||
|  |         #{updateTime,jdbcType=TIMESTAMP}, | ||||||
|  |       </if> | ||||||
|     </trim> |     </trim> | ||||||
|   </insert> |   </insert> | ||||||
|   <update id="updateByPrimaryKeySelective" parameterType="cn.mafangui.hotel.entity.Hotel"> |   <update id="updateByPrimaryKeySelective" parameterType="cn.mafangui.hotel.entity.Hotel"> | ||||||
| @@ -130,15 +138,4 @@ | |||||||
|       update_time = #{updateTime,jdbcType=TIMESTAMP} |       update_time = #{updateTime,jdbcType=TIMESTAMP} | ||||||
|     where hotel_id = #{hotelId,jdbcType=INTEGER} |     where hotel_id = #{hotelId,jdbcType=INTEGER} | ||||||
|   </update> |   </update> | ||||||
|   <select id="selectAll"  resultMap="BaseResultMap"> |  | ||||||
|     select |  | ||||||
|     <include refid="Base_Column_List" /> |  | ||||||
|     from hotel_info |  | ||||||
|   </select> |  | ||||||
|   <select id="selectByName" parameterType="String"  resultMap="BaseResultMap"> |  | ||||||
|     select |  | ||||||
|     <include refid="Base_Column_List" /> |  | ||||||
|     from hotel_info |  | ||||||
|     where hotel_name = #{hotelName,jdbcType=VARCHAR} |  | ||||||
|   </select> |  | ||||||
| </mapper> | </mapper> | ||||||
| @@ -3,20 +3,20 @@ | |||||||
| <mapper namespace="cn.mafangui.hotel.mapper.OrderMapper"> | <mapper namespace="cn.mafangui.hotel.mapper.OrderMapper"> | ||||||
|   <resultMap id="BaseResultMap" type="cn.mafangui.hotel.entity.Order"> |   <resultMap id="BaseResultMap" type="cn.mafangui.hotel.entity.Order"> | ||||||
|     <id column="order_id" jdbcType="INTEGER" property="orderId" /> |     <id column="order_id" jdbcType="INTEGER" property="orderId" /> | ||||||
|     <result column="booking_type" jdbcType="VARCHAR" property="bookingType" /> |     <result column="order_type" jdbcType="VARCHAR" property="orderType" /> | ||||||
|     <result column="phone" jdbcType="VARCHAR" property="phone" /> |     <result column="phone" jdbcType="VARCHAR" property="phone" /> | ||||||
|     <result column="room_number" jdbcType="VARCHAR" property="roomNumber" /> |     <result column="room_type" jdbcType="VARCHAR" property="roomType" /> | ||||||
|     <result column="room_type" jdbcType="INTEGER" property="roomType" /> |     <result column="num_of_room" jdbcType="INTEGER" property="numOfRoom" /> | ||||||
|     <result column="booking_date" jdbcType="DATE" property="bookingDate" /> |     <result column="order_date" jdbcType="DATE" property="orderDate" /> | ||||||
|     <result column="booking_days" jdbcType="INTEGER" property="bookingDays" /> |     <result column="order_days" jdbcType="INTEGER" property="orderDays" /> | ||||||
|     <result column="order_status" jdbcType="INTEGER" property="orderStatus" /> |     <result column="order_status" jdbcType="INTEGER" property="orderStatus" /> | ||||||
|     <result column="order_cost" jdbcType="DECIMAL" property="orderCost" /> |     <result column="order_cost" jdbcType="DOUBLE" property="orderCost" /> | ||||||
|     <result column="create_time" jdbcType="TIMESTAMP" property="createTime" /> |     <result column="create_time" jdbcType="TIMESTAMP" property="createTime" /> | ||||||
|     <result column="update_time" jdbcType="TIMESTAMP" property="updateTime" /> |     <result column="update_time" jdbcType="TIMESTAMP" property="updateTime" /> | ||||||
|   </resultMap> |   </resultMap> | ||||||
|   <sql id="Base_Column_List"> |   <sql id="Base_Column_List"> | ||||||
|     order_id, booking_type, phone, room_number, room_type, booking_date, booking_days,  |     order_id, order_type, phone, room_type, num_of_room, order_date, order_days, order_status,  | ||||||
|     order_status, order_cost, create_time, update_time |     order_cost, create_time, update_time | ||||||
|   </sql> |   </sql> | ||||||
|   <select id="selectByPrimaryKey" parameterType="java.lang.Integer" resultMap="BaseResultMap"> |   <select id="selectByPrimaryKey" parameterType="java.lang.Integer" resultMap="BaseResultMap"> | ||||||
|     select  |     select  | ||||||
| @@ -29,13 +29,13 @@ | |||||||
|     where order_id = #{orderId,jdbcType=INTEGER} |     where order_id = #{orderId,jdbcType=INTEGER} | ||||||
|   </delete> |   </delete> | ||||||
|   <insert id="insert" parameterType="cn.mafangui.hotel.entity.Order"> |   <insert id="insert" parameterType="cn.mafangui.hotel.entity.Order"> | ||||||
|     insert into order_info (order_id, booking_type, phone,  |     insert into order_info (order_id, order_type, phone,  | ||||||
|       room_number, room_type, booking_date,  |       room_type, num_of_room, order_date,  | ||||||
|       booking_days, order_status, order_cost,  |       order_days, order_status, order_cost,  | ||||||
|       create_time, update_time) |       create_time, update_time) | ||||||
|     values (#{orderId,jdbcType=INTEGER}, #{bookingType,jdbcType=VARCHAR}, #{phone,jdbcType=VARCHAR},  |     values (#{orderId,jdbcType=INTEGER}, #{orderType,jdbcType=VARCHAR}, #{phone,jdbcType=VARCHAR},  | ||||||
|       #{roomNumber,jdbcType=VARCHAR}, #{roomType,jdbcType=INTEGER}, #{bookingDate,jdbcType=DATE},  |       #{roomType,jdbcType=VARCHAR}, #{numOfRoom,jdbcType=INTEGER}, #{orderDate,jdbcType=DATE},  | ||||||
|       #{bookingDays,jdbcType=INTEGER}, #{orderStatus,jdbcType=INTEGER}, #{orderCost,jdbcType=DECIMAL},  |       #{orderDays,jdbcType=INTEGER}, #{orderStatus,jdbcType=INTEGER}, #{orderCost,jdbcType=DOUBLE},  | ||||||
|       #{createTime,jdbcType=TIMESTAMP}, #{updateTime,jdbcType=TIMESTAMP}) |       #{createTime,jdbcType=TIMESTAMP}, #{updateTime,jdbcType=TIMESTAMP}) | ||||||
|   </insert> |   </insert> | ||||||
|   <insert id="insertSelective" parameterType="cn.mafangui.hotel.entity.Order"> |   <insert id="insertSelective" parameterType="cn.mafangui.hotel.entity.Order"> | ||||||
| @@ -44,23 +44,23 @@ | |||||||
|       <if test="orderId != null"> |       <if test="orderId != null"> | ||||||
|         order_id, |         order_id, | ||||||
|       </if> |       </if> | ||||||
|       <if test="bookingType != null"> |       <if test="orderType != null"> | ||||||
|         booking_type, |         order_type, | ||||||
|       </if> |       </if> | ||||||
|       <if test="phone != null"> |       <if test="phone != null"> | ||||||
|         phone, |         phone, | ||||||
|       </if> |       </if> | ||||||
|       <if test="roomNumber != null"> |  | ||||||
|         room_number, |  | ||||||
|       </if> |  | ||||||
|       <if test="roomType != null"> |       <if test="roomType != null"> | ||||||
|         room_type, |         room_type, | ||||||
|       </if> |       </if> | ||||||
|       <if test="bookingDate != null"> |       <if test="numOfRoom != null"> | ||||||
|         booking_date, |         num_of_room, | ||||||
|       </if> |       </if> | ||||||
|       <if test="bookingDays != null"> |       <if test="orderDate != null"> | ||||||
|         booking_days, |         order_date, | ||||||
|  |       </if> | ||||||
|  |       <if test="orderDays != null"> | ||||||
|  |         order_days, | ||||||
|       </if> |       </if> | ||||||
|       <if test="orderStatus != null"> |       <if test="orderStatus != null"> | ||||||
|         order_status, |         order_status, | ||||||
| @@ -79,29 +79,29 @@ | |||||||
|       <if test="orderId != null"> |       <if test="orderId != null"> | ||||||
|         #{orderId,jdbcType=INTEGER}, |         #{orderId,jdbcType=INTEGER}, | ||||||
|       </if> |       </if> | ||||||
|       <if test="bookingType != null"> |       <if test="orderType != null"> | ||||||
|         #{bookingType,jdbcType=VARCHAR}, |         #{orderType,jdbcType=VARCHAR}, | ||||||
|       </if> |       </if> | ||||||
|       <if test="phone != null"> |       <if test="phone != null"> | ||||||
|         #{phone,jdbcType=VARCHAR}, |         #{phone,jdbcType=VARCHAR}, | ||||||
|       </if> |       </if> | ||||||
|       <if test="roomNumber != null"> |  | ||||||
|         #{roomNumber,jdbcType=VARCHAR}, |  | ||||||
|       </if> |  | ||||||
|       <if test="roomType != null"> |       <if test="roomType != null"> | ||||||
|         #{roomType,jdbcType=INTEGER}, |         #{roomType,jdbcType=VARCHAR}, | ||||||
|       </if> |       </if> | ||||||
|       <if test="bookingDate != null"> |       <if test="numOfRoom != null"> | ||||||
|         #{bookingDate,jdbcType=DATE}, |         #{numOfRoom,jdbcType=INTEGER}, | ||||||
|       </if> |       </if> | ||||||
|       <if test="bookingDays != null"> |       <if test="orderDate != null"> | ||||||
|         #{bookingDays,jdbcType=INTEGER}, |         #{orderDate,jdbcType=DATE}, | ||||||
|  |       </if> | ||||||
|  |       <if test="orderDays != null"> | ||||||
|  |         #{orderDays,jdbcType=INTEGER}, | ||||||
|       </if> |       </if> | ||||||
|       <if test="orderStatus != null"> |       <if test="orderStatus != null"> | ||||||
|         #{orderStatus,jdbcType=INTEGER}, |         #{orderStatus,jdbcType=INTEGER}, | ||||||
|       </if> |       </if> | ||||||
|       <if test="orderCost != null"> |       <if test="orderCost != null"> | ||||||
|         #{orderCost,jdbcType=DECIMAL}, |         #{orderCost,jdbcType=DOUBLE}, | ||||||
|       </if> |       </if> | ||||||
|       <if test="createTime != null"> |       <if test="createTime != null"> | ||||||
|         #{createTime,jdbcType=TIMESTAMP}, |         #{createTime,jdbcType=TIMESTAMP}, | ||||||
| @@ -114,29 +114,29 @@ | |||||||
|   <update id="updateByPrimaryKeySelective" parameterType="cn.mafangui.hotel.entity.Order"> |   <update id="updateByPrimaryKeySelective" parameterType="cn.mafangui.hotel.entity.Order"> | ||||||
|     update order_info |     update order_info | ||||||
|     <set> |     <set> | ||||||
|       <if test="bookingType != null"> |       <if test="orderType != null"> | ||||||
|         booking_type = #{bookingType,jdbcType=VARCHAR}, |         order_type = #{orderType,jdbcType=VARCHAR}, | ||||||
|       </if> |       </if> | ||||||
|       <if test="phone != null"> |       <if test="phone != null"> | ||||||
|         phone = #{phone,jdbcType=VARCHAR}, |         phone = #{phone,jdbcType=VARCHAR}, | ||||||
|       </if> |       </if> | ||||||
|       <if test="roomNumber != null"> |  | ||||||
|         room_number = #{roomNumber,jdbcType=VARCHAR}, |  | ||||||
|       </if> |  | ||||||
|       <if test="roomType != null"> |       <if test="roomType != null"> | ||||||
|         room_type = #{roomType,jdbcType=INTEGER}, |         room_type = #{roomType,jdbcType=VARCHAR}, | ||||||
|       </if> |       </if> | ||||||
|       <if test="bookingDate != null"> |       <if test="numOfRoom != null"> | ||||||
|         booking_date = #{bookingDate,jdbcType=DATE}, |         num_of_room = #{numOfRoom,jdbcType=INTEGER}, | ||||||
|       </if> |       </if> | ||||||
|       <if test="bookingDays != null"> |       <if test="orderDate != null"> | ||||||
|         booking_days = #{bookingDays,jdbcType=INTEGER}, |         order_date = #{orderDate,jdbcType=DATE}, | ||||||
|  |       </if> | ||||||
|  |       <if test="orderDays != null"> | ||||||
|  |         order_days = #{orderDays,jdbcType=INTEGER}, | ||||||
|       </if> |       </if> | ||||||
|       <if test="orderStatus != null"> |       <if test="orderStatus != null"> | ||||||
|         order_status = #{orderStatus,jdbcType=INTEGER}, |         order_status = #{orderStatus,jdbcType=INTEGER}, | ||||||
|       </if> |       </if> | ||||||
|       <if test="orderCost != null"> |       <if test="orderCost != null"> | ||||||
|         order_cost = #{orderCost,jdbcType=DECIMAL}, |         order_cost = #{orderCost,jdbcType=DOUBLE}, | ||||||
|       </if> |       </if> | ||||||
|       <if test="createTime != null"> |       <if test="createTime != null"> | ||||||
|         create_time = #{createTime,jdbcType=TIMESTAMP}, |         create_time = #{createTime,jdbcType=TIMESTAMP}, | ||||||
| @@ -149,14 +149,14 @@ | |||||||
|   </update> |   </update> | ||||||
|   <update id="updateByPrimaryKey" parameterType="cn.mafangui.hotel.entity.Order"> |   <update id="updateByPrimaryKey" parameterType="cn.mafangui.hotel.entity.Order"> | ||||||
|     update order_info |     update order_info | ||||||
|     set booking_type = #{bookingType,jdbcType=VARCHAR}, |     set order_type = #{orderType,jdbcType=VARCHAR}, | ||||||
|       phone = #{phone,jdbcType=VARCHAR}, |       phone = #{phone,jdbcType=VARCHAR}, | ||||||
|       room_number = #{roomNumber,jdbcType=VARCHAR}, |       room_type = #{roomType,jdbcType=VARCHAR}, | ||||||
|       room_type = #{roomType,jdbcType=INTEGER}, |       num_of_room = #{numOfRoom,jdbcType=INTEGER}, | ||||||
|       booking_date = #{bookingDate,jdbcType=DATE}, |       order_date = #{orderDate,jdbcType=DATE}, | ||||||
|       booking_days = #{bookingDays,jdbcType=INTEGER}, |       order_days = #{orderDays,jdbcType=INTEGER}, | ||||||
|       order_status = #{orderStatus,jdbcType=INTEGER}, |       order_status = #{orderStatus,jdbcType=INTEGER}, | ||||||
|       order_cost = #{orderCost,jdbcType=DECIMAL}, |       order_cost = #{orderCost,jdbcType=DOUBLE}, | ||||||
|       create_time = #{createTime,jdbcType=TIMESTAMP}, |       create_time = #{createTime,jdbcType=TIMESTAMP}, | ||||||
|       update_time = #{updateTime,jdbcType=TIMESTAMP} |       update_time = #{updateTime,jdbcType=TIMESTAMP} | ||||||
|     where order_id = #{orderId,jdbcType=INTEGER} |     where order_id = #{orderId,jdbcType=INTEGER} | ||||||
|   | |||||||
| @@ -4,18 +4,18 @@ | |||||||
|   <resultMap id="BaseResultMap" type="cn.mafangui.hotel.entity.Room"> |   <resultMap id="BaseResultMap" type="cn.mafangui.hotel.entity.Room"> | ||||||
|     <id column="room_id" jdbcType="INTEGER" property="roomId" /> |     <id column="room_id" jdbcType="INTEGER" property="roomId" /> | ||||||
|     <result column="room_number" jdbcType="VARCHAR" property="roomNumber" /> |     <result column="room_number" jdbcType="VARCHAR" property="roomNumber" /> | ||||||
|     <result column="room_floor" jdbcType="INTEGER" property="roomFloor" /> |     <result column="type_id" jdbcType="INTEGER" property="typeId" /> | ||||||
|     <result column="room_type" jdbcType="INTEGER" property="roomType" /> |     <result column="room_type" jdbcType="VARCHAR" property="roomType" /> | ||||||
|     <result column="type_name" jdbcType="VARCHAR" property="typeName" /> |     <result column="room_price" jdbcType="DOUBLE" property="roomPrice" /> | ||||||
|     <result column="room_price" jdbcType="DECIMAL" property="roomPrice" /> |     <result column="room_discount" jdbcType="DOUBLE" property="roomDiscount" /> | ||||||
|     <result column="room_discount" jdbcType="REAL" property="roomDiscount" /> |     <result column="room_status" jdbcType="INTEGER" property="roomStatus" /> | ||||||
|     <result column="room_status" jdbcType="VARCHAR" property="roomStatus" /> |     <result column="remark" jdbcType="VARCHAR" property="remark" /> | ||||||
|     <result column="create_time" jdbcType="TIMESTAMP" property="createTime" /> |     <result column="create_time" jdbcType="TIMESTAMP" property="createTime" /> | ||||||
|     <result column="update_time" jdbcType="TIMESTAMP" property="updateTime" /> |     <result column="update_time" jdbcType="TIMESTAMP" property="updateTime" /> | ||||||
|   </resultMap> |   </resultMap> | ||||||
|   <sql id="Base_Column_List"> |   <sql id="Base_Column_List"> | ||||||
|     room_id, room_number, room_floor, room_type, type_name, room_price, room_discount, room_status, |     room_id, room_number, type_id, room_type, room_price, room_discount, room_status,  | ||||||
|     create_time, update_time |     remark, create_time, update_time | ||||||
|   </sql> |   </sql> | ||||||
|   <select id="selectByPrimaryKey" parameterType="java.lang.Integer" resultMap="BaseResultMap"> |   <select id="selectByPrimaryKey" parameterType="java.lang.Integer" resultMap="BaseResultMap"> | ||||||
|     select  |     select  | ||||||
| @@ -27,7 +27,16 @@ | |||||||
|     delete from room_info |     delete from room_info | ||||||
|     where room_id = #{roomId,jdbcType=INTEGER} |     where room_id = #{roomId,jdbcType=INTEGER} | ||||||
|   </delete> |   </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 id="insertSelective" parameterType="cn.mafangui.hotel.entity.Room"> | ||||||
|     insert into room_info |     insert into room_info | ||||||
|     <trim prefix="(" suffix=")" suffixOverrides=","> |     <trim prefix="(" suffix=")" suffixOverrides=","> | ||||||
| @@ -37,8 +46,8 @@ | |||||||
|       <if test="roomNumber != null"> |       <if test="roomNumber != null"> | ||||||
|         room_number, |         room_number, | ||||||
|       </if> |       </if> | ||||||
|       <if test="roomFloor != null"> |       <if test="typeId != null"> | ||||||
|         room_floor, |         type_id, | ||||||
|       </if> |       </if> | ||||||
|       <if test="roomType != null"> |       <if test="roomType != null"> | ||||||
|         room_type, |         room_type, | ||||||
| @@ -52,6 +61,9 @@ | |||||||
|       <if test="roomStatus != null"> |       <if test="roomStatus != null"> | ||||||
|         room_status, |         room_status, | ||||||
|       </if> |       </if> | ||||||
|  |       <if test="remark != null"> | ||||||
|  |         remark, | ||||||
|  |       </if> | ||||||
|       <if test="createTime != null"> |       <if test="createTime != null"> | ||||||
|         create_time, |         create_time, | ||||||
|       </if> |       </if> | ||||||
| @@ -66,20 +78,23 @@ | |||||||
|       <if test="roomNumber != null"> |       <if test="roomNumber != null"> | ||||||
|         #{roomNumber,jdbcType=VARCHAR}, |         #{roomNumber,jdbcType=VARCHAR}, | ||||||
|       </if> |       </if> | ||||||
|       <if test="roomFloor != null"> |       <if test="typeId != null"> | ||||||
|         #{roomFloor,jdbcType=INTEGER}, |         #{typeId,jdbcType=INTEGER}, | ||||||
|       </if> |       </if> | ||||||
|       <if test="roomType != null"> |       <if test="roomType != null"> | ||||||
|         #{roomType,jdbcType=INTEGER}, |         #{roomType,jdbcType=VARCHAR}, | ||||||
|       </if> |       </if> | ||||||
|       <if test="roomPrice != null"> |       <if test="roomPrice != null"> | ||||||
|         #{roomPrice,jdbcType=DECIMAL}, |         #{roomPrice,jdbcType=DOUBLE}, | ||||||
|       </if> |       </if> | ||||||
|       <if test="roomDiscount != null"> |       <if test="roomDiscount != null"> | ||||||
|         #{roomDiscount,jdbcType=REAL}, |         #{roomDiscount,jdbcType=DOUBLE}, | ||||||
|       </if> |       </if> | ||||||
|       <if test="roomStatus != null"> |       <if test="roomStatus != null"> | ||||||
|         #{roomStatus,jdbcType=VARCHAR}, |         #{roomStatus,jdbcType=INTEGER}, | ||||||
|  |       </if> | ||||||
|  |       <if test="remark != null"> | ||||||
|  |         #{remark,jdbcType=VARCHAR}, | ||||||
|       </if> |       </if> | ||||||
|       <if test="createTime != null"> |       <if test="createTime != null"> | ||||||
|         #{createTime,jdbcType=TIMESTAMP}, |         #{createTime,jdbcType=TIMESTAMP}, | ||||||
| @@ -89,82 +104,50 @@ | |||||||
|       </if> |       </if> | ||||||
|     </trim> |     </trim> | ||||||
|   </insert> |   </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 id="updateByPrimaryKey" parameterType="cn.mafangui.hotel.entity.Room"> | ||||||
|     update room_info |     update room_info | ||||||
|     set room_number = #{roomNumber,jdbcType=VARCHAR}, |     set room_number = #{roomNumber,jdbcType=VARCHAR}, | ||||||
|       room_floor = #{roomFloor,jdbcType=INTEGER}, |       type_id = #{typeId,jdbcType=INTEGER}, | ||||||
|       room_type = #{roomType,jdbcType=INTEGER}, |       room_type = #{roomType,jdbcType=VARCHAR}, | ||||||
|       room_price = #{roomPrice,jdbcType=DECIMAL}, |       room_price = #{roomPrice,jdbcType=DOUBLE}, | ||||||
|       room_discount = #{roomDiscount,jdbcType=REAL}, |       room_discount = #{roomDiscount,jdbcType=DOUBLE}, | ||||||
|       room_status = #{roomStatus,jdbcType=VARCHAR}, |       room_status = #{roomStatus,jdbcType=INTEGER}, | ||||||
|  |       remark = #{remark,jdbcType=VARCHAR}, | ||||||
|       create_time = #{createTime,jdbcType=TIMESTAMP}, |       create_time = #{createTime,jdbcType=TIMESTAMP}, | ||||||
|       update_time = #{updateTime,jdbcType=TIMESTAMP} |       update_time = #{updateTime,jdbcType=TIMESTAMP} | ||||||
|     where room_id = #{roomId,jdbcType=INTEGER} |     where room_id = #{roomId,jdbcType=INTEGER} | ||||||
|   </update> |   </update> | ||||||
|  |  | ||||||
|     <insert id="insert" parameterType="cn.mafangui.hotel.entity.Room"> |  | ||||||
|     insert into room_info ( room_number, room_floor, |  | ||||||
|       room_type, type_name, room_price, room_discount, |  | ||||||
|       room_status, create_time, update_time |  | ||||||
|       ) |  | ||||||
|     values (#{roomNumber,jdbcType=VARCHAR}, #{roomFloor,jdbcType=INTEGER}, |  | ||||||
|       #{roomType,jdbcType=INTEGER}, #{typeName,jdbcType=VARCHAR}, #{roomPrice,jdbcType=DECIMAL}, #{roomDiscount,jdbcType=REAL}, |  | ||||||
|       #{roomStatus,jdbcType=VARCHAR}, now(), now() |  | ||||||
|       ) |  | ||||||
|   </insert> |  | ||||||
|     <delete id="deleteByRoomNumber" parameterType="String"> |  | ||||||
|         delete from room_info where room_number = #{roomNumber,jdbcType=VARCHAR} |  | ||||||
|     </delete> |  | ||||||
|     <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="roomFloor != null"> |  | ||||||
|                 room_floor = #{roomFloor,jdbcType=INTEGER}, |  | ||||||
|             </if> |  | ||||||
|             <if test="roomType != null"> |  | ||||||
|                 room_type = #{roomType,jdbcType=INTEGER}, |  | ||||||
|             </if> |  | ||||||
|             <if test="typeName != null"> |  | ||||||
|                 type_name = #{typeName,jdbcType=VARCHAR}, |  | ||||||
|             </if> |  | ||||||
|             <if test="roomPrice != null"> |  | ||||||
|                 room_price = #{roomPrice,jdbcType=DECIMAL}, |  | ||||||
|             </if> |  | ||||||
|             <if test="roomDiscount != null"> |  | ||||||
|                 room_discount = #{roomDiscount,jdbcType=REAL}, |  | ||||||
|             </if> |  | ||||||
|             <if test="roomStatus != null"> |  | ||||||
|                 room_status = #{roomStatus,jdbcType=VARCHAR}, |  | ||||||
|             </if> |  | ||||||
|                 update_time = now(), |  | ||||||
|         </set> |  | ||||||
|         where room_id = #{roomId,jdbcType=INTEGER} |  | ||||||
|     </update> |  | ||||||
|     <select id="selectByRoomNumber" parameterType="String" resultMap="BaseResultMap"> |  | ||||||
|         select |  | ||||||
|         <include refid="Base_Column_List" /> |  | ||||||
|         from room_info |  | ||||||
|         where room_number = #{roomNumber,jdbcType=VARCHAR} |  | ||||||
|     </select> |  | ||||||
|     <select id="selectAllRoom" resultMap="BaseResultMap"> |  | ||||||
|         select |  | ||||||
|         <include refid="Base_Column_List" /> |  | ||||||
|         from room_info |  | ||||||
|     </select> |  | ||||||
|     <select id="selectByType" parameterType="String" resultMap="BaseResultMap"> |  | ||||||
|         select |  | ||||||
|         <include refid="Base_Column_List" /> |  | ||||||
|         from room_info |  | ||||||
|         where type_name = #{typeName,jdbcType=VARCHAR} |  | ||||||
|     </select> |  | ||||||
|     <select id="selectByStatus" parameterType="String" resultMap="BaseResultMap"> |  | ||||||
|         select |  | ||||||
|         <include refid="Base_Column_List" /> |  | ||||||
|         from room_info |  | ||||||
|         where room_status = #{status,jdbcType=VARCHAR} |  | ||||||
|     </select> |  | ||||||
| </mapper> | </mapper> | ||||||
| @@ -2,126 +2,163 @@ | |||||||
| <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> | <!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"> | <mapper namespace="cn.mafangui.hotel.mapper.RoomTypeMapper"> | ||||||
|   <resultMap id="BaseResultMap" type="cn.mafangui.hotel.entity.RoomType"> |   <resultMap id="BaseResultMap" type="cn.mafangui.hotel.entity.RoomType"> | ||||||
|     <id column="type_id" jdbcType="INTEGER" property="typeId" /> |     <id column="type_id" jdbcType="BIGINT" property="typeId" /> | ||||||
|     <result column="room_type" jdbcType="INTEGER" property="roomType" /> |     <result column="room_type" jdbcType="VARCHAR" property="roomType" /> | ||||||
|     <result column="type_name" jdbcType="VARCHAR" property="typeName" /> |     <result column="remark" jdbcType="VARCHAR" property="remark" /> | ||||||
|     <result column="booking_price" jdbcType="DOUBLE" property="bookingPrice" /> |     <result column="price" jdbcType="DOUBLE" property="price" /> | ||||||
|     <result column="booking_discount" jdbcType="DOUBLE" property="bookingDiscount" /> |     <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="create_time" jdbcType="TIMESTAMP" property="createTime" /> | ||||||
|     <result column="update_time" jdbcType="DATE" property="updateTime" /> |     <result column="update_time" jdbcType="TIMESTAMP" property="updateTime" /> | ||||||
|   </resultMap> |   </resultMap> | ||||||
|   <sql id="Base_Column_List"> |   <sql id="Base_Column_List"> | ||||||
|     type_id, room_type, type_name, booking_price, booking_discount, create_time, update_time |     type_id, room_type, remark, price, discount, area, bed_num, bed_size, window, create_time,  | ||||||
|  |     update_time | ||||||
|   </sql> |   </sql> | ||||||
|   <select id="selectByPrimaryKey" parameterType="java.lang.Integer" resultMap="BaseResultMap"> |   <select id="selectByPrimaryKey" parameterType="java.lang.Long" resultMap="BaseResultMap"> | ||||||
|     select  |     select  | ||||||
|     <include refid="Base_Column_List" /> |     <include refid="Base_Column_List" /> | ||||||
|     from room_type |     from room_type | ||||||
|     where type_id = #{typeId,jdbcType=INTEGER} |     where type_id = #{typeId,jdbcType=BIGINT} | ||||||
|   </select> |   </select> | ||||||
|   <select id="selectByRoomType" parameterType="java.lang.Integer" resultMap="BaseResultMap"> |   <delete id="deleteByPrimaryKey" parameterType="java.lang.Long"> | ||||||
|     select |  | ||||||
|     <include refid="Base_Column_List" /> |  | ||||||
|     from room_type |  | ||||||
|     where room_type = #{roomType,jdbcType=INTEGER} |  | ||||||
|   </select> |  | ||||||
|   <select id="findAll" resultMap="BaseResultMap"> |  | ||||||
|     select * FROM room_type |  | ||||||
|   </select> |  | ||||||
|   <delete id="deleteByPrimaryKey" parameterType="java.lang.Integer"> |  | ||||||
|     delete from room_type |     delete from room_type | ||||||
|     where type_id = #{typeId,jdbcType=INTEGER} |     where type_id = #{typeId,jdbcType=BIGINT} | ||||||
|   </delete> |   </delete> | ||||||
|   <insert id="insert" parameterType="cn.mafangui.hotel.entity.RoomType"> |   <insert id="insert" parameterType="cn.mafangui.hotel.entity.RoomType"> | ||||||
|     insert into room_type (type_id, room_type, type_name,  |     insert into room_type (type_id, room_type, remark,  | ||||||
|       booking_price, booking_discount, create_time,  |       price, discount, area,  | ||||||
|       update_time) |       bed_num, bed_size, window,  | ||||||
|     values (#{typeId,jdbcType=INTEGER}, #{roomType,jdbcType=INTEGER}, #{typeName,jdbcType=VARCHAR},  |       create_time, update_time) | ||||||
|       #{bookingPrice,jdbcType=DOUBLE}, #{bookingDiscount,jdbcType=DOUBLE}, #{createTime,jdbcType=TIMESTAMP}, |     values (#{typeId,jdbcType=BIGINT}, #{roomType,jdbcType=VARCHAR}, #{remark,jdbcType=VARCHAR},  | ||||||
|       #{updateTime,jdbcType=TIMESTAMP}) |       #{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> | ||||||
|   <insert id="insertSelective" parameterType="cn.mafangui.hotel.entity.RoomType"> |   <insert id="insertSelective" parameterType="cn.mafangui.hotel.entity.RoomType"> | ||||||
|     insert into room_type |     insert into room_type | ||||||
|     <trim prefix="(" suffix=")" suffixOverrides=","> |     <trim prefix="(" suffix=")" suffixOverrides=","> | ||||||
|  |       <if test="typeId != null"> | ||||||
|  |         type_id, | ||||||
|  |       </if> | ||||||
|       <if test="roomType != null"> |       <if test="roomType != null"> | ||||||
|         room_type, |         room_type, | ||||||
|       </if> |       </if> | ||||||
|       <if test="typeName != null"> |       <if test="remark != null"> | ||||||
|         type_name, |         remark, | ||||||
|       </if> |       </if> | ||||||
|       <if test="bookingPrice != null"> |       <if test="price != null"> | ||||||
|         booking_price, |         price, | ||||||
|       </if> |       </if> | ||||||
|       <if test="bookingDiscount != null"> |       <if test="discount != null"> | ||||||
|         booking_discount, |         discount, | ||||||
|       </if> |       </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, |         create_time, | ||||||
|  |       </if> | ||||||
|  |       <if test="updateTime != null"> | ||||||
|         update_time, |         update_time, | ||||||
|  |       </if> | ||||||
|     </trim> |     </trim> | ||||||
|     <trim prefix="values (" suffix=")" suffixOverrides=","> |     <trim prefix="values (" suffix=")" suffixOverrides=","> | ||||||
|  |       <if test="typeId != null"> | ||||||
|  |         #{typeId,jdbcType=BIGINT}, | ||||||
|  |       </if> | ||||||
|       <if test="roomType != null"> |       <if test="roomType != null"> | ||||||
|         #{roomType,jdbcType=INTEGER}, |         #{roomType,jdbcType=VARCHAR}, | ||||||
|       </if> |       </if> | ||||||
|       <if test="typeName != null"> |       <if test="remark != null"> | ||||||
|         #{typeName,jdbcType=VARCHAR}, |         #{remark,jdbcType=VARCHAR}, | ||||||
|       </if> |       </if> | ||||||
|       <if test="bookingPrice != null"> |       <if test="price != null"> | ||||||
|         #{bookingPrice,jdbcType=DOUBLE}, |         #{price,jdbcType=DOUBLE}, | ||||||
|       </if> |       </if> | ||||||
|       <if test="bookingDiscount != null"> |       <if test="discount != null"> | ||||||
|         #{bookingDiscount,jdbcType=DOUBLE}, |         #{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> |       </if> | ||||||
|       now(), |  | ||||||
|       now() |  | ||||||
|     </trim> |     </trim> | ||||||
|   </insert> |   </insert> | ||||||
|   <update id="updateByPrimaryKeySelective" parameterType="cn.mafangui.hotel.entity.RoomType"> |   <update id="updateByPrimaryKeySelective" parameterType="cn.mafangui.hotel.entity.RoomType"> | ||||||
|     update room_type |     update room_type | ||||||
|     <set> |     <set> | ||||||
|       <if test="roomType != null"> |       <if test="roomType != null"> | ||||||
|         room_type = #{roomType,jdbcType=INTEGER}, |         room_type = #{roomType,jdbcType=VARCHAR}, | ||||||
|       </if> |       </if> | ||||||
|       <if test="typeName != null"> |       <if test="remark != null"> | ||||||
|         type_name = #{typeName,jdbcType=VARCHAR}, |         remark = #{remark,jdbcType=VARCHAR}, | ||||||
|       </if> |       </if> | ||||||
|       <if test="bookingPrice != null"> |       <if test="price != null"> | ||||||
|         booking_price = #{bookingPrice,jdbcType=DECIMAL}, |         price = #{price,jdbcType=DOUBLE}, | ||||||
|       </if> |       </if> | ||||||
|       <if test="bookingDiscount != null"> |       <if test="discount != null"> | ||||||
|         booking_discount = #{bookingDiscount,jdbcType=REAL}, |         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> |       </if> | ||||||
|         update_time = now(), |  | ||||||
|     </set> |     </set> | ||||||
|     where type_id = #{typeId,jdbcType=INTEGER} |     where type_id = #{typeId,jdbcType=BIGINT} | ||||||
|   </update> |   </update> | ||||||
|   <update id="updateByPrimaryKey" parameterType="cn.mafangui.hotel.entity.RoomType"> |   <update id="updateByPrimaryKey" parameterType="cn.mafangui.hotel.entity.RoomType"> | ||||||
|     update room_type |     update room_type | ||||||
|     set room_type = #{roomType,jdbcType=INTEGER}, |     set room_type = #{roomType,jdbcType=VARCHAR}, | ||||||
|       type_name = #{typeName,jdbcType=VARCHAR}, |       remark = #{remark,jdbcType=VARCHAR}, | ||||||
|       booking_price = #{bookingPrice,jdbcType=DECIMAL}, |       price = #{price,jdbcType=DOUBLE}, | ||||||
|       booking_discount = #{bookingDiscount,jdbcType=REAL}, |       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}, |       create_time = #{createTime,jdbcType=TIMESTAMP}, | ||||||
|       update_time = #{updateTime,jdbcType=TIMESTAMP} |       update_time = #{updateTime,jdbcType=TIMESTAMP} | ||||||
|     where type_id = #{typeId,jdbcType=INTEGER} |     where type_id = #{typeId,jdbcType=BIGINT} | ||||||
|   </update> |  | ||||||
|   <delete id="deleteByRoomType" parameterType="java.lang.Integer"> |  | ||||||
|     delete from room_type |  | ||||||
|     where room_type = #{roomType,jdbcType=INTEGER} |  | ||||||
|   </delete> |  | ||||||
|   <update id="updateByRoomTypeSelective" parameterType="cn.mafangui.hotel.entity.RoomType"> |  | ||||||
|     update room_type |  | ||||||
|     <set> |  | ||||||
|       <if test="typeName != null"> |  | ||||||
|         type_name = #{typeName,jdbcType=VARCHAR}, |  | ||||||
|       </if> |  | ||||||
|       <if test="bookingPrice != null"> |  | ||||||
|         booking_price = #{bookingPrice,jdbcType=DOUBLE}, |  | ||||||
|       </if> |  | ||||||
|       <if test="bookingDiscount != null"> |  | ||||||
|         booking_discount = #{bookingDiscount,jdbcType=DOUBLE}, |  | ||||||
|       </if> |  | ||||||
|         update_time = now(), |  | ||||||
|     </set> |  | ||||||
|     where room_type = #{roomType,jdbcType=INTEGER} |  | ||||||
|   </update> |   </update> | ||||||
| </mapper> | </mapper> | ||||||
| @@ -3,48 +3,49 @@ | |||||||
| <mapper namespace="cn.mafangui.hotel.mapper.UserMapper"> | <mapper namespace="cn.mafangui.hotel.mapper.UserMapper"> | ||||||
|   <resultMap id="BaseResultMap" type="cn.mafangui.hotel.entity.User"> |   <resultMap id="BaseResultMap" type="cn.mafangui.hotel.entity.User"> | ||||||
|     <id column="user_id" jdbcType="INTEGER" property="userId" /> |     <id column="user_id" jdbcType="INTEGER" property="userId" /> | ||||||
|     <result column="user_name" jdbcType="VARCHAR" property="userName" /> |     <result column="username" jdbcType="VARCHAR" property="username" /> | ||||||
|     <result column="password" jdbcType="VARCHAR" property="password" /> |     <result column="password" jdbcType="VARCHAR" property="password" /> | ||||||
|     <result column="name" jdbcType="VARCHAR" property="name" /> |     <result column="name" jdbcType="VARCHAR" property="name" /> | ||||||
|  |     <result column="gender" jdbcType="CHAR" property="gender" /> | ||||||
|     <result column="phone" jdbcType="VARCHAR" property="phone" /> |     <result column="phone" jdbcType="VARCHAR" property="phone" /> | ||||||
|     <result column="email" jdbcType="VARCHAR" property="email" /> |     <result column="email" jdbcType="VARCHAR" property="email" /> | ||||||
|     <result column="address" jdbcType="VARCHAR" property="address" /> |     <result column="address" jdbcType="VARCHAR" property="address" /> | ||||||
|     <result column="id_number" jdbcType="VARCHAR" property="idNumber" /> |     <result column="idcard" jdbcType="VARCHAR" property="idcard" /> | ||||||
|     <result column="create_time" jdbcType="TIMESTAMP" property="createTime" /> |     <result column="create_time" jdbcType="TIMESTAMP" property="createTime" /> | ||||||
|     <result column="update_time" jdbcType="TIMESTAMP" property="updateTime" /> |     <result column="update_time" jdbcType="TIMESTAMP" property="updateTime" /> | ||||||
|   </resultMap> |   </resultMap> | ||||||
|   <sql id="Base_Column_List"> |   <sql id="Base_Column_List"> | ||||||
|     user_id, user_name, password, name, phone, email, address, id_number, create_time,  |     user_id, username, password, name, gender, phone, email, address, idcard, create_time,  | ||||||
|     update_time |     update_time | ||||||
|   </sql> |   </sql> | ||||||
|   <select id="selectByPrimaryKey" parameterType="java.lang.Integer" resultMap="BaseResultMap"> |   <select id="selectByPrimaryKey" parameterType="java.lang.Integer" resultMap="BaseResultMap"> | ||||||
|     select  |     select  | ||||||
|     <include refid="Base_Column_List" /> |     <include refid="Base_Column_List" /> | ||||||
|     from user |     from user_info | ||||||
|     where user_id = #{userId,jdbcType=INTEGER} |     where user_id = #{userId,jdbcType=INTEGER} | ||||||
|   </select> |   </select> | ||||||
|   <delete id="deleteByPrimaryKey" parameterType="java.lang.Integer"> |   <delete id="deleteByPrimaryKey" parameterType="java.lang.Integer"> | ||||||
|     delete from user |     delete from user_info | ||||||
|     where user_id = #{userId,jdbcType=INTEGER} |     where user_id = #{userId,jdbcType=INTEGER} | ||||||
|   </delete> |   </delete> | ||||||
|   <insert id="insert" parameterType="cn.mafangui.hotel.entity.User"> |   <insert id="insert" parameterType="cn.mafangui.hotel.entity.User"> | ||||||
|     insert into user (user_name, password, |     insert into user_info (user_id, username, password,  | ||||||
|       name, phone, email,  |       name, gender, phone, email,  | ||||||
|       address, id_number, create_time,  |       address, idcard, create_time,  | ||||||
|       update_time) |       update_time) | ||||||
|     values (#{userName,jdbcType=VARCHAR}, #{password,jdbcType=VARCHAR}, |     values (#{userId,jdbcType=INTEGER}, #{username,jdbcType=VARCHAR}, #{password,jdbcType=VARCHAR},  | ||||||
|       #{name,jdbcType=VARCHAR}, #{phone,jdbcType=VARCHAR}, #{email,jdbcType=VARCHAR},  |       #{name,jdbcType=VARCHAR}, #{gender,jdbcType=CHAR}, #{phone,jdbcType=VARCHAR}, #{email,jdbcType=VARCHAR},  | ||||||
|       #{address,jdbcType=VARCHAR}, #{idNumber,jdbcType=VARCHAR}, now(), |       #{address,jdbcType=VARCHAR}, #{idcard,jdbcType=VARCHAR}, #{createTime,jdbcType=TIMESTAMP},  | ||||||
|       now()) |       #{updateTime,jdbcType=TIMESTAMP}) | ||||||
|   </insert> |   </insert> | ||||||
|   <insert id="insertSelective" parameterType="cn.mafangui.hotel.entity.User"> |   <insert id="insertSelective" parameterType="cn.mafangui.hotel.entity.User"> | ||||||
|     insert into user |     insert into user_info | ||||||
|     <trim prefix="(" suffix=")" suffixOverrides=","> |     <trim prefix="(" suffix=")" suffixOverrides=","> | ||||||
|       <if test="userId != null"> |       <if test="userId != null"> | ||||||
|         user_id, |         user_id, | ||||||
|       </if> |       </if> | ||||||
|       <if test="userName != null"> |       <if test="username != null"> | ||||||
|         user_name, |         username, | ||||||
|       </if> |       </if> | ||||||
|       <if test="password != null"> |       <if test="password != null"> | ||||||
|         password, |         password, | ||||||
| @@ -52,6 +53,9 @@ | |||||||
|       <if test="name != null"> |       <if test="name != null"> | ||||||
|         name, |         name, | ||||||
|       </if> |       </if> | ||||||
|  |       <if test="gender != null"> | ||||||
|  |         gender, | ||||||
|  |       </if> | ||||||
|       <if test="phone != null"> |       <if test="phone != null"> | ||||||
|         phone, |         phone, | ||||||
|       </if> |       </if> | ||||||
| @@ -61,18 +65,22 @@ | |||||||
|       <if test="address != null"> |       <if test="address != null"> | ||||||
|         address, |         address, | ||||||
|       </if> |       </if> | ||||||
|       <if test="idNumber != null"> |       <if test="idcard != null"> | ||||||
|         id_number, |         idcard, | ||||||
|       </if> |       </if> | ||||||
|  |       <if test="createTime != null"> | ||||||
|         create_time, |         create_time, | ||||||
|  |       </if> | ||||||
|  |       <if test="updateTime != null"> | ||||||
|         update_time, |         update_time, | ||||||
|  |       </if> | ||||||
|     </trim> |     </trim> | ||||||
|     <trim prefix="values (" suffix=")" suffixOverrides=","> |     <trim prefix="values (" suffix=")" suffixOverrides=","> | ||||||
|       <if test="userId != null"> |       <if test="userId != null"> | ||||||
|         #{userId,jdbcType=INTEGER}, |         #{userId,jdbcType=INTEGER}, | ||||||
|       </if> |       </if> | ||||||
|       <if test="userName != null"> |       <if test="username != null"> | ||||||
|         #{userName,jdbcType=VARCHAR}, |         #{username,jdbcType=VARCHAR}, | ||||||
|       </if> |       </if> | ||||||
|       <if test="password != null"> |       <if test="password != null"> | ||||||
|         #{password,jdbcType=VARCHAR}, |         #{password,jdbcType=VARCHAR}, | ||||||
| @@ -80,6 +88,9 @@ | |||||||
|       <if test="name != null"> |       <if test="name != null"> | ||||||
|         #{name,jdbcType=VARCHAR}, |         #{name,jdbcType=VARCHAR}, | ||||||
|       </if> |       </if> | ||||||
|  |       <if test="gender != null"> | ||||||
|  |         #{gender,jdbcType=CHAR}, | ||||||
|  |       </if> | ||||||
|       <if test="phone != null"> |       <if test="phone != null"> | ||||||
|         #{phone,jdbcType=VARCHAR}, |         #{phone,jdbcType=VARCHAR}, | ||||||
|       </if> |       </if> | ||||||
| @@ -89,18 +100,22 @@ | |||||||
|       <if test="address != null"> |       <if test="address != null"> | ||||||
|         #{address,jdbcType=VARCHAR}, |         #{address,jdbcType=VARCHAR}, | ||||||
|       </if> |       </if> | ||||||
|       <if test="idNumber != null"> |       <if test="idcard != null"> | ||||||
|         #{idNumber,jdbcType=VARCHAR}, |         #{idcard,jdbcType=VARCHAR}, | ||||||
|  |       </if> | ||||||
|  |       <if test="createTime != null"> | ||||||
|  |         #{createTime,jdbcType=TIMESTAMP}, | ||||||
|  |       </if> | ||||||
|  |       <if test="updateTime != null"> | ||||||
|  |         #{updateTime,jdbcType=TIMESTAMP}, | ||||||
|       </if> |       </if> | ||||||
|         now(), |  | ||||||
|         now(), |  | ||||||
|     </trim> |     </trim> | ||||||
|   </insert> |   </insert> | ||||||
|   <update id="updateByPrimaryKeySelective" parameterType="cn.mafangui.hotel.entity.User"> |   <update id="updateByPrimaryKeySelective" parameterType="cn.mafangui.hotel.entity.User"> | ||||||
|     update user |     update user_info | ||||||
|     <set> |     <set> | ||||||
|       <if test="userName != null"> |       <if test="username != null"> | ||||||
|         user_name = #{userName,jdbcType=VARCHAR}, |         username = #{username,jdbcType=VARCHAR}, | ||||||
|       </if> |       </if> | ||||||
|       <if test="password != null"> |       <if test="password != null"> | ||||||
|         password = #{password,jdbcType=VARCHAR}, |         password = #{password,jdbcType=VARCHAR}, | ||||||
| @@ -108,6 +123,9 @@ | |||||||
|       <if test="name != null"> |       <if test="name != null"> | ||||||
|         name = #{name,jdbcType=VARCHAR}, |         name = #{name,jdbcType=VARCHAR}, | ||||||
|       </if> |       </if> | ||||||
|  |       <if test="gender != null"> | ||||||
|  |         gender = #{gender,jdbcType=CHAR}, | ||||||
|  |       </if> | ||||||
|       <if test="phone != null"> |       <if test="phone != null"> | ||||||
|         phone = #{phone,jdbcType=VARCHAR}, |         phone = #{phone,jdbcType=VARCHAR}, | ||||||
|       </if> |       </if> | ||||||
| @@ -117,8 +135,8 @@ | |||||||
|       <if test="address != null"> |       <if test="address != null"> | ||||||
|         address = #{address,jdbcType=VARCHAR}, |         address = #{address,jdbcType=VARCHAR}, | ||||||
|       </if> |       </if> | ||||||
|       <if test="idNumber != null"> |       <if test="idcard != null"> | ||||||
|         id_number = #{idNumber,jdbcType=VARCHAR}, |         idcard = #{idcard,jdbcType=VARCHAR}, | ||||||
|       </if> |       </if> | ||||||
|       <if test="createTime != null"> |       <if test="createTime != null"> | ||||||
|         create_time = #{createTime,jdbcType=TIMESTAMP}, |         create_time = #{createTime,jdbcType=TIMESTAMP}, | ||||||
| @@ -130,56 +148,17 @@ | |||||||
|     where user_id = #{userId,jdbcType=INTEGER} |     where user_id = #{userId,jdbcType=INTEGER} | ||||||
|   </update> |   </update> | ||||||
|   <update id="updateByPrimaryKey" parameterType="cn.mafangui.hotel.entity.User"> |   <update id="updateByPrimaryKey" parameterType="cn.mafangui.hotel.entity.User"> | ||||||
|     update user |     update user_info | ||||||
|     set user_name = #{userName,jdbcType=VARCHAR}, |     set username = #{username,jdbcType=VARCHAR}, | ||||||
|       password = #{password,jdbcType=VARCHAR}, |       password = #{password,jdbcType=VARCHAR}, | ||||||
|       name = #{name,jdbcType=VARCHAR}, |       name = #{name,jdbcType=VARCHAR}, | ||||||
|  |       gender = #{gender,jdbcType=CHAR}, | ||||||
|       phone = #{phone,jdbcType=VARCHAR}, |       phone = #{phone,jdbcType=VARCHAR}, | ||||||
|       email = #{email,jdbcType=VARCHAR}, |       email = #{email,jdbcType=VARCHAR}, | ||||||
|       address = #{address,jdbcType=VARCHAR}, |       address = #{address,jdbcType=VARCHAR}, | ||||||
|       id_number = #{idNumber,jdbcType=VARCHAR}, |       idcard = #{idcard,jdbcType=VARCHAR}, | ||||||
|       create_time = #{createTime,jdbcType=TIMESTAMP}, |       create_time = #{createTime,jdbcType=TIMESTAMP}, | ||||||
|       update_time = #{updateTime,jdbcType=TIMESTAMP} |       update_time = #{updateTime,jdbcType=TIMESTAMP} | ||||||
|     where user_id = #{userId,jdbcType=INTEGER} |     where user_id = #{userId,jdbcType=INTEGER} | ||||||
|   </update> |   </update> | ||||||
|   <select id="selectByUserNameAndPassword" parameterType="cn.mafangui.hotel.entity.User" resultMap="BaseResultMap"> |  | ||||||
|     select |  | ||||||
|     <include refid="Base_Column_List" /> |  | ||||||
|     from user |  | ||||||
|     where user_name = #{userName,jdbcType=VARCHAR} and password = #{password,jdbcType=VARCHAR} |  | ||||||
|   </select> |  | ||||||
|   <select id="selectByUserName" parameterType="java.lang.String" resultMap="BaseResultMap"> |  | ||||||
|     select |  | ||||||
|     <include refid="Base_Column_List" /> |  | ||||||
|     from user |  | ||||||
|     where user_name = #{userName,jdbcType=VARCHAR} |  | ||||||
|   </select> |  | ||||||
|   <update id="updateByUserNameSelective" parameterType="cn.mafangui.hotel.entity.User"> |  | ||||||
|     update user |  | ||||||
|     <set> |  | ||||||
|       <if test="userName != null"> |  | ||||||
|         user_name = #{userName,jdbcType=VARCHAR}, |  | ||||||
|       </if> |  | ||||||
|       <if test="password != null"> |  | ||||||
|         password = #{password,jdbcType=VARCHAR}, |  | ||||||
|       </if> |  | ||||||
|       <if test="name != null"> |  | ||||||
|         name = #{name,jdbcType=VARCHAR}, |  | ||||||
|       </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="idNumber != null"> |  | ||||||
|         id_number = #{idNumber,jdbcType=VARCHAR}, |  | ||||||
|       </if> |  | ||||||
|         update_time = now(), |  | ||||||
|     </set> |  | ||||||
|     where user_name = #{userName,jdbcType=INTEGER} |  | ||||||
|   </update> |  | ||||||
| </mapper> | </mapper> | ||||||
| @@ -3,54 +3,82 @@ | |||||||
| <mapper namespace="cn.mafangui.hotel.mapper.WorkerMapper"> | <mapper namespace="cn.mafangui.hotel.mapper.WorkerMapper"> | ||||||
|   <resultMap id="BaseResultMap" type="cn.mafangui.hotel.entity.Worker"> |   <resultMap id="BaseResultMap" type="cn.mafangui.hotel.entity.Worker"> | ||||||
|     <id column="worker_id" jdbcType="INTEGER" property="workerId" /> |     <id column="worker_id" jdbcType="INTEGER" property="workerId" /> | ||||||
|     <result column="user_name" jdbcType="VARCHAR" property="userName" /> |     <result column="role" jdbcType="VARCHAR" property="role" /> | ||||||
|  |     <result column="username" jdbcType="VARCHAR" property="username" /> | ||||||
|     <result column="password" jdbcType="VARCHAR" property="password" /> |     <result column="password" jdbcType="VARCHAR" property="password" /> | ||||||
|     <result column="worker_name" jdbcType="VARCHAR" property="workerName" /> |     <result column="name" jdbcType="VARCHAR" property="name" /> | ||||||
|  |     <result column="gender" jdbcType="CHAR" property="gender" /> | ||||||
|     <result column="phone" jdbcType="VARCHAR" property="phone" /> |     <result column="phone" jdbcType="VARCHAR" property="phone" /> | ||||||
|  |     <result column="department" jdbcType="INTEGER" property="department" /> | ||||||
|     <result column="email" jdbcType="VARCHAR" property="email" /> |     <result column="email" jdbcType="VARCHAR" property="email" /> | ||||||
|     <result column="address" jdbcType="VARCHAR" property="address" /> |     <result column="address" jdbcType="VARCHAR" property="address" /> | ||||||
|     <result column="create_time" jdbcType="TIMESTAMP" property="createTime" /> |     <result column="create_time" jdbcType="TIMESTAMP" property="createTime" /> | ||||||
|     <result column="update_time" jdbcType="TIMESTAMP" property="updateTime" /> |     <result column="update_time" jdbcType="TIMESTAMP" property="updateTime" /> | ||||||
|   </resultMap> |   </resultMap> | ||||||
|   <sql id="Base_Column_List"> |   <sql id="Base_Column_List"> | ||||||
|     worker_id, user_name, password, worker_name, phone, email, address, create_time,  |     worker_id, role, username, password, name, gender, phone, department, email, address,  | ||||||
|     update_time |     create_time, update_time | ||||||
|   </sql> |   </sql> | ||||||
|   <select id="selectByPrimaryKey" parameterType="java.lang.Integer" resultMap="BaseResultMap"> |   <select id="selectByPrimaryKey" parameterType="java.lang.Integer" resultMap="BaseResultMap"> | ||||||
|     select  |     select  | ||||||
|     <include refid="Base_Column_List" /> |     <include refid="Base_Column_List" /> | ||||||
|     from worker |     from worker_info | ||||||
|     where worker_id = #{workerId,jdbcType=INTEGER} |     where worker_id = #{workerId,jdbcType=INTEGER} | ||||||
|   </select> |   </select> | ||||||
|  |   <select id="selectByUsernameAndPassword" parameterType="String" resultMap="BaseResultMap"> | ||||||
|  |     select * from worker_info | ||||||
|  |     where username = #{username,jdbcType=VARCHAR} and password = #{password,jdbcType=VARCHAR} | ||||||
|  |   </select> | ||||||
|  |   <select id="selectByRole" parameterType="String" resultMap="BaseResultMap"> | ||||||
|  |     select * from worker_info | ||||||
|  |     where role = #{role,jdbcType=VARCHAR} | ||||||
|  |   </select> | ||||||
|  |   <select id="selectAll" resultMap="BaseResultMap"> | ||||||
|  |     select * from worker_info | ||||||
|  |   </select> | ||||||
|   <delete id="deleteByPrimaryKey" parameterType="java.lang.Integer"> |   <delete id="deleteByPrimaryKey" parameterType="java.lang.Integer"> | ||||||
|     delete from worker |     delete from worker_info | ||||||
|     where worker_id = #{workerId,jdbcType=INTEGER} |     where worker_id = #{workerId,jdbcType=INTEGER} | ||||||
|   </delete> |   </delete> | ||||||
|   <insert id="insert" parameterType="cn.mafangui.hotel.entity.Worker"> |   <insert id="insert" parameterType="cn.mafangui.hotel.entity.Worker"> | ||||||
|     insert into worker (worker_id, user_name, password, |     insert into worker_info (worker_id, role, username,  | ||||||
|       worker_name, phone, email,  |       password, name, gender,  | ||||||
|  |       phone, department, email,  | ||||||
|       address, create_time, update_time |       address, create_time, update_time | ||||||
|       ) |       ) | ||||||
|     values (#{workerId,jdbcType=INTEGER}, #{userName,jdbcType=VARCHAR}, #{password,jdbcType=VARCHAR}, |     values (#{workerId,jdbcType=INTEGER}, #{role,jdbcType=VARCHAR}, #{username,jdbcType=VARCHAR},  | ||||||
|       #{workerName,jdbcType=VARCHAR}, #{phone,jdbcType=VARCHAR}, #{email,jdbcType=VARCHAR},  |       #{password,jdbcType=VARCHAR}, #{name,jdbcType=VARCHAR}, #{gender,jdbcType=CHAR},  | ||||||
|       #{address,jdbcType=VARCHAR}, #{createTime,jdbcType=TIMESTAMP}, #{updateTime,jdbcType=TIMESTAMP} |       #{phone,jdbcType=VARCHAR}, #{department,jdbcType=INTEGER}, #{email,jdbcType=VARCHAR},  | ||||||
|  |       #{address,jdbcType=VARCHAR}, now(),now() | ||||||
|       ) |       ) | ||||||
|   </insert> |   </insert> | ||||||
|   <insert id="insertSelective" parameterType="cn.mafangui.hotel.entity.Worker"> |   <insert id="insertSelective" parameterType="cn.mafangui.hotel.entity.Worker"> | ||||||
|     insert into worker |     insert into worker_info | ||||||
|     <trim prefix="(" suffix=")" suffixOverrides=","> |     <trim prefix="(" suffix=")" suffixOverrides=","> | ||||||
|       <if test="userName != null"> |       <if test="workerId != null"> | ||||||
|         user_name, |         worker_id, | ||||||
|  |       </if> | ||||||
|  |       <if test="role != null"> | ||||||
|  |         role, | ||||||
|  |       </if> | ||||||
|  |       <if test="username != null"> | ||||||
|  |         username, | ||||||
|       </if> |       </if> | ||||||
|       <if test="password != null"> |       <if test="password != null"> | ||||||
|         password, |         password, | ||||||
|       </if> |       </if> | ||||||
|       <if test="workerName != null"> |       <if test="name != null"> | ||||||
|         worker_name, |         name, | ||||||
|  |       </if> | ||||||
|  |       <if test="gender != null"> | ||||||
|  |         gender, | ||||||
|       </if> |       </if> | ||||||
|       <if test="phone != null"> |       <if test="phone != null"> | ||||||
|         phone, |         phone, | ||||||
|       </if> |       </if> | ||||||
|  |       <if test="department != null"> | ||||||
|  |         department, | ||||||
|  |       </if> | ||||||
|       <if test="email != null"> |       <if test="email != null"> | ||||||
|         email, |         email, | ||||||
|       </if> |       </if> | ||||||
| @@ -61,104 +89,85 @@ | |||||||
|         update_time, |         update_time, | ||||||
|     </trim> |     </trim> | ||||||
|     <trim prefix="values (" suffix=")" suffixOverrides=","> |     <trim prefix="values (" suffix=")" suffixOverrides=","> | ||||||
|       <if test="userName != null"> |       <if test="workerId != null"> | ||||||
|         #{userName,jdbcType=VARCHAR}, |         #{workerId,jdbcType=INTEGER}, | ||||||
|  |       </if> | ||||||
|  |       <if test="role != null"> | ||||||
|  |         #{role,jdbcType=VARCHAR}, | ||||||
|  |       </if> | ||||||
|  |       <if test="username != null"> | ||||||
|  |         #{username,jdbcType=VARCHAR}, | ||||||
|       </if> |       </if> | ||||||
|       <if test="password != null"> |       <if test="password != null"> | ||||||
|         #{password,jdbcType=VARCHAR}, |         #{password,jdbcType=VARCHAR}, | ||||||
|       </if> |       </if> | ||||||
|       <if test="workerName != null"> |       <if test="name != null"> | ||||||
|         #{workerName,jdbcType=VARCHAR}, |         #{name,jdbcType=VARCHAR}, | ||||||
|  |       </if> | ||||||
|  |       <if test="gender != null"> | ||||||
|  |         #{gender,jdbcType=CHAR}, | ||||||
|       </if> |       </if> | ||||||
|       <if test="phone != null"> |       <if test="phone != null"> | ||||||
|         #{phone,jdbcType=VARCHAR}, |         #{phone,jdbcType=VARCHAR}, | ||||||
|       </if> |       </if> | ||||||
|  |       <if test="department != null"> | ||||||
|  |         #{department,jdbcType=INTEGER}, | ||||||
|  |       </if> | ||||||
|       <if test="email != null"> |       <if test="email != null"> | ||||||
|         #{email,jdbcType=VARCHAR}, |         #{email,jdbcType=VARCHAR}, | ||||||
|       </if> |       </if> | ||||||
|       <if test="address != null"> |       <if test="address != null"> | ||||||
|         #{address,jdbcType=VARCHAR}, |         #{address,jdbcType=VARCHAR}, | ||||||
|       </if> |       </if> | ||||||
|         now(), |       now(), | ||||||
|         now(), |       now(), | ||||||
|     </trim> |     </trim> | ||||||
|   </insert> |   </insert> | ||||||
|   <update id="updateByPrimaryKeySelective" parameterType="cn.mafangui.hotel.entity.Worker"> |   <update id="updateByPrimaryKeySelective" parameterType="cn.mafangui.hotel.entity.Worker"> | ||||||
|     update worker |     update worker_info | ||||||
|     <set> |     <set> | ||||||
|       <if test="userName != null"> |       <if test="role != null"> | ||||||
|         user_name = #{userName,jdbcType=VARCHAR}, |         role = #{role,jdbcType=VARCHAR}, | ||||||
|  |       </if> | ||||||
|  |       <if test="username != null"> | ||||||
|  |         username = #{username,jdbcType=VARCHAR}, | ||||||
|       </if> |       </if> | ||||||
|       <if test="password != null"> |       <if test="password != null"> | ||||||
|         password = #{password,jdbcType=VARCHAR}, |         password = #{password,jdbcType=VARCHAR}, | ||||||
|       </if> |       </if> | ||||||
|       <if test="workerName != null"> |       <if test="name != null"> | ||||||
|         worker_name = #{workerName,jdbcType=VARCHAR}, |         name = #{name,jdbcType=VARCHAR}, | ||||||
|  |       </if> | ||||||
|  |       <if test="gender != null"> | ||||||
|  |         gender = #{gender,jdbcType=CHAR}, | ||||||
|       </if> |       </if> | ||||||
|       <if test="phone != null"> |       <if test="phone != null"> | ||||||
|         phone = #{phone,jdbcType=VARCHAR}, |         phone = #{phone,jdbcType=VARCHAR}, | ||||||
|       </if> |       </if> | ||||||
|  |       <if test="department != null"> | ||||||
|  |         department = #{department,jdbcType=INTEGER}, | ||||||
|  |       </if> | ||||||
|       <if test="email != null"> |       <if test="email != null"> | ||||||
|         email = #{email,jdbcType=VARCHAR}, |         email = #{email,jdbcType=VARCHAR}, | ||||||
|       </if> |       </if> | ||||||
|       <if test="address != null"> |       <if test="address != null"> | ||||||
|         address = #{address,jdbcType=VARCHAR}, |         address = #{address,jdbcType=VARCHAR}, | ||||||
|       </if> |       </if> | ||||||
|       <if test="createTime != null"> |  | ||||||
|         create_time = #{createTime,jdbcType=TIMESTAMP}, |  | ||||||
|       </if> |  | ||||||
|       <if test="updateTime != null"> |  | ||||||
|         update_time = #{updateTime,jdbcType=TIMESTAMP}, |  | ||||||
|       </if> |  | ||||||
|     </set> |     </set> | ||||||
|     where worker_id = #{workerId,jdbcType=INTEGER} |     where worker_id = #{workerId,jdbcType=INTEGER} | ||||||
|   </update> |   </update> | ||||||
|   <update id="updateByPrimaryKey" parameterType="cn.mafangui.hotel.entity.Worker"> |   <update id="updateByPrimaryKey" parameterType="cn.mafangui.hotel.entity.Worker"> | ||||||
|     update worker |     update worker_info | ||||||
|     set user_name = #{userName,jdbcType=VARCHAR}, |     set role = #{role,jdbcType=VARCHAR}, | ||||||
|  |       username = #{username,jdbcType=VARCHAR}, | ||||||
|       password = #{password,jdbcType=VARCHAR}, |       password = #{password,jdbcType=VARCHAR}, | ||||||
|       worker_name = #{workerName,jdbcType=VARCHAR}, |       name = #{name,jdbcType=VARCHAR}, | ||||||
|  |       gender = #{gender,jdbcType=CHAR}, | ||||||
|       phone = #{phone,jdbcType=VARCHAR}, |       phone = #{phone,jdbcType=VARCHAR}, | ||||||
|  |       department = #{department,jdbcType=INTEGER}, | ||||||
|       email = #{email,jdbcType=VARCHAR}, |       email = #{email,jdbcType=VARCHAR}, | ||||||
|       address = #{address,jdbcType=VARCHAR}, |       address = #{address,jdbcType=VARCHAR}, | ||||||
|       create_time = #{createTime,jdbcType=TIMESTAMP}, |  | ||||||
|       update_time = #{updateTime,jdbcType=TIMESTAMP} |  | ||||||
|     where worker_id = #{workerId,jdbcType=INTEGER} |     where worker_id = #{workerId,jdbcType=INTEGER} | ||||||
|   </update> |   </update> | ||||||
|   <delete id="deleteByUserName" parameterType="String"> |  | ||||||
|     delete from worker |  | ||||||
|     where user_name = #{userName,jdbcType=VARCHAR} |  | ||||||
|   </delete> |  | ||||||
|   <update id="updateByUserNameSelective"> |  | ||||||
|     update worker |  | ||||||
|     set |  | ||||||
|     <if test="password != null"> |  | ||||||
|     password = #{password,jdbcType=VARCHAR}, |  | ||||||
|     </if> |  | ||||||
|     <if test="workerName != null"> |  | ||||||
|       worker_name = #{workerName,jdbcType=VARCHAR}, |  | ||||||
|     </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> |  | ||||||
|       update_time = now() |  | ||||||
|     where user_name = #{userName,jdbcType=VARCHAR} |  | ||||||
|   </update> |  | ||||||
|   <select id="selectByUserName" parameterType="String" resultMap="BaseResultMap"> |  | ||||||
|     select * from worker |  | ||||||
|     where user_name = #{userName,jdbcType=VARCHAR} |  | ||||||
|   </select> |  | ||||||
|   <select id="findAll" resultMap="BaseResultMap"> |  | ||||||
|     select * from worker |  | ||||||
|   </select> |  | ||||||
|   <select id="selectByUserNameAndPassword" resultMap="BaseResultMap"> |  | ||||||
|     select * from worker |  | ||||||
|     where user_name = #{userName,jdbcType=VARCHAR} and password = #{password,jdbcType=VARCHAR} |  | ||||||
|   </select> |  | ||||||
| </mapper> | </mapper> | ||||||
| @@ -1,16 +0,0 @@ | |||||||
| package cn.mafangui.hotel; |  | ||||||
|  |  | ||||||
| import org.junit.Test; |  | ||||||
| import org.junit.runner.RunWith; |  | ||||||
| import org.springframework.boot.test.context.SpringBootTest; |  | ||||||
| import org.springframework.test.context.junit4.SpringRunner; |  | ||||||
|  |  | ||||||
| @RunWith(SpringRunner.class) |  | ||||||
| @SpringBootTest |  | ||||||
| public class HotelApplicationTests { |  | ||||||
|  |  | ||||||
|     @Test |  | ||||||
|     public void contextLoads() { |  | ||||||
|     } |  | ||||||
|  |  | ||||||
| } |  | ||||||
| @@ -1,57 +0,0 @@ | |||||||
| package cn.mafangui.hotel.controller; |  | ||||||
|  |  | ||||||
| import org.junit.After; |  | ||||||
| import org.junit.Assert; |  | ||||||
| import org.junit.Before; |  | ||||||
| import org.junit.Test; |  | ||||||
| import org.junit.runner.RunWith; |  | ||||||
| import org.springframework.beans.factory.annotation.Autowired; |  | ||||||
| import org.springframework.boot.test.context.SpringBootTest; |  | ||||||
| import org.springframework.test.context.junit4.SpringJUnit4ClassRunner; |  | ||||||
|  |  | ||||||
| import static org.junit.Assert.*; |  | ||||||
|  |  | ||||||
| @RunWith(SpringJUnit4ClassRunner.class) |  | ||||||
| @SpringBootTest |  | ||||||
| public class AdminControllerTest { |  | ||||||
|     @Autowired |  | ||||||
|     private AdminController adminController; |  | ||||||
|  |  | ||||||
|     @Before |  | ||||||
|     public void setUp() throws Exception { |  | ||||||
|     } |  | ||||||
|  |  | ||||||
|     @After |  | ||||||
|     public void tearDown() throws Exception { |  | ||||||
|     } |  | ||||||
|  |  | ||||||
|     @Test |  | ||||||
|     public void login() { |  | ||||||
|         String userName = "admin"; |  | ||||||
|         Assert.assertEquals(0, adminController.login(userName, userName)); |  | ||||||
|     } |  | ||||||
|  |  | ||||||
|     @Test |  | ||||||
|     public void register() { |  | ||||||
|         String userName = "test"; |  | ||||||
|         Assert.assertEquals(1, adminController.register(userName, userName)); |  | ||||||
|     } |  | ||||||
|  |  | ||||||
|     @Test |  | ||||||
|     public void updateProfile() { |  | ||||||
|         String userName = "test"; |  | ||||||
|         String password = "1234"; |  | ||||||
|         Assert.assertEquals(1, adminController.updateProfile(userName, password)); |  | ||||||
|     } |  | ||||||
|  |  | ||||||
|     @Test |  | ||||||
|     public void getAdmin() { |  | ||||||
|         String userName = "test"; |  | ||||||
|         Assert.assertNotNull(adminController.getAdmin(userName)); |  | ||||||
|     } |  | ||||||
|  |  | ||||||
|     @Test |  | ||||||
|     public void getAllAdmin() { |  | ||||||
|         Assert.assertNotNull(adminController.getAllAdmin()); |  | ||||||
|     } |  | ||||||
| } |  | ||||||
| @@ -1,54 +0,0 @@ | |||||||
| package cn.mafangui.hotel.controller; |  | ||||||
|  |  | ||||||
| import cn.mafangui.hotel.entity.Room; |  | ||||||
| import cn.mafangui.hotel.utils.MyDateTimeFormat; |  | ||||||
| import org.junit.Before; |  | ||||||
| import org.junit.Test; |  | ||||||
| import org.junit.runner.RunWith; |  | ||||||
| import org.springframework.beans.factory.annotation.Autowired; |  | ||||||
| import org.springframework.boot.test.context.SpringBootTest; |  | ||||||
| import org.springframework.test.context.junit4.SpringJUnit4ClassRunner; |  | ||||||
|  |  | ||||||
| @SpringBootTest |  | ||||||
| @RunWith(SpringJUnit4ClassRunner.class) |  | ||||||
| public class RoomControllerTest { |  | ||||||
|     @Autowired |  | ||||||
|     private RoomController roomController; |  | ||||||
|  |  | ||||||
|     MyDateTimeFormat df = new MyDateTimeFormat(); |  | ||||||
|  |  | ||||||
|     Room room = new Room(); |  | ||||||
|     @Before |  | ||||||
|     public void setUp() throws Exception { |  | ||||||
|         room.setRoomNumber("502"); |  | ||||||
|     } |  | ||||||
|  |  | ||||||
|     @Test |  | ||||||
|     public void addRoom() { |  | ||||||
|     } |  | ||||||
|  |  | ||||||
|     @Test |  | ||||||
|     public void deleteRoom() { |  | ||||||
|     } |  | ||||||
|  |  | ||||||
|     @Test |  | ||||||
|     public void updateRoom() { |  | ||||||
|     } |  | ||||||
|  |  | ||||||
|     @Test |  | ||||||
|     public void allRoom() { |  | ||||||
|     } |  | ||||||
|  |  | ||||||
|     @Test |  | ||||||
|     public void findRoomByNumber() { |  | ||||||
|  |  | ||||||
|     } |  | ||||||
|  |  | ||||||
|     @Test |  | ||||||
|     public void findRoomByStatus() { |  | ||||||
|     } |  | ||||||
|  |  | ||||||
|     @Test |  | ||||||
|     public void findRoomByType() { |  | ||||||
|     } |  | ||||||
| } |  | ||||||
| @@ -1,42 +0,0 @@ | |||||||
| package cn.mafangui.hotel.controller; |  | ||||||
|  |  | ||||||
| import org.junit.Assert; |  | ||||||
| import org.junit.Test; |  | ||||||
| import org.junit.runner.RunWith; |  | ||||||
| import org.springframework.beans.factory.annotation.Autowired; |  | ||||||
| import org.springframework.boot.test.context.SpringBootTest; |  | ||||||
| import org.springframework.test.context.junit4.SpringJUnit4ClassRunner; |  | ||||||
|  |  | ||||||
| import static org.junit.Assert.*; |  | ||||||
|  |  | ||||||
|  |  | ||||||
| @RunWith(SpringJUnit4ClassRunner.class) |  | ||||||
| @SpringBootTest |  | ||||||
| public class RoomTypeControllerTest { |  | ||||||
|  |  | ||||||
|     @Autowired |  | ||||||
|     private RoomTypeController roomTypeController; |  | ||||||
|  |  | ||||||
|     @Test |  | ||||||
|     public void addNewType() { |  | ||||||
|     } |  | ||||||
|  |  | ||||||
|     @Test |  | ||||||
|     public void delType() { |  | ||||||
|     } |  | ||||||
|  |  | ||||||
|     @Test |  | ||||||
|     public void updateType() { |  | ||||||
|     } |  | ||||||
|  |  | ||||||
|     @Test |  | ||||||
|     public void findByRoomType() { |  | ||||||
|         int roomType = 101; |  | ||||||
|         Assert.assertNotNull(roomTypeController.findByRoomType(roomType)); |  | ||||||
|     } |  | ||||||
|  |  | ||||||
|     @Test |  | ||||||
|     public void findAllRoomType() { |  | ||||||
|         Assert.assertNotNull(roomTypeController.findAllRoomType()); |  | ||||||
|     } |  | ||||||
| } |  | ||||||
| @@ -1,66 +0,0 @@ | |||||||
| package cn.mafangui.hotel.controller; |  | ||||||
|  |  | ||||||
|  |  | ||||||
| import org.junit.Assert; |  | ||||||
| import org.junit.Test; |  | ||||||
| import org.junit.runner.RunWith; |  | ||||||
| import org.springframework.beans.factory.annotation.Autowired; |  | ||||||
| import org.springframework.boot.test.context.SpringBootTest; |  | ||||||
| import org.springframework.test.context.junit4.SpringJUnit4ClassRunner; |  | ||||||
|  |  | ||||||
|  |  | ||||||
| @RunWith(SpringJUnit4ClassRunner.class) |  | ||||||
| @SpringBootTest |  | ||||||
| public class WorkerControllerTest { |  | ||||||
|  |  | ||||||
|     @Autowired |  | ||||||
|     private WorkerController workerController; |  | ||||||
|  |  | ||||||
|     @Test |  | ||||||
|     public void login() { |  | ||||||
|         String userName = "haha"; |  | ||||||
|         String pwd = "123456"; |  | ||||||
|         String password = "11111"; |  | ||||||
|         Assert.assertEquals(1,workerController.login(userName,password)); |  | ||||||
|     } |  | ||||||
|  |  | ||||||
|     @Test |  | ||||||
|     public void addWorker() { |  | ||||||
|         String userName = "haha"; |  | ||||||
|         String password = "123456"; |  | ||||||
|         String workerName = "nidsahao"; |  | ||||||
|         String phone = "9834431"; |  | ||||||
|         String email = "fads@kjd"; |  | ||||||
|         String address = "street101"; |  | ||||||
|         Assert.assertEquals(1,  workerController.addWorker(userName,password,workerName,phone,email,address)); |  | ||||||
|     } |  | ||||||
|  |  | ||||||
|     @Test |  | ||||||
|     public void delWorker() { |  | ||||||
|         String userName = "haha"; |  | ||||||
|         Assert.assertEquals(1, workerController.delWorker(userName)); |  | ||||||
|     } |  | ||||||
|  |  | ||||||
|     @Test |  | ||||||
|     public void updateWorker() { |  | ||||||
|         String userName = "haha"; |  | ||||||
|         String password = "11111"; |  | ||||||
|         String workerName = "chenhao"; |  | ||||||
|         String phone = null; |  | ||||||
|         String email = null; |  | ||||||
|         String address = null; |  | ||||||
|         Assert.assertEquals(1, workerController.updateWorker(userName,password,workerName,phone,email,address)); |  | ||||||
|     } |  | ||||||
|  |  | ||||||
|     @Test |  | ||||||
|     public void queryWorker() { |  | ||||||
|         String userName = "haha"; |  | ||||||
|         System.out.println(workerController.queryWorker(userName)); |  | ||||||
|         Assert.assertNotNull(workerController.queryWorker(userName)); |  | ||||||
|     } |  | ||||||
|  |  | ||||||
|     @Test |  | ||||||
|     public void findAllWorkers() { |  | ||||||
|         Assert.assertNotNull(workerController.findAllWorkers()); |  | ||||||
|     } |  | ||||||
| } |  | ||||||
							
								
								
									
										25
									
								
								src/test/java/cn/mafangui/hotel/mapper/UserMapperTest.java
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										25
									
								
								src/test/java/cn/mafangui/hotel/mapper/UserMapperTest.java
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,25 @@ | |||||||
|  | package cn.mafangui.hotel.mapper; | ||||||
|  |  | ||||||
|  | import org.junit.Assert; | ||||||
|  | import org.junit.Test; | ||||||
|  | import org.junit.runner.RunWith; | ||||||
|  | import org.springframework.beans.factory.annotation.Autowired; | ||||||
|  | import org.springframework.boot.test.context.SpringBootTest; | ||||||
|  | import org.springframework.test.context.junit4.SpringJUnit4ClassRunner; | ||||||
|  |  | ||||||
|  | import static org.junit.Assert.*; | ||||||
|  |  | ||||||
|  | @SpringBootTest | ||||||
|  | @RunWith(SpringJUnit4ClassRunner.class) | ||||||
|  | public class UserMapperTest { | ||||||
|  |  | ||||||
|  |     @Autowired | ||||||
|  |     private UserMapper userMapper; | ||||||
|  |  | ||||||
|  |     @Test | ||||||
|  |     public void testId(){ | ||||||
|  |         int id = 1; | ||||||
|  |         System.out.println(userMapper.selectByPrimaryKey(1)); | ||||||
|  |         Assert.assertNotNull(userMapper.selectByPrimaryKey(1)); | ||||||
|  |     } | ||||||
|  | } | ||||||
| @@ -0,0 +1,100 @@ | |||||||
|  | package cn.mafangui.hotel.service.impl; | ||||||
|  |  | ||||||
|  | import cn.mafangui.hotel.entity.Worker; | ||||||
|  | import org.junit.Assert; | ||||||
|  | import org.junit.Before; | ||||||
|  | import org.junit.Test; | ||||||
|  | import org.junit.runner.RunWith; | ||||||
|  | import org.springframework.beans.factory.annotation.Autowired; | ||||||
|  | import org.springframework.boot.test.context.SpringBootTest; | ||||||
|  | import org.springframework.test.context.junit4.SpringJUnit4ClassRunner; | ||||||
|  |  | ||||||
|  | import java.util.List; | ||||||
|  |  | ||||||
|  | import static org.junit.Assert.*; | ||||||
|  |  | ||||||
|  |  | ||||||
|  | @SpringBootTest | ||||||
|  | @RunWith(SpringJUnit4ClassRunner.class) | ||||||
|  | public class WorkerServiceImplTest { | ||||||
|  |  | ||||||
|  |     @Autowired | ||||||
|  |     WorkerServiceImpl workerService; | ||||||
|  |  | ||||||
|  |     @Before | ||||||
|  |     public void setUp() throws Exception { | ||||||
|  |     } | ||||||
|  |  | ||||||
|  |     @Test | ||||||
|  |     public void insert() { | ||||||
|  |         String role = "operator"; | ||||||
|  |         String username = "abc"; | ||||||
|  |         String password = "abc"; | ||||||
|  |         String name = "fdsa"; | ||||||
|  |         String gender = "女"; | ||||||
|  |         String phone = "242424"; | ||||||
|  |         Worker worker = new Worker(); | ||||||
|  |         worker.setPhone(phone); | ||||||
|  |         worker.setGender(gender); | ||||||
|  |         worker.setName(name); | ||||||
|  |         worker.setPassword(password); | ||||||
|  |         worker.setUsername(username); | ||||||
|  |         worker.setRole(role); | ||||||
|  |         Assert.assertEquals(1,workerService.insert(worker)); | ||||||
|  |     } | ||||||
|  |  | ||||||
|  |     @Test | ||||||
|  |     public void delete() { | ||||||
|  |         int id = 4; | ||||||
|  |         Assert.assertEquals(1,workerService.delete(id)); | ||||||
|  |     } | ||||||
|  |  | ||||||
|  |     @Test | ||||||
|  |     public void updateById() { | ||||||
|  |         int id = 4; | ||||||
|  |         String role = "operator"; | ||||||
|  |         String username = "abc"; | ||||||
|  |         String password = "abc"; | ||||||
|  |         String name = "fdsa"; | ||||||
|  |         String gender = "女"; | ||||||
|  |         String phone = "11111111"; | ||||||
|  |         Worker worker = new Worker(); | ||||||
|  |         worker.setWorkerId(4); | ||||||
|  |         worker.setPhone(phone); | ||||||
|  |         worker.setGender(gender); | ||||||
|  |         worker.setName(name); | ||||||
|  |         worker.setPassword(password); | ||||||
|  |         worker.setUsername(username); | ||||||
|  |         worker.setRole(role); | ||||||
|  |         Assert.assertEquals(1,workerService.updateById(worker)); | ||||||
|  |     } | ||||||
|  |  | ||||||
|  |     @Test | ||||||
|  |     public void selectById() { | ||||||
|  |         int id = 4; | ||||||
|  |         Assert.assertEquals("fdsa",workerService.selectById(id).getName()); | ||||||
|  |     } | ||||||
|  |  | ||||||
|  |     @Test | ||||||
|  |     public void findAll() { | ||||||
|  |         List<Worker> list = workerService.findAll(); | ||||||
|  |         System.out.println(list); | ||||||
|  |         Assert.assertNotNull(list); | ||||||
|  |     } | ||||||
|  |  | ||||||
|  |     @Test | ||||||
|  |     public void selectByRole() { | ||||||
|  |         String role = "admin"; | ||||||
|  |         List<Worker> list = workerService.selectByRole(role); | ||||||
|  |         System.out.println(list); | ||||||
|  |         Assert.assertEquals(1,list.size()); | ||||||
|  |     } | ||||||
|  |  | ||||||
|  |     @Test | ||||||
|  |     public void login() { | ||||||
|  |         String username = "admin"; | ||||||
|  |         String password = "admin"; | ||||||
|  |         Worker worker = workerService.login(username,password); | ||||||
|  |         Assert.assertNotNull(worker); | ||||||
|  |     } | ||||||
|  | } | ||||||
		Reference in New Issue
	
	Block a user