loginDomain修正

This commit is contained in:
2025-12-19 18:19:04 +08:00
parent 9c4f73ac9c
commit 1131a34c6e
19 changed files with 206 additions and 252 deletions

View File

@@ -40,7 +40,7 @@ public class AgentController {
* @since 2025-12-17
*/
@PostMapping
@PreAuthorize("@ss.hasPermi('ai:agent:create')")
@PreAuthorize("hasAuthority('ai:agent:create')")
public ResultDomain<TbAgent> createAgent(@RequestBody TbAgent agent) {
log.info("创建智能体: name={}", agent.getName());
// 参数校验
@@ -62,7 +62,7 @@ public class AgentController {
* @since 2025-12-17
*/
@PutMapping
@PreAuthorize("@ss.hasPermi('ai:agent:update')")
@PreAuthorize("hasAuthority('ai:agent:update')")
public ResultDomain<TbAgent> updateAgent(@RequestBody TbAgent agent) {
log.info("更新智能体: agentId={}", agent.getAgentId());
// 参数校验
@@ -85,7 +85,7 @@ public class AgentController {
* @since 2025-12-17
*/
@DeleteMapping("/{agentId}")
@PreAuthorize("@ss.hasPermi('ai:agent:delete')")
@PreAuthorize("hasAuthority('ai:agent:delete')")
public ResultDomain<TbAgent> deleteAgent(@PathVariable("agentId") @NotNull String agentId) {
log.info("删除智能体: agentId={}", agentId);
TbAgent agent = new TbAgent();
@@ -100,7 +100,7 @@ public class AgentController {
* @since 2025-12-17
*/
@GetMapping("/{agentId}")
@PreAuthorize("@ss.hasPermi('ai:agent:view')")
@PreAuthorize("hasAuthority('ai:agent:view')")
public ResultDomain<TbAgent> getAgent(@PathVariable("agentId") @NotNull String agentId) {
log.info("获取智能体: agentId={}", agentId);
ResultDomain<TbAgent> agentResult = agentService.selectAgentById(agentId);
@@ -117,7 +117,7 @@ public class AgentController {
* @since 2025-12-17
*/
@PostMapping("/page")
@PreAuthorize("@ss.hasPermi('ai:agent:view')")
@PreAuthorize("hasAuthority('ai:agent:view')")
public ResultDomain<TbAgent> getAgentPage(@RequestBody PageRequest<TbAgent> pageRequest) {
log.info("分页查询智能体");
// 参数校验(支持嵌套属性路径)
@@ -139,7 +139,7 @@ public class AgentController {
* @since 2025-12-17
*/
@GetMapping("/list")
@PreAuthorize("@ss.hasPermi('ai:agent:view')")
@PreAuthorize("hasAuthority('ai:agent:view')")
public ResultDomain<TbAgent> getAgentList(TbAgent tbAgent) {
log.info("获取智能体列表");
return agentService.getAgentList(tbAgent);

View File

@@ -54,7 +54,7 @@ public class KnowledgeController {
* @author yslg
* @since 2025-12-18
*/
@PreAuthorize("@ss.hasPermission('ai:knowledge:create')")
@PreAuthorize("hasAuthority('ai:knowledge:create')")
@PostMapping
public ResultDomain<TbKnowledge> createKnowledge(@RequestBody TbKnowledge knowledge) {
ValidationResult result = ValidationUtils.validate(knowledge, Arrays.asList(
@@ -75,7 +75,7 @@ public class KnowledgeController {
* @author yslg
* @since 2025-12-18
*/
@PreAuthorize("@ss.hasPermission('ai:knowledge:update')")
@PreAuthorize("hasAuthority('ai:knowledge:update')")
@PutMapping
public ResultDomain<TbKnowledge> updateKnowledge(@RequestBody @Valid TbKnowledge knowledge) {
ValidationResult result = ValidationUtils.validate(knowledge, Arrays.asList(
@@ -97,7 +97,7 @@ public class KnowledgeController {
* @author yslg
* @since 2025-12-18
*/
@PreAuthorize("@ss.hasPermission('ai:knowledge:delete')")
@PreAuthorize("hasAuthority('ai:knowledge:delete')")
@DeleteMapping("/{knowledgeId}")
public ResultDomain<Boolean> deleteKnowledge(@PathVariable("knowledgeId") @NotBlank String knowledgeId) {
logger.info("删除知识库: knowledgeId={}", knowledgeId);
@@ -110,7 +110,7 @@ public class KnowledgeController {
* @author yslg
* @since 2025-12-18
*/
@PreAuthorize("@ss.hasPermission('ai:knowledge:view')")
@PreAuthorize("hasAuthority('ai:knowledge:view')")
@GetMapping("/{knowledgeId}")
public ResultDomain<TbKnowledge> getKnowledge(@PathVariable("knowledgeId") @NotBlank String knowledgeId) {
logger.info("获取知识库: knowledgeId={}", knowledgeId);
@@ -123,7 +123,7 @@ public class KnowledgeController {
* @author yslg
* @since 2025-12-18
*/
@PreAuthorize("@ss.hasPermission('ai:knowledge:view')")
@PreAuthorize("hasAuthority('ai:knowledge:view')")
@PostMapping("/list")
public ResultDomain<TbKnowledge> listKnowledges(@RequestBody(required = false) TbKnowledge filter) {
logger.info("查询知识库列表");
@@ -136,7 +136,7 @@ public class KnowledgeController {
* @author yslg
* @since 2025-12-18
*/
@PreAuthorize("@ss.hasPermission('ai:knowledge:view')")
@PreAuthorize("hasAuthority('ai:knowledge:view')")
@PostMapping("/page")
public ResultDomain<TbKnowledge> pageKnowledges(@RequestBody @Valid PageRequest<TbKnowledge> pageRequest) {
logger.info("分页查询知识库");
@@ -149,7 +149,7 @@ public class KnowledgeController {
* @author yslg
* @since 2025-12-18
*/
@PreAuthorize("@ss.hasPermission('ai:knowledge:view')")
@PreAuthorize("hasAuthority('ai:knowledge:view')")
@GetMapping("/{knowledgeId}/stats")
public ResultDomain<TbKnowledge> getKnowledgeStats(@PathVariable("knowledgeId") @NotBlank String knowledgeId) {
logger.info("获取知识库统计: knowledgeId={}", knowledgeId);
@@ -164,7 +164,7 @@ public class KnowledgeController {
* @author yslg
* @since 2025-12-18
*/
@PreAuthorize("@ss.hasPermission('ai:knowledge:file:view')")
@PreAuthorize("hasAuthority('ai:knowledge:file:view')")
@GetMapping("/{knowledgeId}/documents")
public ResultDomain<Map<String, Object>> getDocumentList(
@PathVariable("knowledgeId") @NotBlank String knowledgeId,
@@ -182,7 +182,7 @@ public class KnowledgeController {
* @author yslg
* @since 2025-12-18
*/
@PreAuthorize("@ss.hasPermission('ai:knowledge:file:upload')")
@PreAuthorize("hasAuthority('ai:knowledge:file:upload')")
@PostMapping(value = "/file/upload", consumes = MediaType.MULTIPART_FORM_DATA_VALUE)
public ResultDomain<TbKnowledgeFile> uploadToKnowledge(
@RequestParam("file") @NotNull MultipartFile file,
@@ -200,7 +200,7 @@ public class KnowledgeController {
* @author yslg
* @since 2025-12-18
*/
@PreAuthorize("@ss.hasPermission('ai:knowledge:file:upload')")
@PreAuthorize("hasAuthority('ai:knowledge:file:upload')")
@PostMapping(value = "/file/batch-upload", consumes = MediaType.MULTIPART_FORM_DATA_VALUE)
public ResultDomain<TbKnowledgeFile> batchUploadToKnowledge(
@RequestParam("files") @NotEmpty List<MultipartFile> files,
@@ -218,7 +218,7 @@ public class KnowledgeController {
* @author yslg
* @since 2025-12-18
*/
@PreAuthorize("@ss.hasPermission('ai:knowledge:file:update')")
@PreAuthorize("hasAuthority('ai:knowledge:file:update')")
@PutMapping(value = "/file/upload", consumes = MediaType.MULTIPART_FORM_DATA_VALUE)
public ResultDomain<TbKnowledgeFile> updateFile(
@RequestParam("file") @NotNull MultipartFile file,
@@ -234,7 +234,7 @@ public class KnowledgeController {
* @author yslg
* @since 2025-12-18
*/
@PreAuthorize("@ss.hasPermission('ai:knowledge:file:delete')")
@PreAuthorize("hasAuthority('ai:knowledge:file:delete')")
@DeleteMapping("/file/{fileId}")
public ResultDomain<Boolean> deleteFile(@PathVariable("fileId") @NotBlank String fileId) {
logger.info("删除知识库文件: fileId={}", fileId);
@@ -247,7 +247,7 @@ public class KnowledgeController {
* @author yslg
* @since 2025-12-18
*/
@PreAuthorize("@ss.hasPermission('ai:knowledge:file:view')")
@PreAuthorize("hasAuthority('ai:knowledge:file:view')")
@GetMapping("/file/{fileId}/history")
public ResultDomain<TbKnowledgeFile> getFileHistory(@PathVariable("fileId") @NotBlank String fileRootId) {
logger.info("获取文件历史: fileRootId={}", fileRootId);
@@ -263,7 +263,7 @@ public class KnowledgeController {
* @author yslg
* @since 2025-12-18
*/
@PreAuthorize("@ss.hasPermission('ai:dify:segment:view')")
@PreAuthorize("hasAuthority('ai:dify:segment:view')")
@GetMapping("/datasets/{datasetId}/documents/{documentId}/segments")
public ResultDomain<JSONObject> getDocumentSegments(
@PathVariable("datasetId") @NotBlank String datasetId,
@@ -280,7 +280,7 @@ public class KnowledgeController {
* @author yslg
* @since 2025-12-18
*/
@PreAuthorize("@ss.hasPermission('ai:dify:segment:create')")
@PreAuthorize("hasAuthority('ai:dify:segment:create')")
@PostMapping("/datasets/{datasetId}/documents/{documentId}/segments")
public ResultDomain<String> createSegment(
@PathVariable("datasetId") @NotBlank String datasetId,
@@ -299,7 +299,7 @@ public class KnowledgeController {
* @author yslg
* @since 2025-12-18
*/
@PreAuthorize("@ss.hasPermission('ai:dify:segment:update')")
@PreAuthorize("hasAuthority('ai:dify:segment:update')")
@PatchMapping("/datasets/{datasetId}/documents/{documentId}/segments/{segmentId}")
public ResultDomain<String> updateSegment(
@PathVariable("datasetId") @NotBlank String datasetId,
@@ -318,7 +318,7 @@ public class KnowledgeController {
* @author yslg
* @since 2025-12-18
*/
@PreAuthorize("@ss.hasPermission('ai:dify:segment:delete')")
@PreAuthorize("hasAuthority('ai:dify:segment:delete')")
@DeleteMapping("/datasets/{datasetId}/documents/{documentId}/segments/{segmentId}")
public ResultDomain<String> deleteSegment(
@PathVariable("datasetId") @NotBlank String datasetId,
@@ -338,7 +338,7 @@ public class KnowledgeController {
* @author yslg
* @since 2025-12-18
*/
@PreAuthorize("@ss.hasPermission('ai:dify:document:status')")
@PreAuthorize("hasAuthority('ai:dify:document:status')")
@PatchMapping("/datasets/{datasetId}/documents/{action}/status")
public ResultDomain<String> updateDocumentStatus(
@PathVariable("datasetId") @NotBlank String datasetId,