Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feat: department management #65

Merged
merged 8 commits into from
Feb 4, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion api/desc/all.api
Original file line number Diff line number Diff line change
Expand Up @@ -7,4 +7,5 @@ import "authority.api"
import "dictionary.api"
import "oauth.api"
import "token.api"
import "core.api"
import "core.api"
import "department.api"
4 changes: 2 additions & 2 deletions api/desc/base.api
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,7 @@ type StatusCodeReq {

// Status code | 状态码
// Required: true
Status uint64 `json:"status" validate:"number"`
Status uint32 `json:"status" validate:"number"`
}

// The request params of setting status code by UUID | 根据UUID设置状态参数
Expand All @@ -138,5 +138,5 @@ type StatusCodeUUIDReq {

// Status code | 状态码
// Required: true
Status uint64 `json:"status" validate:"number"`
Status uint32 `json:"status" validate:"number"`
}
128 changes: 128 additions & 0 deletions api/desc/department.api
Original file line number Diff line number Diff line change
@@ -0,0 +1,128 @@
import "base.api"

type (
// The response data of Department information | Department信息
DepartmentInfo {
BaseInfo

// Translated Name
Trans string `json:"trans"`

// Status
Status uint32 `json:"status"`

// Name
Name string `json:"name"`

// Ancestors
Ancestors string `json:"ancestors"`

// Leader
Leader string `json:"leader"`

// Phone
Phone string `json:"phone"`

// Email
Email string `json:"email"`

// Sort
Sort uint32 `json:"sort"`

// Remark
Remark string `json:"remark"`

// ParentId
ParentId uint64 `json:"parentId"`
}

// Create or update Department information request | 创建或更新Department信息
CreateOrUpdateDepartmentReq {
// ID
// Required: true
Id uint64 `json:"id"`

// Status
Status uint32 `json:"status"`

// Name
Name string `json:"name"`

// Ancestors
Ancestors string `json:"ancestors,optional"`

// Leader
Leader string `json:"leader"`

// Phone
Phone string `json:"phone"`

// Email
Email string `json:"email"`

// Sort
Sort uint32 `json:"sort"`

// Remark
Remark string `json:"remark"`

// ParentId
ParentId uint64 `json:"parentId"`
}

// The response data of Department list | Department列表数据
DepartmentListResp {
BaseDataInfo

// Department list data | Department 列表数据
Data DepartmentListInfo `json:"data"`
}

// Department list data | Department 列表数据
DepartmentListInfo {
BaseListInfo

// The API list data | Department 列表数据
Data []DepartmentInfo `json:"data"`
}

// Get department list request params | Department列表请求参数
DepartmentListReq {
PageInfo

// Name
Name string `json:"name,optional"`

// Leader
Leader string `json:"leader,optional"`
}
)

@server(
jwt: Auth
group: department
middleware: Authority
)

