|
10 | 10 |
|
11 | 11 | public interface FlowRecordEntityRepository extends FastRepository<FlowRecordEntity, Long> { |
12 | 12 |
|
13 | | - |
| 13 | + @Query(value = "select r from FlowRecordEntity r where r.flowType!='DELETE' and r.id = ?1") |
14 | 14 | FlowRecordEntity getFlowRecordEntityById(long id); |
15 | 15 |
|
16 | 16 | void deleteByProcessId(String processId); |
17 | 17 |
|
18 | | - |
| 18 | + @Query(value = "select r from FlowRecordEntity r where r.flowType!='DELETE' and r.preId = ?1") |
19 | 19 | List<FlowRecordEntity> findFlowRecordEntityByPreId(long preId); |
20 | 20 |
|
| 21 | + @Query(value = "select r from FlowRecordEntity r where r.flowType!='DELETE' and r.processId = ?1") |
21 | 22 | List<FlowRecordEntity> findFlowRecordEntityByProcessId(String processId); |
22 | 23 |
|
23 | | - @Query(value = "select r from FlowRecordEntity r where r.flowType = 'TODO' and r.flowStatus = 'RUNNING' and r.processId = ?1") |
| 24 | + @Query(value = "select r from FlowRecordEntity r where r.flowType!='DELETE' and r.flowType = 'TODO' and r.flowStatus = 'RUNNING' and r.processId = ?1") |
24 | 25 | List<FlowRecordEntity> findTodoFlowRecordByProcessId(String processId); |
25 | 26 |
|
26 | 27 | @Query(value = "select r from FlowRecordEntity r" + |
27 | 28 | " LEFT JOIN (select min(m.id) as id from FlowRecordEntity m where m.currentOperatorId = ?1 and m.flowType = 'TODO' and m.flowStatus = 'RUNNING' and m.mergeable = true ) debup " + |
28 | 29 | "on r.id = debup.id" + |
29 | | - " where r.currentOperatorId = ?1 and r.flowType = 'TODO' and r.flowStatus = 'RUNNING'" + |
| 30 | + " where r.flowType!='DELETE' and r.currentOperatorId = ?1 and r.flowType = 'TODO' and r.flowStatus = 'RUNNING'" + |
30 | 31 | " and (r.mergeable !=true or debup.id is NOT null ) order by r.id desc") |
31 | 32 | Page<FlowRecordEntity> findTodoByOperatorId(long operatorId, PageRequest pageRequest); |
32 | 33 |
|
33 | | - @Query(value = "select r from FlowRecordEntity r where r.currentOperatorId = ?1 and r.workCode = ?2 and r.nodeCode = ?3" + |
| 34 | + @Query(value = "select r from FlowRecordEntity r where r.flowType!='DELETE'and r.currentOperatorId = ?1 and r.workCode = ?2 and r.nodeCode = ?3" + |
34 | 35 | " and r.mergeable = true and r.flowType = 'TODO' and r.flowStatus = 'RUNNING' order by r.id desc") |
35 | 36 | List<FlowRecordEntity> findMergeFlowRecordById(long currentOperatorId,String workCode, String nodeCode); |
36 | 37 |
|
37 | | - @Query(value = "select r from FlowRecordEntity r where r.currentOperatorId = ?1 and r.workCode = ?2 and r.flowType = 'TODO' and r.flowStatus = 'RUNNING' order by r.id desc") |
| 38 | + @Query(value = "select r from FlowRecordEntity r where r.flowType!='DELETE'and r.currentOperatorId = ?1 and r.workCode = ?2 and r.flowType = 'TODO' and r.flowStatus = 'RUNNING' order by r.id desc") |
38 | 39 | Page<FlowRecordEntity> findTodoByOperatorIdAndWorkCode(long operatorId, String workCode, PageRequest pageRequest); |
39 | 40 |
|
40 | | - @Query(value = "select r from FlowRecordEntity r where r.currentOperatorId = ?1 and r.read = false and r.flowStatus = 'RUNNING' order by r.id desc") |
| 41 | + @Query(value = "select r from FlowRecordEntity r where r.flowType!='DELETE'and r.currentOperatorId = ?1 and r.read = false and r.flowStatus = 'RUNNING' order by r.id desc") |
41 | 42 | Page<FlowRecordEntity> findUnReadByOperatorId(long operatorId, PageRequest pageRequest); |
42 | 43 |
|
43 | | - @Query(value = "select r from FlowRecordEntity r where r.currentOperatorId = ?1 and r.workCode = ?2 and r.read = false and r.flowStatus = 'RUNNING' order by r.id desc") |
| 44 | + @Query(value = "select r from FlowRecordEntity r where r.flowType!='DELETE'and r.currentOperatorId = ?1 and r.workCode = ?2 and r.read = false and r.flowStatus = 'RUNNING' order by r.id desc") |
44 | 45 | Page<FlowRecordEntity> findUnReadByOperatorIdAndWorkCode(long operatorId, String workCode, PageRequest pageRequest); |
45 | 46 |
|
46 | | - @Query(value = "select d from FlowRecordEntity d where d.id in (select max(r.id) from FlowRecordEntity r where r.currentOperatorId = ?1 and r.flowType = 'DONE' group by r.processId ) order by d.id desc") |
| 47 | + @Query(value = "select d from FlowRecordEntity d where d.flowType!='DELETE'and d.id in (select max(r.id) from FlowRecordEntity r where r.currentOperatorId = ?1 and r.flowType = 'DONE' group by r.processId ) order by d.id desc") |
47 | 48 | Page<FlowRecordEntity> findDoneByOperatorId(long operatorId, PageRequest pageRequest); |
48 | 49 |
|
49 | | - @Query(value = "select d from FlowRecordEntity d where d.id in (select max(r.id) from FlowRecordEntity r where r.currentOperatorId = ?1 and r.workCode = ?2 and r.flowType = 'DONE' group by r.processId) order by d.id desc") |
| 50 | + @Query(value = "select d from FlowRecordEntity d where d.flowType!='DELETE'and d.id in (select max(r.id) from FlowRecordEntity r where r.currentOperatorId = ?1 and r.workCode = ?2 and r.flowType = 'DONE' group by r.processId) order by d.id desc") |
50 | 51 | Page<FlowRecordEntity> findDoneByOperatorIdAndworkCode(long operatorId, String workCode, PageRequest pageRequest); |
51 | 52 |
|
52 | | - @Query(value = "select d from FlowRecordEntity d where d.id in (select max(r.id) from FlowRecordEntity r where r.currentOperatorId = ?1 and r.preId = 0 and r.nodeCode = 'start' group by r.processId) order by d.id desc") |
| 53 | + @Query(value = "select d from FlowRecordEntity d where d.flowType!='DELETE'and d.id in (select max(r.id) from FlowRecordEntity r where r.currentOperatorId = ?1 and r.preId = 0 and r.nodeCode = 'start' group by r.processId) order by d.id desc") |
53 | 54 | Page<FlowRecordEntity> findInitiatedByOperatorId(long operatorId, PageRequest pageRequest); |
54 | 55 |
|
55 | | - @Query(value = "select d from FlowRecordEntity d where d.id in (select max(r.id) from FlowRecordEntity r where r.currentOperatorId = ?1 group by r.processId) order by d.id desc") |
| 56 | + @Query(value = "select d from FlowRecordEntity d where d.flowType!='DELETE' and d.id in (select max(r.id) from FlowRecordEntity r where r.currentOperatorId = ?1 group by r.processId) order by d.id desc") |
56 | 57 | Page<FlowRecordEntity> findAllByOperatorId(long operatorId, PageRequest pageRequest); |
57 | 58 |
|
58 | | - @Query(value = "select d from FlowRecordEntity d where d.id in (select max(r.id) from FlowRecordEntity r where r.currentOperatorId = ?1 and r.workCode = ?2 and r.preId = 0 and r.nodeCode = 'start' group by r.processId) order by d.id desc") |
| 59 | + @Query(value = "select d from FlowRecordEntity d where d.flowType!='DELETE' and d.id in (select max(r.id) from FlowRecordEntity r where r.currentOperatorId = ?1 and r.workCode = ?2 and r.preId = 0 and r.nodeCode = 'start' group by r.processId) order by d.id desc") |
59 | 60 | Page<FlowRecordEntity> findInitiatedByOperatorIdAndWorkCode(long operatorId, String workCode, PageRequest pageRequest); |
60 | 61 |
|
61 | | - @Query(value = "select r from FlowRecordEntity r where r.currentOperatorId = ?1 and r.flowType = 'TODO' and r.flowStatus = 'RUNNING' and r.timeoutTime >0 and r.timeoutTime < ?2 order by r.id desc") |
| 62 | + @Query(value = "select r from FlowRecordEntity r where r.flowType!='DELETE' and r.currentOperatorId = ?1 and r.flowType = 'TODO' and r.flowStatus = 'RUNNING' and r.timeoutTime >0 and r.timeoutTime < ?2 order by r.id desc") |
62 | 63 | Page<FlowRecordEntity> findTimeoutTodoByOperatorId(long operatorId, long currentTime, PageRequest pageRequest); |
63 | 64 |
|
64 | | - @Query(value = "select r from FlowRecordEntity r where r.currentOperatorId = ?1 and r.workCode = ?2 and r.flowType = 'TODO' and r.flowStatus = 'RUNNING' and r.timeoutTime >0 and r.timeoutTime < ?3 order by r.id desc") |
| 65 | + @Query(value = "select r from FlowRecordEntity r where r.flowType!='DELETE' and r.currentOperatorId = ?1 and r.workCode = ?2 and r.flowType = 'TODO' and r.flowStatus = 'RUNNING' and r.timeoutTime >0 and r.timeoutTime < ?3 order by r.id desc") |
65 | 66 | Page<FlowRecordEntity> findTimeoutTodoByOperatorIdAndWorkCode(long operatorId, String workCode, long currentTime, PageRequest pageRequest); |
66 | 67 |
|
67 | | - @Query(value = "select r from FlowRecordEntity r where r.currentOperatorId = ?1 and r.flowType = 'TODO' and r.flowStatus = 'RUNNING' and r.postponedCount > 0 order by r.id desc") |
| 68 | + @Query(value = "select r from FlowRecordEntity r where r.flowType!='DELETE' and r.currentOperatorId = ?1 and r.flowType = 'TODO' and r.flowStatus = 'RUNNING' and r.postponedCount > 0 order by r.id desc") |
68 | 69 | Page<FlowRecordEntity> findPostponedTodoByOperatorId(long operatorId, PageRequest pageRequest); |
69 | 70 |
|
70 | | - @Query(value = "select r from FlowRecordEntity r where r.currentOperatorId = ?1 and r.workCode =?2 and r.flowType = 'TODO' and r.flowStatus = 'RUNNING' and r.postponedCount > 0 order by r.id desc") |
| 71 | + @Query(value = "select r from FlowRecordEntity r where r.flowType!='DELETE' and r.currentOperatorId = ?1 and r.workCode =?2 and r.flowType = 'TODO' and r.flowStatus = 'RUNNING' and r.postponedCount > 0 order by r.id desc") |
71 | 72 | Page<FlowRecordEntity> findPostponedTodoByOperatorIdAndWorkCode(long operatorId, String workCode, PageRequest pageRequest); |
72 | 73 |
|
73 | | - |
74 | | - @Query(value = "select d from FlowRecordEntity d where d.id in (select max(r.id) from FlowRecordEntity r group by r.processId ) order by d.id desc") |
| 74 | + @Query(value = "select d from FlowRecordEntity d where d.flowType!='DELETE' and d.id in (select max(r.id) from FlowRecordEntity r group by r.processId ) order by d.id desc") |
75 | 75 | Page<FlowRecordEntity> findAllFlowRecords(PageRequest pageRequest); |
76 | 76 |
|
77 | 77 | } |
0 commit comments