Initial commit

This commit is contained in:
muamua 2018-10-13 16:24:01 +08:00
commit 96611e9f72
38 changed files with 2783 additions and 0 deletions

25
.gitignore vendored Normal file
View File

@ -0,0 +1,25 @@
/target/
!.mvn/wrapper/maven-wrapper.jar
### STS ###
.apt_generated
.classpath
.factorypath
.project
.settings
.springBeans
.sts4-cache
### IntelliJ IDEA ###
.idea
*.iws
*.iml
*.ipr
### NetBeans ###
/nbproject/private/
/build/
/nbbuild/
/dist/
/nbdist/
/.nb-gradle/

BIN
.mvn/wrapper/maven-wrapper.jar vendored Normal file

Binary file not shown.

1
.mvn/wrapper/maven-wrapper.properties vendored Normal file
View File

@ -0,0 +1 @@
distributionUrl=https://repo1.maven.org/maven2/org/apache/maven/apache-maven/3.5.4/apache-maven-3.5.4-bin.zip

225
mvnw vendored Normal file
View File

@ -0,0 +1,225 @@
#!/bin/sh
# ----------------------------------------------------------------------------
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not use this file except in compliance
# with the License. You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing,
# software distributed under the License is distributed on an
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
# KIND, either express or implied. See the License for the
# specific language governing permissions and limitations
# under the License.
# ----------------------------------------------------------------------------
# ----------------------------------------------------------------------------
# Maven2 Start Up Batch script
#
# Required ENV vars:
# ------------------
# JAVA_HOME - location of a JDK home dir
#
# Optional ENV vars
# -----------------
# M2_HOME - location of maven2's installed home dir
# MAVEN_OPTS - parameters passed to the Java VM when running Maven
# e.g. to debug Maven itself, use
# set MAVEN_OPTS=-Xdebug -Xrunjdwp:transport=dt_socket,server=y,suspend=y,address=8000
# MAVEN_SKIP_RC - flag to disable loading of mavenrc files
# ----------------------------------------------------------------------------
if [ -z "$MAVEN_SKIP_RC" ] ; then
if [ -f /etc/mavenrc ] ; then
. /etc/mavenrc
fi
if [ -f "$HOME/.mavenrc" ] ; then
. "$HOME/.mavenrc"
fi
fi
# OS specific support. $var _must_ be set to either true or false.
cygwin=false;
darwin=false;
mingw=false
case "`uname`" in
CYGWIN*) cygwin=true ;;
MINGW*) mingw=true;;
Darwin*) darwin=true
# Use /usr/libexec/java_home if available, otherwise fall back to /Library/Java/Home
# See https://developer.apple.com/library/mac/qa/qa1170/_index.html
if [ -z "$JAVA_HOME" ]; then
if [ -x "/usr/libexec/java_home" ]; then
export JAVA_HOME="`/usr/libexec/java_home`"
else
export JAVA_HOME="/Library/Java/Home"
fi
fi
;;
esac
if [ -z "$JAVA_HOME" ] ; then
if [ -r /etc/gentoo-release ] ; then
JAVA_HOME=`java-config --jre-home`
fi
fi
if [ -z "$M2_HOME" ] ; then
## resolve links - $0 may be a link to maven's home
PRG="$0"
# need this for relative symlinks
while [ -h "$PRG" ] ; do
ls=`ls -ld "$PRG"`
link=`expr "$ls" : '.*-> \(.*\)$'`
if expr "$link" : '/.*' > /dev/null; then
PRG="$link"
else
PRG="`dirname "$PRG"`/$link"
fi
done
saveddir=`pwd`
M2_HOME=`dirname "$PRG"`/..
# make it fully qualified
M2_HOME=`cd "$M2_HOME" && pwd`
cd "$saveddir"
# echo Using m2 at $M2_HOME
fi
# For Cygwin, ensure paths are in UNIX format before anything is touched
if $cygwin ; then
[ -n "$M2_HOME" ] &&
M2_HOME=`cygpath --unix "$M2_HOME"`
[ -n "$JAVA_HOME" ] &&
JAVA_HOME=`cygpath --unix "$JAVA_HOME"`
[ -n "$CLASSPATH" ] &&
CLASSPATH=`cygpath --path --unix "$CLASSPATH"`
fi
# For Migwn, ensure paths are in UNIX format before anything is touched
if $mingw ; then
[ -n "$M2_HOME" ] &&
M2_HOME="`(cd "$M2_HOME"; pwd)`"
[ -n "$JAVA_HOME" ] &&
JAVA_HOME="`(cd "$JAVA_HOME"; pwd)`"
# TODO classpath?
fi
if [ -z "$JAVA_HOME" ]; then
javaExecutable="`which javac`"
if [ -n "$javaExecutable" ] && ! [ "`expr \"$javaExecutable\" : '\([^ ]*\)'`" = "no" ]; then
# readlink(1) is not available as standard on Solaris 10.
readLink=`which readlink`
if [ ! `expr "$readLink" : '\([^ ]*\)'` = "no" ]; then
if $darwin ; then
javaHome="`dirname \"$javaExecutable\"`"
javaExecutable="`cd \"$javaHome\" && pwd -P`/javac"
else
javaExecutable="`readlink -f \"$javaExecutable\"`"
fi
javaHome="`dirname \"$javaExecutable\"`"
javaHome=`expr "$javaHome" : '\(.*\)/bin'`
JAVA_HOME="$javaHome"
export JAVA_HOME
fi
fi
fi
if [ -z "$JAVACMD" ] ; then
if [ -n "$JAVA_HOME" ] ; then
if [ -x "$JAVA_HOME/jre/sh/java" ] ; then
# IBM's JDK on AIX uses strange locations for the executables
JAVACMD="$JAVA_HOME/jre/sh/java"
else
JAVACMD="$JAVA_HOME/bin/java"
fi
else
JAVACMD="`which java`"
fi
fi
if [ ! -x "$JAVACMD" ] ; then
echo "Error: JAVA_HOME is not defined correctly." >&2
echo " We cannot execute $JAVACMD" >&2
exit 1
fi
if [ -z "$JAVA_HOME" ] ; then
echo "Warning: JAVA_HOME environment variable is not set."
fi
CLASSWORLDS_LAUNCHER=org.codehaus.plexus.classworlds.launcher.Launcher
# traverses directory structure from process work directory to filesystem root
# first directory with .mvn subdirectory is considered project base directory
find_maven_basedir() {
if [ -z "$1" ]
then
echo "Path not specified to find_maven_basedir"
return 1
fi
basedir="$1"
wdir="$1"
while [ "$wdir" != '/' ] ; do
if [ -d "$wdir"/.mvn ] ; then
basedir=$wdir
break
fi
# workaround for JBEAP-8937 (on Solaris 10/Sparc)
if [ -d "${wdir}" ]; then
wdir=`cd "$wdir/.."; pwd`
fi
# end of workaround
done
echo "${basedir}"
}
# concatenates all lines of a file
concat_lines() {
if [ -f "$1" ]; then
echo "$(tr -s '\n' ' ' < "$1")"
fi
}
BASE_DIR=`find_maven_basedir "$(pwd)"`
if [ -z "$BASE_DIR" ]; then
exit 1;
fi
export MAVEN_PROJECTBASEDIR=${MAVEN_BASEDIR:-"$BASE_DIR"}
echo $MAVEN_PROJECTBASEDIR
MAVEN_OPTS="$(concat_lines "$MAVEN_PROJECTBASEDIR/.mvn/jvm.config") $MAVEN_OPTS"
# For Cygwin, switch paths to Windows format before running java
if $cygwin; then
[ -n "$M2_HOME" ] &&
M2_HOME=`cygpath --path --windows "$M2_HOME"`
[ -n "$JAVA_HOME" ] &&
JAVA_HOME=`cygpath --path --windows "$JAVA_HOME"`
[ -n "$CLASSPATH" ] &&
CLASSPATH=`cygpath --path --windows "$CLASSPATH"`
[ -n "$MAVEN_PROJECTBASEDIR" ] &&
MAVEN_PROJECTBASEDIR=`cygpath --path --windows "$MAVEN_PROJECTBASEDIR"`
fi
WRAPPER_LAUNCHER=org.apache.maven.wrapper.MavenWrapperMain
exec "$JAVACMD" \
$MAVEN_OPTS \
-classpath "$MAVEN_PROJECTBASEDIR/.mvn/wrapper/maven-wrapper.jar" \
"-Dmaven.home=${M2_HOME}" "-Dmaven.multiModuleProjectDirectory=${MAVEN_PROJECTBASEDIR}" \
${WRAPPER_LAUNCHER} $MAVEN_CONFIG "$@"

