作者 yangfu

add services\users

正在显示 49 个修改的文件 包含 403 行增加123 行删除
version: v1
kind: Attribute
metadata:
name: desc
description: 描述
type:
primitive: int64
... ...
version: v1
kind: Attribute
metadata:
name: parentId
description: 父级ID
type:
primitive: int64
... ...
version: v1
kind: Attribute
metadata:
name: sort
description: 排序
type:
primitive: int
... ...
version: v1
kind: Attribute
metadata:
name: address
description: 公司地址
type:
primitive: string
... ...
version: v1
kind: Attribute
metadata:
name: businessLicense
description: 营业执照
type:
primitive: string
... ...
version: v1
kind: Attribute
metadata:
name: contacts
description: 联系人
type:
primitive: string
... ...
version: v1
kind: Attribute
metadata:
name: industryCategory
description: 所属行业
type:
primitive: string
... ...
version: v1
kind: Attribute
metadata:
name: logo
description: 公司Logo地址
type:
primitive: string
... ...
version: v1
kind: Attribute
metadata:
name: registStatus
description: 注册状态 1:已注册 2:待认证 3:已认证
type:
primitive: int
... ...
version: v1
kind: Attribute
metadata:
name: scale
description: 规模
type:
primitive: string
... ...
version: v1
kind: Attribute
metadata:
name: taxpayerCode
description: 纳税人识别号
type:
primitive: string
... ...
version: v1
kind: Attribute
metadata:
name: accessCode
description: 权限编码 users:edit
type:
primitive: string
... ...
version: v1
kind: Attribute
metadata:
name: code
description: 菜单编码 SYSTEM_USER_EDIT
type:
primitive: string
... ...
version: v1
kind: Attribute
metadata:
name: icon
description: 菜单图标
type:
primitive: string
... ...
version: v1
kind: Attribute
metadata:
name: isPublish
description: 菜单是否公开状态,[0:隐藏],[1:显示],默认显示
type:
primitive: int
... ...
version: v1
kind: Attribute
metadata:
name: menuName
description: 菜单名称
type:
primitive: string
... ...
version: v1
kind: Attribute
metadata:
name: menuType
description: 菜单类型 (目录catalog、菜单menu、按钮button)
type:
primitive: string
... ...
version: v1
kind: Attribute
metadata:
name: remark
description: 菜单说明
type:
primitive: string
... ...
version: v1
kind: Attribute
metadata:
name: depName
description: 部门名称
type:
primitive: string
... ...
version: v1
kind: Attribute
metadata:
name: isOrg
description: 是否是组织(是:1 不是:0)
type:
primitive: int
... ...
version: v1
kind: Attribute
metadata:
name: accessMenus
description: 有权限的菜单
type:
primitive: int64
... ...
version: v1
kind: Attribute
metadata:
name: avator
description: 头像
type:
primitive: string
... ...
version: v1
kind: Attribute
metadata:
name: email
description: 邮箱
type:
primitive: string
... ...
version: v1
kind: Attribute
metadata:
name: enableStatus
description: 启用状态(启用:1 禁用:2)
type:
primitive: int
... ...
version: v1
kind: Attribute
metadata:
name: favoriteMenus
description: 收藏的菜单(工作台)(菜单编码列表)
type:
array: string
... ...
version: v1
kind: Attribute
metadata:
name: password
description: 密码
type:
primitive: string
... ...
version: v1
kind: Attribute
metadata:
name: phone
description: 手机号码
type:
primitive: string
... ...
version: v1
kind: Attribute
metadata:
name: usersOrg
description: 用户关联的组织
type:
array: int64
... ...
version: v1
kind: Attribute
metadata:
name: usersRole
description: 用户关联的角色
type:
array: int64
... ...
... ... @@ -4,38 +4,16 @@ metadata:
name: companyInfo
description: 公司信息
attributes:
- name: companyName
description: 公司名称
type:
primitive: string
- name: scale
description: 规模
type:
primitive: string
- name: logo
description: 公司Logo地址
type:
primitive: string
- name: address
description: 公司地址
type:
primitive: string
- name: taxpayerCode
description: 纳税人识别号
type:
primitive: string
- name: businessLicense
description: 营业执照
type:
primitive: string
- name: industryCategory
description: 所属行业
type:
primitive: string
- name: contacts
description: 联系人
type:
primitive: string
- ref: companyName
required: true
- ref: scale
required: true
- ref: logo
required: true
- ref: industryCategory
required: true
- ref: contacts
required: true
- name: registTime
description: 注册时间
type:
... ...
... ... @@ -8,11 +8,7 @@ metadata:
required: true
- ref: orgName
required: true
- name: phone
description: 手机号
type:
primitive: string
- name: depName
description: 部门名称
type:
primitive: string
- ref: phone
required: true
- ref: depName
required: true
... ...
... ... @@ -6,38 +6,22 @@ metadata:
attributes:
- ref: menuId
required: true
- name: parentId
description: 父级id
type:
primitive: int64
- name: menuName
description: 菜单名称
type:
primitive: string
- name: code
description: 菜单编码 SYSTEM_USER_EDIT / 100101 (字符编码)
type:
primitive: string
- name: accessCode
description: 权限编码 users:edit
type:
primitive: string
- name: menuType
description: 菜单类型 (目录catalog、菜单menu、按钮button)
type:
primitive: string
- name: icon
description: 菜单图标
type:
primitive: string
- name: sort
description: 排序
type:
primitive: int
- name: remark
description: 菜单说明
type:
primitive: string
- ref: parentId
required: true
- ref: menuName
required: true
- ref: code
required: true
- ref: accessCode
required: true
- ref: menuType
required: true
- ref: icon
required: true
- ref: sort
required: true
- ref: remark
required: true
- name: category
description: 菜单类别 (web:1、app:2)
type:
... ... @@ -46,7 +30,5 @@ metadata:
description: 父级节点路径("0,11,12,")
type:
primitive: string
- name: isPublish
description: 菜单是否公开状态,[0:隐藏],[1:显示],默认显示
type:
primitive: int
- ref: isPublish
required: true
... ...
... ... @@ -19,10 +19,6 @@ metadata:
- ref: orgName
required: true
- name: isOrg
description: 是否是组织
type:
primitive: int
- name: parentId
description: 父级ID
type:
primitive: int64
required: true
- ref: parentId
required: true
... ...
... ... @@ -4,11 +4,7 @@ metadata:
name: phoneAuth
description: 手机认证 (base)
attributes:
- name: phone
description: 手机号
type:
primitive: string
- name: password
description: 密码
type:
primitive: string
- ref: phone
required: true
- ref: password
required: true
... ...
... ... @@ -12,14 +12,10 @@ metadata:
required: true
- ref: roleName
required: true
- name: menuAccess
description: 菜单权限列表
type:
array: int64
- name: desc
description: 角色描述
type:
primitive: string
- ref: accessMenus
required: true
- ref: desc
required: true
- name: ext
description: 扩展数据
type:
... ...
... ... @@ -6,15 +6,9 @@ metadata:
attributes:
- ref: usersName
required: true
- name: phone
description: 手机号码
type:
primitive: string
- name: avator
description: 头像
type:
primitive: string
- name: email
description: 邮箱
type:
primitive: string
- ref: phone
required: true
- ref: avator
required: true
- ref: email
required: true
... ...
version: v1
kind: Method
metadata:
name: createUsers
type: command
description: 创建用户信息
payload:
- 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
- ref: enableStatus
required: true
- ref: usersName
required: true
- ref: phone
required: true
- ref: avator
required: false
- ref: email
required: false
result:
- name: users
type:
schema: users
required: true
... ...
version: v1
kind: Method
metadata:
name: getUsers
type: query
description: 返回用户信息
payload:
- ref: usersId
required: true
result:
- name: users
type:
schema: users
required: true
... ...
version: v1
kind: Method
metadata:
name: listUsers
type: query
description: 返回用户信息列表
payload:
- ref: offset
required: true
- ref: limit
required: true
result:
- ref: count
required: true
- name: userss
type:
array: users
required: true
... ...
version: v1
kind: Method
metadata:
name: removeUsers
type: command
description: 移除用户信息
payload:
- ref: usersId
required: true
result:
- name: users
type:
schema: users
required: true
... ...
version: v1
kind: Method
metadata:
name: updateUsers
type: command
description: 更新用户信息
payload:
- ref: usersId
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
- ref: enableStatus
required: true
- ref: usersName
required: true
- ref: phone
required: true
- ref: avator
required: false
- ref: email
required: false
result:
- name: users
type:
schema: users
required: true
... ...
version: v1
kind: Service
metadata:
name: users
description: 用户信息
... ...
package models
type Menu struct {
tableName string `pg:"base.menu,alias:menu"`
tableName string `pg:"users.menu,alias:menu"`
// 菜单编号
MenuId int64 `pg:",pk"`
// 父级id
... ...
... ... @@ -69,7 +69,7 @@ func (repository *MenuRepository) Save(menu *domain.Menu) (*domain.Menu, error)
&menu.IsPublish,
&menu.IsSystem,
),
fmt.Sprintf("INSERT INTO base.menu (%s) VALUES (%s) RETURNING %s", insertFieldsSnippet, insertPlaceHoldersSnippet, returningFieldsSnippet),
fmt.Sprintf("INSERT INTO users.menu (%s) VALUES (%s) RETURNING %s", insertFieldsSnippet, insertPlaceHoldersSnippet, returningFieldsSnippet),
menu.ParentId,
menu.MenuName,
menu.Code,
... ... @@ -102,7 +102,7 @@ func (repository *MenuRepository) Save(menu *domain.Menu) (*domain.Menu, error)
&menu.IsPublish,
&menu.IsSystem,
),
fmt.Sprintf("UPDATE base.menu SET %s WHERE menu_id=? RETURNING %s", updateFieldsSnippet, returningFieldsSnippet),
fmt.Sprintf("UPDATE users.menu SET %s WHERE menu_id=? RETURNING %s", updateFieldsSnippet, returningFieldsSnippet),
menu.ParentId,
menu.MenuName,
menu.Code,
... ...
... ... @@ -39,7 +39,7 @@ var _ = Describe("创建菜单服务", func() {
})
})
AfterEach(func() {
_, err := pG.DB.Exec("DELETE FROM base.menu WHERE true")
_, err := pG.DB.Exec("DELETE FROM users.menu WHERE true")
Expect(err).NotTo(HaveOccurred())
})
})
... ...
... ... @@ -15,7 +15,7 @@ var _ = Describe("返回菜单服务", func() {
BeforeEach(func() {
_, err := pG.DB.QueryOne(
pg.Scan(&menuId),
"INSERT INTO base.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, is_system) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?) RETURNING menu_id",
1, 0, "testMenuName", "testCode", "testAccessCode", "testMenuType", "testIcon", 1, "testDesc", "testCategory", "testParentPath", 1, 1)
Expect(err).NotTo(HaveOccurred())
})
... ... @@ -36,7 +36,7 @@ var _ = Describe("返回菜单服务", func() {
})
})
AfterEach(func() {
_, err := pG.DB.Exec("DELETE FROM base.menu WHERE true")
_, err := pG.DB.Exec("DELETE FROM users.menu WHERE true")
Expect(err).NotTo(HaveOccurred())
})
})
... ...
... ... @@ -15,7 +15,7 @@ var _ = Describe("返回菜单服务列表", func() {
BeforeEach(func() {
_, err := pG.DB.QueryOne(
pg.Scan(&menuId),
"INSERT INTO base.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, is_system) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?) RETURNING menu_id",
1, 0, "testMenuName", "testCode", "testAccessCode", "testMenuType", "testIcon", 1, "testDesc", "testCategory", "testfullPath", 1, 1)
Expect(err).NotTo(HaveOccurred())
})
... ... @@ -40,7 +40,7 @@ var _ = Describe("返回菜单服务列表", func() {
})
})
AfterEach(func() {
_, err := pG.DB.Exec("DELETE FROM base.menu WHERE true")
_, err := pG.DB.Exec("DELETE FROM users.menu WHERE true")
Expect(err).NotTo(HaveOccurred())
})
})
... ...
... ... @@ -15,7 +15,7 @@ var _ = Describe("移除菜单服务", func() {
BeforeEach(func() {
_, err := pG.DB.QueryOne(
pg.Scan(&menuId),
"INSERT INTO base.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, is_system) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?) RETURNING menu_id",
1, 0, "testMenuName", "testCode", "testAccessCode", "testMenuType", "testIcon", 1, "testDesc", "testCategory", "testfullPath", 1, 1)
Expect(err).NotTo(HaveOccurred())
})
... ... @@ -36,7 +36,7 @@ var _ = Describe("移除菜单服务", func() {
})
})
AfterEach(func() {
_, err := pG.DB.Exec("DELETE FROM base.menu WHERE true")
_, err := pG.DB.Exec("DELETE FROM users.menu WHERE true")
Expect(err).NotTo(HaveOccurred())
})
})
... ...
... ... @@ -15,7 +15,7 @@ var _ = Describe("更新菜单服务", func() {
BeforeEach(func() {
_, err := pG.DB.QueryOne(
pg.Scan(&menuId),
"INSERT INTO base.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, is_system) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?) RETURNING menu_id",
1, 0, "testMenuName", "testCode", "testAccessCode", "testMenuType", "testIcon", 1, "testDesc", "testCategory", "testfullPath", 1, 1)
Expect(err).NotTo(HaveOccurred())
})
... ... @@ -48,7 +48,7 @@ var _ = Describe("更新菜单服务", func() {
})
})
AfterEach(func() {
_, err := pG.DB.Exec("DELETE FROM base.menu WHERE true")
_, err := pG.DB.Exec("DELETE FROM users.menu WHERE true")
Expect(err).NotTo(HaveOccurred())
})
})
... ...