Fix Bug #575: fallback修复

This commit is contained in:
2026-05-27 07:46:35 +08:00
parent 74b287bdb1
commit 6cd5faf6d1
2 changed files with 79 additions and 139 deletions

View File

@@ -0,0 +1,28 @@
package com.openhis.application.mapper;
import com.openhis.application.domain.entity.SchedulePool;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;
public interface SchedulePoolMapper {
SchedulePool selectByPrimaryKey(Long id);
int insert(SchedulePool record);
int updateByPrimaryKey(SchedulePool record);
/**
* 乐观锁递增 booked_num
*
* @param id 号源池主键
* @param oldBookedNum 更新前的 booked_num 值
* @return 受影响的行数0 表示并发冲突
*/
@Update("UPDATE adm_schedule_pool " +
"SET booked_num = booked_num + 1 " +
"WHERE id = #{id} AND booked_num = #{oldBookedNum}")
int updateBookedNumOptimistic(@Param("id") Long id,
@Param("oldBookedNum") Integer oldBookedNum);
}