143
mvnw.cmd vendored Normal file
View File

@ -0,0 +1,143 @@
@REM ----------------------------------------------------------------------------
@REM Licensed to the Apache Software Foundation (ASF) under one
@REM or more contributor license agreements. See the NOTICE file
@REM distributed with this work for additional information
@REM regarding copyright ownership. The ASF licenses this file
@REM to you under the Apache License, Version 2.0 (the
@REM "License"); you may not use this file except in compliance
@REM with the License. You may obtain a copy of the License at
@REM
@REM http://www.apache.org/licenses/LICENSE-2.0
@REM
@REM Unless required by applicable law or agreed to in writing,
@REM software distributed under the License is distributed on an
@REM "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
@REM KIND, either express or implied. See the License for the
@REM specific language governing permissions and limitations
@REM under the License.
@REM ----------------------------------------------------------------------------
@REM ----------------------------------------------------------------------------
@REM Maven2 Start Up Batch script
@REM
@REM Required ENV vars:
@REM JAVA_HOME - location of a JDK home dir
@REM
@REM Optional ENV vars
@REM M2_HOME - location of maven2's installed home dir
@REM MAVEN_BATCH_ECHO - set to 'on' to enable the echoing of the batch commands
@REM MAVEN_BATCH_PAUSE - set to 'on' to wait for a key stroke before ending
@REM MAVEN_OPTS - parameters passed to the Java VM when running Maven
@REM e.g. to debug Maven itself, use
@REM set MAVEN_OPTS=-Xdebug -Xrunjdwp:transport=dt_socket,server=y,suspend=y,address=8000
@REM MAVEN_SKIP_RC - flag to disable loading of mavenrc files
@REM ----------------------------------------------------------------------------
@REM Begin all REM lines with '@' in case MAVEN_BATCH_ECHO is 'on'
@echo off
@REM enable echoing my setting MAVEN_BATCH_ECHO to 'on'
@if "%MAVEN_BATCH_ECHO%" == "on" echo %MAVEN_BATCH_ECHO%
@REM set %HOME% to equivalent of $HOME
if "%HOME%" == "" (set "HOME=%HOMEDRIVE%%HOMEPATH%")
@REM Execute a user defined script before this one
if not "%MAVEN_SKIP_RC%" == "" goto skipRcPre
@REM check for pre script, once with legacy .bat ending and once with .cmd ending
if exist "%HOME%\mavenrc_pre.bat" call "%HOME%\mavenrc_pre.bat"
if exist "%HOME%\mavenrc_pre.cmd" call "%HOME%\mavenrc_pre.cmd"
:skipRcPre
@setlocal
set ERROR_CODE=0
@REM To isolate internal variables from possible post scripts, we use another setlocal
@setlocal
@REM ==== START VALIDATION ====
if not "%JAVA_HOME%" == "" goto OkJHome
echo.
echo Error: JAVA_HOME not found in your environment. >&2
echo Please set the JAVA_HOME variable in your environment to match the >&2
echo location of your Java installation. >&2
echo.
goto error
:OkJHome
if exist "%JAVA_HOME%\bin\java.exe" goto init
echo.
echo Error: JAVA_HOME is set to an invalid directory. >&2
echo JAVA_HOME = "%JAVA_HOME%" >&2
echo Please set the JAVA_HOME variable in your environment to match the >&2
echo location of your Java installation. >&2
echo.
goto error
@REM ==== END VALIDATION ====
:init
@REM Find the project base dir, i.e. the directory that contains the folder ".mvn".
@REM Fallback to current working directory if not found.
set MAVEN_PROJECTBASEDIR=%MAVEN_BASEDIR%
IF NOT "%MAVEN_PROJECTBASEDIR%"=="" goto endDetectBaseDir
set EXEC_DIR=%CD%
set WDIR=%EXEC_DIR%
:findBaseDir
IF EXIST "%WDIR%"\.mvn goto baseDirFound
cd ..
IF "%WDIR%"=="%CD%" goto baseDirNotFound
set WDIR=%CD%
goto findBaseDir
:baseDirFound
set MAVEN_PROJECTBASEDIR=%WDIR%
cd "%EXEC_DIR%"
goto endDetectBaseDir
:baseDirNotFound
set MAVEN_PROJECTBASEDIR=%EXEC_DIR%
cd "%EXEC_DIR%"
:endDetectBaseDir
IF NOT EXIST "%MAVEN_PROJECTBASEDIR%\.mvn\jvm.config" goto endReadAdditionalConfig
@setlocal EnableExtensions EnableDelayedExpansion
for /F "usebackq delims=" %%a in ("%MAVEN_PROJECTBASEDIR%\.mvn\jvm.config") do set JVM_CONFIG_MAVEN_PROPS=!JVM_CONFIG_MAVEN_PROPS! %%a
@endlocal & set JVM_CONFIG_MAVEN_PROPS=%JVM_CONFIG_MAVEN_PROPS%
:endReadAdditionalConfig
SET MAVEN_JAVA_EXE="%JAVA_HOME%\bin\java.exe"
set WRAPPER_JAR="%MAVEN_PROJECTBASEDIR%\.mvn\wrapper\maven-wrapper.jar"
set WRAPPER_LAUNCHER=org.apache.maven.wrapper.MavenWrapperMain
%MAVEN_JAVA_EXE% %JVM_CONFIG_MAVEN_PROPS% %MAVEN_OPTS% %MAVEN_DEBUG_OPTS% -classpath %WRAPPER_JAR% "-Dmaven.multiModuleProjectDirectory=%MAVEN_PROJECTBASEDIR%" %WRAPPER_LAUNCHER% %MAVEN_CONFIG% %*
if ERRORLEVEL 1 goto error
goto end
:error
set ERROR_CODE=1
:end
@endlocal & set ERROR_CODE=%ERROR_CODE%
if not "%MAVEN_SKIP_RC%" == "" goto skipRcPost
@REM check for post script, once with legacy .bat ending and once with .cmd ending
if exist "%HOME%\mavenrc_post.bat" call "%HOME%\mavenrc_post.bat"
if exist "%HOME%\mavenrc_post.cmd" call "%HOME%\mavenrc_post.cmd"
:skipRcPost
@REM pause the script if MAVEN_BATCH_PAUSE is set to 'on'
if "%MAVEN_BATCH_PAUSE%" == "on" pause
if "%MAVEN_TERMINATE_CMD%" == "on" exit %ERROR_CODE%
exit /B %ERROR_CODE%

