29 lines
914 B
Java
29 lines
914 B
Java
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);
|
||
}
|