commit 96611e9f7223bb781ad0b243230372a05d94d785 Author: muamua <1032790697@qq.com> Date: Sat Oct 13 16:24:01 2018 +0800 Initial commit diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..82eca33 --- /dev/null +++ b/.gitignore @@ -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/ \ No newline at end of file diff --git a/.mvn/wrapper/maven-wrapper.jar b/.mvn/wrapper/maven-wrapper.jar new file mode 100644 index 0000000..9cc84ea Binary files /dev/null and b/.mvn/wrapper/maven-wrapper.jar differ diff --git a/.mvn/wrapper/maven-wrapper.properties b/.mvn/wrapper/maven-wrapper.properties new file mode 100644 index 0000000..6c8c0e0 --- /dev/null +++ b/.mvn/wrapper/maven-wrapper.properties @@ -0,0 +1 @@ +distributionUrl=https://repo1.maven.org/maven2/org/apache/maven/apache-maven/3.5.4/apache-maven-3.5.4-bin.zip diff --git a/mvnw b/mvnw new file mode 100644 index 0000000..5bf251c --- /dev/null +++ b/mvnw @@ -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 "$@" diff --git a/mvnw.cmd b/mvnw.cmd new file mode 100644 index 0000000..019bd74 --- /dev/null +++ b/mvnw.cmd @@ -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% diff --git a/pom.xml b/pom.xml new file mode 100644 index 0000000..30e2b8b --- /dev/null +++ b/pom.xml @@ -0,0 +1,77 @@ + + + 4.0.0 + + cn.mafangui + hotel + 0.0.1-SNAPSHOT + jar + + hotel + A project for hotel manager + + + org.springframework.boot + spring-boot-starter-parent + 2.0.5.RELEASE + + + + + UTF-8 + UTF-8 + 1.8 + + + + + org.springframework.boot + spring-boot-starter + + + org.springframework.boot + spring-boot-starter-web + + + + org.springframework.boot + spring-boot-starter-test + test + + + + mysql + mysql-connector-java + + + + org.mybatis.spring.boot + mybatis-spring-boot-starter + 1.3.2 + + + + + + + + + org.springframework.boot + spring-boot-maven-plugin + + + + org.mybatis.generator + mybatis-generator-maven-plugin + 1.3.7 + + false + true + + + + + + + diff --git a/src/main/java/cn/mafangui/hotel/HotelApplication.java b/src/main/java/cn/mafangui/hotel/HotelApplication.java new file mode 100644 index 0000000..223ccc4 --- /dev/null +++ b/src/main/java/cn/mafangui/hotel/HotelApplication.java @@ -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); + } +} diff --git a/src/main/java/cn/mafangui/hotel/controller/UserController.java b/src/main/java/cn/mafangui/hotel/controller/UserController.java new file mode 100644 index 0000000..029610e --- /dev/null +++ b/src/main/java/cn/mafangui/hotel/controller/UserController.java @@ -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; + } + +} diff --git a/src/main/java/cn/mafangui/hotel/entity/Admin.java b/src/main/java/cn/mafangui/hotel/entity/Admin.java new file mode 100644 index 0000000..7989560 --- /dev/null +++ b/src/main/java/cn/mafangui/hotel/entity/Admin.java @@ -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; + } +} \ No newline at end of file diff --git a/src/main/java/cn/mafangui/hotel/entity/CheckIn.java b/src/main/java/cn/mafangui/hotel/entity/CheckIn.java new file mode 100644 index 0000000..19d6010 --- /dev/null +++ b/src/main/java/cn/mafangui/hotel/entity/CheckIn.java @@ -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; + } +} \ No newline at end of file diff --git a/src/main/java/cn/mafangui/hotel/entity/Hotel.java b/src/main/java/cn/mafangui/hotel/entity/Hotel.java new file mode 100644 index 0000000..246ad15 --- /dev/null +++ b/src/main/java/cn/mafangui/hotel/entity/Hotel.java @@ -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; + } +} \ No newline at end of file diff --git a/src/main/java/cn/mafangui/hotel/entity/Order.java b/src/main/java/cn/mafangui/hotel/entity/Order.java new file mode 100644 index 0000000..1d53325 --- /dev/null +++ b/src/main/java/cn/mafangui/hotel/entity/Order.java @@ -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; + } +} \ No newline at end of file diff --git a/src/main/java/cn/mafangui/hotel/entity/Room.java b/src/main/java/cn/mafangui/hotel/entity/Room.java new file mode 100644 index 0000000..ea475bd --- /dev/null +++ b/src/main/java/cn/mafangui/hotel/entity/Room.java @@ -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; + } +} \ No newline at end of file diff --git a/src/main/java/cn/mafangui/hotel/entity/RoomType.java b/src/main/java/cn/mafangui/hotel/entity/RoomType.java new file mode 100644 index 0000000..3d92dae --- /dev/null +++ b/src/main/java/cn/mafangui/hotel/entity/RoomType.java @@ -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; + } +} \ No newline at end of file diff --git a/src/main/java/cn/mafangui/hotel/entity/User.java b/src/main/java/cn/mafangui/hotel/entity/User.java new file mode 100644 index 0000000..e7f31b0 --- /dev/null +++ b/src/main/java/cn/mafangui/hotel/entity/User.java @@ -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() { + } +} \ No newline at end of file diff --git a/src/main/java/cn/mafangui/hotel/entity/Worker.java b/src/main/java/cn/mafangui/hotel/entity/Worker.java new file mode 100644 index 0000000..48b34f6 --- /dev/null +++ b/src/main/java/cn/mafangui/hotel/entity/Worker.java @@ -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; + } +} \ No newline at end of file diff --git a/src/main/java/cn/mafangui/hotel/mapper/AdminMapper.java b/src/main/java/cn/mafangui/hotel/mapper/AdminMapper.java new file mode 100644 index 0000000..af8991c --- /dev/null +++ b/src/main/java/cn/mafangui/hotel/mapper/AdminMapper.java @@ -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); +} \ No newline at end of file diff --git a/src/main/java/cn/mafangui/hotel/mapper/CheckInMapper.java b/src/main/java/cn/mafangui/hotel/mapper/CheckInMapper.java new file mode 100644 index 0000000..714391f --- /dev/null +++ b/src/main/java/cn/mafangui/hotel/mapper/CheckInMapper.java @@ -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); +} \ No newline at end of file diff --git a/src/main/java/cn/mafangui/hotel/mapper/HotelMapper.java b/src/main/java/cn/mafangui/hotel/mapper/HotelMapper.java new file mode 100644 index 0000000..6430208 --- /dev/null +++ b/src/main/java/cn/mafangui/hotel/mapper/HotelMapper.java @@ -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); +} \ No newline at end of file diff --git a/src/main/java/cn/mafangui/hotel/mapper/OrderMapper.java b/src/main/java/cn/mafangui/hotel/mapper/OrderMapper.java new file mode 100644 index 0000000..d0999b4 --- /dev/null +++ b/src/main/java/cn/mafangui/hotel/mapper/OrderMapper.java @@ -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); +} \ No newline at end of file diff --git a/src/main/java/cn/mafangui/hotel/mapper/RoomMapper.java b/src/main/java/cn/mafangui/hotel/mapper/RoomMapper.java new file mode 100644 index 0000000..caed91f --- /dev/null +++ b/src/main/java/cn/mafangui/hotel/mapper/RoomMapper.java @@ -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); +} \ No newline at end of file diff --git a/src/main/java/cn/mafangui/hotel/mapper/RoomTypeMapper.java b/src/main/java/cn/mafangui/hotel/mapper/RoomTypeMapper.java new file mode 100644 index 0000000..e0e3f59 --- /dev/null +++ b/src/main/java/cn/mafangui/hotel/mapper/RoomTypeMapper.java @@ -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); +} \ No newline at end of file diff --git a/src/main/java/cn/mafangui/hotel/mapper/UserMapper.java b/src/main/java/cn/mafangui/hotel/mapper/UserMapper.java new file mode 100644 index 0000000..db72959 --- /dev/null +++ b/src/main/java/cn/mafangui/hotel/mapper/UserMapper.java @@ -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); +} \ No newline at end of file diff --git a/src/main/java/cn/mafangui/hotel/mapper/WorkerMapper.java b/src/main/java/cn/mafangui/hotel/mapper/WorkerMapper.java new file mode 100644 index 0000000..33013ec --- /dev/null +++ b/src/main/java/cn/mafangui/hotel/mapper/WorkerMapper.java @@ -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); +} \ No newline at end of file diff --git a/src/main/java/cn/mafangui/hotel/service/UserService.java b/src/main/java/cn/mafangui/hotel/service/UserService.java new file mode 100644 index 0000000..2aba6b9 --- /dev/null +++ b/src/main/java/cn/mafangui/hotel/service/UserService.java @@ -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); +} diff --git a/src/main/java/cn/mafangui/hotel/service/impl/UserServiceImpl.java b/src/main/java/cn/mafangui/hotel/service/impl/UserServiceImpl.java new file mode 100644 index 0000000..38a1e92 --- /dev/null +++ b/src/main/java/cn/mafangui/hotel/service/impl/UserServiceImpl.java @@ -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); + } + + +} diff --git a/src/main/resources/application.yml b/src/main/resources/application.yml new file mode 100644 index 0000000..28ea23d --- /dev/null +++ b/src/main/resources/application.yml @@ -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 + diff --git a/src/main/resources/generatorConfig.xml b/src/main/resources/generatorConfig.xml new file mode 100644 index 0000000..71acfa4 --- /dev/null +++ b/src/main/resources/generatorConfig.xml @@ -0,0 +1,105 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + +
+ + +
+ +
+ +
+ +
+ +
+ +
+
+
\ No newline at end of file diff --git a/src/main/resources/mybatis/config.xml b/src/main/resources/mybatis/config.xml new file mode 100644 index 0000000..fe519c1 --- /dev/null +++ b/src/main/resources/mybatis/config.xml @@ -0,0 +1,52 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/src/main/resources/mybatis/mapper/AdminMapper.xml b/src/main/resources/mybatis/mapper/AdminMapper.xml new file mode 100644 index 0000000..c1a33d0 --- /dev/null +++ b/src/main/resources/mybatis/mapper/AdminMapper.xml @@ -0,0 +1,93 @@ + + + + + + + + + + + + admin_id, user_name, password, create_time, update_time + + + + delete from admin + where admin_id = #{adminId,jdbcType=INTEGER} + + + 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 into admin + + + admin_id, + + + user_name, + + + password, + + + create_time, + + + update_time, + + + + + #{adminId,jdbcType=INTEGER}, + + + #{userName,jdbcType=VARCHAR}, + + + #{password,jdbcType=VARCHAR}, + + + #{createTime,jdbcType=TIMESTAMP}, + + + #{updateTime,jdbcType=TIMESTAMP}, + + + + + update admin + + + 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 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} + + \ No newline at end of file diff --git a/src/main/resources/mybatis/mapper/CheckInMapper.xml b/src/main/resources/mybatis/mapper/CheckInMapper.xml new file mode 100644 index 0000000..5d297dd --- /dev/null +++ b/src/main/resources/mybatis/mapper/CheckInMapper.xml @@ -0,0 +1,153 @@ + + + + + + + + + + + + + + + + + check_in_id, order_id, room_number, room_type, person_num, person_name, id_numbers, + check_in_time, create_time, update_time + + + + delete from check_in + where check_in_id = #{checkInId,jdbcType=INTEGER} + + + 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 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, + + + + + #{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}, + + + + + update check_in + + + 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 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} + + \ No newline at end of file diff --git a/src/main/resources/mybatis/mapper/HotelMapper.xml b/src/main/resources/mybatis/mapper/HotelMapper.xml new file mode 100644 index 0000000..9682084 --- /dev/null +++ b/src/main/resources/mybatis/mapper/HotelMapper.xml @@ -0,0 +1,141 @@ + + + + + + + + + + + + + + + + hotel_id, hotel_name, phone, telephone, email, address, website, create_time, update_time + + + + delete from hotel_info + where hotel_id = #{hotelId,jdbcType=INTEGER} + + + 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 into hotel_info + + + hotel_id, + + + hotel_name, + + + phone, + + + telephone, + + + email, + + + address, + + + website, + + + create_time, + + + update_time, + + + + + #{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}, + + + + + update hotel_info + + + 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 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} + + \ No newline at end of file diff --git a/src/main/resources/mybatis/mapper/OrderMapper.xml b/src/main/resources/mybatis/mapper/OrderMapper.xml new file mode 100644 index 0000000..8ac5974 --- /dev/null +++ b/src/main/resources/mybatis/mapper/OrderMapper.xml @@ -0,0 +1,164 @@ + + + + + + + + + + + + + + + + + + order_id, booking_type, phone, room_number, room_type, booking_date, booking_days, + order_status, order_cost, create_time, update_time + + + + delete from order_info + where order_id = #{orderId,jdbcType=INTEGER} + + + 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 into order_info + + + order_id, + + + booking_type, + + + phone, + + + room_number, + + + room_type, + + + booking_date, + + + booking_days, + + + order_status, + + + order_cost, + + + create_time, + + + update_time, + + + + + #{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}, + + + + + update order_info + + + 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 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} + + \ No newline at end of file diff --git a/src/main/resources/mybatis/mapper/RoomMapper.xml b/src/main/resources/mybatis/mapper/RoomMapper.xml new file mode 100644 index 0000000..2c4c18d --- /dev/null +++ b/src/main/resources/mybatis/mapper/RoomMapper.xml @@ -0,0 +1,142 @@ + + + + + + + + + + + + + + + + room_id, room_number, room_floor, room_type, room_price, room_discount, room_status, + create_time, update_time + + + + delete from room_info + where room_id = #{roomId,jdbcType=INTEGER} + + + 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 into room_info + + + room_id, + + + room_number, + + + room_floor, + + + room_type, + + + room_price, + + + room_discount, + + + room_status, + + + create_time, + + + update_time, + + + + + #{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}, + + + + + update room_info + + + 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 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} + + \ No newline at end of file diff --git a/src/main/resources/mybatis/mapper/RoomTypeMapper.xml b/src/main/resources/mybatis/mapper/RoomTypeMapper.xml new file mode 100644 index 0000000..39fec86 --- /dev/null +++ b/src/main/resources/mybatis/mapper/RoomTypeMapper.xml @@ -0,0 +1,117 @@ + + + + + + + + + + + + + + type_id, room_type, type_name, booking_price, booking_discount, create_time, update_time + + + + delete from room_type + where type_id = #{typeId,jdbcType=INTEGER} + + + 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 into room_type + + + type_id, + + + room_type, + + + type_name, + + + booking_price, + + + booking_discount, + + + create_time, + + + update_time, + + + + + #{typeId,jdbcType=INTEGER}, + + + #{roomType,jdbcType=INTEGER}, + + + #{typeName,jdbcType=VARCHAR}, + + + #{bookingPrice,jdbcType=DECIMAL}, + + + #{bookingDiscount,jdbcType=REAL}, + + + #{createTime,jdbcType=TIMESTAMP}, + + + #{updateTime,jdbcType=TIMESTAMP}, + + + + + update room_type + + + 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 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} + + \ No newline at end of file diff --git a/src/main/resources/mybatis/mapper/UserMapper.xml b/src/main/resources/mybatis/mapper/UserMapper.xml new file mode 100644 index 0000000..a2b95df --- /dev/null +++ b/src/main/resources/mybatis/mapper/UserMapper.xml @@ -0,0 +1,159 @@ + + + + + + + + + + + + + + + + + user_id, user_name, password, name, phone, email, address, id_number, create_time, + update_time + + + + delete from user + where user_id = #{userId,jdbcType=INTEGER} + + + 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 into user + + + user_id, + + + user_name, + + + password, + + + name, + + + phone, + + + email, + + + address, + + + id_number, + + + create_time, + + + update_time, + + + + + #{userId,jdbcType=INTEGER}, + + + #{userName,jdbcType=VARCHAR}, + + + #{password,jdbcType=VARCHAR}, + + + #{name,jdbcType=VARCHAR}, + + + #{phone,jdbcType=VARCHAR}, + + + #{email,jdbcType=VARCHAR}, + + + #{address,jdbcType=VARCHAR}, + + + #{idNumber,jdbcType=VARCHAR}, + + + #{createTime,jdbcType=TIMESTAMP}, + + + #{updateTime,jdbcType=TIMESTAMP}, + + + + + update user + + + 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 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} + + + \ No newline at end of file diff --git a/src/main/resources/mybatis/mapper/WorkerMapper.xml b/src/main/resources/mybatis/mapper/WorkerMapper.xml new file mode 100644 index 0000000..14ae9c1 --- /dev/null +++ b/src/main/resources/mybatis/mapper/WorkerMapper.xml @@ -0,0 +1,142 @@ + + + + + + + + + + + + + + + + worker_id, user_name, password, worker_name, phone, email, address, create_time, + update_time + + + + delete from worker + where worker_id = #{workerId,jdbcType=INTEGER} + + + 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 into worker + + + worker_id, + + + user_name, + + + password, + + + worker_name, + + + phone, + + + email, + + + address, + + + create_time, + + + update_time, + + + + + #{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}, + + + + + update worker + + + 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 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} + + \ No newline at end of file diff --git a/src/test/java/cn/mafangui/hotel/HotelApplicationTests.java b/src/test/java/cn/mafangui/hotel/HotelApplicationTests.java new file mode 100644 index 0000000..e3b88b5 --- /dev/null +++ b/src/test/java/cn/mafangui/hotel/HotelApplicationTests.java @@ -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() { + } + +}