Files
his/openhis-application/src/main/java/com/openhis/application/mapper/SchedulePoolMapper.java
2026-05-27 07:46:35 +08:00

29 lines
914 B
Java
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

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);
}