fix: 优化后端各模块 handler

- database_handler, knowledge_handler, model_handler
- neo4j_handler, sub_table_handler
- system_handler, upload_handler
- knowledge_service, upload_service

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
2026-03-11 14:26:04 +08:00
parent ecb885ee5e
commit fdd6b2c17d
9 changed files with 427 additions and 60 deletions

View File

@@ -17,7 +17,16 @@ func NewNeo4jHandler(svc *service.Neo4jService) *Neo4jHandler {
return &Neo4jHandler{service: svc}
}
// Check 检查 Neo4j 连接
// @Summary 检查 Neo4j 连接
// @Description 测试 Neo4j 数据库连接是否正常
// @Tags Neo4j
// @Accept json
// @Produce json
// @Param request body model.Neo4jCheckRequest true "Neo4j连接信息"
// @Success 200 {object} map[string]interface{}
// @Failure 400 {object} map[string]string
// @Failure 500 {object} map[string]string
// @Router /neo4j/check [post]
func (h *Neo4jHandler) Check(c *gin.Context) {
var req model.Neo4jCheckRequest
if err := c.ShouldBindJSON(&req); err != nil {
@@ -34,7 +43,16 @@ func (h *Neo4jHandler) Check(c *gin.Context) {
c.JSON(http.StatusOK, result)
}
// GetGraphs 获取图谱概览数据
// @Summary 获取图谱概览
// @Description 获取 Neo4j 中的图谱概览数据
// @Tags Neo4j
// @Accept json
// @Produce json
// @Param request body model.Neo4jGraphRequest true "图谱查询请求"
// @Success 200 {object} map[string]interface{}
// @Failure 400 {object} map[string]string
// @Failure 500 {object} map[string]string
// @Router /neo4j/graphs [post]
func (h *Neo4jHandler) GetGraphs(c *gin.Context) {
var req model.Neo4jGraphRequest
if err := c.ShouldBindJSON(&req); err != nil {
@@ -51,7 +69,16 @@ func (h *Neo4jHandler) GetGraphs(c *gin.Context) {
c.JSON(http.StatusOK, result)
}
// GetNodes 获取节点详情
// @Summary 获取节点列表
// @Description 获取 Neo4j 中的节点详情
// @Tags Neo4j
// @Accept json
// @Produce json
// @Param request body model.Neo4jNodeRequest true "节点查询请求"
// @Success 200 {object} map[string]interface{}
// @Failure 400 {object} map[string]string
// @Failure 500 {object} map[string]string
// @Router /neo4j/nodes [post]
func (h *Neo4jHandler) GetNodes(c *gin.Context) {
var req model.Neo4jNodeRequest
if err := c.ShouldBindJSON(&req); err != nil {
@@ -68,7 +95,16 @@ func (h *Neo4jHandler) GetNodes(c *gin.Context) {
c.JSON(http.StatusOK, result)
}
// GetRelationships 获取关系详情
// @Summary 获取关系列表
// @Description 获取 Neo4j 中的关系详情
// @Tags Neo4j
// @Accept json
// @Produce json
// @Param request body model.Neo4jRelRequest true "关系查询请求"
// @Success 200 {object} map[string]interface{}
// @Failure 400 {object} map[string]string
// @Failure 500 {object} map[string]string
// @Router /neo4j/relationships [post]
func (h *Neo4jHandler) GetRelationships(c *gin.Context) {
var req model.Neo4jRelRequest
if err := c.ShouldBindJSON(&req); err != nil {