Skip to content

Commit e9d974a

Browse files
committed
add TodoList
1 parent 356cf24 commit e9d974a

File tree

7 files changed

+44
-6
lines changed

7 files changed

+44
-6
lines changed

admin-ui/src/api/flow.ts

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -101,6 +101,17 @@ export async function flowRecordList(params: any,
101101
}
102102

103103

104+
export async function findAllByOperatorId(params: any,
105+
sort: any,
106+
filter: any,
107+
match: {
108+
key: string,
109+
type: string
110+
}[]) {
111+
return page('/api/query/flowRecord/findAllByOperatorId', params, sort, filter, match);
112+
}
113+
114+
104115
export async function findTodoByOperatorId(params: any,
105116
sort: any,
106117
filter: any,

admin-ui/src/pages/flow/record/index.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
11
import React, {useEffect} from "react";
22
import {ActionType, PageContainer, ProTable} from "@ant-design/pro-components";
33
import {
4+
findAllByOperatorId,
45
findDoneByOperatorId,
56
findInitiatedByOperatorId,
67
findPostponedTodoByOperatorId,
78
findTimeoutTodoByOperatorId,
89
findTodoByOperatorId,
9-
flowRecordList,
1010
urge
1111
} from "@/api/flow";
1212
import moment from "moment";
@@ -302,7 +302,7 @@ const FlowRecordPage = () => {
302302
return record.read?"record-read":"record-unread";
303303
}}
304304
request={async (params, sort, filter) => {
305-
return flowRecordList(params, sort, filter, []);
305+
return findAllByOperatorId(params, sort, filter, []);
306306
}}
307307
/>
308308
)

example/example-application/src/main/java/com/codingapi/example/query/FlowRecordQueryController.java

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,15 @@ public SingleResponse<FlowDetail> detail(SearchRequest searchRequest) {
4545
}
4646

4747

48+
49+
@GetMapping("/findAllByOperatorId")
50+
public MultiResponse<FlowRecordEntity> findAllByOperatorId(SearchRequest searchRequest) {
51+
User user = userRepository.getUserByUsername(TokenContext.current().getUsername());
52+
PageRequest pageRequest = PageRequest.of(searchRequest.getCurrent(), searchRequest.getPageSize());
53+
return MultiResponse.of(flowRecordQuery.findAllByOperatorId(user.getId(), pageRequest));
54+
}
55+
56+
4857
@GetMapping("/findTodoByOperatorId")
4958
public MultiResponse<FlowRecordEntity> findTodoByOperatorId(SearchRequest searchRequest) {
5059
User user = userRepository.getUserByUsername(TokenContext.current().getUsername());

example/example-application/src/main/java/com/codingapi/example/query/app/FlowAppQueryController.java

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,21 @@ public MultiResponse<FlowRecordEntity> list(SearchRequest searchRequest) {
3737
}
3838

3939

40+
@GetMapping("/findAllByOperatorId")
41+
public MultiResponse<FlowRecordEntity> findAllByOperatorId(SearchRequest searchRequest) {
42+
User user = userRepository.getUserByUsername(TokenContext.current().getUsername());
43+
String lastId = searchRequest.getParameter("lastId");
44+
SQLBuilder sqlBuilder = new SQLBuilder("from FlowRecordEntity d where d.id in (select max(r.id) from FlowRecordEntity r where r.currentOperatorId = ?1 group by r.processId) ");
45+
sqlBuilder.addParam(user.getId());
46+
if(StringUtils.hasText(lastId)){
47+
sqlBuilder.append(" and d.id < ?",Long.parseLong(lastId));
48+
}
49+
sqlBuilder.appendSql(" order by d.id desc ");
50+
PageRequest pageRequest = PageRequest.of(0, searchRequest.getPageSize());
51+
return MultiResponse.of(flowRecordQuery.dynamicPageQuery(sqlBuilder,pageRequest));
52+
}
53+
54+
4055
@GetMapping("/findTodoByOperatorId")
4156
public MultiResponse<FlowRecordEntity> findTodoByOperatorId(SearchRequest searchRequest) {
4257
User user = userRepository.getUserByUsername(TokenContext.current().getUsername());

example/example-infra-flow/src/main/java/com/codingapi/example/jpa/FlowRecordEntityRepository.java

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,9 @@ public interface FlowRecordEntityRepository extends FastRepository<FlowRecordEnt
4444
@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")
4545
Page<FlowRecordEntity> findInitiatedByOperatorId(long operatorId, PageRequest pageRequest);
4646

47+
@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")
48+
Page<FlowRecordEntity> findAllByOperatorId(long operatorId, PageRequest pageRequest);
49+
4750
@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")
4851
Page<FlowRecordEntity> findInitiatedByOperatorIdAndWorkCode(long operatorId, String workCode, PageRequest pageRequest);
4952

mobile-ui/src/api/flow.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -96,9 +96,9 @@ export async function urge(body:any) {
9696

9797
// 待办中心控制
9898

99-
export async function flowRecordList( lastId?: string,
99+
export async function findAllByOperatorId( lastId?: string,
100100
pageSize=10) {
101-
return get('/api/app/query/flowRecord/list',{lastId,pageSize});
101+
return get('/api/app/query/flowRecord/findAllByOperatorId',{lastId,pageSize});
102102
}
103103

104104
export async function findTodoByOperatorId(lastId?: string,

mobile-ui/src/pages/flow/index.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ import {
88
findPostponedTodoByOperatorId,
99
findTimeoutTodoByOperatorId,
1010
findTodoByOperatorId,
11-
flowRecordList,
11+
findAllByOperatorId,
1212
} from "@/api/flow";
1313
import {Tabs} from "antd-mobile";
1414
import moment from "moment";
@@ -79,7 +79,7 @@ const FlowListPage = () => {
7979
return findPostponedTodoByOperatorId(last, pageSize);
8080
}
8181
if (key === 'all') {
82-
return flowRecordList(last, pageSize);
82+
return findAllByOperatorId(last, pageSize);
8383
}
8484
}
8585

0 commit comments

Comments
 (0)