77
pom.xml Normal file
View File

@ -0,0 +1,77 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>cn.mafangui</groupId>
<artifactId>hotel</artifactId>
<version>0.0.1-SNAPSHOT</version>
<packaging>jar</packaging>
<name>hotel</name>
<description>A project for hotel manager</description>
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>2.0.5.RELEASE</version>
<relativePath/> <!-- lookup parent from repository -->
</parent>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
<java.version>1.8</java.version>
</properties>
<!--依赖-->
<dependencies>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-test</artifactId>
<scope>test</scope>
</dependency>
<!--mysql-->
<dependency>
<groupId>mysql</groupId>
<artifactId>mysql-connector-java</artifactId>
</dependency>
<dependency>
<groupId>org.mybatis.spring.boot</groupId>
<artifactId>mybatis-spring-boot-starter</artifactId>
<version>1.3.2</version>
</dependency>
</dependencies>
<build>
<!--插件-->
<plugins>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
</plugin>
<plugin>
<groupId>org.mybatis.generator</groupId>
<artifactId>mybatis-generator-maven-plugin</artifactId>
<version>1.3.7</version>
<configuration>
<verbose>false</verbose>
<overwrite>true</overwrite>
</configuration>
</plugin>
</plugins>
</build>
</project>

View File

@ -0,0 +1,14 @@
package cn.mafangui.hotel;
import org.mybatis.spring.annotation.MapperScan;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
@SpringBootApplication
@MapperScan(basePackages = "cn.mafangui.hotel.mapper")
public class HotelApplication {
public static void main(String[] args) {
SpringApplication.run(HotelApplication.class, args);
}
}

View File

@ -0,0 +1,57 @@
package cn.mafangui.hotel.controller;
import cn.mafangui.hotel.entity.User;
import cn.mafangui.hotel.service.UserService;
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.List;
@RestController
@RequestMapping(value = "/user")
public class UserController {
@Autowired
private UserService userService;
@RequestMapping(value = "/getUser")
public User getUser(int id){
return userService.selectById(id);
}
/**
* 注册
* @param userName
* @param password
* @param name
* @param phone
* @param email
* @param address
* @param idNumber
* @return
*/
@RequestMapping(method = RequestMethod.POST, value = "/register")
public int userRegister(String userName, String password, String name,
String phone, String email, String address, String idNumber){
User user = new User(userName,password,name,phone,email,address,idNumber);
return userService.register(user);
}
/**
* 登录
* @param userName
* @param password
* @return
*/
@RequestMapping(method = RequestMethod.POST, value = "/login")
public int userLogin(String userName, String password){
if (userService.login(userName,password) == null){
return -1;
}
return 1;
}
}

View File

@ -0,0 +1,55 @@
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;
}
}

View File

@ -0,0 +1,105 @@
package cn.mafangui.hotel.entity;
import java.util.Date;
public class CheckIn {
private Integer checkInId;
private Integer orderId;
private String roomNumber;
private Integer roomType;
private Integer personNum;
private String personName;
private String idNumbers;
private Date checkInTime;
private Date createTime;
private Date updateTime;
public Integer getCheckInId() {
return checkInId;
}
public void setCheckInId(Integer checkInId) {
this.checkInId = checkInId;
}
public Integer getOrderId() {
return orderId;
}
public void setOrderId(Integer orderId) {
this.orderId = orderId;
}
public String getRoomNumber() {
return roomNumber;
}
public void setRoomNumber(String roomNumber) {
this.roomNumber = roomNumber == null ? null : roomNumber.trim();
}
public Integer getRoomType() {
return roomType;
}
public void setRoomType(Integer roomType) {
this.roomType = roomType;
}
public Integer getPersonNum() {
return personNum;
}
public void setPersonNum(Integer personNum) {
this.personNum = personNum;
}
public String getPersonName() {
return personName;
}
public void setPersonName(String personName) {
this.personName = personName == null ? null : personName.trim();
}
public String getIdNumbers() {
return idNumbers;
}
public void setIdNumbers(String idNumbers) {
this.idNumbers = idNumbers == null ? null : idNumbers.trim();
}
public Date getCheckInTime() {
return checkInTime;
}
public void setCheckInTime(Date checkInTime) {
this.checkInTime = checkInTime;
}
public Date getCreateTime() {
return createTime;
}
public void setCreateTime(Date createTime) {
this.createTime = createTime;
}
public Date getUpdateTime() {
return updateTime;
}
public void setUpdateTime(Date updateTime) {
this.updateTime = updateTime;
}
}

View File

@ -0,0 +1,95 @@
package cn.mafangui.hotel.entity;
import java.util.Date;
public class Hotel {
private Integer hotelId;
private String hotelName;
private String phone;
private String telephone;
private String email;
private String address;
private String website;
private Date createTime;
private Date updateTime;
public Integer getHotelId() {
return hotelId;
}
public void setHotelId(Integer hotelId) {
this.hotelId = hotelId;
}
public String getHotelName() {
return hotelName;
}
public void setHotelName(String hotelName) {
this.hotelName = hotelName == null ? null : hotelName.trim();
}
public String getPhone() {
return phone;
}
public void setPhone(String phone) {
this.phone = phone == null ? null : phone.trim();
}
public String getTelephone() {
return telephone;
}
public void setTelephone(String telephone) {
this.telephone = telephone == null ? null : telephone.trim();
}
public String getEmail() {
return email;
}
public void setEmail(String email) {
this.email = email == null ? null : email.trim();
}
public String getAddress() {
return address;
}
public void setAddress(String address) {
this.address = address == null ? null : address.trim();
}
public String getWebsite() {
return website;
}
public void setWebsite(String website) {
this.website = website == null ? null : website.trim();
}
public Date getCreateTime() {
return createTime;
}
public void setCreateTime(Date createTime) {
this.createTime = createTime;
}
public Date getUpdateTime() {
return updateTime;
}
public void setUpdateTime(Date updateTime) {
this.updateTime = updateTime;
}
}

View File

@ -0,0 +1,116 @@
package cn.mafangui.hotel.entity;
import java.math.BigDecimal;
import java.util.Date;
public class Order {
private Integer orderId;
private String bookingType;
private String phone;
private String roomNumber;
private Integer roomType;
private Date bookingDate;
private Integer bookingDays;
private Integer orderStatus;
private BigDecimal orderCost;
private Date createTime;
private Date updateTime;
public Integer getOrderId() {
return orderId;
}
public void setOrderId(Integer orderId) {
this.orderId = orderId;
}
public String getBookingType() {
return bookingType;
}
public void setBookingType(String bookingType) {
this.bookingType = bookingType == null ? null : bookingType.trim();
}
public String getPhone() {
return phone;
}
public void setPhone(String phone) {
this.phone = phone == null ? null : phone.trim();
}
public String getRoomNumber() {
return roomNumber;
}
public void setRoomNumber(String roomNumber) {
this.roomNumber = roomNumber == null ? null : roomNumber.trim();
}
public Integer getRoomType() {
return roomType;
}
public void setRoomType(Integer roomType) {
this.roomType = roomType;
}
public Date getBookingDate() {
return bookingDate;
}
public void setBookingDate(Date bookingDate) {
this.bookingDate = bookingDate;
}
public Integer getBookingDays() {
return bookingDays;
}
public void setBookingDays(Integer bookingDays) {
this.bookingDays = bookingDays;
}
public Integer getOrderStatus() {
return orderStatus;
}
public void setOrderStatus(Integer orderStatus) {
this.orderStatus = orderStatus;
}
public BigDecimal getOrderCost() {
return orderCost;
}
public void setOrderCost(BigDecimal orderCost) {
this.orderCost = orderCost;
}
public Date getCreateTime() {
return createTime;
}
public void setCreateTime(Date createTime) {
this.createTime = createTime;
}
public Date getUpdateTime() {
return updateTime;
}
public void setUpdateTime(Date updateTime) {
this.updateTime = updateTime;
}
}

