table.api 2.9 KB
syntax = "v1"

info(
    title: "天联字库图表模板"
    desc: "图表模板"
    author: "小火箭"
    email: "email"
    version: "v1"
)

@server(
    prefix: v1
    group: table
    //jwt: JwtAuth
    //middleware: Authority
)
service Core {
    @doc "源数据表-字段可选值"
    @handler searchTableFieldOptionalValues
    post /table/field-optional-values (SearchTableByModuleRequest) returns (SearchTableByModuleResponse)

    @doc "源数据表-详情"
    @handler getTableDetail
    get /table/:tableId (GetTableDetailRequest) returns (GetTableDetailResponse)

    @doc "源数据表-数据"
    @handler searchTableData
    post /table/data (SearchTableDataRequest) returns (SearchTableDataResponse)
}

@server(
    prefix: v1
    group: table
    jwt: JwtAuth
    //middleware: Authority
)
service Core {
    @doc "源数据表-按模块搜索"
    @handler searchTableByModule
    post /table/search-by-module (SearchTableByModuleRequest) returns (SearchTableByModuleResponse)
}

type (
    SearchTableByModuleRequest struct{
        Token string `header:"x-mmm-accesstoken,optional"`
    }
    SearchTableByModuleResponse struct{

    }

    SearchTableFieldOptionalValuesRequest struct{
        Token string `header:"x-mmm-accesstoken,optional"`
        ObjectId   int          `json:"objectId"` // 对象ID
        Field      string       `json:"field"`    // 当前选择的字段
        //SqlName    string       `json:"sqlName,optional"`  // 字段SqlName
        // Match      string       `json:"match"`
        //PageNumber int          `json:"pageNumber,optional"` // 分页数
        //PageSize   int          `json:"pageSize,optional"`   // 页码
        Condition  []*Condition `json:"conditions,optional"` // 条件
    }
    SearchTableFieldOptionalValuesResponse struct{
        Values []string `json:"values"`
        Total  int64 `json:"total"`
    }
    Condition struct {
        FieldName string    `json:"field"` // 条件字段
        //SqlName    string   `json:"sqlName,optional"`  // 字段SqlName
        Like  string        `json:"like,optional"`  // 模糊匹配
        In    []string      `json:"in,optional"`    // 匹配多个值
        Order string        `json:"order,optional,options=ASC||DESC"` // 排序 ASC DESC 默认ASC
    }

    GetTableDetailRequest struct {
        Token string `header:"x-mmm-accesstoken,optional"`
        TableId int `path:"tableId"` // 表ID
    }
    GetTableDetailResponse struct{

    }

    SearchTableDataRequest struct{
        Token string `header:"x-mmm-accesstoken,optional"`
        ObjectId  int          `json:"objectId"`              // 对象ID
        PageNumber int          `json:"page,optional"` // 分页数
        PageSize   int          `json:"size,optional"`   // 页码
        Condition  []*Condition `json:"conditions,optional"`          // 条件
    }
    SearchTableDataResponse struct{

    }
)