mirror of
https://github.com/FreeeBird/hotel.git
synced 2025-05-06 19:49:26 +08:00
退房登记完成
This commit is contained in:
parent
c1591ad821
commit
3aba922a10
@ -15,10 +15,12 @@ public interface CheckInMapper {
|
|||||||
|
|
||||||
CheckIn selectByPrimaryKey(Integer checkInId);
|
CheckIn selectByPrimaryKey(Integer checkInId);
|
||||||
|
|
||||||
CheckIn selectByRoomNumber(String roomNumber);
|
CheckIn selectLatestByRoomNumber(String roomNumber);
|
||||||
|
|
||||||
int updateByRoomNumber(String roomNumber);
|
int updateByRoomNumber(String roomNumber);
|
||||||
|
|
||||||
|
int checkOut(Integer checkInId);
|
||||||
|
|
||||||
int updateByPrimaryKeySelective(CheckIn record);
|
int updateByPrimaryKeySelective(CheckIn record);
|
||||||
|
|
||||||
int updateByPrimaryKey(CheckIn record);
|
int updateByPrimaryKey(CheckIn record);
|
||||||
|
@ -5,6 +5,7 @@ import cn.mafangui.hotel.entity.Order;
|
|||||||
import cn.mafangui.hotel.entity.Room;
|
import cn.mafangui.hotel.entity.Room;
|
||||||
import cn.mafangui.hotel.entity.RoomType;
|
import cn.mafangui.hotel.entity.RoomType;
|
||||||
import cn.mafangui.hotel.enums.OrderStatus;
|
import cn.mafangui.hotel.enums.OrderStatus;
|
||||||
|
import cn.mafangui.hotel.enums.RoomStatus;
|
||||||
import cn.mafangui.hotel.mapper.CheckInMapper;
|
import cn.mafangui.hotel.mapper.CheckInMapper;
|
||||||
import cn.mafangui.hotel.service.CheckInService;
|
import cn.mafangui.hotel.service.CheckInService;
|
||||||
import cn.mafangui.hotel.service.OrderService;
|
import cn.mafangui.hotel.service.OrderService;
|
||||||
@ -14,6 +15,7 @@ import org.springframework.beans.factory.annotation.Autowired;
|
|||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
import org.springframework.transaction.annotation.Transactional;
|
import org.springframework.transaction.annotation.Transactional;
|
||||||
|
|
||||||
|
import java.sql.Timestamp;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
@Service
|
@Service
|
||||||
@ -67,8 +69,11 @@ public class CheckInServiceImpl implements CheckInService {
|
|||||||
public int checkOut(String roomNumber) {
|
public int checkOut(String roomNumber) {
|
||||||
Room r = roomService.selectByNumber(roomNumber);
|
Room r = roomService.selectByNumber(roomNumber);
|
||||||
RoomType ty = roomTypeService.selectById(r.getTypeId());
|
RoomType ty = roomTypeService.selectById(r.getTypeId());
|
||||||
CheckIn checkIn = checkInMapper.selectByPrimaryKey(1);
|
CheckIn checkIn = checkInMapper.selectLatestByRoomNumber(roomNumber);
|
||||||
return 0;
|
r.setRoomStatus(RoomStatus.AVAILABLE.getCode());
|
||||||
|
if(roomService.update(r) <=0 )return -3;
|
||||||
|
if (roomTypeService.updateRest(ty.getTypeId(),1)<=0)return -2;
|
||||||
|
return checkInMapper.checkOut(checkIn.getCheckInId());
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -23,11 +23,11 @@
|
|||||||
from check_in
|
from check_in
|
||||||
where check_in_id = #{checkInId,jdbcType=INTEGER}
|
where check_in_id = #{checkInId,jdbcType=INTEGER}
|
||||||
</select>
|
</select>
|
||||||
<select id="selectByRoomNumber" parameterType="String" resultMap="BaseResultMap">
|
<select id="selectLatestByRoomNumber" parameterType="String" resultMap="BaseResultMap">
|
||||||
select
|
select
|
||||||
<include refid="Base_Column_List" />
|
<include refid="Base_Column_List" />
|
||||||
from check_in
|
from check_in
|
||||||
where room_number = #{roomNumber,jdbcType=VARCHAR}
|
where room_number = #{roomNumber,jdbcType=VARCHAR} order by check_in_time desc limit 1
|
||||||
</select>
|
</select>
|
||||||
<select id="selectAll" resultMap="BaseResultMap">
|
<select id="selectAll" resultMap="BaseResultMap">
|
||||||
select
|
select
|
||||||
@ -45,8 +45,7 @@
|
|||||||
update_time)
|
update_time)
|
||||||
values (#{checkInId,jdbcType=INTEGER}, #{orderId,jdbcType=INTEGER},#{roomId,jdbcType=INTEGER}, #{roomNumber,jdbcType=VARCHAR},
|
values (#{checkInId,jdbcType=INTEGER}, #{orderId,jdbcType=INTEGER},#{roomId,jdbcType=INTEGER}, #{roomNumber,jdbcType=VARCHAR},
|
||||||
#{peoCount,jdbcType=INTEGER}, #{persons,jdbcType=VARCHAR},
|
#{peoCount,jdbcType=INTEGER}, #{persons,jdbcType=VARCHAR},
|
||||||
#{ids,jdbcType=VARCHAR}, #{checkInTime,jdbcType=TIMESTAMP}, #{createTime,jdbcType=TIMESTAMP},
|
#{ids,jdbcType=VARCHAR}, #{checkInTime,jdbcType=TIMESTAMP}, now(),now())
|
||||||
#{updateTime,jdbcType=TIMESTAMP})
|
|
||||||
</insert>
|
</insert>
|
||||||
<insert id="insertSelective" parameterType="cn.mafangui.hotel.entity.CheckIn">
|
<insert id="insertSelective" parameterType="cn.mafangui.hotel.entity.CheckIn">
|
||||||
insert into check_in
|
insert into check_in
|
||||||
@ -132,6 +131,13 @@
|
|||||||
</set>
|
</set>
|
||||||
where check_in_id = #{checkInId,jdbcType=INTEGER}
|
where check_in_id = #{checkInId,jdbcType=INTEGER}
|
||||||
</update>
|
</update>
|
||||||
|
<update id="checkOut" parameterType="Integer">
|
||||||
|
update check_in
|
||||||
|
set
|
||||||
|
check_out_time = now(),
|
||||||
|
update_time = now()
|
||||||
|
where check_in_id = #{checkInId,jdbcType=INTEGER}
|
||||||
|
</update>
|
||||||
<update id="updateByRoomNumber" parameterType="String">
|
<update id="updateByRoomNumber" parameterType="String">
|
||||||
update check_in
|
update check_in
|
||||||
set
|
set
|
||||||
|
Loading…
x
Reference in New Issue
Block a user