mirror of
https://github.com/FreeeBird/hotel.git
synced 2025-09-14 11:19:45 +08:00
Initial commit
This commit is contained in:
14
src/main/resources/application.yml
Normal file
14
src/main/resources/application.yml
Normal 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
|
||||
|
105
src/main/resources/generatorConfig.xml
Normal file
105
src/main/resources/generatorConfig.xml
Normal 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&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>
|
52
src/main/resources/mybatis/config.xml
Normal file
52
src/main/resources/mybatis/config.xml
Normal 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>
|
93
src/main/resources/mybatis/mapper/AdminMapper.xml
Normal file
93
src/main/resources/mybatis/mapper/AdminMapper.xml
Normal 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>
|
153
src/main/resources/mybatis/mapper/CheckInMapper.xml
Normal file
153
src/main/resources/mybatis/mapper/CheckInMapper.xml
Normal 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>
|
141
src/main/resources/mybatis/mapper/HotelMapper.xml
Normal file
141
src/main/resources/mybatis/mapper/HotelMapper.xml
Normal 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>
|
164
src/main/resources/mybatis/mapper/OrderMapper.xml
Normal file
164
src/main/resources/mybatis/mapper/OrderMapper.xml
Normal 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>
|
142
src/main/resources/mybatis/mapper/RoomMapper.xml
Normal file
142
src/main/resources/mybatis/mapper/RoomMapper.xml
Normal 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>
|
117
src/main/resources/mybatis/mapper/RoomTypeMapper.xml
Normal file
117
src/main/resources/mybatis/mapper/RoomTypeMapper.xml
Normal 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>
|
159
src/main/resources/mybatis/mapper/UserMapper.xml
Normal file
159
src/main/resources/mybatis/mapper/UserMapper.xml
Normal 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>
|
142
src/main/resources/mybatis/mapper/WorkerMapper.xml
Normal file
142
src/main/resources/mybatis/mapper/WorkerMapper.xml
Normal 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>
|
Reference in New Issue
Block a user