SequenceKeyDao.java
1.3 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
package com.diligrp.assistant.uid.dao;
import com.diligrp.assistant.shared.mybatis.MybatisMapperSupport;
import com.diligrp.assistant.uid.domain.PersistentSequenceKey;
import org.springframework.stereotype.Repository;
import java.util.Optional;
/**
* KeySequence数据操作
*
*/
@Repository("sequenceKeyDao")
public interface SequenceKeyDao extends MybatisMapperSupport {
/**
* 注册SequenceKey
*/
void insertSequenceKey(PersistentSequenceKey sequenceKey);
/**
* 查询指定的SequenceKey
*
* @param key - SequenceKey唯一标识
* @return SequenceKey
*/
Optional<PersistentSequenceKey> findSequenceKey(String key);
/**
* 根据KeyId查询SequenceKey
*
* @param id - KeyId
* @return SequenceKey
*/
Optional<PersistentSequenceKey> findSequenceKeyById(Long id);
/**
* 悲观锁实现 - 根据数据库主键锁定数据记录
*
* @param id - KeyId
* @return SequenceKey
*/
Optional<PersistentSequenceKey> lockSequenceKey(Long id);
/**
* 悲观锁解锁实现 - 根据数据库主键解锁数据记录
*
* @param sequenceKey - 参数列表:id/newValue/expiredOn
* @return 1-更新成功,0-更新失败
*/
int unlockSequenceKey(PersistentSequenceKey sequenceKey);
}