View File

@ -0,0 +1,96 @@
package cn.mafangui.hotel.entity;
import java.math.BigDecimal;
import java.util.Date;
public class Room {
private Integer roomId;
private String roomNumber;
private Integer roomFloor;
private Integer roomType;
private BigDecimal roomPrice;
private Float roomDiscount;
private String roomStatus;
private Date createTime;
private Date updateTime;
public Integer getRoomId() {
return roomId;
}
public void setRoomId(Integer roomId) {
this.roomId = roomId;
}
public String getRoomNumber() {
return roomNumber;
}
public void setRoomNumber(String roomNumber) {
this.roomNumber = roomNumber == null ? null : roomNumber.trim();
}
public Integer getRoomFloor() {
return roomFloor;
}
public void setRoomFloor(Integer roomFloor) {
this.roomFloor = roomFloor;
}
public Integer getRoomType() {
return roomType;
}
public void setRoomType(Integer roomType) {
this.roomType = roomType;
}
public BigDecimal getRoomPrice() {
return roomPrice;
}
public void setRoomPrice(BigDecimal roomPrice) {
this.roomPrice = roomPrice;
}
public Float getRoomDiscount() {
return roomDiscount;
}
public void setRoomDiscount(Float roomDiscount) {
this.roomDiscount = roomDiscount;
}
public String getRoomStatus() {
return roomStatus;
}
public void setRoomStatus(String roomStatus) {
this.roomStatus = roomStatus == null ? null : roomStatus.trim();
}
public Date getCreateTime() {
return createTime;
}
public void setCreateTime(Date createTime) {
this.createTime = createTime;
}
public Date getUpdateTime() {
return updateTime;
}
public void setUpdateTime(Date updateTime) {
this.updateTime = updateTime;
}
}

View File

@ -0,0 +1,76 @@
package cn.mafangui.hotel.entity;
import java.math.BigDecimal;
import java.util.Date;
public class RoomType {
private Integer typeId;
private Integer roomType;
private String typeName;
private BigDecimal bookingPrice;
private Float bookingDiscount;
private Date createTime;
private Date updateTime;
public Integer getTypeId() {
return typeId;
}
public void setTypeId(Integer typeId) {
this.typeId = typeId;
}
public Integer getRoomType() {
return roomType;
}
public void setRoomType(Integer roomType) {
this.roomType = roomType;
}
public String getTypeName() {
return typeName;
}
public void setTypeName(String typeName) {
this.typeName = typeName == null ? null : typeName.trim();
}
public BigDecimal getBookingPrice() {
return bookingPrice;
}
public void setBookingPrice(BigDecimal bookingPrice) {
this.bookingPrice = bookingPrice;
}
public Float getBookingDiscount() {
return bookingDiscount;
}
public void setBookingDiscount(Float bookingDiscount) {
this.bookingDiscount = bookingDiscount;
}
public Date getCreateTime() {
return createTime;
}
public void setCreateTime(Date createTime) {
this.createTime = createTime;
}
public Date getUpdateTime() {
return updateTime;
}
public void setUpdateTime(Date updateTime) {
this.updateTime = updateTime;
}
}

View File

@ -0,0 +1,118 @@
package cn.mafangui.hotel.entity;
import java.util.Date;
public class User {
private Integer userId;
private String userName;
private String password;
private String name;
private String phone;
private String email;
private String address;
private String idNumber;
private Date createTime;
private Date updateTime;
public Integer getUserId() {
return userId;
}
public void setUserId(Integer userId) {
this.userId = userId;
}
public String getUserName() {
return userName;
}
public void setUserName(String userName) {
this.userName = userName == null ? null : userName.trim();
}
public String getPassword() {
return password;
}
public void setPassword(String password) {
this.password = password == null ? null : password.trim();
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name == null ? null : name.trim();
}
public String getPhone() {
return phone;
}
public void setPhone(String phone) {
this.phone = phone == null ? null : phone.trim();
}
public String getEmail() {
return email;
}
public void setEmail(String email) {
this.email = email == null ? null : email.trim();
}
public String getAddress() {
return address;
}
public void setAddress(String address) {
this.address = address == null ? null : address.trim();
}
public String getIdNumber() {
return idNumber;
}
public void setIdNumber(String idNumber) {
this.idNumber = idNumber == null ? null : idNumber.trim();
}
public Date getCreateTime() {
return createTime;
}
public User(String userName, String password, String name, String phone, String email, String address, String idNumber) {
this.userName = userName;
this.password = password;
this.name = name;
this.phone = phone;
this.email = email;
this.address = address;
this.idNumber = idNumber;
}
public void setCreateTime(Date createTime) {
this.createTime = createTime;
}
public Date getUpdateTime() {
return updateTime;
}
public void setUpdateTime(Date updateTime) {
this.updateTime = updateTime;
}
public User() {
}
}

View File

@ -0,0 +1,95 @@
package cn.mafangui.hotel.entity;
import java.util.Date;
public class Worker {
private Integer workerId;
private String userName;
private String password;
private String workerName;
private String phone;
private String email;
private String address;
private Date createTime;
private Date updateTime;
public Integer getWorkerId() {
return workerId;
}
public void setWorkerId(Integer workerId) {
this.workerId = workerId;
}
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 String getWorkerName() {
return workerName;
}
public void setWorkerName(String workerName) {
this.workerName = workerName == null ? null : workerName.trim();
}
public String getPhone() {
return phone;
}
public void setPhone(String phone) {
this.phone = phone == null ? null : phone.trim();
}
public String getEmail() {
return email;
}
public void setEmail(String email) {
this.email = email == null ? null : email.trim();
}
public String getAddress() {
return address;
}
public void setAddress(String address) {
this.address = address == null ? null : address.trim();
}
public Date getCreateTime() {
return createTime;
}
public void setCreateTime(Date createTime) {
this.createTime = createTime;
}
public Date getUpdateTime() {
return updateTime;
}
public void setUpdateTime(Date updateTime) {
this.updateTime = updateTime;
}
}

View File

@ -0,0 +1,17 @@
package cn.mafangui.hotel.mapper;
import cn.mafangui.hotel.entity.Admin;
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);
}

View File

@ -0,0 +1,17 @@
package cn.mafangui.hotel.mapper;
import cn.mafangui.hotel.entity.CheckIn;
public interface CheckInMapper {
int deleteByPrimaryKey(Integer checkInId);
int insert(CheckIn record);
int insertSelective(CheckIn record);
CheckIn selectByPrimaryKey(Integer checkInId);
int updateByPrimaryKeySelective(CheckIn record);
int updateByPrimaryKey(CheckIn record);
}

