作者 yangfu

add services org role users usersCompany

正在显示 44 个修改的文件 包含 555 行增加85 行删除
... ... @@ -2,6 +2,6 @@ version: v1
kind: Attribute
metadata:
name: isPublish
description: 菜单是否公开状态,[0:隐藏],[1:显示],默认显示
description: 菜单是否公开状态(上架、下架),[0:隐藏],[1:显示],默认显示
type:
primitive: int
... ...
... ... @@ -10,6 +10,8 @@ metadata:
required: true
- ref: logo
required: true
- ref: address
required: true
- ref: industryCategory
required: true
- ref: contacts
... ...
... ... @@ -12,3 +12,8 @@ metadata:
required: true
- ref: depName
required: true
- name: parentDepName
description: 父级部门名称
type:
primitive: string
required: true
... ...
... ... @@ -30,5 +30,8 @@ metadata:
description: 父级节点路径("0,11,12,")
type:
primitive: string
- ref: enableStatus
description: 启用状态(启用:1 禁用:0)
required: true
- ref: isPublish
required: true
... ...
... ... @@ -18,6 +18,10 @@ metadata:
required: true
- ref: orgName
required: true
- name: ext
description: 扩展数据
type:
schema: ext
- name: isOrg
required: true
- ref: parentId
... ...
version: v1
kind: Method
metadata:
name: companySignUp
type: command
description: 企业注册
payload:
- ref: companyName
required: true
- ref: contacts
required: true
- ref: phone
required: true
- ref: scale
required: true
- ref: industryCategory
required: true
- ref: password
required: true
result:
- name: users
type:
schema: users
required: true
... ...
version: v1
kind: Method
metadata:
name: resetPassword
type: command
description: 重置密码
payload:
- ref: phone
required: true
- ref: password
required: true
result:
- name: msg
description: 消息
type:
primitive: string
\ No newline at end of file
... ...
version: v1
kind: Service
metadata:
name: auth
description: 认证服务
... ...
... ... @@ -42,6 +42,9 @@ metadata:
description: 菜单说明
type:
primitive: string
- ref: enableStatus
description: 启用状态(启用:1 禁用:0)
required: true
- name: isPublish
description: 菜单是否公开状态,[0:隐藏],[1:显示],默认显示
type:
... ...
... ... @@ -43,6 +43,9 @@ metadata:
description: 菜单是否公开状态,[0:隐藏],[1:显示],默认显示
type:
primitive: int
- ref: enableStatus
description: 启用状态(启用:1 禁用:0)
required: true
result:
- name: menu
type:
... ...
version: v1
kind: Method
metadata:
name: createOrg
type: command
description: 创建组织管理
payload:
- ref: companyId
required: true
- ref: orgCode
required: true
- ref: orgName
required: true
- name: isOrg
required: true
- ref: parentId
required: true
result:
- name: org
type:
schema: org
required: true
... ...
version: v1
kind: Method
metadata:
name: getOrg
type: query
description: 返回组织管理
payload:
- ref: orgId
required: true
result:
- name: org
type:
schema: org
required: true
... ...
version: v1
kind: Method
metadata:
name: listOrg
type: query
description: 返回组织管理列表
payload:
- ref: offset
required: true
- ref: limit
required: true
- ref: orgCode
required: false
- ref: depName
required: false
- ref: parentId
required: false
result:
- ref: count
required: true
- name: orgs
type:
array: org
required: true
... ...
version: v1
kind: Method
metadata:
name: removeOrg
type: command
description: 移除组织管理
payload:
- ref: orgId
required: true
result:
- name: org
type:
schema: org
required: true
... ...
version: v1
kind: Method
metadata:
name: updateOrg
type: command
description: 更新组织管理
payload:
- ref: orgId
required: true
- ref: orgCode
required: true
- ref: orgName
required: true
- name: isOrg
required: true
- ref: parentId
required: true
result:
- name: org
type:
schema: org
required: true
... ...
version: v1
kind: Service
metadata:
name: org
description: 组织管理
... ...
version: v1
kind: Method
metadata:
name: createRole
type: command
description: 创建角色管理
payload:
- ref: roleName
required: true
- ref: desc
required: false
result:
- name: role
type:
schema: role
required: true
... ...
version: v1
kind: Method
metadata:
name: getRole
type: query
description: 返回角色管理
payload:
- ref: roleId
required: true
result:
- name: role
type:
schema: role
required: true
... ...
version: v1
kind: Method
metadata:
name: listRole
type: query
description: 返回角色管理列表
payload:
- ref: offset
required: true
- ref: limit
required: true
- ref: roleName
required: false
- ref: orgName
required: false
result:
- ref: count
required: true
- name: roles
type:
array: role
required: true
... ...
version: v1
kind: Method
metadata:
name: removeRole
type: command
description: 移除角色管理
payload:
- ref: roleId
required: true
result:
- name: role
type:
schema: role
required: true
... ...
version: v1
kind: Method
metadata:
name: updateRole
type: command
description: 更新角色管理
payload:
- ref: roleId
required: true
- ref: roleName
required: true
- ref: desc
required: false
result:
- name: role
type:
schema: role
required: true
... ...
version: v1
kind: Service
metadata:
name: role
description: 角色管理
... ...
version: v1
kind: Method
metadata:
name: check
type: command
description: 密码检查
payload:
- ref: usersId
required: true
- ref: phone
required: true
- ref: password
required: true
result:
- name: users
type:
schema: users
required: true
... ...
... ... @@ -5,38 +5,20 @@ metadata:
type: command
description: 创建用户信息
payload:
- ref: usersCode
- ref: usersId
required: true
- name: organizationId
description: 组织机构
- name: usersInfo
description: 用户信息
type:
primitive: int64
required: true
- name: departmentId
description: 所属部门
type:
primitive: int64
required: true
- name: usersOrg
description: 用户关联的组织
schema: usersInfo
- name: phoneAuth
description: 手机认证
type:
array: int64
required: false
- name: usersRole
description: 用户关联的角色
schemal: phoneAuth
- name: im
description: IM信息
type:
array: int64
required: false
- ref: enableStatus
required: true
- ref: usersName
required: true
- ref: phone
required: true
- ref: avator
required: false
- ref: email
required: false
schemal: im
result:
- name: users
type:
... ...
... ... @@ -12,7 +12,7 @@ metadata:
result:
- ref: count
required: true
- name: userss
- name: users
type:
array: users
required: true
... ...
version: v1
kind: Method
metadata:
name: phoneAuth
type: command
description: 手机认证
payload:
- ref: usersId
required: true
- ref: phone
required: true
- ref: password
required: true
result:
- name: users
type:
schema: users
required: true
... ...
... ... @@ -7,36 +7,18 @@ metadata:
payload:
- ref: usersId
required: true
- name: organizationId
description: 组织机构
- name: usersInfo
description: 用户信息
type:
primitive: int64
required: true
- name: departmentId
description: 所属部门
type:
primitive: int64
required: true
- name: usersOrg
description: 用户关联的组织
schema: usersInfo
- name: phoneAuth
description: 手机认证
type:
array: int64
required: false
- name: usersRole
description: 用户关联的角色
schemal: phoneAuth
- name: im
description: IM信息
type:
array: int64
required: false
- ref: enableStatus
required: true
- ref: usersName
required: true
- ref: phone
required: true
- ref: avator
required: false
- ref: email
required: false
schemal: im
result:
- name: users
type:
... ...
version: v1
kind: Method
metadata:
name: batchAdd
type: command
description: 批量添加
payload:
- ref: usersType
required: true
- name: users
description: 用户列表
type:
array: usersCompany
result:
- name: count
type:
primitive: int
required: true
... ...
version: v1
kind: Method
metadata:
name: batchEnable
type: command
description: 批量修改启用状态
payload:
- name: usersCompanyIds
type:
array: int64
required: true
- ref: enableStatus
required: true
result:
- name: usersCompany
type:
schema: usersCompany
required: true
... ...
version: v1
kind: Method
metadata:
name: batchResetPassword
type: command
description: 批量重置密码
payload:
- name: usersCompanyIds
type:
array: int64
required: true
- ref: password
required: true
result:
- name: usersCompany
type:
schema: usersCompany
required: true
... ...
version: v1
kind: Method
metadata:
name: createUsersCompany
type: command
description: 创建企业用户管理
payload:
- ref: companyId
required: true
- ref: usersType
required: true
- ref: usersCode
required: true
- name: organizationId
description: 组织机构
type:
primitive: int64
required: true
- name: departmentId
description: 所属部门
type:
primitive: int64
required: true
- name: usersOrg
description: 用户关联的组织
type:
array: int64
required: false
- name: usersRole
description: 用户关联的角色
type:
array: int64
required: false
- name: cooperationInfo
description: 共创信息 (共创用户有效)
type:
schema: cooperationInfo
required: false
- ref: enableStatus
required: true
- ref: usersName
required: true
- ref: phone
required: true
- ref: avator
required: false
- ref: email
required: false
result:
- name: usersCompany
type:
schema: usersCompany
required: true
... ...
version: v1
kind: Method
metadata:
name: getUsersCompany
type: query
description: 返回企业用户管理
payload:
- ref: usersCompanyId
required: true
result:
- name: usersCompany
type:
schema: usersCompany
required: true
... ...
version: v1
kind: Method
metadata:
name: listUsersCompany
type: query
description: 返回企业用户管理列表
payload:
- ref: offset
required: true
- ref: limit
required: true
- ref: userName
required: false
- ref: depName
required: false
- name: cooperationCompany
type:
primitive: string
required: false
result:
- ref: count
required: true
- name: usersCompanys
type:
array: usersCompany
required: true
... ...
version: v1
kind: Method
metadata:
name: removeUsersCompany
type: command
description: 移除企业用户管理
payload:
- ref: usersCompanyId
required: true
result:
- name: usersCompany
type:
schema: usersCompany
required: true
... ...
version: v1
kind: Method
metadata:
name: updateUsersCompany
type: command
description: 更新企业用户管理
payload:
- ref: usersCompanyId
required: true
- name: organizationId
description: 组织机构
type:
primitive: int64
required: true
- name: departmentId
description: 所属部门
type:
primitive: int64
required: true
- name: usersOrg
description: 用户关联的组织
type:
array: int64
required: false
- name: usersRole
description: 用户关联的角色
type:
array: int64
required: false
- name: cooperationInfo
description: 共创信息 (共创用户有效)
type:
schema: cooperationInfo
required: false
- ref: enableStatus
required: true
- ref: usersName
required: true
- ref: phone
required: true
- ref: avator
required: false
- ref: email
required: false
result:
- name: usersCompany
type:
schema: usersCompany
required: true
... ...
version: v1
kind: Service
metadata:
name: usersCompany
description: 企业用户管理
... ...
... ... @@ -48,8 +48,8 @@ type Menu struct {
ParentPath string `json:"parentPath"`
// 菜单是否公开状态,[0:隐藏],[1:显示],默认显示
IsPublish int `json:"isPublish"`
// 菜单是否是系统级,[0:否],[1:是],默认否
IsSystem int `json:"isSystem"`
// 启用状态(启用:1 禁用:0),默认启用
EnableStatus int `json:"enableStatus"`
}
type MenuRepository interface {
... ... @@ -100,8 +100,8 @@ func (menu *Menu) Update(data map[string]interface{}) error {
if isPublish, ok := data["isPublish"]; ok {
menu.IsPublish = isPublish.(int)
}
if isSystem, ok := data["isSystem"]; ok {
menu.IsSystem = isSystem.(int)
if enableStatus, ok := data["enableStatus"]; ok {
menu.EnableStatus = enableStatus.(int)
}
return nil
}
... ...
... ... @@ -26,6 +26,6 @@ type Menu struct {
ParentPath string
// 菜单是否公开状态,[0:隐藏],[1:显示],默认显示
IsPublish int
// 菜单是否是系统级,[0:否],[1:是],默认否
IsSystem int
// 启用状态(启用:1 禁用:0),默认启用
EnableStatus int
}
... ...
... ... @@ -7,18 +7,18 @@ import (
func TransformToMenuDomainModelFromPgModels(menuModel *models.Menu) (*domain.Menu, error) {
return &domain.Menu{
MenuId: menuModel.MenuId,
ParentId: menuModel.ParentId,
MenuName: menuModel.MenuName,
Code: menuModel.Code,
AccessCode: menuModel.AccessCode,
MenuType: menuModel.MenuType,
Icon: menuModel.Icon,
Sort: menuModel.Sort,
Remark: menuModel.Remark,
Category: menuModel.Category,
ParentPath: menuModel.ParentPath,
IsPublish: menuModel.IsPublish,
IsSystem: menuModel.IsSystem,
MenuId: menuModel.MenuId,
ParentId: menuModel.ParentId,
MenuName: menuModel.MenuName,
Code: menuModel.Code,
AccessCode: menuModel.AccessCode,
MenuType: menuModel.MenuType,
Icon: menuModel.Icon,
Sort: menuModel.Sort,
Remark: menuModel.Remark,
Category: menuModel.Category,
ParentPath: menuModel.ParentPath,
IsPublish: menuModel.IsPublish,
EnableStatus: menuModel.EnableStatus,
}, nil
}
... ...
... ... @@ -38,7 +38,7 @@ func (repository *MenuRepository) Save(menu *domain.Menu) (*domain.Menu, error)
"category",
"parent_path",
"is_publish",
"is_system",
"enable_status",
}
insertFieldsSnippet := sqlbuilder.SqlFieldsSnippet(sqlbuilder.RemoveSqlFields(sqlBuildFields, "menu_id"))
insertPlaceHoldersSnippet := sqlbuilder.SqlPlaceHoldersSnippet(sqlbuilder.RemoveSqlFields(sqlBuildFields, "menu_id"))
... ... @@ -67,7 +67,7 @@ func (repository *MenuRepository) Save(menu *domain.Menu) (*domain.Menu, error)
&menu.Category,
&menu.ParentPath,
&menu.IsPublish,
&menu.IsSystem,
&menu.EnableStatus,
),
fmt.Sprintf("INSERT INTO users.menu (%s) VALUES (%s) RETURNING %s", insertFieldsSnippet, insertPlaceHoldersSnippet, returningFieldsSnippet),
menu.ParentId,
... ... @@ -81,7 +81,7 @@ func (repository *MenuRepository) Save(menu *domain.Menu) (*domain.Menu, error)
menu.Category,
menu.ParentPath,
menu.IsPublish,
menu.IsSystem,
menu.EnableStatus,
); err != nil {
return menu, err
}
... ... @@ -100,7 +100,7 @@ func (repository *MenuRepository) Save(menu *domain.Menu) (*domain.Menu, error)
&menu.Category,
&menu.ParentPath,
&menu.IsPublish,
&menu.IsSystem,
&menu.EnableStatus,
),
fmt.Sprintf("UPDATE users.menu SET %s WHERE menu_id=? RETURNING %s", updateFieldsSnippet, returningFieldsSnippet),
menu.ParentId,
... ... @@ -114,7 +114,7 @@ func (repository *MenuRepository) Save(menu *domain.Menu) (*domain.Menu, error)
menu.Category,
menu.ParentPath,
menu.IsPublish,
menu.IsSystem,
menu.EnableStatus,
menu.Identify(),
); err != nil {
return menu, err
... ...
... ... @@ -15,7 +15,7 @@ var _ = Describe("返回菜单服务", func() {
BeforeEach(func() {
_, err := pG.DB.QueryOne(
pg.Scan(&menuId),
"INSERT INTO users.menu (menu_id, parent_id, menu_name, code, access_code, menu_type, icon, sort, remark, category, parent_path, is_publish, is_system) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?) RETURNING menu_id",
"INSERT INTO users.menu (menu_id, parent_id, menu_name, code, access_code, menu_type, icon, sort, remark, category, parent_path, is_publish, enable_status) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?) RETURNING menu_id",
1, 0, "testMenuName", "testCode", "testAccessCode", "testMenuType", "testIcon", 1, "testDesc", "testCategory", "testParentPath", 1, 1)
Expect(err).NotTo(HaveOccurred())
})
... ...
... ... @@ -15,7 +15,7 @@ var _ = Describe("返回菜单服务列表", func() {
BeforeEach(func() {
_, err := pG.DB.QueryOne(
pg.Scan(&menuId),
"INSERT INTO users.menu (menu_id, parent_id, menu_name, code, access_code, menu_type, icon, sort, remark, category, parent_path, is_publish, is_system) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?) RETURNING menu_id",
"INSERT INTO users.menu (menu_id, parent_id, menu_name, code, access_code, menu_type, icon, sort, remark, category, parent_path, is_publish, enable_status) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?) RETURNING menu_id",
1, 0, "testMenuName", "testCode", "testAccessCode", "testMenuType", "testIcon", 1, "testDesc", "testCategory", "testfullPath", 1, 1)
Expect(err).NotTo(HaveOccurred())
})
... ...
... ... @@ -15,7 +15,7 @@ var _ = Describe("移除菜单服务", func() {
BeforeEach(func() {
_, err := pG.DB.QueryOne(
pg.Scan(&menuId),
"INSERT INTO users.menu (menu_id, parent_id, menu_name, code, access_code, menu_type, icon, sort, remark, category, parent_path, is_publish, is_system) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?) RETURNING menu_id",
"INSERT INTO users.menu (menu_id, parent_id, menu_name, code, access_code, menu_type, icon, sort, remark, category, parent_path, is_publish, enable_status) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?) RETURNING menu_id",
1, 0, "testMenuName", "testCode", "testAccessCode", "testMenuType", "testIcon", 1, "testDesc", "testCategory", "testfullPath", 1, 1)
Expect(err).NotTo(HaveOccurred())
})
... ...
... ... @@ -15,7 +15,7 @@ var _ = Describe("更新菜单服务", func() {
BeforeEach(func() {
_, err := pG.DB.QueryOne(
pg.Scan(&menuId),
"INSERT INTO users.menu (menu_id, parent_id, menu_name, code, access_code, menu_type, icon, sort, remark, category, parent_path, is_publish, is_system) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?) RETURNING menu_id",
"INSERT INTO users.menu (menu_id, parent_id, menu_name, code, access_code, menu_type, icon, sort, remark, category, parent_path, is_publish, enable_status) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?) RETURNING menu_id",
1, 0, "testMenuName", "testCode", "testAccessCode", "testMenuType", "testIcon", 1, "testDesc", "testCategory", "testfullPath", 1, 1)
Expect(err).NotTo(HaveOccurred())
})
... ...