|
| 1 | +package com.codingapi.flow.query.controller; |
| 2 | + |
| 3 | +import com.codingapi.flow.infra.entity.FlowRecordEntity; |
| 4 | +import com.codingapi.flow.infra.jpa.FlowRecordEntityRepository; |
| 5 | +import com.codingapi.flow.operator.IFlowOperator; |
| 6 | +import com.codingapi.springboot.framework.dto.request.SearchRequest; |
| 7 | +import com.codingapi.springboot.framework.dto.response.MultiResponse; |
| 8 | +import com.codingapi.springboot.framework.user.UserContext; |
| 9 | +import lombok.AllArgsConstructor; |
| 10 | +import org.springframework.data.domain.PageRequest; |
| 11 | +import org.springframework.web.bind.annotation.GetMapping; |
| 12 | +import org.springframework.web.bind.annotation.RequestMapping; |
| 13 | +import org.springframework.web.bind.annotation.RestController; |
| 14 | + |
| 15 | +@RestController |
| 16 | +@RequestMapping("/api/query/record") |
| 17 | +@AllArgsConstructor |
| 18 | +public class FlowRecordQueryController { |
| 19 | + |
| 20 | + private final FlowRecordEntityRepository flowRecordEntityRepository; |
| 21 | + |
| 22 | + /** |
| 23 | + * 全部流程记录接口 |
| 24 | + */ |
| 25 | + @GetMapping("/list") |
| 26 | + public MultiResponse<FlowRecordEntity> list(SearchRequest request) { |
| 27 | + return MultiResponse.of(flowRecordEntityRepository.searchRequest(request)); |
| 28 | + } |
| 29 | + |
| 30 | + |
| 31 | + /** |
| 32 | + * 我的待办记录 |
| 33 | + */ |
| 34 | + @GetMapping("/todo") |
| 35 | + public MultiResponse<FlowRecordEntity> todo(SearchRequest request) { |
| 36 | + IFlowOperator current = (IFlowOperator) UserContext.getInstance().current(); |
| 37 | + PageRequest pageRequest = request.toPageRequest(FlowRecordEntity.class); |
| 38 | + return MultiResponse.of(flowRecordEntityRepository.findTodoPage(current.getUserId(),pageRequest)); |
| 39 | + } |
| 40 | + |
| 41 | + |
| 42 | + /** |
| 43 | + * 我的已办记录 |
| 44 | + */ |
| 45 | + @GetMapping("/done") |
| 46 | + public MultiResponse<FlowRecordEntity> done(SearchRequest request) { |
| 47 | + IFlowOperator current = (IFlowOperator) UserContext.getInstance().current(); |
| 48 | + PageRequest pageRequest = request.toPageRequest(FlowRecordEntity.class); |
| 49 | + return MultiResponse.of(flowRecordEntityRepository.findDonePage(current.getUserId(),pageRequest)); |
| 50 | + } |
| 51 | +} |
0 commit comments