mirror of
https://github.com/FreeeBird/hotel.git
synced 2025-05-06 19:49:26 +08:00
227 lines
8.2 KiB
XML
227 lines
8.2 KiB
XML
<?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>
|
|
<select id="selectAll" resultMap="BaseResultMap">
|
|
select
|
|
<include refid="Base_Column_List" />
|
|
from order_info
|
|
</select>
|
|
<select id="getOrderCount" resultType="java.lang.Integer">
|
|
select count(order_id)
|
|
from order_info
|
|
</select>
|
|
<select id="selectByNameAndPhone" parameterType="cn.mafangui.hotel.entity.Order" resultMap="BaseResultMap">
|
|
select
|
|
<include refid="Base_Column_List" />
|
|
from order_info where name = #{name,jdbcType=VARCHAR} and phone = #{phone,jdbcType=VARCHAR}
|
|
and order_status = #{orderStatus,jdbcType=INTEGER}
|
|
</select>
|
|
<select id="selectByUserId" parameterType="java.lang.Integer" resultMap="BaseResultMap">
|
|
select
|
|
<include refid="Base_Column_List" />
|
|
from order_info
|
|
where user_id = #{userId,jdbcType=INTEGER}
|
|
</select>
|
|
<select id="selectAllByUser" parameterType="java.lang.Integer" resultMap="BaseResultMap">
|
|
select
|
|
<include refid="Base_Column_List" />
|
|
from order_info
|
|
where user_id = #{userId,jdbcType=INTEGER} and order_status > #{orderStatus,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>
|
|
</mapper>
|