zhou zhou
16 小时以前 80a6d9236ade191a5de0975abe4de5a6e7e63915
rsf-server/src/main/java/com/vincent/rsf/server/ai/controller/AiMcpMountController.java
@@ -1,6 +1,7 @@
package com.vincent.rsf.server.ai.controller;
import com.vincent.rsf.framework.common.R;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.vincent.rsf.server.ai.dto.AiMcpToolTestRequest;
import com.vincent.rsf.server.ai.entity.AiMcpMount;
import com.vincent.rsf.server.ai.service.AiMcpMountService;
@@ -29,31 +30,57 @@
    public R page(@RequestBody Map<String, Object> map) {
        BaseParam baseParam = buildParam(map, BaseParam.class);
        PageParam<AiMcpMount, BaseParam> pageParam = new PageParam<>(baseParam, AiMcpMount.class);
        return R.ok().add(aiMcpMountService.page(pageParam, pageParam.buildWrapper(true)));
        return R.ok().add(aiMcpMountService.page(pageParam, pageParam.buildWrapper(true)
                .eq("tenant_id", getTenantId())
                .eq("deleted", 0)));
    }
    @PreAuthorize("hasAuthority('system:aiMcpMount:list')")
    @PostMapping("/aiMcpMount/list")
    public R list(@RequestBody Map<String, Object> map) {
        return R.ok().add(aiMcpMountService.list());
        return R.ok().add(aiMcpMountService.list(new LambdaQueryWrapper<AiMcpMount>()
                .eq(AiMcpMount::getTenantId, getTenantId())
                .eq(AiMcpMount::getDeleted, 0)
                .orderByAsc(AiMcpMount::getSort)
                .orderByDesc(AiMcpMount::getId)));
    }
    @PreAuthorize("hasAuthority('system:aiMcpMount:list')")
    @PostMapping({"/aiMcpMount/many/{ids}", "/aiMcpMounts/many/{ids}"})
    public R many(@PathVariable Long[] ids) {
        return R.ok().add(aiMcpMountService.listByIds(Arrays.asList(ids)));
        return R.ok().add(aiMcpMountService.list(new LambdaQueryWrapper<AiMcpMount>()
                .eq(AiMcpMount::getTenantId, getTenantId())
                .eq(AiMcpMount::getDeleted, 0)
                .in(AiMcpMount::getId, Arrays.asList(ids))));
    }
    @PreAuthorize("hasAuthority('system:aiMcpMount:list')")
    @GetMapping("/aiMcpMount/{id}")
    public R get(@PathVariable("id") Long id) {
        return R.ok().add(aiMcpMountService.getById(id));
        return R.ok().add(aiMcpMountService.getOne(new LambdaQueryWrapper<AiMcpMount>()
                .eq(AiMcpMount::getId, id)
                .eq(AiMcpMount::getTenantId, getTenantId())
                .eq(AiMcpMount::getDeleted, 0)
                .last("limit 1")));
    }
    @PreAuthorize("hasAuthority('system:aiMcpMount:list')")
    @GetMapping("/aiMcpMount/{id}/tools")
    public R previewTools(@PathVariable("id") Long id) {
        return R.ok().add(aiMcpMountService.previewTools(id, getLoginUserId(), getTenantId()));
    }
    @PreAuthorize("hasAuthority('system:aiMcpMount:update')")
    @PostMapping("/aiMcpMount/{id}/connectivity/test")
    public R testConnectivity(@PathVariable("id") Long id) {
        return R.ok().add(aiMcpMountService.testConnectivity(id, getLoginUserId(), getTenantId()));
    }
    @PreAuthorize("hasAnyAuthority('system:aiMcpMount:save','system:aiMcpMount:update')")
    @PostMapping("/aiMcpMount/connectivity/validate-draft")
    public R testDraftConnectivity(@RequestBody AiMcpMount mount) {
        mount.setTenantId(getTenantId());
        return R.ok().add(aiMcpMountService.testDraftConnectivity(mount, getLoginUserId(), getTenantId()));
    }
    @PreAuthorize("hasAuthority('system:aiMcpMount:update')")
@@ -66,7 +93,8 @@
    @OperationLog("Create AiMcpMount")
    @PostMapping("/aiMcpMount/save")
    public R save(@RequestBody AiMcpMount aiMcpMount) {
        aiMcpMountService.validateBeforeSave(aiMcpMount);
        aiMcpMount.setTenantId(getTenantId());
        aiMcpMountService.validateBeforeSave(aiMcpMount, getTenantId());
        aiMcpMount.setCreateBy(getLoginUserId());
        aiMcpMount.setCreateTime(new Date());
        aiMcpMount.setUpdateBy(getLoginUserId());
@@ -81,7 +109,8 @@
    @OperationLog("Update AiMcpMount")
    @PostMapping("/aiMcpMount/update")
    public R update(@RequestBody AiMcpMount aiMcpMount) {
        aiMcpMountService.validateBeforeUpdate(aiMcpMount);
        aiMcpMount.setTenantId(getTenantId());
        aiMcpMountService.validateBeforeUpdate(aiMcpMount, getTenantId());
        aiMcpMount.setUpdateBy(getLoginUserId());
        aiMcpMount.setUpdateTime(new Date());
        if (!aiMcpMountService.updateById(aiMcpMount)) {
@@ -103,6 +132,10 @@
    @PreAuthorize("hasAuthority('system:aiMcpMount:list')")
    @PostMapping("/aiMcpMount/export")
    public void export(@RequestBody Map<String, Object> map, HttpServletResponse response) throws Exception {
        ExcelUtil.build(ExcelUtil.create(aiMcpMountService.list(), AiMcpMount.class), response);
        ExcelUtil.build(ExcelUtil.create(aiMcpMountService.list(new LambdaQueryWrapper<AiMcpMount>()
                .eq(AiMcpMount::getTenantId, getTenantId())
                .eq(AiMcpMount::getDeleted, 0)
                .orderByAsc(AiMcpMount::getSort)
                .orderByDesc(AiMcpMount::getId)), AiMcpMount.class), response);
    }
}