update RoomType

This commit is contained in:
freeebird
2018-10-16 14:32:27 +08:00
parent 128de0cf17
commit 97e522a9f4
8 changed files with 215 additions and 36 deletions

View File

@@ -5,8 +5,8 @@
<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="booking_price" jdbcType="DOUBLE" property="bookingPrice" />
<result column="booking_discount" jdbcType="DOUBLE" property="bookingDiscount" />
<result column="create_time" jdbcType="TIMESTAMP" property="createTime" />
<result column="update_time" jdbcType="TIMESTAMP" property="updateTime" />
</resultMap>
@@ -19,6 +19,15 @@
from room_type
where type_id = #{typeId,jdbcType=INTEGER}
</select>
<select id="selectByRoomType" parameterType="java.lang.Integer" resultMap="BaseResultMap">
select
<include refid="Base_Column_List" />
from room_type
where room_type = #{roomType,jdbcType=INTEGER}
</select>
<select id="findAll" resultMap="BaseResultMap">
select * FROM room_type
</select>
<delete id="deleteByPrimaryKey" parameterType="java.lang.Integer">
delete from room_type
where type_id = #{typeId,jdbcType=INTEGER}
@@ -28,15 +37,12 @@
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},
#{bookingPrice,jdbcType=DOUBLE}, #{bookingDiscount,jdbcType=DOUBLE}, #{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>
@@ -49,17 +55,10 @@
<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>
@@ -67,17 +66,13 @@
#{typeName,jdbcType=VARCHAR},
</if>
<if test="bookingPrice != null">
#{bookingPrice,jdbcType=DECIMAL},
#{bookingPrice,jdbcType=DOUBLE},
</if>
<if test="bookingDiscount != null">
#{bookingDiscount,jdbcType=REAL},
</if>
<if test="createTime != null">
#{createTime,jdbcType=TIMESTAMP},
</if>
<if test="updateTime != null">
#{updateTime,jdbcType=TIMESTAMP},
#{bookingDiscount,jdbcType=DOUBLE},
</if>
now(),
now()
</trim>
</insert>
<update id="updateByPrimaryKeySelective" parameterType="cn.mafangui.hotel.entity.RoomType">
@@ -114,4 +109,24 @@
update_time = #{updateTime,jdbcType=TIMESTAMP}
where type_id = #{typeId,jdbcType=INTEGER}
</update>
<delete id="deleteByRoomType" parameterType="java.lang.Integer">
delete from room_type
where room_type = #{roomType,jdbcType=INTEGER}
</delete>
<update id="updateByRoomTypeSelective" parameterType="cn.mafangui.hotel.entity.RoomType">
update room_type
<set>
<if test="typeName != null">
type_name = #{typeName,jdbcType=VARCHAR},
</if>
<if test="bookingPrice != null">
booking_price = #{bookingPrice,jdbcType=DOUBLE},
</if>
<if test="bookingDiscount != null">
booking_discount = #{bookingDiscount,jdbcType=DOUBLE},
</if>
update_time = now(),
</set>
where room_type = #{roomType,jdbcType=INTEGER}
</update>
</mapper>