View File

@ -0,0 +1,17 @@
package cn.mafangui.hotel.mapper;
import cn.mafangui.hotel.entity.Hotel;
public interface HotelMapper {
int deleteByPrimaryKey(Integer hotelId);
int insert(Hotel record);
int insertSelective(Hotel record);
Hotel selectByPrimaryKey(Integer hotelId);
int updateByPrimaryKeySelective(Hotel record);
int updateByPrimaryKey(Hotel record);
}

View File

@ -0,0 +1,17 @@
package cn.mafangui.hotel.mapper;
import cn.mafangui.hotel.entity.Order;
public interface OrderMapper {
int deleteByPrimaryKey(Integer orderId);
int insert(Order record);
int insertSelective(Order record);
Order selectByPrimaryKey(Integer orderId);
int updateByPrimaryKeySelective(Order record);
int updateByPrimaryKey(Order record);
}

View File

@ -0,0 +1,17 @@
package cn.mafangui.hotel.mapper;
import cn.mafangui.hotel.entity.Room;
public interface RoomMapper {
int deleteByPrimaryKey(Integer roomId);
int insert(Room record);
int insertSelective(Room record);
Room selectByPrimaryKey(Integer roomId);
int updateByPrimaryKeySelective(Room record);
int updateByPrimaryKey(Room record);
}

View File

@ -0,0 +1,17 @@
package cn.mafangui.hotel.mapper;
import cn.mafangui.hotel.entity.RoomType;
public interface RoomTypeMapper {
int deleteByPrimaryKey(Integer typeId);
int insert(RoomType record);
int insertSelective(RoomType record);
RoomType selectByPrimaryKey(Integer typeId);
int updateByPrimaryKeySelective(RoomType record);
int updateByPrimaryKey(RoomType record);
}

View File

@ -0,0 +1,21 @@
package cn.mafangui.hotel.mapper;
import cn.mafangui.hotel.entity.User;
import org.springframework.stereotype.Component;
@Component
public interface UserMapper {
int deleteByPrimaryKey(Integer userId);
int insert(User record);
int insertSelective(User record);
User selectByPrimaryKey(Integer userId);
int updateByPrimaryKeySelective(User record);
int updateByPrimaryKey(User record);
User selectByUserNameAndPassword(User user);
}

View File

@ -0,0 +1,17 @@
package cn.mafangui.hotel.mapper;
import cn.mafangui.hotel.entity.Worker;
public interface WorkerMapper {
int deleteByPrimaryKey(Integer workerId);
int insert(Worker record);
int insertSelective(Worker record);
Worker selectByPrimaryKey(Integer workerId);
int updateByPrimaryKeySelective(Worker record);
int updateByPrimaryKey(Worker record);
}

View File

@ -0,0 +1,13 @@
package cn.mafangui.hotel.service;
import cn.mafangui.hotel.entity.User;
public interface UserService {
User selectById(int id);
int register(User user);
User login(String userName, String password);
}

View File

@ -0,0 +1,34 @@
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;
@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.insert(user);
}
@Override
public User login(String userName, String password) {
User user = new User();
user.setUserName(userName);
user.setPassword(password);
return userMapper.selectByUserNameAndPassword(user);
}
}

View File

