mirror of
https://github.com/FreeeBird/hotel.git
synced 2025-09-14 11:19:45 +08:00
更新数据库结构,重写订单接口,添加注释
This commit is contained in:
@@ -59,50 +59,50 @@
|
||||
<!-- schema即为数据库名 tableName为对应的数据库表 domainObjectName是要生成的实体类 enable*ByExample
|
||||
是否生成 example类 -->
|
||||
|
||||
<table schema="hotel" tableName="user_info"
|
||||
domainObjectName="User" enableCountByExample="false"
|
||||
enableDeleteByExample="false" enableSelectByExample="false"
|
||||
enableUpdateByExample="false">
|
||||
</table>
|
||||
<table schema="hotel" tableName="worker_info"
|
||||
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="order_type"
|
||||
domainObjectName="OrderType" 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="user_info"-->
|
||||
<!--domainObjectName="User" enableCountByExample="false"-->
|
||||
<!--enableDeleteByExample="false" enableSelectByExample="false"-->
|
||||
<!--enableUpdateByExample="false">-->
|
||||
<!--</table>-->
|
||||
<!--<table schema="hotel" tableName="worker_info"-->
|
||||
<!--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="order_type"-->
|
||||
<!--domainObjectName="OrderType" 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="department_info"
|
||||
domainObjectName="Department" 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="hotel_info"-->
|
||||
<!--domainObjectName="Hotel" enableCountByExample="false"-->
|
||||
<!--enableDeleteByExample="false" enableSelectByExample="false"-->
|
||||
<!--enableUpdateByExample="false">-->
|
||||
<!--</table>-->
|
||||
<!--<table schema="hotel" tableName="department_info"-->
|
||||
<!--domainObjectName="Department" 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>-->
|
||||
</context>
|
||||
</generatorConfiguration>
|
||||
</generatorConfiguration>
|
||||
|
@@ -1,6 +1,201 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
<mapper namespace="cn.mafangui.hotel.mapper.OrderMapper">
|
||||
<resultMap id="BaseResultMap" type="cn.mafangui.hotel.entity.Order">
|
||||
<id column="order_id" jdbcType="INTEGER" property="orderId" />
|
||||
<result column="order_type_id" jdbcType="INTEGER" property="orderTypeId" />
|
||||
<result column="order_type" jdbcType="VARCHAR" property="orderType" />
|
||||
<result column="user_id" jdbcType="INTEGER" property="userId" />
|
||||
<result column="name" jdbcType="VARCHAR" property="name" />
|
||||
<result column="phone" jdbcType="VARCHAR" property="phone" />
|
||||
<result column="room_type_id" jdbcType="INTEGER" property="roomTypeId" />
|
||||
<result column="room_type" jdbcType="VARCHAR" property="roomType" />
|
||||
<result column="order_date" jdbcType="DATE" property="orderDate" />
|
||||
<result column="order_days" jdbcType="INTEGER" property="orderDays" />
|
||||
<result column="order_status" jdbcType="INTEGER" property="orderStatus" />
|
||||
<result column="order_cost" jdbcType="DOUBLE" property="orderCost" />
|
||||
<result column="create_time" jdbcType="TIMESTAMP" property="createTime" />
|
||||
<result column="update_time" jdbcType="TIMESTAMP" property="updateTime" />
|
||||
</resultMap>
|
||||
<sql id="Base_Column_List">
|
||||
order_id, order_type_id, order_type, user_id, name, phone, room_type_id, room_type,
|
||||
order_date, order_days, order_status, order_cost, create_time, update_time
|
||||
</sql>
|
||||
<select id="selectByPrimaryKey" parameterType="java.lang.Integer" resultMap="BaseResultMap">
|
||||
select
|
||||
<include refid="Base_Column_List" />
|
||||
from order_info
|
||||
where order_id = #{orderId,jdbcType=INTEGER}
|
||||
</select>
|
||||
<delete id="deleteByPrimaryKey" parameterType="java.lang.Integer">
|
||||
delete from order_info
|
||||
where order_id = #{orderId,jdbcType=INTEGER}
|
||||
</delete>
|
||||
<insert id="insert" parameterType="cn.mafangui.hotel.entity.Order">
|
||||
insert into order_info (order_id, order_type_id, order_type,
|
||||
user_id, name, phone,
|
||||
room_type_id, room_type, order_date,
|
||||
order_days, order_status, order_cost,
|
||||
create_time, update_time)
|
||||
values (#{orderId,jdbcType=INTEGER}, #{orderTypeId,jdbcType=INTEGER}, #{orderType,jdbcType=VARCHAR},
|
||||
#{userId,jdbcType=INTEGER}, #{name,jdbcType=VARCHAR}, #{phone,jdbcType=VARCHAR},
|
||||
#{roomTypeId,jdbcType=INTEGER}, #{roomType,jdbcType=VARCHAR}, #{orderDate,jdbcType=DATE},
|
||||
#{orderDays,jdbcType=INTEGER}, #{orderStatus,jdbcType=INTEGER}, #{orderCost,jdbcType=DOUBLE},
|
||||
#{createTime,jdbcType=TIMESTAMP}, #{updateTime,jdbcType=TIMESTAMP})
|
||||
</insert>
|
||||
<insert id="insertSelective" parameterType="cn.mafangui.hotel.entity.Order">
|
||||
insert into order_info
|
||||
<trim prefix="(" suffix=")" suffixOverrides=",">
|
||||
<if test="orderId != null">
|
||||
order_id,
|
||||
</if>
|
||||
<if test="orderTypeId != null">
|
||||
order_type_id,
|
||||
</if>
|
||||
<if test="orderType != null">
|
||||
order_type,
|
||||
</if>
|
||||
<if test="userId != null">
|
||||
user_id,
|
||||
</if>
|
||||
<if test="name != null">
|
||||
name,
|
||||
</if>
|
||||
<if test="phone != null">
|
||||
phone,
|
||||
</if>
|
||||
<if test="roomTypeId != null">
|
||||
room_type_id,
|
||||
</if>
|
||||
<if test="roomType != null">
|
||||
room_type,
|
||||
</if>
|
||||
<if test="orderDate != null">
|
||||
order_date,
|
||||
</if>
|
||||
<if test="orderDays != null">
|
||||
order_days,
|
||||
</if>
|
||||
<if test="orderStatus != null">
|
||||
order_status,
|
||||
</if>
|
||||
<if test="orderCost != null">
|
||||
order_cost,
|
||||
</if>
|
||||
<if test="createTime != null">
|
||||
create_time,
|
||||
</if>
|
||||
<if test="updateTime != null">
|
||||
update_time,
|
||||
</if>
|
||||
</trim>
|
||||
<trim prefix="values (" suffix=")" suffixOverrides=",">
|
||||
<if test="orderId != null">
|
||||
#{orderId,jdbcType=INTEGER},
|
||||
</if>
|
||||
<if test="orderTypeId != null">
|
||||
#{orderTypeId,jdbcType=INTEGER},
|
||||
</if>
|
||||
<if test="orderType != null">
|
||||
#{orderType,jdbcType=VARCHAR},
|
||||
</if>
|
||||
<if test="userId != null">
|
||||
#{userId,jdbcType=INTEGER},
|
||||
</if>
|
||||
<if test="name != null">
|
||||
#{name,jdbcType=VARCHAR},
|
||||
</if>
|
||||
<if test="phone != null">
|
||||
#{phone,jdbcType=VARCHAR},
|
||||
</if>
|
||||
<if test="roomTypeId != null">
|
||||
#{roomTypeId,jdbcType=INTEGER},
|
||||
</if>
|
||||
<if test="roomType != null">
|
||||
#{roomType,jdbcType=VARCHAR},
|
||||
</if>
|
||||
<if test="orderDate != null">
|
||||
#{orderDate,jdbcType=DATE},
|
||||
</if>
|
||||
<if test="orderDays != null">
|
||||
#{orderDays,jdbcType=INTEGER},
|
||||
</if>
|
||||
<if test="orderStatus != null">
|
||||
#{orderStatus,jdbcType=INTEGER},
|
||||
</if>
|
||||
<if test="orderCost != null">
|
||||
#{orderCost,jdbcType=DOUBLE},
|
||||
</if>
|
||||
<if test="createTime != null">
|
||||
#{createTime,jdbcType=TIMESTAMP},
|
||||
</if>
|
||||
<if test="updateTime != null">
|
||||
#{updateTime,jdbcType=TIMESTAMP},
|
||||
</if>
|
||||
</trim>
|
||||
</insert>
|
||||
<update id="updateByPrimaryKeySelective" parameterType="cn.mafangui.hotel.entity.Order">
|
||||
update order_info
|
||||
<set>
|
||||
<if test="orderTypeId != null">
|
||||
order_type_id = #{orderTypeId,jdbcType=INTEGER},
|
||||
</if>
|
||||
<if test="orderType != null">
|
||||
order_type = #{orderType,jdbcType=VARCHAR},
|
||||
</if>
|
||||
<if test="userId != null">
|
||||
user_id = #{userId,jdbcType=INTEGER},
|
||||
</if>
|
||||
<if test="name != null">
|
||||
name = #{name,jdbcType=VARCHAR},
|
||||
</if>
|
||||
<if test="phone != null">
|
||||
phone = #{phone,jdbcType=VARCHAR},
|
||||
</if>
|
||||
<if test="roomTypeId != null">
|
||||
room_type_id = #{roomTypeId,jdbcType=INTEGER},
|
||||
</if>
|
||||
<if test="roomType != null">
|
||||
room_type = #{roomType,jdbcType=VARCHAR},
|
||||
</if>
|
||||
<if test="orderDate != null">
|
||||
order_date = #{orderDate,jdbcType=DATE},
|
||||
</if>
|
||||
<if test="orderDays != null">
|
||||
order_days = #{orderDays,jdbcType=INTEGER},
|
||||
</if>
|
||||
<if test="orderStatus != null">
|
||||
order_status = #{orderStatus,jdbcType=INTEGER},
|
||||
</if>
|
||||
<if test="orderCost != null">
|
||||
order_cost = #{orderCost,jdbcType=DOUBLE},
|
||||
</if>
|
||||
<if test="createTime != null">
|
||||
create_time = #{createTime,jdbcType=TIMESTAMP},
|
||||
</if>
|
||||
<if test="updateTime != null">
|
||||
update_time = #{updateTime,jdbcType=TIMESTAMP},
|
||||
</if>
|
||||
</set>
|
||||
where order_id = #{orderId,jdbcType=INTEGER}
|
||||
</update>
|
||||
<update id="updateByPrimaryKey" parameterType="cn.mafangui.hotel.entity.Order">
|
||||
update order_info
|
||||
set order_type_id = #{orderTypeId,jdbcType=INTEGER},
|
||||
order_type = #{orderType,jdbcType=VARCHAR},
|
||||
user_id = #{userId,jdbcType=INTEGER},
|
||||
name = #{name,jdbcType=VARCHAR},
|
||||
phone = #{phone,jdbcType=VARCHAR},
|
||||
room_type_id = #{roomTypeId,jdbcType=INTEGER},
|
||||
room_type = #{roomType,jdbcType=VARCHAR},
|
||||
order_date = #{orderDate,jdbcType=DATE},
|
||||
order_days = #{orderDays,jdbcType=INTEGER},
|
||||
order_status = #{orderStatus,jdbcType=INTEGER},
|
||||
order_cost = #{orderCost,jdbcType=DOUBLE},
|
||||
create_time = #{createTime,jdbcType=TIMESTAMP},
|
||||
update_time = #{updateTime,jdbcType=TIMESTAMP}
|
||||
where order_id = #{orderId,jdbcType=INTEGER}
|
||||
</update>
|
||||
<resultMap id="BaseResultMap" type="cn.mafangui.hotel.entity.Order">
|
||||
<id column="order_id" jdbcType="INTEGER" property="orderId" />
|
||||
<result column="order_type" jdbcType="VARCHAR" property="orderType" />
|
||||
@@ -40,7 +235,7 @@
|
||||
select
|
||||
*
|
||||
from order_info
|
||||
where order_status >= -2 and user_id = #{userId,jdbcType=VARCHAR}
|
||||
where order_status >= -2 and user_id = #{userId,jdbcType=VARCHAR}
|
||||
</select>
|
||||
<delete id="deleteByPrimaryKey" parameterType="java.lang.Integer">
|
||||
delete from order_info
|
||||
@@ -172,4 +367,4 @@
|
||||
update_time = now()
|
||||
where order_id = #{orderId,jdbcType=INTEGER}
|
||||
</update>
|
||||
</mapper>
|
||||
</mapper>
|
@@ -11,15 +11,16 @@
|
||||
<result column="bed_num" jdbcType="INTEGER" property="bedNum" />
|
||||
<result column="bed_size" jdbcType="VARCHAR" property="bedSize" />
|
||||
<result column="window" jdbcType="INTEGER" property="window" />
|
||||
<result column="rest" jdbcType="INTEGER" property="rest" />
|
||||
<result column="create_time" jdbcType="TIMESTAMP" property="createTime" />
|
||||
<result column="update_time" jdbcType="TIMESTAMP" property="updateTime" />
|
||||
</resultMap>
|
||||
<sql id="Base_Column_List">
|
||||
type_id, room_type, remark, price, discount, area, bed_num, bed_size, window, create_time,
|
||||
type_id, room_type, remark, price, discount, area, bed_num, bed_size, window, rest,create_time,
|
||||
update_time
|
||||
</sql>
|
||||
<select id="selectByPrimaryKey" parameterType="java.lang.Integer" resultMap="BaseResultMap">
|
||||
select
|
||||
select
|
||||
<include refid="Base_Column_List" />
|
||||
from room_type
|
||||
where type_id = #{typeId,jdbcType=INTEGER}
|
||||
@@ -35,13 +36,14 @@
|
||||
where type_id = #{typeId,jdbcType=INTEGER}
|
||||
</delete>
|
||||
<insert id="insert" parameterType="cn.mafangui.hotel.entity.RoomType">
|
||||
insert into room_type (type_id, room_type, remark,
|
||||
price, discount, area,
|
||||
bed_num, bed_size, window,
|
||||
insert into room_type (type_id, room_type, remark,
|
||||
price, discount, area,
|
||||
bed_num, bed_size, window, rest
|
||||
create_time, update_time)
|
||||
values (#{typeId,jdbcType=INTEGER}, #{roomType,jdbcType=VARCHAR}, #{remark,jdbcType=VARCHAR},
|
||||
#{price,jdbcType=DOUBLE}, #{discount,jdbcType=DOUBLE}, #{area,jdbcType=INTEGER},
|
||||
#{bedNum,jdbcType=INTEGER}, #{bedSize,jdbcType=VARCHAR}, #{window,jdbcType=INTEGER},
|
||||
#{price,jdbcType=DOUBLE}, #{discount,jdbcType=DOUBLE}, #{area,jdbcType=INTEGER},
|
||||
#{bedNum,jdbcType=INTEGER}, #{bedSize,jdbcType=VARCHAR}, #{window,jdbcType=INTEGER},
|
||||
#{rest,jdbcType=INTEGER},
|
||||
now(), now())
|
||||
</insert>
|
||||
<insert id="insertSelective" parameterType="cn.mafangui.hotel.entity.RoomType">
|
||||
@@ -73,6 +75,9 @@
|
||||
</if>
|
||||
<if test="window != null">
|
||||
window,
|
||||
</if>
|
||||
<if test="rest != null">
|
||||
rest,
|
||||
</if>
|
||||
create_time,
|
||||
update_time,
|
||||
@@ -105,6 +110,9 @@
|
||||
<if test="window != null">
|
||||
#{window,jdbcType=INTEGER},
|
||||
</if>
|
||||
<if test="rest != null">
|
||||
#{rest,jdbcType=INTEGER},
|
||||
</if>
|
||||
now(),
|
||||
now(),
|
||||
</trim>
|
||||
@@ -135,6 +143,9 @@
|
||||
</if>
|
||||
<if test="window != null">
|
||||
window = #{window,jdbcType=INTEGER},
|
||||
</if>
|
||||
<if test="rest != null">
|
||||
rest = #{rest,jdbcType=INTEGER},
|
||||
</if>
|
||||
update_time = now(),
|
||||
</set>
|
||||
@@ -150,7 +161,8 @@
|
||||
bed_num = #{bedNum,jdbcType=INTEGER},
|
||||
bed_size = #{bedSize,jdbcType=VARCHAR},
|
||||
window = #{window,jdbcType=INTEGER},
|
||||
rest = #{rest,jdbcType=INTEGER},
|
||||
update_time = now()
|
||||
where type_id = #{typeId,jdbcType=INTEGER}
|
||||
</update>
|
||||
</mapper>
|
||||
</mapper>
|
||||
|
Reference in New Issue
Block a user