|
@@ -1,13 +1,19 @@
|
|
package cn.iocoder.yudao.module.ai.controller.admin.knowledge;
|
|
package cn.iocoder.yudao.module.ai.controller.admin.knowledge;
|
|
|
|
|
|
import cn.iocoder.yudao.framework.common.pojo.CommonResult;
|
|
import cn.iocoder.yudao.framework.common.pojo.CommonResult;
|
|
-import cn.iocoder.yudao.module.ai.controller.admin.knowledge.vo.AiKnowledgeCreateMyReqVO;
|
|
|
|
-import cn.iocoder.yudao.module.ai.controller.admin.knowledge.vo.AiKnowledgeUpdateMyReqVO;
|
|
|
|
|
|
+import cn.iocoder.yudao.framework.common.pojo.PageParam;
|
|
|
|
+import cn.iocoder.yudao.framework.common.pojo.PageResult;
|
|
|
|
+import cn.iocoder.yudao.framework.common.util.object.BeanUtils;
|
|
|
|
+import cn.iocoder.yudao.module.ai.controller.admin.knowledge.vo.knowledge.AiKnowledgeCreateMyReqVO;
|
|
|
|
+import cn.iocoder.yudao.module.ai.controller.admin.knowledge.vo.knowledge.AiKnowledgeRespVO;
|
|
|
|
+import cn.iocoder.yudao.module.ai.controller.admin.knowledge.vo.knowledge.AiKnowledgeUpdateMyReqVO;
|
|
|
|
+import cn.iocoder.yudao.module.ai.dal.dataobject.knowledge.AiKnowledgeDO;
|
|
import cn.iocoder.yudao.module.ai.service.knowledge.AiKnowledgeService;
|
|
import cn.iocoder.yudao.module.ai.service.knowledge.AiKnowledgeService;
|
|
import io.swagger.v3.oas.annotations.Operation;
|
|
import io.swagger.v3.oas.annotations.Operation;
|
|
import io.swagger.v3.oas.annotations.tags.Tag;
|
|
import io.swagger.v3.oas.annotations.tags.Tag;
|
|
import jakarta.annotation.Resource;
|
|
import jakarta.annotation.Resource;
|
|
import jakarta.validation.Valid;
|
|
import jakarta.validation.Valid;
|
|
|
|
+import org.springframework.validation.annotation.Validated;
|
|
import org.springframework.web.bind.annotation.*;
|
|
import org.springframework.web.bind.annotation.*;
|
|
|
|
|
|
import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success;
|
|
import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success;
|
|
@@ -19,19 +25,27 @@ import static cn.iocoder.yudao.framework.security.core.util.SecurityFrameworkUti
|
|
public class AiKnowledgeController {
|
|
public class AiKnowledgeController {
|
|
|
|
|
|
@Resource
|
|
@Resource
|
|
- private AiKnowledgeService knowledgeBaseService;
|
|
|
|
|
|
+ private AiKnowledgeService knowledgeService;
|
|
|
|
+
|
|
|
|
+ @GetMapping("/my-page")
|
|
|
|
+ @Operation(summary = "获取【我的】知识库分页")
|
|
|
|
+ public CommonResult<PageResult<AiKnowledgeRespVO>> getKnowledgePageMy(@Validated PageParam pageReqVO) {
|
|
|
|
+ PageResult<AiKnowledgeDO> pageResult = knowledgeService.getKnowledgePageMy(getLoginUserId(), pageReqVO);
|
|
|
|
+ return success(BeanUtils.toBean(pageResult, AiKnowledgeRespVO.class));
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
|
|
@PostMapping("/create-my")
|
|
@PostMapping("/create-my")
|
|
@Operation(summary = "创建【我的】知识库")
|
|
@Operation(summary = "创建【我的】知识库")
|
|
public CommonResult<Long> createKnowledgeMy(@RequestBody @Valid AiKnowledgeCreateMyReqVO createReqVO) {
|
|
public CommonResult<Long> createKnowledgeMy(@RequestBody @Valid AiKnowledgeCreateMyReqVO createReqVO) {
|
|
- return success(knowledgeBaseService.createKnowledgeMy(createReqVO, getLoginUserId()));
|
|
|
|
|
|
+ return success(knowledgeService.createKnowledgeMy(createReqVO, getLoginUserId()));
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
@PutMapping("/update-my")
|
|
@PutMapping("/update-my")
|
|
@Operation(summary = "更新【我的】知识库")
|
|
@Operation(summary = "更新【我的】知识库")
|
|
public CommonResult<Boolean> updateKnowledgeMy(@RequestBody @Valid AiKnowledgeUpdateMyReqVO updateReqVO) {
|
|
public CommonResult<Boolean> updateKnowledgeMy(@RequestBody @Valid AiKnowledgeUpdateMyReqVO updateReqVO) {
|
|
- knowledgeBaseService.updateKnowledgeMy(updateReqVO, getLoginUserId());
|
|
|
|
|
|
+ knowledgeService.updateKnowledgeMy(updateReqVO, getLoginUserId());
|
|
return success(true);
|
|
return success(true);
|
|
}
|
|
}
|
|
|
|
|