@ -0,0 +1,14 @@
server:
port: 8080
servlet:
context-path: "/hotel"
spring:
datasource:
driver-class-name: com.mysql.jdbc.Driver
username: root
password: root
url: jdbc:mysql://localhost:3306/hotel?useUnicode=true&characterEncoding=UTF-8
mybatis:
type-aliases-package: classpath*:cn.mafangui.hotel.entity
mapper-locations: classpath*:mybatis/mapper/*.xml

View File

@ -0,0 +1,105 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE generatorConfiguration
PUBLIC "-//mybatis.org//DTD MyBatis Generator Configuration 1.0//EN"
"http://mybatis.org/dtd/mybatis-generator-config_1_0.dtd">
<generatorConfiguration>
<properties resource="application.yml" />
<!-- mysql驱动的位置 -->
<classPathEntry location="C:\Users\muamua\.m2\repository\mysql\mysql-connector-java\5.1.47\mysql-connector-java-5.1.47.jar" />
<context id="Tables" targetRuntime="MyBatis3">
<!-- 注释 -->
<commentGenerator>
<!-- 是否生成注释代时间戳 -->
<property name="suppressDate" value="true"/>
<!-- 是否去除自动生成的注释 true false:否 -->
<property name="suppressAllComments" value="true"/>
</commentGenerator>
<!-- JDBC连接 -->
<jdbcConnection
driverClass="com.mysql.jdbc.Driver"
connectionURL="jdbc:mysql://localhost:3306/hotel?useUnicode=true&amp;characterEncoding=UTF-8"
userId="root"
password="root">
</jdbcConnection>
<!-- 非必需类型处理器在数据库类型和java类型之间的转换控制-->
<!-- 默认false把JDBC DECIMAL 和 NUMERIC 类型解析为 Integer为 true时把JDBC DECIMAL 和
NUMERIC 类型解析为java.math.BigDecimal -->
<javaTypeResolver>
<!-- 是否使用bigDecimal false可自动转化以下类型Long, Integer, Short, etc. -->
<property name="forceBigDecimals" value="false" />
</javaTypeResolver>
<!-- 生成实体类地址 -->
<javaModelGenerator targetPackage="cn.mafangui.hotel.entity" targetProject="src/main/java">
<!-- 从数据库返回的值被清理前后的空格 -->
<property name="trimStrings" value="true" />
<!-- enableSubPackages:是否让schema作为包的后缀 -->
<property name="enableSubPackages" value="false" />
</javaModelGenerator>
<!-- 生成mapper xml文件 -->
<sqlMapGenerator targetPackage="mybatis/mapper" targetProject="src/main/resources">
<!-- enableSubPackages:是否让schema作为包的后缀 -->
<property name="enableSubPackages" value="false" />
</sqlMapGenerator>
<!-- 生成mapper xml对应Client-->
<javaClientGenerator targetPackage="cn.mafangui.hotel.mapper" targetProject="src/main/java" type="XMLMAPPER">
<!-- enableSubPackages:是否让schema作为包的后缀 -->
<property name="enableSubPackages" value="false" />
</javaClientGenerator>
<!-- 配置表信息 -->
<!-- schema即为数据库名 tableName为对应的数据库表 domainObjectName是要生成的实体类 enable*ByExample
是否生成 example类 -->
<table schema="hotel" tableName="user"
domainObjectName="User" enableCountByExample="false"
enableDeleteByExample="false" enableSelectByExample="false"
enableUpdateByExample="false">
</table>
<table schema="hotel" tableName="worker"
domainObjectName="Worker" enableCountByExample="false"
enableDeleteByExample="false" enableSelectByExample="false"
enableUpdateByExample="false">
</table>
<table schema="hotel" tableName="room_type"
domainObjectName="RoomType" enableCountByExample="false"
enableDeleteByExample="false" enableSelectByExample="false"
enableUpdateByExample="false">
</table>
<table schema="hotel" tableName="room_info"
domainObjectName="Room" enableCountByExample="false"
enableDeleteByExample="false" enableSelectByExample="false"
enableUpdateByExample="false">
</table>
<table schema="hotel" tableName="order_info"
domainObjectName="Order" enableCountByExample="false"
enableDeleteByExample="false" enableSelectByExample="false"
enableUpdateByExample="false">
</table>
<table schema="hotel" tableName="hotel_info"
domainObjectName="Hotel" enableCountByExample="false"
enableDeleteByExample="false" enableSelectByExample="false"
enableUpdateByExample="false">
</table>
<table schema="hotel" tableName="check_in"
domainObjectName="CheckIn" enableCountByExample="false"
enableDeleteByExample="false" enableSelectByExample="false"
enableUpdateByExample="false">
</table>
<table schema="hotel" tableName="admin"
domainObjectName="Admin" enableCountByExample="false"
enableDeleteByExample="false" enableSelectByExample="false"
enableUpdateByExample="false">
</table>
</context>
</generatorConfiguration>

View File

@ -0,0 +1,52 @@
<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE configuration PUBLIC "-//mybatis.org//DTD Config 3.0//EN"
"http://mybatis.org/dtd/mybatis-3-config.dtd">
<configuration>
<settings>
<!-- 这个配置使全局的映射器启用或禁用缓存 -->
<setting name="cacheEnabled" value="false" />
<!-- 全局启用或禁用延迟加载。当禁用时,所有关联对象都会即时加载 -->
<setting name="lazyLoadingEnabled" value="true" />
<!-- 当启用时,有延迟加载属性的对象在被调用时将会完全加载任意属性。否则,每种属性将会按需要加载 -->
<setting name="aggressiveLazyLoading" value="true" />
<!-- 允许或不允许多种结果集从一个单独的语句中返回(需要适合的驱动) -->
<setting name="multipleResultSetsEnabled" value="true" />
<!-- 使用列标签代替列名。不同的驱动在这方便表现不同。参考驱动文档或充分测试两种方法来决定所使用的驱动 -->
<setting name="useColumnLabel" value="true" />
<!-- 允许JDBC支持生成的键。需要适合的驱动。如果设置为true则这个设置强制生成的键被使用尽管一些驱动拒绝兼容但仍然有效比如Derby -->
<setting name="useGeneratedKeys" value="true" />
<!-- 指定MyBatis如何自动映射列到字段/属性。PARTIAL只会自动映射简单没有嵌套的结果。FULL会自动映射任意复杂的结果嵌套的或其他情况 -->
<setting name="autoMappingBehavior" value="PARTIAL" />
<!--当检测出未知列(或未知属性)时,如何处理,默认情况下没有任何提示,这在测试的时候很不方便,不容易找到错误。
NONE : 不做任何处理 (默认值)
WARNING : 警告日志形式的详细信息
FAILING : 映射失败,抛出异常和详细信息
-->
<setting name="autoMappingUnknownColumnBehavior" value="WARNING"/>
<!-- 配置默认的执行器。SIMPLE执行器没有什么特别之处。REUSE执行器重用预处理语句。BATCH执行器重用语句和批量更新 -->
<setting name="defaultExecutorType" value="SIMPLE" />
<!-- 设置超时时间,它决定驱动等待一个数据库响应的时间 -->
<setting name="defaultStatementTimeout" value="25000" />
<!--设置查询返回值数量,可以被查询数值覆盖 -->
<setting name="defaultFetchSize" value="100"/>
<!-- 允许在嵌套语句中使用分页-->
<setting name="safeRowBoundsEnabled" value="true"/>
<!--是否开启自动驼峰命名规则映射,即从经典数据库列名 A_COLUMN 到经典 Java 属性名 aColumn 的类似映射。-->
<setting name="mapUnderscoreToCamelCase" value="true"/>
<!--MyBatis利用本地缓存机制(Local Cache)防止循环引用(circular references)和加速重复嵌套查询。 默认值为 SESSION这种情况下会缓存一个会话中执行的所有查询。 若设置值为 STATEMENT本地会话仅用在语句执行上对相同 SqlSession 的不同调用将不会共享数据。-->
<setting name="localCacheScope" value="SESSION"/>
<!-- 当没有为参数提供特定的 JDBC 类型时,为空值指定 JDBC 类型。 某些驱动需要指定列的 JDBC 类型,多数情况直接用一般类型即可,比如 NULL、VARCHAR、OTHER。-->
<setting name="jdbcTypeForNull" value="OTHER"/>
<!-- 指定哪个对象的方法触发一次延迟加载。-->
<setting name="lazyLoadTriggerMethods" value="equals,clone,hashCode,toString"/>
</settings>
<typeAliases>
<typeAlias alias="Integer" type="java.lang.Integer" />
<typeAlias alias="Long" type="java.lang.Long" />
<typeAlias alias="HashMap" type="java.util.HashMap" />
<typeAlias alias="LinkedHashMap" type="java.util.LinkedHashMap" />
<typeAlias alias="ArrayList" type="java.util.ArrayList" />
<typeAlias alias="LinkedList" type="java.util.LinkedList" />
</typeAliases>
</configuration>

View File

@ -0,0 +1,93 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="cn.mafangui.hotel.mapper.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>
<if test="createTime != null">
create_time,
</if>
<if test="updateTime != null">
update_time,
</if>
</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>
<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.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>
</mapper>

View File

@ -0,0 +1,153 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="cn.mafangui.hotel.mapper.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="INTEGER" property="roomType" />
<result column="person_num" jdbcType="INTEGER" property="personNum" />
<result column="person_name" jdbcType="VARCHAR" property="personName" />
<result column="id_numbers" jdbcType="VARCHAR" property="idNumbers" />
<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, person_num, person_name, id_numbers,
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, person_num, person_name,
id_numbers, check_in_time, create_time,
update_time)
values (#{checkInId,jdbcType=INTEGER}, #{orderId,jdbcType=INTEGER}, #{roomNumber,jdbcType=VARCHAR},
#{roomType,jdbcType=INTEGER}, #{personNum,jdbcType=INTEGER}, #{personName,jdbcType=VARCHAR},
#{idNumbers,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="personNum != null">
person_num,
</if>
<if test="personName != null">
person_name,
</if>
<if test="idNumbers != null">
id_numbers,
</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=INTEGER},
</if>
<if test="personNum != null">
#{personNum,jdbcType=INTEGER},
</if>
<if test="personName != null">
#{personName,jdbcType=VARCHAR},
</if>
<if test="idNumbers != null">
#{idNumbers,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=INTEGER},
</if>
<if test="personNum != null">
person_num = #{personNum,jdbcType=INTEGER},
</if>
<if test="personName != null">
person_name = #{personName,jdbcType=VARCHAR},
</if>
<if test="idNumbers != null">
id_numbers = #{idNumbers,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=INTEGER},
person_num = #{personNum,jdbcType=INTEGER},
person_name = #{personName,jdbcType=VARCHAR},
id_numbers = #{idNumbers,jdbcType=VARCHAR},
check_in_time = #{checkInTime,jdbcType=TIMESTAMP},
create_time = #{createTime,jdbcType=TIMESTAMP},
update_time = #{updateTime,jdbcType=TIMESTAMP}
where check_in_id = #{checkInId,jdbcType=INTEGER}
</update>
</mapper>

View File

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

View File

@ -0,0 +1,164 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="cn.mafangui.hotel.mapper.OrderMapper">
<resultMap id="BaseResultMap" type="cn.mafangui.hotel.entity.Order">
<id column="order_id" jdbcType="INTEGER" property="orderId" />
<result column="booking_type" jdbcType="VARCHAR" property="bookingType" />
<result column="phone" jdbcType="VARCHAR" property="phone" />
<result column="room_number" jdbcType="VARCHAR" property="roomNumber" />
<result column="room_type" jdbcType="INTEGER" property="roomType" />
<result column="booking_date" jdbcType="DATE" property="bookingDate" />
<result column="booking_days" jdbcType="INTEGER" property="bookingDays" />
<result column="order_status" jdbcType="INTEGER" property="orderStatus" />
<result column="order_cost" jdbcType="DECIMAL" 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, booking_type, phone, room_number, room_type, booking_date, booking_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, booking_type, phone,
room_number, room_type, booking_date,
booking_days, order_status, order_cost,
create_time, update_time)
values (#{orderId,jdbcType=INTEGER}, #{bookingType,jdbcType=VARCHAR}, #{phone,jdbcType=VARCHAR},
#{roomNumber,jdbcType=VARCHAR}, #{roomType,jdbcType=INTEGER}, #{bookingDate,jdbcType=DATE},
#{bookingDays,jdbcType=INTEGER}, #{orderStatus,jdbcType=INTEGER}, #{orderCost,jdbcType=DECIMAL},
#{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="bookingType != null">
booking_type,
</if>
<if test="phone != null">
phone,
</if>
<if test="roomNumber != null">
room_number,
</if>
<if test="roomType != null">
room_type,
</if>
<if test="bookingDate != null">
booking_date,
</if>
<if test="bookingDays != null">
booking_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="bookingType != null">
#{bookingType,jdbcType=VARCHAR},
</if>
<if test="phone != null">
#{phone,jdbcType=VARCHAR},
</if>
<if test="roomNumber != null">
#{roomNumber,jdbcType=VARCHAR},
</if>
<if test="roomType != null">
#{roomType,jdbcType=INTEGER},
</if>
<if test="bookingDate != null">
#{bookingDate,jdbcType=DATE},
</if>
<if test="bookingDays != null">
#{bookingDays,jdbcType=INTEGER},
</if>
<if test="orderStatus != null">
#{orderStatus,jdbcType=INTEGER},
</if>
<if test="orderCost != null">
#{orderCost,jdbcType=DECIMAL},
</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="bookingType != null">
booking_type = #{bookingType,jdbcType=VARCHAR},
</if>
<if test="phone != null">
phone = #{phone,jdbcType=VARCHAR},
</if>
<if test="roomNumber != null">
room_number = #{roomNumber,jdbcType=VARCHAR},
</if>
<if test="roomType != null">
room_type = #{roomType,jdbcType=INTEGER},
</if>
<if test="bookingDate != null">
booking_date = #{bookingDate,jdbcType=DATE},
</if>
<if test="bookingDays != null">
booking_days = #{bookingDays,jdbcType=INTEGER},
</if>
<if test="orderStatus != null">
order_status = #{orderStatus,jdbcType=INTEGER},
</if>
<if test="orderCost != null">
order_cost = #{orderCost,jdbcType=DECIMAL},
</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 booking_type = #{bookingType,jdbcType=VARCHAR},
phone = #{phone,jdbcType=VARCHAR},
room_number = #{roomNumber,jdbcType=VARCHAR},
room_type = #{roomType,jdbcType=INTEGER},
booking_date = #{bookingDate,jdbcType=DATE},
booking_days = #{bookingDays,jdbcType=INTEGER},
order_status = #{orderStatus,jdbcType=INTEGER},
order_cost = #{orderCost,jdbcType=DECIMAL},
create_time = #{createTime,jdbcType=TIMESTAMP},
update_time = #{updateTime,jdbcType=TIMESTAMP}
where order_id = #{orderId,jdbcType=INTEGER}
</update>
</mapper>

View File

@ -0,0 +1,142 @@
<?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="room_floor" jdbcType="INTEGER" property="roomFloor" />
<result column="room_type" jdbcType="INTEGER" property="roomType" />
<result column="room_price" jdbcType="DECIMAL" property="roomPrice" />
<result column="room_discount" jdbcType="REAL" property="roomDiscount" />
<result column="room_status" jdbcType="VARCHAR" property="roomStatus" />
<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, room_floor, room_type, room_price, room_discount, room_status,
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, room_floor,
room_type, room_price, room_discount,
room_status, create_time, update_time
)
values (#{roomId,jdbcType=INTEGER}, #{roomNumber,jdbcType=VARCHAR}, #{roomFloor,jdbcType=INTEGER},
#{roomType,jdbcType=INTEGER}, #{roomPrice,jdbcType=DECIMAL}, #{roomDiscount,jdbcType=REAL},
#{roomStatus,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="roomFloor != null">
room_floor,
</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="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="roomFloor != null">
#{roomFloor,jdbcType=INTEGER},
</if>
<if test="roomType != null">
#{roomType,jdbcType=INTEGER},
</if>
<if test="roomPrice != null">
#{roomPrice,jdbcType=DECIMAL},
</if>
<if test="roomDiscount != null">
#{roomDiscount,jdbcType=REAL},
</if>
<if test="roomStatus != null">
#{roomStatus,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="roomFloor != null">
room_floor = #{roomFloor,jdbcType=INTEGER},
</if>
<if test="roomType != null">
room_type = #{roomType,jdbcType=INTEGER},
</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>
<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},
room_floor = #{roomFloor,jdbcType=INTEGER},
room_type = #{roomType,jdbcType=INTEGER},
room_price = #{roomPrice,jdbcType=DECIMAL},
room_discount = #{roomDiscount,jdbcType=REAL},
room_status = #{roomStatus,jdbcType=VARCHAR},
create_time = #{createTime,jdbcType=TIMESTAMP},
update_time = #{updateTime,jdbcType=TIMESTAMP}
where room_id = #{roomId,jdbcType=INTEGER}
</update>
</mapper>

View File

@ -0,0 +1,117 @@
<?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="INTEGER" property="typeId" />
<result column="room_type" jdbcType="INTEGER" property="roomType" />
<result column="type_name" jdbcType="VARCHAR" property="typeName" />
<result column="booking_price" jdbcType="DECIMAL" property="bookingPrice" />
<result column="booking_discount" jdbcType="REAL" property="bookingDiscount" />
<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, type_name, booking_price, booking_discount, create_time, update_time
</sql>
<select id="selectByPrimaryKey" parameterType="java.lang.Integer" resultMap="BaseResultMap">
select
<include refid="Base_Column_List" />
from room_type
where type_id = #{typeId,jdbcType=INTEGER}
</select>
<delete id="deleteByPrimaryKey" parameterType="java.lang.Integer">
delete from room_type
where type_id = #{typeId,jdbcType=INTEGER}
</delete>
<insert id="insert" parameterType="cn.mafangui.hotel.entity.RoomType">
insert into room_type (type_id, room_type, type_name,
booking_price, booking_discount, create_time,
update_time)
values (#{typeId,jdbcType=INTEGER}, #{roomType,jdbcType=INTEGER}, #{typeName,jdbcType=VARCHAR},
#{bookingPrice,jdbcType=DECIMAL}, #{bookingDiscount,jdbcType=REAL}, #{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="typeName != null">
type_name,
</if>
<if test="bookingPrice != null">
booking_price,
</if>
<if test="bookingDiscount != null">
booking_discount,
</if>
<if test="createTime != null">
create_time,
</if>
<if test="updateTime != null">
update_time,
</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="typeId != null">
#{typeId,jdbcType=INTEGER},
</if>
<if test="roomType != null">
#{roomType,jdbcType=INTEGER},
</if>
<if test="typeName != null">
#{typeName,jdbcType=VARCHAR},
</if>
<if test="bookingPrice != null">
#{bookingPrice,jdbcType=DECIMAL},
</if>
<if test="bookingDiscount != null">
#{bookingDiscount,jdbcType=REAL},
</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=INTEGER},
</if>
<if test="typeName != null">
type_name = #{typeName,jdbcType=VARCHAR},
</if>
<if test="bookingPrice != null">
booking_price = #{bookingPrice,jdbcType=DECIMAL},
</if>
<if test="bookingDiscount != null">
booking_discount = #{bookingDiscount,jdbcType=REAL},
</if>
<if test="createTime != null">
create_time = #{createTime,jdbcType=TIMESTAMP},
</if>
<if test="updateTime != null">
update_time = #{updateTime,jdbcType=TIMESTAMP},
</if>
</set>
where type_id = #{typeId,jdbcType=INTEGER}
</update>
<update id="updateByPrimaryKey" parameterType="cn.mafangui.hotel.entity.RoomType">
update room_type
set room_type = #{roomType,jdbcType=INTEGER},
type_name = #{typeName,jdbcType=VARCHAR},
booking_price = #{bookingPrice,jdbcType=DECIMAL},
booking_discount = #{bookingDiscount,jdbcType=REAL},
create_time = #{createTime,jdbcType=TIMESTAMP},
update_time = #{updateTime,jdbcType=TIMESTAMP}
where type_id = #{typeId,jdbcType=INTEGER}
</update>
</mapper>

View File

@ -0,0 +1,159 @@
<?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="user_name" jdbcType="VARCHAR" property="userName" />
<result column="password" jdbcType="VARCHAR" property="password" />
<result column="name" jdbcType="VARCHAR" property="name" />
<result column="phone" jdbcType="VARCHAR" property="phone" />
<result column="email" jdbcType="VARCHAR" property="email" />
<result column="address" jdbcType="VARCHAR" property="address" />
<result column="id_number" jdbcType="VARCHAR" property="idNumber" />
<result column="create_time" jdbcType="TIMESTAMP" property="createTime" />
<result column="update_time" jdbcType="TIMESTAMP" property="updateTime" />
</resultMap>
<sql id="Base_Column_List">
user_id, user_name, password, name, phone, email, address, id_number, create_time,
update_time
</sql>
<select id="selectByPrimaryKey" parameterType="java.lang.Integer" resultMap="BaseResultMap">
select
<include refid="Base_Column_List" />
from user
where user_id = #{userId,jdbcType=INTEGER}
</select>
<delete id="deleteByPrimaryKey" parameterType="java.lang.Integer">
delete from user
where user_id = #{userId,jdbcType=INTEGER}
</delete>
<insert id="insert" parameterType="cn.mafangui.hotel.entity.User">
insert into user (user_name, password,
name, phone, email,
address, id_number, create_time,
update_time)
values (#{userName,jdbcType=VARCHAR}, #{password,jdbcType=VARCHAR},
#{name,jdbcType=VARCHAR}, #{phone,jdbcType=VARCHAR}, #{email,jdbcType=VARCHAR},
#{address,jdbcType=VARCHAR}, #{idNumber,jdbcType=VARCHAR}, now(),
now())
</insert>
<insert id="insertSelective" parameterType="cn.mafangui.hotel.entity.User">
insert into user
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="userId != null">
user_id,
</if>
<if test="userName != null">
user_name,
</if>
<if test="password != null">
password,
</if>
<if test="name != null">
name,
</if>
<if test="phone != null">
phone,
</if>
<if test="email != null">
email,
</if>
<if test="address != null">
address,
</if>
<if test="idNumber != null">
id_number,
</if>
<if test="createTime != null">
create_time,
</if>
<if test="updateTime != null">
update_time,
</if>
</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="phone != null">
#{phone,jdbcType=VARCHAR},
</if>
<if test="email != null">
#{email,jdbcType=VARCHAR},
</if>
<if test="address != null">
#{address,jdbcType=VARCHAR},
</if>
<if test="idNumber != null">
#{idNumber,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.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>
<if test="createTime != null">
create_time = #{createTime,jdbcType=TIMESTAMP},
</if>
<if test="updateTime != null">
update_time = #{updateTime,jdbcType=TIMESTAMP},
</if>
</set>
where user_id = #{userId,jdbcType=INTEGER}
</update>
<update id="updateByPrimaryKey" parameterType="cn.mafangui.hotel.entity.User">
update user
set user_name = #{userName,jdbcType=VARCHAR},
password = #{password,jdbcType=VARCHAR},
name = #{name,jdbcType=VARCHAR},
phone = #{phone,jdbcType=VARCHAR},
email = #{email,jdbcType=VARCHAR},
address = #{address,jdbcType=VARCHAR},
id_number = #{idNumber,jdbcType=VARCHAR},
create_time = #{createTime,jdbcType=TIMESTAMP},
update_time = #{updateTime,jdbcType=TIMESTAMP}
where user_id = #{userId,jdbcType=INTEGER}
</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>
</mapper>

View File

@ -0,0 +1,142 @@
<?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="user_name" jdbcType="VARCHAR" property="userName" />
<result column="password" jdbcType="VARCHAR" property="password" />
<result column="worker_name" jdbcType="VARCHAR" property="workerName" />
<result column="phone" jdbcType="VARCHAR" property="phone" />
<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, user_name, password, worker_name, phone, email, address, create_time,
update_time
</sql>
<select id="selectByPrimaryKey" parameterType="java.lang.Integer" resultMap="BaseResultMap">
select
<include refid="Base_Column_List" />
from worker
where worker_id = #{workerId,jdbcType=INTEGER}
</select>
<delete id="deleteByPrimaryKey" parameterType="java.lang.Integer">
delete from worker
where worker_id = #{workerId,jdbcType=INTEGER}
</delete>
<insert id="insert" parameterType="cn.mafangui.hotel.entity.Worker">
insert into worker (worker_id, user_name, password,
worker_name, phone, email,
address, create_time, update_time
)
values (#{workerId,jdbcType=INTEGER}, #{userName,jdbcType=VARCHAR}, #{password,jdbcType=VARCHAR},
#{workerName,jdbcType=VARCHAR}, #{phone,jdbcType=VARCHAR}, #{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
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="workerId != null">
worker_id,
</if>
<if test="userName != null">
user_name,
</if>
<if test="password != null">
password,
</if>
<if test="workerName != null">
worker_name,
</if>
<if test="phone != null">
phone,
</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="userName != null">
#{userName,jdbcType=VARCHAR},
</if>
<if test="password != null">
#{password,jdbcType=VARCHAR},
</if>
<if test="workerName != null">
#{workerName,jdbcType=VARCHAR},
</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="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
<set>
<if test="userName != null">
user_name = #{userName,jdbcType=VARCHAR},
</if>
<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>
<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
set user_name = #{userName,jdbcType=VARCHAR},
password = #{password,jdbcType=VARCHAR},
worker_name = #{workerName,jdbcType=VARCHAR},
phone = #{phone,jdbcType=VARCHAR},
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>

View File

@ -0,0 +1,16 @@
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() {
}
}