Fix Bug #574: fallback修复
This commit is contained in:
@@ -1,27 +1,48 @@
|
||||
package com.openhis.application.mapper;
|
||||
|
||||
import com.openhis.application.domain.entity.ScheduleSlot;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
import org.apache.ibatis.annotations.Update;
|
||||
import org.apache.ibatis.annotations.*;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 排班号数据访问层
|
||||
* ScheduleSlotMapper
|
||||
*
|
||||
* 新增 updateStatusById 用于统一更新状态字段,供退款、支付等业务使用。
|
||||
* 新增:
|
||||
* 1. updateStatusByIdAndVersion - 使用乐观锁更新 slot 状态
|
||||
* 2. updateStatusAndClearOrder - 诊前退号时使用,清除 order_id 并恢复为可预约状态
|
||||
*/
|
||||
@Mapper
|
||||
public interface ScheduleSlotMapper {
|
||||
|
||||
// 其它 CRUD 方法省略 ...
|
||||
@Select("SELECT * FROM adm_schedule_slot WHERE id = #{id}")
|
||||
ScheduleSlot selectById(@Param("id") Integer id);
|
||||
|
||||
@Update("UPDATE adm_schedule_slot SET status = #{status} WHERE id = #{id}")
|
||||
int updateStatusById(@Param("id") Integer id, @Param("status") Integer status);
|
||||
|
||||
/**
|
||||
* 根据排班号主键更新状态。
|
||||
* 乐观锁更新状态,只有 version 与传入值相同才会更新。
|
||||
*
|
||||
* @param id 排班号主键
|
||||
* @param status 新的状态值(如 "3" 已取、"4" 已退号)
|
||||
* @return 受影响的行数
|
||||
* @param id slot 主键
|
||||
* @param status 新状态
|
||||
* @param version 当前版本号
|
||||
* @return 更新行数
|
||||
*/
|
||||
@Update("UPDATE adm_schedule_slot SET status = #{status} WHERE id = #{id}")
|
||||
int updateStatusById(@Param("id") Long id, @Param("status") String status);
|
||||
@Update("UPDATE adm_schedule_slot " +
|
||||
"SET status = #{status}, version = version + 1 " +
|
||||
"WHERE id = #{id} AND version = #{version}")
|
||||
int updateStatusByIdAndVersion(@Param("id") Integer id,
|
||||
@Param("status") Integer status,
|
||||
@Param("version") Integer version);
|
||||
|
||||
/**
|
||||
* 诊前退号使用:将状态恢复为可预约(0),并清空关联的 order_id。
|
||||
*/
|
||||
@Update("UPDATE adm_schedule_slot " +
|
||||
"SET status = #{status}, order_id = NULL " +
|
||||
"WHERE id = #{id}")
|
||||
int updateStatusAndClearOrder(@Param("id") Integer id,
|
||||
@Param("status") Integer status);
|
||||
|
||||
// 其他已有方法保持不变...
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user