department.api 1.6 KB
syntax = "v1"

info(
    title: "部门分组"
    desc: "部门分组"
    author: "zz"
    email: "email"
    version: "v1"
)

@server(
    prefix: v1
    group: department
    middleware: LoginStatusCheck
    jwt: SystemAuth
)
service Core {
    @doc "部门列表"
    @handler systemList
    post /system/department/list (DepartmentListRequest) returns (DepartmentListResponse)

    @doc "部门-新增"
    @handler systemAdd
    post /system/department/add (DepartmentAddRequest) returns (DepartmentGetResponse)

    @doc "部门-详情"
    @handler systemGet
    get /system/department/:id (DepartmentGetRequest) returns (DepartmentGetResponse)

    @doc "部门-更新"
    @handler systemUpdate
    put /system/department/:id (DepartmentUpdateRequest) returns (DepartmentGetResponse)

    @doc "部门-删除"
    @handler systemDelete
    delete /system/department/:id (DepartmentGetRequest) returns (DepartmentGetResponse)
}

type (
    DepartmentAddRequest  {
        Name string  `json:"name"`       // 分组名称
        Ids  []int64 `json:"ids"`        // 用户ID
    }

    DepartmentGetRequest {
        Id int64 `path:"id"`
    }

    DepartmentGetResponse struct{
        Department Department `json:"department"`
    }

    DepartmentUpdateRequest {
        Id   int64   `path:"id"`
        Name string  `json:"name"`
        Ids  []int64 `json:"ids"`        // 用户ID
    }

    DepartmentListRequest  {
        Page int `json:"page"`
        Size int `json:"size"`
    }

    DepartmentListResponse {
        List []Department     `json:"list"`
        Total int64           `json:"total"`
    }

)