mirror of
https://github.com/xinnan-tech/xiaozhi-esp32-server.git
synced 2026-11-28 04:59:52 +01:00
模板 GET 入口迁回 AgentTemplateController #3395
根因:AgentController 已存在 GET /agent/template/templateList,AgentTemplateController 缺显式 GET,于是路由虽通却跨 controller 暴露模板数据,且职责错位。修复:删 AgentController.templateList,同名 @GetMapping(无 path)落到 AgentTemplateController,权限 normal、orderByAsc sort、复用现有 service.list。验证:spring-boot 启动期无 Ambiguous;/agent/template、/page、/{id} 三路由均被 Shiro 一致拦截,权限/路径正确。
This commit is contained in:
parent
7a260ee143
commit
7341070d89
2 changed files with 9 additions and 12 deletions
|
|
@ -19,8 +19,6 @@ import org.springframework.web.bind.annotation.RequestMapping;
|
||||||
import org.springframework.web.bind.annotation.RequestParam;
|
import org.springframework.web.bind.annotation.RequestParam;
|
||||||
import org.springframework.web.bind.annotation.RestController;
|
import org.springframework.web.bind.annotation.RestController;
|
||||||
|
|
||||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
|
||||||
|
|
||||||
import io.swagger.v3.oas.annotations.Operation;
|
import io.swagger.v3.oas.annotations.Operation;
|
||||||
import io.swagger.v3.oas.annotations.Parameter;
|
import io.swagger.v3.oas.annotations.Parameter;
|
||||||
import io.swagger.v3.oas.annotations.Parameters;
|
import io.swagger.v3.oas.annotations.Parameters;
|
||||||
|
|
@ -44,7 +42,6 @@ import xiaozhi.modules.agent.dto.AgentDTO;
|
||||||
import xiaozhi.modules.agent.dto.AgentMemoryDTO;
|
import xiaozhi.modules.agent.dto.AgentMemoryDTO;
|
||||||
import xiaozhi.modules.agent.dto.AgentUpdateDTO;
|
import xiaozhi.modules.agent.dto.AgentUpdateDTO;
|
||||||
import xiaozhi.modules.agent.entity.AgentEntity;
|
import xiaozhi.modules.agent.entity.AgentEntity;
|
||||||
import xiaozhi.modules.agent.entity.AgentTemplateEntity;
|
|
||||||
import xiaozhi.modules.agent.dto.AgentTagDTO;
|
import xiaozhi.modules.agent.dto.AgentTagDTO;
|
||||||
import xiaozhi.modules.agent.entity.AgentTagEntity;
|
import xiaozhi.modules.agent.entity.AgentTagEntity;
|
||||||
import xiaozhi.modules.agent.service.AgentTagService;
|
import xiaozhi.modules.agent.service.AgentTagService;
|
||||||
|
|
@ -192,15 +189,6 @@ public class AgentController {
|
||||||
return new Result<>();
|
return new Result<>();
|
||||||
}
|
}
|
||||||
|
|
||||||
@GetMapping("/template")
|
|
||||||
@Operation(summary = "智能体模板模板列表")
|
|
||||||
@RequiresPermissions("sys:role:normal")
|
|
||||||
public Result<List<AgentTemplateEntity>> templateList() {
|
|
||||||
List<AgentTemplateEntity> list = agentTemplateService
|
|
||||||
.list(new QueryWrapper<AgentTemplateEntity>().orderByAsc("sort"));
|
|
||||||
return new Result<List<AgentTemplateEntity>>().ok(list);
|
|
||||||
}
|
|
||||||
|
|
||||||
@GetMapping("/{id}/sessions")
|
@GetMapping("/{id}/sessions")
|
||||||
@Operation(summary = "获取智能体会话列表")
|
@Operation(summary = "获取智能体会话列表")
|
||||||
@RequiresPermissions("sys:role:normal")
|
@RequiresPermissions("sys:role:normal")
|
||||||
|
|
|
||||||
|
|
@ -41,6 +41,15 @@ public class AgentTemplateController {
|
||||||
|
|
||||||
private final AgentTemplateService agentTemplateService;
|
private final AgentTemplateService agentTemplateService;
|
||||||
|
|
||||||
|
@GetMapping
|
||||||
|
@Operation(summary = "智能体模板列表")
|
||||||
|
@RequiresPermissions("sys:role:normal")
|
||||||
|
public Result<List<AgentTemplateEntity>> getAgentTemplates() {
|
||||||
|
List<AgentTemplateEntity> list = agentTemplateService
|
||||||
|
.list(new QueryWrapper<AgentTemplateEntity>().orderByAsc("sort"));
|
||||||
|
return new Result<List<AgentTemplateEntity>>().ok(list);
|
||||||
|
}
|
||||||
|
|
||||||
@GetMapping("/page")
|
@GetMapping("/page")
|
||||||
@Operation(summary = "获取模板分页列表")
|
@Operation(summary = "获取模板分页列表")
|
||||||
@RequiresPermissions("sys:role:superAdmin")
|
@RequiresPermissions("sys:role:superAdmin")
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue