package com.qmth.sop.business.mapper;

import com.baomidou.mybatisplus.annotation.InterceptorIgnore;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.qmth.sop.business.entity.Sequence;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Update;

/**
 * <p>
 * 序列表 Mapper 接口
 * </p>
 *
 * @author wangliang
 * @since 2023-08-14
 */
public interface SequenceMapper extends BaseMapper<Sequence> {

    /**
     * 获取序列号
     *
     * @param name
     * @return
     */
    Long selectNextVal(@Param("name") String name);

    @InterceptorIgnore(blockAttack = "true")
    @Update("UPDATE sequence s set s.current_value = 0")
    Boolean sequenceReset();
}