service core {
// Create or update Department information | 创建或更新Department
@handler createOrUpdateDepartment
post /department/create_or_update (CreateOrUpdateDepartmentReq) returns (BaseMsgResp)

// Delete Department information | 删除Department信息
@handler deleteDepartment
post /department/delete (IDReq) returns (BaseMsgResp)

// Get Department list | 获取Department列表
@handler getDepartmentList
post /department/list (DepartmentListReq) returns (DepartmentListResp)

// Delete Department information | 删除Department信息
@handler batchDeleteDepartment
post /department/batch_delete (IDsReq) returns (BaseMsgResp)

// Set department's status | 更新Department状态
@handler updateDepartmentStatus
post /department/status (StatusCodeReq) returns (BaseMsgResp)

}
8 changes: 4 additions & 4 deletions api/desc/dictionary.api
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ type (
Name string `json:"name"`

// Dictionary status | 字典状态
Status uint64 `json:"status"`
Status uint32 `json:"status"`

// Dictionary description | 字典描述
Description string `json:"description"`
Expand All @@ -48,7 +48,7 @@ type (

// Dictionary status | 字典状态
// Required: true
Status uint64 `json:"status" validate:"number"`
Status uint32 `json:"status" validate:"number"`

// Dictionary description | 字典描述
// Required: true
Expand Down Expand Up @@ -99,7 +99,7 @@ type (
Value string `json:"value"`

// Status | 状态
Status uint64 `json:"status"`
Status uint32 `json:"status"`
}

// The response data of dictionary KV list | 字典值的列表数据
Expand Down Expand Up @@ -142,7 +142,7 @@ type (

// Status | 状态
// Required: true
Status uint64 `json:"status" validate:"number"`
Status uint32 `json:"status" validate:"number"`

// Parent ID | 所属字典ID
// Required: true
Expand Down
21 changes: 7 additions & 14 deletions api/desc/menu.api
Original file line number Diff line number Diff line change
Expand Up @@ -46,12 +46,7 @@ type (
// If disabled | 是否禁用菜单
Disabled bool `json:"disabled"`

// in: body
Meta

// children | 子集
// in: body
Children []*MenuInfo `json:"children"`
}

// The meta data of menu | 菜单的meta数据
Expand All @@ -73,7 +68,7 @@ type (

// Current active menu, if not nil, it will active the tab | 当前激活的菜单
// Max length: 30
CurrentActiveMenu string `json:"currentActiveMenu,omitempty" validate:"max=30"`
CurrentActiveMenu string `json:"currentActiveMenu"`

// Do not keep alive the tab | 不缓存Tab
IgnoreKeepAlive bool `json:"ignoreKeepAlive" validate:"boolean"`
Expand All @@ -82,7 +77,7 @@ type (
HideTab bool `json:"hideTab" validate:"boolean"`

// Iframe path | 内嵌iframe的地址
FrameSrc string `json:"frameSrc,omitempty" validate:"max=100"`
FrameSrc string `json:"frameSrc"`

// The route carries parameters or not | 如果该路由会携带参数,且需要在tab页上面显示。则需要设置为true
CarryParam bool `json:"carryParam" validate:"boolean"`
Expand All @@ -97,7 +92,7 @@ type (
DynamicLevel uint32 `json:"dynamicLevel" validate:"number,lt=30"`

// The real path of the route without dynamic part | 动态路由的实际Path, 即去除路由的动态部分
RealPath string `json:"realPath,omitempty" validate:"max=200"`
RealPath string `json:"realPath"`
}

// The response data of menu list | 菜单列表返回数据
Expand All @@ -118,6 +113,10 @@ type (

// The response data of role menu list data | 角色菜单列表数据
GetMenuListBase {
// ID
// Required: true
Id uint64 `json:"id"`

// Menu type: directory or menu | 菜单类型: 目录或菜单
menuType uint32 `json:"type"`

Expand Down Expand Up @@ -145,12 +144,7 @@ type (
// If disabled | 是否禁用菜单
Disabled bool `json:"disabled"`

// in: body
Meta Meta `json:"meta"`

// children | 子集
// in: body
Children []*GetMenuListBase `json:"children"`
}

// The response data of role menu list, show after user login | 角色菜单列表数据, 登录后自动获取
Expand Down Expand Up @@ -215,7 +209,6 @@ type (
// Required: true
Disabled bool `json:"disabled" validate:"boolean"`

// in: body
Meta
}

Expand Down
4 changes: 2 additions & 2 deletions api/desc/token.api
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ type (
Source string `json:"source"`

// JWT status 0 ban 1 active | JWT状态, 0 禁止 1 正常
Status uint64 `json:"status"`
Status uint32 `json:"status"`

// Expire time | 过期时间
ExpiredAt int64 `json:"expiredAt"`
Expand Down Expand Up @@ -53,7 +53,7 @@ type (

// JWT status 0 ban 1 active | JWT状态, 0 禁止 1 正常
// Required: true
Status uint64 `json:"status" validate:"number"`
Status uint32 `json:"status" validate:"number"`

// Expire time | 过期时间
// Required: true
Expand Down
38 changes: 31 additions & 7 deletions api/desc/user.api
Original file line number Diff line number Diff line change
Expand Up @@ -175,12 +175,18 @@ type (
// The user's avatar path | 用户的头像路径
Avatar string `json:"avatar"`

// The user's layout mode | 用户的布局
SideMode string `json:"sideMode"`

// The user's status | 用户状态
// 1 normal, 2 ban | 1 正常 2 拉黑
Status uint64 `json:"status"`
Status uint32 `json:"status"`

// The home page that the user enters after logging in | 用户登陆后进入的首页
HomePath string `json:"homePath"`

// The description of user | 用户的描述信息
Description string `json:"desc"`

// User's department id | 用户的部门ID
DepartmentId uint64 `json:"departmentId"`
}

// The response data of user's basic information | 用户基本信息返回数据
Expand All @@ -206,8 +212,13 @@ type (
Avatar string `json:"avatar"`

// User's role information| 用户的角色信息
// in: body
Roles GetUserRoleInfo `json:"roles"`

// The home page that the user enters after logging in | 用户登陆后进入的首页
HomePath string `json:"homePath"`

// The description of user | 用户的描述信息
Description string `json:"desc"`
}

// The response data of user's basic role information | 用户角色信息数据
Expand Down Expand Up @@ -268,7 +279,7 @@ type (
// User's mobile phone number | 用户的手机号码
// Required: true
// Max length: 18
Mobile string `json:"mobile,optional" validate:"numeric,max=18"`
Mobile string `json:"mobile,optional" validate:"omitempty,numeric,max=18"`

// User's role id | 用户的角色ID
// Required: true
Expand All @@ -289,7 +300,17 @@ type (
// 1 normal, 2 ban | 1 正常 2 拉黑
// Required: true
// Maximum: 20
Status uint64 `json:"status" validate:"number,max=20"`
Status uint32 `json:"status" validate:"number,max=20"`

// User's department id | 用户的部门ID
// Required: true
DepartmentId uint64 `json:"departmentId"`

// The home page that the user enters after logging in | 用户登陆后进入的首页
HomePath string `json:"homePath,optional"`

// The description of user | 用户的描述信息
Description string `json:"desc,optional"`
}

// Get user list request | 获取用户列表请求参数
Expand Down Expand Up @@ -322,6 +343,9 @@ type (
// User's role ID | 用户的角色ID
// Maximum: 1000
RoleId uint64 `json:"roleId,optional" validate:"omitempty,number,max=1000"`

// The user's department ID | 用户所属部门ID
DepartmentId uint64 `json:"departmentId,optional"`
}
)

Expand Down
Loading