zhou zhou
1 天以前 1dcfa3702505f0c431757312b5304531029f90f6
rsf-server/src/main/java/com/vincent/rsf/server/system/controller/FlowInstanceController.java
@@ -15,8 +15,9 @@
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 javax.servlet.http.HttpServletResponse;
import jakarta.servlet.http.HttpServletResponse;
import java.util.*;
@RestController
@@ -30,25 +31,25 @@
    public R page(@RequestBody Map<String, Object> map) {
        BaseParam baseParam = buildParam(map, BaseParam.class);
        PageParam<FlowInstance, BaseParam> pageParam = new PageParam<>(baseParam, FlowInstance.class);
        return R.ok().add(flowInstanceService.page(pageParam, pageParam.buildWrapper(true)));
        return R.ok().add(buildPageRowsUtils.rowsMap(flowInstanceService.page(pageParam, pageParam.buildWrapper(true))));
    }
    @PreAuthorize("hasAuthority('system:flowInstance:list')")
    @PostMapping("/flowInstance/list")
    public R list(@RequestBody Map<String, Object> map) {
        return R.ok().add(flowInstanceService.list());
        return R.ok().add(buildPageRowsUtils.rowsMap(flowInstanceService.list()));
    }
    @PreAuthorize("hasAuthority('system:flowInstance:list')")
    @PostMapping({"/flowInstance/many/{ids}", "/flowInstances/many/{ids}"})
    public R many(@PathVariable Long[] ids) {
        return R.ok().add(flowInstanceService.listByIds(Arrays.asList(ids)));
        return R.ok().add(buildPageRowsUtils.rowsMap(flowInstanceService.listByIds(Arrays.asList(ids))));
    }
    @PreAuthorize("hasAuthority('system:flowInstance:list')")
    @GetMapping("/flowInstance/{id}")
    public R get(@PathVariable("id") Long id) {
        return R.ok().add(flowInstanceService.getById(id));
        return R.ok().add(buildPageRowsUtils.rowsMap(flowInstanceService.getById(id)));
    }
    @PreAuthorize("hasAuthority('system:flowInstance:save')")
@@ -60,7 +61,7 @@
        if (!flowInstanceService.save(flowInstance)) {
            return R.error("Save Fail");
        }
        return R.ok("Save Success").add(flowInstance);
        return R.ok("Save Success").add(buildPageRowsUtils.rowsMap(flowInstance));
    }
    @PreAuthorize("hasAuthority('system:flowInstance:update')")
@@ -71,7 +72,7 @@
        if (!flowInstanceService.updateById(flowInstance)) {
            return R.error("Update Fail");
        }
        return R.ok("Update Success").add(flowInstance);
        return R.ok("Update Success").add(buildPageRowsUtils.rowsMap(flowInstance));
    }
    @PreAuthorize("hasAuthority('system:flowInstance:remove')")
@@ -81,7 +82,7 @@
        if (!flowInstanceService.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('system:flowInstance:list')")
@@ -95,13 +96,14 @@
        flowInstanceService.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('system:flowInstance:list')")
    @PostMapping("/flowInstance/export")
    public void export(@RequestBody Map<String, Object> map, HttpServletResponse response) throws Exception {
        ExcelUtil.build(ExcelUtil.create(flowInstanceService.list(), FlowInstance.class), response);
        ExcelUtil.build(ExcelUtil.create(buildPageRowsUtils.rowsMap(flowInstanceService.list()), FlowInstance.class), response);
    }
}