修复住宿:增加并发床位分配串行保护
This commit is contained in:
1 parent
b3a1fa58d6
commit
fbfec1a2ec
2 files changed
+29
No files matched your search
+8
@@ -21,6 +21,14 @@ public interface TrainDormitoryInfoMapper
|
||||
*/
|
||||
public TrainDormitoryInfo selectTrainDormitoryInfoByDormId(String dormId);
|
||||
|
||||
/**
|
||||
* 查询宿舍信息并加行级排他锁 (SELECT ... FOR UPDATE)
|
||||
*
|
||||
* @param dormId 宿舍信息主键
|
||||
* @return 宿舍信息
|
||||
*/
|
||||
public TrainDormitoryInfo selectTrainDormitoryInfoForUpdate(@Param("dormId") String dormId);
|
||||
|
||||
/**
|
||||
* 查询宿舍信息列表 (包含实时聚合的 used_count 与 remaining_beds)
|
||||
*
|
||||
|
||||
@@ -76,6 +76,27 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
WHERE d.dorm_id = #{dormId} AND d.del_flag = '0'
|
||||
</select>
|
||||
|
||||
<select id="selectTrainDormitoryInfoForUpdate" parameterType="String" resultMap="TrainDormitoryInfoResult">
|
||||
SELECT
|
||||
dorm_id,
|
||||
dorm_building,
|
||||
dorm_floor,
|
||||
dorm_room,
|
||||
capacity,
|
||||
gender_type,
|
||||
lock_device_sn,
|
||||
dorm_status,
|
||||
del_flag,
|
||||
create_by,
|
||||
create_time,
|
||||
update_by,
|
||||
update_time,
|
||||
remark
|
||||
FROM train_dormitory_info
|
||||
WHERE dorm_id = #{dormId} AND del_flag = '0'
|
||||
FOR UPDATE
|
||||
</select>
|
||||
|
||||
<select id="checkBuildingRoomUnique" resultMap="TrainDormitoryInfoResult">
|
||||
SELECT dorm_id, dorm_building, dorm_room
|
||||
FROM train_dormitory_info
|
||||
|
||||
Reference in new issue
Block a user