| | |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.security.access.prepost.PreAuthorize; |
| | | import org.springframework.web.bind.annotation.*; |
| | | import com.vincent.rsf.server.manager.utils.buildPageRowsUtils; |
| | | |
| | | import jakarta.servlet.http.HttpServletResponse; |
| | | import java.util.*; |
| | |
| | | public R page(@RequestBody Map<String, Object> map) { |
| | | BaseParam baseParam = buildParam(map, BaseParam.class); |
| | | PageParam<FlowStepInstance, BaseParam> pageParam = new PageParam<>(baseParam, FlowStepInstance.class); |
| | | return R.ok().add(flowStepInstanceService.page(pageParam, pageParam.buildWrapper(true))); |
| | | return R.ok().add(buildPageRowsUtils.rowsMap(flowStepInstanceService.page(pageParam, pageParam.buildWrapper(true)))); |
| | | } |
| | | |
| | | @PreAuthorize("hasAuthority('manager:task:list')") |
| | | @PostMapping("/flowStepInstance/list") |
| | | public R list(@RequestBody Map<String, Object> map) { |
| | | return R.ok().add(flowStepInstanceService.list()); |
| | | return R.ok().add(buildPageRowsUtils.rowsMap(flowStepInstanceService.list())); |
| | | } |
| | | |
| | | @PreAuthorize("hasAuthority('manager:task:list')") |
| | | @PostMapping({"/flowStepInstance/many/{ids}", "/flowStepInstances/many/{ids}"}) |
| | | public R many(@PathVariable Long[] ids) { |
| | | return R.ok().add(flowStepInstanceService.listByIds(Arrays.asList(ids))); |
| | | return R.ok().add(buildPageRowsUtils.rowsMap(flowStepInstanceService.listByIds(Arrays.asList(ids)))); |
| | | } |
| | | |
| | | @PreAuthorize("hasAuthority('manager:task:list')") |
| | | @GetMapping("/flowStepInstance/{id}") |
| | | public R get(@PathVariable("id") Long id) { |
| | | return R.ok().add(flowStepInstanceService.getById(id)); |
| | | return R.ok().add(buildPageRowsUtils.rowsMap(flowStepInstanceService.getById(id))); |
| | | } |
| | | |
| | | @PreAuthorize("hasAuthority('manager:task:save')") |
| | |
| | | if (!flowStepInstanceService.save(flowStepInstance)) { |
| | | return R.error("Save Fail"); |
| | | } |
| | | return R.ok("Save Success").add(flowStepInstance); |
| | | return R.ok("Save Success").add(buildPageRowsUtils.rowsMap(flowStepInstance)); |
| | | } |
| | | |
| | | @PreAuthorize("hasAuthority('manager:task:update')") |
| | |
| | | if (!flowStepInstanceService.updateById(flowStepInstance)) { |
| | | return R.error("Update Fail"); |
| | | } |
| | | return R.ok("Update Success").add(flowStepInstance); |
| | | return R.ok("Update Success").add(buildPageRowsUtils.rowsMap(flowStepInstance)); |
| | | } |
| | | |
| | | @PreAuthorize("hasAuthority('manager:task:update')") |
| | |
| | | if (!flowStepInstanceService.jumpCurrent(id)) { |
| | | return R.error("跳转异常"); |
| | | } |
| | | return R.ok("跳转成功").add(id); |
| | | return R.ok("跳转成功").add(buildPageRowsUtils.rowsMap(id)); |
| | | } |
| | | |
| | | @PreAuthorize("hasAuthority('manager:task:remove')") |
| | |
| | | if (!flowStepInstanceService.removeByIds(Arrays.asList(ids))) { |
| | | return R.error("Delete Fail"); |
| | | } |
| | | return R.ok("Delete Success").add(ids); |
| | | return R.ok("Delete Success").add(buildPageRowsUtils.rowsMap(ids)); |
| | | } |
| | | |
| | | @PreAuthorize("hasAuthority('manager:task:list')") |
| | |
| | | flowStepInstanceService.page(new Page<>(1, 30), wrapper).getRecords().forEach( |
| | | item -> vos.add(new KeyValVo(item.getId(), item.getId())) |
| | | ); |
| | | return R.ok().add(vos); |
| | | return R.ok().add(buildPageRowsUtils.rowsMap(vos)); |
| | | } |
| | | |
| | | @PreAuthorize("hasAuthority('manager:task:list')") |
| | | @PostMapping("/flowStepInstance/export") |
| | | public void export(@RequestBody Map<String, Object> map, HttpServletResponse response) throws Exception { |
| | | ExcelUtil.build(ExcelUtil.create(flowStepInstanceService.list(), FlowStepInstance.class), response); |
| | | ExcelUtil.build(ExcelUtil.create(buildPageRowsUtils.rowsMap(flowStepInstanceService.list()), FlowStepInstance.class), response); |
| | | } |
| | | |
| | | } |