正在显示
137 个修改的文件
包含
417 行增加
和
2018 行删除
| 1 | -version: v1 | ||
| 2 | -kind: HttpApi | ||
| 3 | -metadata: | ||
| 4 | - service: menu | ||
| 5 | - path: /menus | ||
| 6 | - endpoints: | ||
| 7 | - - method: createMenu | ||
| 8 | - route: | ||
| 9 | - post: / | ||
| 10 | - - method: updateMenu | ||
| 11 | - route: | ||
| 12 | - put: /{menuId} | ||
| 13 | - - method: getMenu | ||
| 14 | - route: | ||
| 15 | - get: /{menuId} | ||
| 16 | - - method: removeMenu | ||
| 17 | - route: | ||
| 18 | - delete: /{menuId} | ||
| 19 | - - method: listMenu | ||
| 20 | - route: | ||
| 21 | - get: / | ||
| 22 | - params: | ||
| 23 | - - name: offset | ||
| 24 | - - name: limit |
| 1 | -version: v1 | ||
| 2 | -kind: Schema | ||
| 3 | -metadata: | ||
| 4 | - name: app | ||
| 5 | - description: app项目管理 | ||
| 6 | - attributes: | ||
| 7 | - - name: appId | ||
| 8 | - description: appId | ||
| 9 | - type: | ||
| 10 | - primitive: int64 | ||
| 11 | - - name: project | ||
| 12 | - description: 项目标识 ability | ||
| 13 | - type: | ||
| 14 | - primitive: string | ||
| 15 | - - name: app | ||
| 16 | - description: 应用标识 ability.boss.pad | ||
| 17 | - type: | ||
| 18 | - primitive: string | ||
| 19 | - - name: icon | ||
| 20 | - description: 图标地址 | ||
| 21 | - type: | ||
| 22 | - primitive: string | ||
| 23 | - - name: remark | ||
| 24 | - description: 备注信息 | ||
| 25 | - type: | ||
| 26 | - primitive: string | ||
| 27 | - - ref: createAt | ||
| 28 | - required: true | ||
| 29 | - - ref: updateAt | ||
| 30 | - required: true | ||
| 31 | - - ref: deleteAt | ||
| 32 | - required: true |
| 1 | -version: v1 | ||
| 2 | -kind: Schema | ||
| 3 | -metadata: | ||
| 4 | - name: appVersion | ||
| 5 | - description: App版本管理 | ||
| 6 | - attributes: | ||
| 7 | - - name: appVersionId | ||
| 8 | - description: app版本id | ||
| 9 | - type: | ||
| 10 | - primitive: int64 | ||
| 11 | - - name: app | ||
| 12 | - description: 应用 | ||
| 13 | - type: | ||
| 14 | - schema: app | ||
| 15 | - - name: os | ||
| 16 | - description: 设备类型 0:IOS 1:安卓 | ||
| 17 | - type: | ||
| 18 | - primitive: int | ||
| 19 | - - name: version | ||
| 20 | - description: 版本信息 | ||
| 21 | - type: | ||
| 22 | - schema: appVersionInfo | ||
| 23 | - - name: remark | ||
| 24 | - description: 备注信息 | ||
| 25 | - type: | ||
| 26 | - primitive: string | ||
| 27 | - - ref: createAt | ||
| 28 | - required: true | ||
| 29 | - - ref: updateAt | ||
| 30 | - required: true | ||
| 31 | - - ref: deleteAt | ||
| 32 | - required: true |
| 1 | -version: v1 | ||
| 2 | -kind: Schema | ||
| 3 | -metadata: | ||
| 4 | - name: appVersionInfo | ||
| 5 | - description: app 版本信息 | ||
| 6 | - attributes: | ||
| 7 | - - name: versionNo | ||
| 8 | - description: 版本号 | ||
| 9 | - type: | ||
| 10 | - primitive: string | ||
| 11 | - - name: versionName | ||
| 12 | - description: 版本名称 | ||
| 13 | - type: | ||
| 14 | - primitive: string | ||
| 15 | - - name: title | ||
| 16 | - description: 标题 | ||
| 17 | - type: | ||
| 18 | - primitive: string | ||
| 19 | - - name: summary | ||
| 20 | - description: 版本概要 | ||
| 21 | - type: | ||
| 22 | - primitive: string | ||
| 23 | - - name: content | ||
| 24 | - description: 版本内容 | ||
| 25 | - type: | ||
| 26 | - primitive: string | ||
| 27 | - - name: deviceType | ||
| 28 | - description: 设备类型 0:ios , 1:android | ||
| 29 | - type: | ||
| 30 | - primitive: int | ||
| 31 | - - name: downloadPage | ||
| 32 | - description: 下载页面 | ||
| 33 | - type: | ||
| 34 | - primitive: string | ||
| 35 | - - name: downloadFile | ||
| 36 | - description: 文件下载地址 | ||
| 37 | - type: | ||
| 38 | - primitive: string | ||
| 39 | - - name: updateType | ||
| 40 | - description: 更新类型 0不需要更新 1是引导更新 2是强制更新 | ||
| 41 | - type: | ||
| 42 | - primitive: int | ||
| 43 | - - name: channel | ||
| 44 | - description: 更新的渠道 当前渠道 0_AppStore、1_fir平台、2_华为、3_小米、4_魅族、5_oppo、6_vivo、7_360、8_百度、9_应用宝、10_其他(使用应用宝地址) | ||
| 45 | - type: | ||
| 46 | - array: int |
| 1 | -version: v1 | ||
| 2 | -kind: Schema | ||
| 3 | -metadata: | ||
| 4 | - name: company | ||
| 5 | - description: 企业信息 (base) | ||
| 6 | - attributes: | ||
| 7 | - - ref: companyId | ||
| 8 | - required: true | ||
| 9 | - - name: companyConfig | ||
| 10 | - description: 企业配置信息 | ||
| 11 | - type: | ||
| 12 | - schema: companyConfig | ||
| 13 | - - name: companyInfo | ||
| 14 | - description: 企业基本信息 | ||
| 15 | - type: | ||
| 16 | - schema: companyInfo | ||
| 17 | - - name: status | ||
| 18 | - description: 公司状态 | ||
| 19 | - type: | ||
| 20 | - primitive: int | ||
| 21 | - - ref: createAt | ||
| 22 | - required: false | ||
| 23 | - - ref: updateAt | ||
| 24 | - required: false | ||
| 25 | - |
| 1 | -version: v1 | ||
| 2 | -kind: Schema | ||
| 3 | -metadata: | ||
| 4 | - name: companyInfo | ||
| 5 | - description: 公司信息 | ||
| 6 | - attributes: | ||
| 7 | - - ref: companyName | ||
| 8 | - required: true | ||
| 9 | - - ref: scale | ||
| 10 | - required: true | ||
| 11 | - - ref: logo | ||
| 12 | - required: true | ||
| 13 | - - ref: address | ||
| 14 | - required: true | ||
| 15 | - - ref: industryCategory | ||
| 16 | - required: true | ||
| 17 | - - ref: contacts | ||
| 18 | - required: true | ||
| 19 | - - name: registTime | ||
| 20 | - description: 注册时间 | ||
| 21 | - type: | ||
| 22 | - primitive: datetime | ||
| 23 | - - name: registStatus | ||
| 24 | - description: 注册状态 1:已注册 2:待认证 3:已认证 | ||
| 25 | - type: | ||
| 26 | - primitive: int |
| 1 | -version: v1 | ||
| 2 | -kind: Schema | ||
| 3 | -metadata: | ||
| 4 | - name: cooperationInfo | ||
| 5 | - description: 共创信息 | ||
| 6 | - attributes: | ||
| 7 | - - name: cooperationCompany | ||
| 8 | - description: 共创公司 | ||
| 9 | - type: | ||
| 10 | - primitive: string | ||
| 11 | - - name: cooperationDeadline | ||
| 12 | - description: 共创到期时间 (yyyy-MM-dd) | ||
| 13 | - type: | ||
| 14 | - primitive: datetime |
| 1 | -version: v1 | ||
| 2 | -kind: Schema | ||
| 3 | -metadata: | ||
| 4 | - name: credentialAuth | ||
| 5 | - description: 凭证认证 (base) | ||
| 6 | - attributes: | ||
| 7 | - - name: credential | ||
| 8 | - description: 凭证 | ||
| 9 | - type: | ||
| 10 | - primitive: string | ||
| 11 | - - name: deviceType | ||
| 12 | - description: 设备类型 | ||
| 13 | - type: | ||
| 14 | - primitive: string | ||
| 15 | - - name: expire | ||
| 16 | - description: 过期时间蹉(unix) | ||
| 17 | - type: | ||
| 18 | - primitive: int64 |
| 1 | -version: v1 | ||
| 2 | -kind: Schema | ||
| 3 | -metadata: | ||
| 4 | - name: customizeMenus | ||
| 5 | - description: 自定义菜单 (base)(菜单维护) | ||
| 6 | - attributes: | ||
| 7 | - - name: customizeMenusId | ||
| 8 | - description: 自定义菜单id | ||
| 9 | - type: | ||
| 10 | - primitive: int64 | ||
| 11 | - - ref: companyId | ||
| 12 | - required: true | ||
| 13 | - - name: menuId | ||
| 14 | - description: 菜单id | ||
| 15 | - type: | ||
| 16 | - primitive: int64 | ||
| 17 | - - name: menuName | ||
| 18 | - description: 菜单名称 | ||
| 19 | - type: | ||
| 20 | - primitive: string | ||
| 21 | - - name: menuAlias | ||
| 22 | - description: 菜单别名 | ||
| 23 | - type: | ||
| 24 | - primitive: string | ||
| 25 | - - name: sort | ||
| 26 | - description: 排序 | ||
| 27 | - type: | ||
| 28 | - primitive: int |
| 1 | -version: v1 | ||
| 2 | -kind: Schema | ||
| 3 | -metadata: | ||
| 4 | - name: dataColumn | ||
| 5 | - description: 数据列 | ||
| 6 | - attributes: | ||
| 7 | - - name: dataIndex | ||
| 8 | - description: 数据列字段代码名称 | ||
| 9 | - type: | ||
| 10 | - primitive: string | ||
| 11 | - - name: title | ||
| 12 | - description: 数据列字段中文描述 | ||
| 13 | - type: | ||
| 14 | - primitive: string | ||
| 15 | - - name: sortBy | ||
| 16 | - description: 默认的排序 | ||
| 17 | - type: | ||
| 18 | - primitive: int64 | ||
| 19 | - - name: isDefault | ||
| 20 | - description: 是否是默认配置字段 | ||
| 21 | - type: | ||
| 22 | - primitive: int |
| 1 | -version: v1 | ||
| 2 | -kind: Schema | ||
| 3 | -metadata: | ||
| 4 | - name: dataColumnPerson | ||
| 5 | - description: 列表设置个人:页面列表数据的输出列的个人配置 | ||
| 6 | - attributes: | ||
| 7 | - - name: dataColumnPersonId | ||
| 8 | - description: 数据id | ||
| 9 | - type: | ||
| 10 | - primitive: int64 | ||
| 11 | - - name: resource | ||
| 12 | - description: 资源 (列如表单 user) | ||
| 13 | - type: | ||
| 14 | - primitive: string | ||
| 15 | - - name: columns | ||
| 16 | - description: 配置的用户显示的字段,例 `["c1","c2"]`` | ||
| 17 | - type: | ||
| 18 | - array: string | ||
| 19 | - - name: usersId | ||
| 20 | - description: 归属的用户id | ||
| 21 | - type: | ||
| 22 | - primitive: int64 |
| 1 | -version: v1 | ||
| 2 | -kind: Schema | ||
| 3 | -metadata: | ||
| 4 | - name: dataColumnSys | ||
| 5 | - description: 列表设置系统:页面列表数据的输出列的系统全局配置 | ||
| 6 | - attributes: | ||
| 7 | - - name: dataColumnSysId | ||
| 8 | - description: 数据id | ||
| 9 | - type: | ||
| 10 | - primitive: int64 | ||
| 11 | - - name: resource | ||
| 12 | - description: 资源 (列如表单 user) | ||
| 13 | - type: | ||
| 14 | - primitive: string | ||
| 15 | - - name: columns | ||
| 16 | - description: 数据列字段代码名称 | ||
| 17 | - type: | ||
| 18 | - array: dataColumn |
| 1 | -version: v1 | ||
| 2 | -kind: Schema | ||
| 3 | -metadata: | ||
| 4 | - name: ext | ||
| 5 | - description: 冗余附加数据 | ||
| 6 | - attributes: | ||
| 7 | - - ref: usersName | ||
| 8 | - required: true | ||
| 9 | - - ref: orgName | ||
| 10 | - required: true | ||
| 11 | - - ref: phone | ||
| 12 | - required: true | ||
| 13 | - - ref: depName | ||
| 14 | - required: true | ||
| 15 | - - name: parentDepName | ||
| 16 | - description: 父级部门名称 | ||
| 17 | - type: | ||
| 18 | - primitive: string | ||
| 19 | - required: true |
| 1 | -version: v1 | ||
| 2 | -kind: Schema | ||
| 3 | -metadata: | ||
| 4 | - name: im | ||
| 5 | - description: 冗余附加数据 | ||
| 6 | - attributes: | ||
| 7 | - - name: accid | ||
| 8 | - description: 网易云信ID | ||
| 9 | - type: | ||
| 10 | - primitive: string | ||
| 11 | - - name: imToken | ||
| 12 | - description: 网易云信Token | ||
| 13 | - type: | ||
| 14 | - primitive: string | ||
| 15 | - - name: csAccountId | ||
| 16 | - description: 系统分配客服ID | ||
| 17 | - type: | ||
| 18 | - primitive: string |
| 1 | -version: v1 | ||
| 2 | -kind: Schema | ||
| 3 | -metadata: | ||
| 4 | - name: menu | ||
| 5 | - description: 系统菜单 | ||
| 6 | - attributes: | ||
| 7 | - - ref: menuId | ||
| 8 | - required: true | ||
| 9 | - - ref: parentId | ||
| 10 | - required: true | ||
| 11 | - - ref: menuName | ||
| 12 | - required: true | ||
| 13 | - - ref: code | ||
| 14 | - required: true | ||
| 15 | - - ref: accessCode | ||
| 16 | - required: true | ||
| 17 | - - ref: menuType | ||
| 18 | - required: true | ||
| 19 | - - ref: icon | ||
| 20 | - required: true | ||
| 21 | - - ref: sort | ||
| 22 | - required: true | ||
| 23 | - - ref: remark | ||
| 24 | - required: true | ||
| 25 | - - name: category | ||
| 26 | - description: 菜单类别 (web:1、app:2) | ||
| 27 | - type: | ||
| 28 | - primitive: string | ||
| 29 | - - name: parentPath | ||
| 30 | - description: 父级节点路径("0,11,12,") | ||
| 31 | - type: | ||
| 32 | - primitive: string | ||
| 33 | - - ref: enableStatus | ||
| 34 | - description: 启用状态(启用:1 禁用:0) | ||
| 35 | - required: true | ||
| 36 | - - ref: isPublish | ||
| 37 | - required: true |
| 1 | -version: v1 | ||
| 2 | -kind: Schema | ||
| 3 | -metadata: | ||
| 4 | - name: org | ||
| 5 | - description: 组织 organization | ||
| 6 | - attributes: | ||
| 7 | - - ref: orgId | ||
| 8 | - required: true | ||
| 9 | - - ref: companyId | ||
| 10 | - required: true | ||
| 11 | - - ref: createAt | ||
| 12 | - required: true | ||
| 13 | - - ref: updateAt | ||
| 14 | - required: true | ||
| 15 | - - ref: deleteAt | ||
| 16 | - required: true | ||
| 17 | - - ref: orgCode | ||
| 18 | - required: true | ||
| 19 | - - ref: orgName | ||
| 20 | - required: true | ||
| 21 | - - name: ext | ||
| 22 | - description: 扩展数据 | ||
| 23 | - type: | ||
| 24 | - schema: ext | ||
| 25 | - - name: isOrg | ||
| 26 | - required: true | ||
| 27 | - - ref: parentId | ||
| 28 | - required: true |
| 1 | -version: v1 | ||
| 2 | -kind: Schema | ||
| 3 | -metadata: | ||
| 4 | - name: role | ||
| 5 | - description: 角色 (base) | ||
| 6 | - attributes: | ||
| 7 | - - ref: roleId | ||
| 8 | - required: true | ||
| 9 | - - ref: companyId | ||
| 10 | - required: true | ||
| 11 | - - ref: orgId | ||
| 12 | - required: true | ||
| 13 | - - ref: roleName | ||
| 14 | - required: true | ||
| 15 | - - ref: accessMenus | ||
| 16 | - required: true | ||
| 17 | - - ref: desc | ||
| 18 | - required: true | ||
| 19 | - - name: ext | ||
| 20 | - description: 扩展数据 | ||
| 21 | - type: | ||
| 22 | - schema: ext | ||
| 23 | - - ref: createAt | ||
| 24 | - required: true | ||
| 25 | - - ref: updateAt | ||
| 26 | - required: true |
| 1 | -version: v1 | ||
| 2 | -kind: Schema | ||
| 3 | -metadata: | ||
| 4 | - name: users | ||
| 5 | - description: 用户(base) | ||
| 6 | - attributes: | ||
| 7 | - - ref: usersId | ||
| 8 | - required: true | ||
| 9 | - - name: usersInfo | ||
| 10 | - description: 用户信息 | ||
| 11 | - type: | ||
| 12 | - schema: usersInfo | ||
| 13 | - - name: phoneAuth | ||
| 14 | - description: 手机认证 | ||
| 15 | - type: | ||
| 16 | - schemal: phoneAuth | ||
| 17 | - - name: im | ||
| 18 | - description: IM信息 | ||
| 19 | - type: | ||
| 20 | - schemal: im | ||
| 21 | - - ref: createAt | ||
| 22 | - required: true | ||
| 23 | - - ref: updateAt | ||
| 24 | - required: true |
| 1 | -version: v1 | ||
| 2 | -kind: Schema | ||
| 3 | -metadata: | ||
| 4 | - name: usersCompany | ||
| 5 | - description: 用户 (base) | ||
| 6 | - attributes: | ||
| 7 | - - ref: usersCompanyId | ||
| 8 | - required: true | ||
| 9 | - - ref: companyId | ||
| 10 | - required: true | ||
| 11 | - - ref: usersId | ||
| 12 | - required: true | ||
| 13 | - - ref: usersType | ||
| 14 | - required: true | ||
| 15 | - - ref: usersCode | ||
| 16 | - required: true | ||
| 17 | - - name: organizationId | ||
| 18 | - description: 组织机构 | ||
| 19 | - type: | ||
| 20 | - primitive: int64 | ||
| 21 | - - name: departmentId | ||
| 22 | - description: 所属部门 | ||
| 23 | - type: | ||
| 24 | - primitive: int64 | ||
| 25 | - - name: usersOrg | ||
| 26 | - description: 用户关联的组织 | ||
| 27 | - type: | ||
| 28 | - array: int64 | ||
| 29 | - - name: usersRole | ||
| 30 | - description: 用户关联的角色 | ||
| 31 | - type: | ||
| 32 | - array: int64 | ||
| 33 | - - name: favoriteMenus | ||
| 34 | - description: 收藏的菜单(工作台)(菜单编码列表) | ||
| 35 | - type: | ||
| 36 | - array: string | ||
| 37 | - - name: cooperationInfo | ||
| 38 | - description: 共创信息 (共创用户有效) | ||
| 39 | - type: | ||
| 40 | - schema: cooperationInfo | ||
| 41 | - - name: enableStatus | ||
| 42 | - description: 启用状态(启用:1 禁用:2) | ||
| 43 | - type: | ||
| 44 | - primitive: int | ||
| 45 | - - name: ext | ||
| 46 | - description: 扩展数据 | ||
| 47 | - type: | ||
| 48 | - schema: ext | ||
| 49 | - - ref: createAt | ||
| 50 | - required: true | ||
| 51 | - - ref: updateAt | ||
| 52 | - required: true |
| 1 | -version: v1 | ||
| 2 | -kind: Method | ||
| 3 | -metadata: | ||
| 4 | - name: companySignUp | ||
| 5 | - type: command | ||
| 6 | - description: 企业注册 | ||
| 7 | - payload: | ||
| 8 | - - ref: companyName | ||
| 9 | - required: true | ||
| 10 | - - ref: contacts | ||
| 11 | - required: true | ||
| 12 | - - ref: phone | ||
| 13 | - required: true | ||
| 14 | - - ref: scale | ||
| 15 | - required: true | ||
| 16 | - - ref: industryCategory | ||
| 17 | - required: true | ||
| 18 | - - ref: password | ||
| 19 | - required: true | ||
| 20 | - result: | ||
| 21 | - - name: users | ||
| 22 | - type: | ||
| 23 | - schema: users | ||
| 24 | - required: true |
| 1 | -version: v1 | ||
| 2 | -kind: Method | ||
| 3 | -metadata: | ||
| 4 | - name: createMenu | ||
| 5 | - type: command | ||
| 6 | - description: 创建菜单服务 | ||
| 7 | - payload: | ||
| 8 | - - name: parentId | ||
| 9 | - description: 父级id | ||
| 10 | - type: | ||
| 11 | - primitive: int64 | ||
| 12 | - - name: menuName | ||
| 13 | - description: 菜单名称 | ||
| 14 | - type: | ||
| 15 | - primitive: string | ||
| 16 | - required: true | ||
| 17 | - - name: code | ||
| 18 | - description: 菜单编码 SYSTEM_USER_EDIT / 100101 (字符编码) | ||
| 19 | - type: | ||
| 20 | - primitive: string | ||
| 21 | - required: true | ||
| 22 | - - name: accessCode | ||
| 23 | - description: 权限编码 users:edit | ||
| 24 | - type: | ||
| 25 | - primitive: string | ||
| 26 | - required: true | ||
| 27 | - - name: menuType | ||
| 28 | - description: 菜单类型 (目录catalog、菜单menu、按钮button) | ||
| 29 | - type: | ||
| 30 | - primitive: string | ||
| 31 | - required: true | ||
| 32 | - - name: icon | ||
| 33 | - description: 菜单图标 | ||
| 34 | - type: | ||
| 35 | - primitive: string | ||
| 36 | - - name: sort | ||
| 37 | - description: 排序 | ||
| 38 | - type: | ||
| 39 | - primitive: int | ||
| 40 | - required: true | ||
| 41 | - - name: remark | ||
| 42 | - description: 菜单说明 | ||
| 43 | - type: | ||
| 44 | - primitive: string | ||
| 45 | - - ref: enableStatus | ||
| 46 | - description: 启用状态(启用:1 禁用:0) | ||
| 47 | - required: true | ||
| 48 | - - name: isPublish | ||
| 49 | - description: 菜单是否公开状态,[0:隐藏],[1:显示],默认显示 | ||
| 50 | - type: | ||
| 51 | - primitive: int | ||
| 52 | - required: true | ||
| 53 | - result: | ||
| 54 | - - name: menu | ||
| 55 | - type: | ||
| 56 | - schema: menu | ||
| 57 | - required: true |
| 1 | -version: v1 | ||
| 2 | -kind: Method | ||
| 3 | -metadata: | ||
| 4 | - name: listMenu | ||
| 5 | - type: query | ||
| 6 | - description: 返回菜单服务列表 | ||
| 7 | - payload: | ||
| 8 | - - name: menuCategory | ||
| 9 | - description: 菜单类别 web app | ||
| 10 | - required: false | ||
| 11 | - type: | ||
| 12 | - primitive: string | ||
| 13 | - - name: parentId | ||
| 14 | - description: 菜单父级id 0:查询所有 n:父级id为n的菜单列表 | ||
| 15 | - required: false | ||
| 16 | - type: | ||
| 17 | - primitive: int64 | ||
| 18 | - - name: menuName | ||
| 19 | - description: 菜单名称过滤 | ||
| 20 | - required: false | ||
| 21 | - type: | ||
| 22 | - primitive: string | ||
| 23 | - - ref: offset | ||
| 24 | - required: true | ||
| 25 | - - ref: limit | ||
| 26 | - required: true | ||
| 27 | - result: | ||
| 28 | - - ref: count | ||
| 29 | - required: true | ||
| 30 | - - name: menus | ||
| 31 | - type: | ||
| 32 | - array: menu | ||
| 33 | - required: true |
| 1 | -version: v1 | ||
| 2 | -kind: Method | ||
| 3 | -metadata: | ||
| 4 | - name: updateMenu | ||
| 5 | - type: command | ||
| 6 | - description: 更新菜单服务 | ||
| 7 | - payload: | ||
| 8 | - - ref: menuId | ||
| 9 | - required: true | ||
| 10 | - - name: menuName | ||
| 11 | - description: 菜单名称 | ||
| 12 | - type: | ||
| 13 | - primitive: string | ||
| 14 | - required: true | ||
| 15 | - - name: code | ||
| 16 | - description: 菜单编码 SYSTEM_USER_EDIT / 100101 (字符编码) | ||
| 17 | - type: | ||
| 18 | - primitive: string | ||
| 19 | - required: true | ||
| 20 | - - name: accessCode | ||
| 21 | - description: 权限编码 users:edit | ||
| 22 | - type: | ||
| 23 | - primitive: string | ||
| 24 | - - name: menuType | ||
| 25 | - description: 菜单类型 (目录catalog、菜单menu、按钮button) | ||
| 26 | - type: | ||
| 27 | - primitive: string | ||
| 28 | - required: true | ||
| 29 | - - name: icon | ||
| 30 | - description: 菜单图标 | ||
| 31 | - type: | ||
| 32 | - primitive: string | ||
| 33 | - - name: sort | ||
| 34 | - description: 排序 | ||
| 35 | - type: | ||
| 36 | - primitive: int | ||
| 37 | - required: true | ||
| 38 | - - name: remark | ||
| 39 | - description: 菜单说明 | ||
| 40 | - type: | ||
| 41 | - primitive: string | ||
| 42 | - - name: isPublish | ||
| 43 | - description: 菜单是否公开状态,[0:隐藏],[1:显示],默认显示 | ||
| 44 | - type: | ||
| 45 | - primitive: int | ||
| 46 | - - ref: enableStatus | ||
| 47 | - description: 启用状态(启用:1 禁用:0) | ||
| 48 | - required: true | ||
| 49 | - result: | ||
| 50 | - - name: menu | ||
| 51 | - type: | ||
| 52 | - schema: menu | ||
| 53 | - required: true |
| 1 | -version: v1 | ||
| 2 | -kind: Method | ||
| 3 | -metadata: | ||
| 4 | - name: createOrg | ||
| 5 | - type: command | ||
| 6 | - description: 创建组织管理 | ||
| 7 | - payload: | ||
| 8 | - - ref: companyId | ||
| 9 | - required: true | ||
| 10 | - - ref: orgCode | ||
| 11 | - required: true | ||
| 12 | - - ref: orgName | ||
| 13 | - required: true | ||
| 14 | - - name: isOrg | ||
| 15 | - required: true | ||
| 16 | - - ref: parentId | ||
| 17 | - required: true | ||
| 18 | - result: | ||
| 19 | - - name: org | ||
| 20 | - type: | ||
| 21 | - schema: org | ||
| 22 | - required: true |
| 1 | -version: v1 | ||
| 2 | -kind: Method | ||
| 3 | -metadata: | ||
| 4 | - name: listOrg | ||
| 5 | - type: query | ||
| 6 | - description: 返回组织管理列表 | ||
| 7 | - payload: | ||
| 8 | - - ref: offset | ||
| 9 | - required: true | ||
| 10 | - - ref: limit | ||
| 11 | - required: true | ||
| 12 | - - ref: orgCode | ||
| 13 | - required: false | ||
| 14 | - - ref: depName | ||
| 15 | - required: false | ||
| 16 | - - ref: parentId | ||
| 17 | - required: false | ||
| 18 | - result: | ||
| 19 | - - ref: count | ||
| 20 | - required: true | ||
| 21 | - - name: orgs | ||
| 22 | - type: | ||
| 23 | - array: org | ||
| 24 | - required: true |
| 1 | -version: v1 | ||
| 2 | -kind: Method | ||
| 3 | -metadata: | ||
| 4 | - name: updateOrg | ||
| 5 | - type: command | ||
| 6 | - description: 更新组织管理 | ||
| 7 | - payload: | ||
| 8 | - - ref: orgId | ||
| 9 | - required: true | ||
| 10 | - - ref: orgCode | ||
| 11 | - required: true | ||
| 12 | - - ref: orgName | ||
| 13 | - required: true | ||
| 14 | - - name: isOrg | ||
| 15 | - required: true | ||
| 16 | - - ref: parentId | ||
| 17 | - required: true | ||
| 18 | - result: | ||
| 19 | - - name: org | ||
| 20 | - type: | ||
| 21 | - schema: org | ||
| 22 | - required: true |
| 1 | -version: v1 | ||
| 2 | -kind: Method | ||
| 3 | -metadata: | ||
| 4 | - name: listRole | ||
| 5 | - type: query | ||
| 6 | - description: 返回角色管理列表 | ||
| 7 | - payload: | ||
| 8 | - - ref: offset | ||
| 9 | - required: true | ||
| 10 | - - ref: limit | ||
| 11 | - required: true | ||
| 12 | - - ref: roleName | ||
| 13 | - required: false | ||
| 14 | - - ref: orgName | ||
| 15 | - required: false | ||
| 16 | - result: | ||
| 17 | - - ref: count | ||
| 18 | - required: true | ||
| 19 | - - name: roles | ||
| 20 | - type: | ||
| 21 | - array: role | ||
| 22 | - required: true |
| 1 | -version: v1 | ||
| 2 | -kind: Method | ||
| 3 | -metadata: | ||
| 4 | - name: updateRole | ||
| 5 | - type: command | ||
| 6 | - description: 更新角色管理 | ||
| 7 | - payload: | ||
| 8 | - - ref: roleId | ||
| 9 | - required: true | ||
| 10 | - - ref: roleName | ||
| 11 | - required: true | ||
| 12 | - - ref: desc | ||
| 13 | - required: false | ||
| 14 | - result: | ||
| 15 | - - name: role | ||
| 16 | - type: | ||
| 17 | - schema: role | ||
| 18 | - required: true |
| 1 | -version: v1 | ||
| 2 | -kind: Method | ||
| 3 | -metadata: | ||
| 4 | - name: check | ||
| 5 | - type: command | ||
| 6 | - description: 密码检查 | ||
| 7 | - payload: | ||
| 8 | - - ref: usersId | ||
| 9 | - required: true | ||
| 10 | - - ref: phone | ||
| 11 | - required: true | ||
| 12 | - - ref: password | ||
| 13 | - required: true | ||
| 14 | - result: | ||
| 15 | - - name: users | ||
| 16 | - type: | ||
| 17 | - schema: users | ||
| 18 | - required: true |
| 1 | -version: v1 | ||
| 2 | -kind: Method | ||
| 3 | -metadata: | ||
| 4 | - name: createUsers | ||
| 5 | - type: command | ||
| 6 | - description: 创建用户信息 | ||
| 7 | - payload: | ||
| 8 | - - ref: usersId | ||
| 9 | - required: true | ||
| 10 | - - name: usersInfo | ||
| 11 | - description: 用户信息 | ||
| 12 | - type: | ||
| 13 | - schema: usersInfo | ||
| 14 | - - name: phoneAuth | ||
| 15 | - description: 手机认证 | ||
| 16 | - type: | ||
| 17 | - schemal: phoneAuth | ||
| 18 | - - name: im | ||
| 19 | - description: IM信息 | ||
| 20 | - type: | ||
| 21 | - schemal: im | ||
| 22 | - result: | ||
| 23 | - - name: users | ||
| 24 | - type: | ||
| 25 | - schema: users | ||
| 26 | - required: true |
| 1 | -version: v1 | ||
| 2 | -kind: Method | ||
| 3 | -metadata: | ||
| 4 | - name: listUsers | ||
| 5 | - type: query | ||
| 6 | - description: 返回用户信息列表 | ||
| 7 | - payload: | ||
| 8 | - - ref: offset | ||
| 9 | - required: true | ||
| 10 | - - ref: limit | ||
| 11 | - required: true | ||
| 12 | - result: | ||
| 13 | - - ref: count | ||
| 14 | - required: true | ||
| 15 | - - name: users | ||
| 16 | - type: | ||
| 17 | - array: users | ||
| 18 | - required: true |
| 1 | -version: v1 | ||
| 2 | -kind: Method | ||
| 3 | -metadata: | ||
| 4 | - name: phoneAuth | ||
| 5 | - type: command | ||
| 6 | - description: 手机认证 | ||
| 7 | - payload: | ||
| 8 | - - ref: usersId | ||
| 9 | - required: true | ||
| 10 | - - ref: phone | ||
| 11 | - required: true | ||
| 12 | - - ref: password | ||
| 13 | - required: true | ||
| 14 | - result: | ||
| 15 | - - name: users | ||
| 16 | - type: | ||
| 17 | - schema: users | ||
| 18 | - required: true |
| 1 | -version: v1 | ||
| 2 | -kind: Method | ||
| 3 | -metadata: | ||
| 4 | - name: updateUsers | ||
| 5 | - type: command | ||
| 6 | - description: 更新用户信息 | ||
| 7 | - payload: | ||
| 8 | - - ref: usersId | ||
| 9 | - required: true | ||
| 10 | - - name: usersInfo | ||
| 11 | - description: 用户信息 | ||
| 12 | - type: | ||
| 13 | - schema: usersInfo | ||
| 14 | - - name: phoneAuth | ||
| 15 | - description: 手机认证 | ||
| 16 | - type: | ||
| 17 | - schemal: phoneAuth | ||
| 18 | - - name: im | ||
| 19 | - description: IM信息 | ||
| 20 | - type: | ||
| 21 | - schemal: im | ||
| 22 | - result: | ||
| 23 | - - name: users | ||
| 24 | - type: | ||
| 25 | - schema: users | ||
| 26 | - required: true |
| 1 | -version: v1 | ||
| 2 | -kind: Method | ||
| 3 | -metadata: | ||
| 4 | - name: batchAdd | ||
| 5 | - type: command | ||
| 6 | - description: 批量添加 | ||
| 7 | - payload: | ||
| 8 | - - ref: usersType | ||
| 9 | - required: true | ||
| 10 | - - name: users | ||
| 11 | - description: 用户列表 | ||
| 12 | - type: | ||
| 13 | - array: usersCompany | ||
| 14 | - result: | ||
| 15 | - - name: count | ||
| 16 | - type: | ||
| 17 | - primitive: int | ||
| 18 | - required: true |
| 1 | -version: v1 | ||
| 2 | -kind: Method | ||
| 3 | -metadata: | ||
| 4 | - name: batchEnable | ||
| 5 | - type: command | ||
| 6 | - description: 批量修改启用状态 | ||
| 7 | - payload: | ||
| 8 | - - name: usersCompanyIds | ||
| 9 | - type: | ||
| 10 | - array: int64 | ||
| 11 | - required: true | ||
| 12 | - - ref: enableStatus | ||
| 13 | - required: true | ||
| 14 | - result: | ||
| 15 | - - name: usersCompany | ||
| 16 | - type: | ||
| 17 | - schema: usersCompany | ||
| 18 | - required: true |
| 1 | -version: v1 | ||
| 2 | -kind: Method | ||
| 3 | -metadata: | ||
| 4 | - name: batchResetPassword | ||
| 5 | - type: command | ||
| 6 | - description: 批量重置密码 | ||
| 7 | - payload: | ||
| 8 | - - name: usersCompanyIds | ||
| 9 | - type: | ||
| 10 | - array: int64 | ||
| 11 | - required: true | ||
| 12 | - - ref: password | ||
| 13 | - required: true | ||
| 14 | - result: | ||
| 15 | - - name: usersCompany | ||
| 16 | - type: | ||
| 17 | - schema: usersCompany | ||
| 18 | - required: true |
| 1 | -version: v1 | ||
| 2 | -kind: Method | ||
| 3 | -metadata: | ||
| 4 | - name: createUsersCompany | ||
| 5 | - type: command | ||
| 6 | - description: 创建企业用户管理 | ||
| 7 | - payload: | ||
| 8 | - - ref: companyId | ||
| 9 | - required: true | ||
| 10 | - - ref: usersType | ||
| 11 | - required: true | ||
| 12 | - - ref: usersCode | ||
| 13 | - required: true | ||
| 14 | - - name: organizationId | ||
| 15 | - description: 组织机构 | ||
| 16 | - type: | ||
| 17 | - primitive: int64 | ||
| 18 | - required: true | ||
| 19 | - - name: departmentId | ||
| 20 | - description: 所属部门 | ||
| 21 | - type: | ||
| 22 | - primitive: int64 | ||
| 23 | - required: true | ||
| 24 | - - name: usersOrg | ||
| 25 | - description: 用户关联的组织 | ||
| 26 | - type: | ||
| 27 | - array: int64 | ||
| 28 | - required: false | ||
| 29 | - - name: usersRole | ||
| 30 | - description: 用户关联的角色 | ||
| 31 | - type: | ||
| 32 | - array: int64 | ||
| 33 | - required: false | ||
| 34 | - - name: cooperationInfo | ||
| 35 | - description: 共创信息 (共创用户有效) | ||
| 36 | - type: | ||
| 37 | - schema: cooperationInfo | ||
| 38 | - required: false | ||
| 39 | - - ref: enableStatus | ||
| 40 | - required: true | ||
| 41 | - - ref: usersName | ||
| 42 | - required: true | ||
| 43 | - - ref: phone | ||
| 44 | - required: true | ||
| 45 | - - ref: avator | ||
| 46 | - required: false | ||
| 47 | - - ref: email | ||
| 48 | - required: false | ||
| 49 | - result: | ||
| 50 | - - name: usersCompany | ||
| 51 | - type: | ||
| 52 | - schema: usersCompany | ||
| 53 | - required: true |
| 1 | -version: v1 | ||
| 2 | -kind: Method | ||
| 3 | -metadata: | ||
| 4 | - name: listUsersCompany | ||
| 5 | - type: query | ||
| 6 | - description: 返回企业用户管理列表 | ||
| 7 | - payload: | ||
| 8 | - - ref: offset | ||
| 9 | - required: true | ||
| 10 | - - ref: limit | ||
| 11 | - required: true | ||
| 12 | - - ref: userName | ||
| 13 | - required: false | ||
| 14 | - - ref: depName | ||
| 15 | - required: false | ||
| 16 | - - name: cooperationCompany | ||
| 17 | - type: | ||
| 18 | - primitive: string | ||
| 19 | - required: false | ||
| 20 | - result: | ||
| 21 | - - ref: count | ||
| 22 | - required: true | ||
| 23 | - - name: usersCompanys | ||
| 24 | - type: | ||
| 25 | - array: usersCompany | ||
| 26 | - required: true |
| 1 | -version: v1 | ||
| 2 | -kind: Method | ||
| 3 | -metadata: | ||
| 4 | - name: updateUsersCompany | ||
| 5 | - type: command | ||
| 6 | - description: 更新企业用户管理 | ||
| 7 | - payload: | ||
| 8 | - - ref: usersCompanyId | ||
| 9 | - required: true | ||
| 10 | - - name: organizationId | ||
| 11 | - description: 组织机构 | ||
| 12 | - type: | ||
| 13 | - primitive: int64 | ||
| 14 | - required: true | ||
| 15 | - - name: departmentId | ||
| 16 | - description: 所属部门 | ||
| 17 | - type: | ||
| 18 | - primitive: int64 | ||
| 19 | - required: true | ||
| 20 | - - name: usersOrg | ||
| 21 | - description: 用户关联的组织 | ||
| 22 | - type: | ||
| 23 | - array: int64 | ||
| 24 | - required: false | ||
| 25 | - - name: usersRole | ||
| 26 | - description: 用户关联的角色 | ||
| 27 | - type: | ||
| 28 | - array: int64 | ||
| 29 | - required: false | ||
| 30 | - - name: cooperationInfo | ||
| 31 | - description: 共创信息 (共创用户有效) | ||
| 32 | - type: | ||
| 33 | - schema: cooperationInfo | ||
| 34 | - required: false | ||
| 35 | - - ref: enableStatus | ||
| 36 | - required: true | ||
| 37 | - - ref: usersName | ||
| 38 | - required: true | ||
| 39 | - - ref: phone | ||
| 40 | - required: true | ||
| 41 | - - ref: avator | ||
| 42 | - required: false | ||
| 43 | - - ref: email | ||
| 44 | - required: false | ||
| 45 | - result: | ||
| 46 | - - name: usersCompany | ||
| 47 | - type: | ||
| 48 | - schema: usersCompany | ||
| 49 | - required: true |
pkg/application/common/service/common.go
0 → 100644
| 1 | +package service | ||
| 2 | + | ||
| 3 | +type CommonService struct { | ||
| 4 | +} | ||
| 5 | + | ||
| 6 | +// 创建菜单服务 | ||
| 7 | +func (commonService *CommonService) DictionarySearch(codes []string) (interface{}, error) { | ||
| 8 | + type dictItem struct { | ||
| 9 | + ItemCode string `json:"itemCode"` | ||
| 10 | + ItemValue string `json:"itemValue"` | ||
| 11 | + } | ||
| 12 | + dictionaries := make([]interface{}, 0) | ||
| 13 | + for i := range codes { | ||
| 14 | + switch codes[i] { | ||
| 15 | + case "MenuType": | ||
| 16 | + dictionaries = append(dictionaries, map[string]interface{}{ | ||
| 17 | + "dictName": "菜单类型", | ||
| 18 | + "dictItems": []dictItem{ | ||
| 19 | + {"目录", "catalog"}, | ||
| 20 | + {"菜单", "menu"}, | ||
| 21 | + {"按钮", "button"}, | ||
| 22 | + }, | ||
| 23 | + }) | ||
| 24 | + } | ||
| 25 | + } | ||
| 26 | + return map[string]interface{}{"dictionary": dictionaries}, nil | ||
| 27 | +} |
| @@ -30,20 +30,20 @@ func CreateRoleRepository(options map[string]interface{}) (domain.RoleRepository | @@ -30,20 +30,20 @@ func CreateRoleRepository(options map[string]interface{}) (domain.RoleRepository | ||
| 30 | return repository.NewRoleRepository(transactionContext) | 30 | return repository.NewRoleRepository(transactionContext) |
| 31 | } | 31 | } |
| 32 | 32 | ||
| 33 | -func CreateUsersBaseRepository(options map[string]interface{}) (domain.UsersBaseRepository, error) { | 33 | +func CreateUserBaseRepository(options map[string]interface{}) (domain.UserBaseRepository, error) { |
| 34 | var transactionContext *pg.TransactionContext | 34 | var transactionContext *pg.TransactionContext |
| 35 | if value, ok := options["transactionContext"]; ok { | 35 | if value, ok := options["transactionContext"]; ok { |
| 36 | transactionContext = value.(*pg.TransactionContext) | 36 | transactionContext = value.(*pg.TransactionContext) |
| 37 | } | 37 | } |
| 38 | - return repository.NewUsersBaseRepository(transactionContext) | 38 | + return repository.NewUserBaseRepository(transactionContext) |
| 39 | } | 39 | } |
| 40 | 40 | ||
| 41 | -func CreateUsersRepository(options map[string]interface{}) (domain.UsersRepository, error) { | 41 | +func CreateUserRepository(options map[string]interface{}) (domain.UserRepository, error) { |
| 42 | var transactionContext *pg.TransactionContext | 42 | var transactionContext *pg.TransactionContext |
| 43 | if value, ok := options["transactionContext"]; ok { | 43 | if value, ok := options["transactionContext"]; ok { |
| 44 | transactionContext = value.(*pg.TransactionContext) | 44 | transactionContext = value.(*pg.TransactionContext) |
| 45 | } | 45 | } |
| 46 | - return repository.NewUsersRepository(transactionContext) | 46 | + return repository.NewUserRepository(transactionContext) |
| 47 | } | 47 | } |
| 48 | 48 | ||
| 49 | func CreateCompanyRepository(options map[string]interface{}) (domain.CompanyRepository, error) { | 49 | func CreateCompanyRepository(options map[string]interface{}) (domain.CompanyRepository, error) { |
| @@ -13,7 +13,7 @@ type CreateMenuCommand struct { | @@ -13,7 +13,7 @@ type CreateMenuCommand struct { | ||
| 13 | MenuName string `json:"menuName" valid:"Required"` | 13 | MenuName string `json:"menuName" valid:"Required"` |
| 14 | // 菜单编码 SYSTEM_USER_EDIT / 100101 (字符编码) | 14 | // 菜单编码 SYSTEM_USER_EDIT / 100101 (字符编码) |
| 15 | Code string `json:"code" valid:"Required"` | 15 | Code string `json:"code" valid:"Required"` |
| 16 | - // 权限编码 users:edit | 16 | + // 权限编码 user:edit |
| 17 | AccessCode string `json:"accessCode"` | 17 | AccessCode string `json:"accessCode"` |
| 18 | // 菜单类型 (目录catalog、菜单menu、按钮button) | 18 | // 菜单类型 (目录catalog、菜单menu、按钮button) |
| 19 | MenuType string `json:"menuType" valid:"Required"` | 19 | MenuType string `json:"menuType" valid:"Required"` |
| @@ -15,7 +15,7 @@ type UpdateMenuCommand struct { | @@ -15,7 +15,7 @@ type UpdateMenuCommand struct { | ||
| 15 | MenuName string `json:"menuName" valid:"Required"` | 15 | MenuName string `json:"menuName" valid:"Required"` |
| 16 | // 菜单编码 SYSTEM_USER_EDIT / 100101 (字符编码) | 16 | // 菜单编码 SYSTEM_USER_EDIT / 100101 (字符编码) |
| 17 | Code string `json:"code" valid:"Required"` | 17 | Code string `json:"code" valid:"Required"` |
| 18 | - // 权限编码 users:edit | 18 | + // 权限编码 user:edit |
| 19 | AccessCode string `json:"accessCode,omitempty"` | 19 | AccessCode string `json:"accessCode,omitempty"` |
| 20 | // 菜单类型 (目录catalog、菜单menu、按钮button) | 20 | // 菜单类型 (目录catalog、菜单menu、按钮button) |
| 21 | MenuType string `json:"menuType" valid:"Required"` | 21 | MenuType string `json:"menuType" valid:"Required"` |
| @@ -3,7 +3,7 @@ package domain | @@ -3,7 +3,7 @@ package domain | ||
| 3 | // 冗余附加数据 | 3 | // 冗余附加数据 |
| 4 | type Ext struct { | 4 | type Ext struct { |
| 5 | // 用户姓名 | 5 | // 用户姓名 |
| 6 | - UsersName string `json:"usersName,omitempty"` | 6 | + UserName string `json:"userName,omitempty"` |
| 7 | // 组织名称 | 7 | // 组织名称 |
| 8 | OrgName string `json:"orgName,omitempty"` | 8 | OrgName string `json:"orgName,omitempty"` |
| 9 | // 手机号码 | 9 | // 手机号码 |
| @@ -44,7 +44,7 @@ type Menu struct { | @@ -44,7 +44,7 @@ type Menu struct { | ||
| 44 | MenuName string `json:"menuName,omitempty"` | 44 | MenuName string `json:"menuName,omitempty"` |
| 45 | // 菜单编码 SYSTEM_USER_EDIT / 100101 (字符编码) | 45 | // 菜单编码 SYSTEM_USER_EDIT / 100101 (字符编码) |
| 46 | Code string `json:"code,omitempty"` | 46 | Code string `json:"code,omitempty"` |
| 47 | - // 权限编码 users:edit | 47 | + // 权限编码 user:edit |
| 48 | AccessCode string `json:"accessCode,omitempty"` | 48 | AccessCode string `json:"accessCode,omitempty"` |
| 49 | // 菜单类型 (目录catalog、菜单menu、按钮button) | 49 | // 菜单类型 (目录catalog、菜单menu、按钮button) |
| 50 | MenuType string `json:"menuType,omitempty"` | 50 | MenuType string `json:"menuType,omitempty"` |
| @@ -60,8 +60,8 @@ func (org *Org) Update(data map[string]interface{}) error { | @@ -60,8 +60,8 @@ func (org *Org) Update(data map[string]interface{}) error { | ||
| 60 | if orgName, ok := data["orgName"]; ok { | 60 | if orgName, ok := data["orgName"]; ok { |
| 61 | org.OrgName = orgName.(string) | 61 | org.OrgName = orgName.(string) |
| 62 | } | 62 | } |
| 63 | - if usersName, ok := data["usersName"]; ok { | ||
| 64 | - org.Ext.UsersName = usersName.(string) | 63 | + if userName, ok := data["userName"]; ok { |
| 64 | + org.Ext.UserName = userName.(string) | ||
| 65 | } | 65 | } |
| 66 | if orgName, ok := data["orgName"]; ok { | 66 | if orgName, ok := data["orgName"]; ok { |
| 67 | org.Ext.OrgName = orgName.(string) | 67 | org.Ext.OrgName = orgName.(string) |
| @@ -86,3 +86,22 @@ func (org *Org) Update(data map[string]interface{}) error { | @@ -86,3 +86,22 @@ func (org *Org) Update(data map[string]interface{}) error { | ||
| 86 | } | 86 | } |
| 87 | return nil | 87 | return nil |
| 88 | } | 88 | } |
| 89 | + | ||
| 90 | +// 部门 | ||
| 91 | +type Department struct { | ||
| 92 | + // 部门ID | ||
| 93 | + DepartmentId int64 `json:"departmentId"` | ||
| 94 | + // 部门名称 | ||
| 95 | + DepartmentName string `json:"departmentName"` | ||
| 96 | + // 部门编号 | ||
| 97 | + DepartmentNumber string `json:"departmentNumber"` | ||
| 98 | +} | ||
| 99 | + | ||
| 100 | +// 通过组织获取当前部门信息 | ||
| 101 | +func (org *Org) ConvDep() *Department { | ||
| 102 | + return &Department{ | ||
| 103 | + DepartmentId: org.OrgId, | ||
| 104 | + DepartmentName: org.OrgName, | ||
| 105 | + DepartmentNumber: org.OrgCode, | ||
| 106 | + } | ||
| 107 | +} |
| @@ -65,8 +65,8 @@ func (role *Role) Update(data map[string]interface{}) error { | @@ -65,8 +65,8 @@ func (role *Role) Update(data map[string]interface{}) error { | ||
| 65 | if desc, ok := data["desc"]; ok { | 65 | if desc, ok := data["desc"]; ok { |
| 66 | role.Desc = desc.(int64) | 66 | role.Desc = desc.(int64) |
| 67 | } | 67 | } |
| 68 | - if usersName, ok := data["usersName"]; ok { | ||
| 69 | - role.Ext.UsersName = usersName.(string) | 68 | + if userName, ok := data["userName"]; ok { |
| 69 | + role.Ext.UserName = userName.(string) | ||
| 70 | } | 70 | } |
| 71 | if orgName, ok := data["orgName"]; ok { | 71 | if orgName, ok := data["orgName"]; ok { |
| 72 | role.Ext.OrgName = orgName.(string) | 72 | role.Ext.OrgName = orgName.(string) |
| @@ -4,40 +4,44 @@ import "time" | @@ -4,40 +4,44 @@ import "time" | ||
| 4 | 4 | ||
| 5 | // 用户类型 | 5 | // 用户类型 |
| 6 | const ( | 6 | const ( |
| 7 | - UsersTypeEmployee = 1 | ||
| 8 | - UsersTypeCooperation = 2 | ||
| 9 | - UsersTypeCompanyAdmin = 1024 | 7 | + UserTypeEmployee = 1 |
| 8 | + UserTypeCooperation = 2 | ||
| 9 | + UserTypeCompanyAdmin = 1024 | ||
| 10 | ) | 10 | ) |
| 11 | 11 | ||
| 12 | // 用户状态 | 12 | // 用户状态 |
| 13 | const ( | 13 | const ( |
| 14 | - UserStatusEnable UsersStatus = 1 | ||
| 15 | - UserStatusDisable UsersStatus = 2 | ||
| 16 | - UserStatusDestroy UsersStatus = 3 | 14 | + UserStatusEnable UserStatus = 1 |
| 15 | + UserStatusDisable UserStatus = 2 | ||
| 16 | + UserStatusDestroy UserStatus = 3 | ||
| 17 | ) | 17 | ) |
| 18 | 18 | ||
| 19 | // 用户 | 19 | // 用户 |
| 20 | -type Users struct { | 20 | +type User struct { |
| 21 | // 用户Id 用户唯一标识 | 21 | // 用户Id 用户唯一标识 |
| 22 | - UsersId int64 `json:"usersId,omitempty"` | 22 | + UserId int64 `json:"userId,omitempty"` |
| 23 | // 企业id | 23 | // 企业id |
| 24 | CompanyId int64 `json:"companyId,omitempty"` | 24 | CompanyId int64 `json:"companyId,omitempty"` |
| 25 | // 用户基础数据id | 25 | // 用户基础数据id |
| 26 | - UsersBaseId int64 `json:"usersBaseId,omitempty"` | 26 | + UserBaseId int64 `json:"userBaseId,omitempty"` |
| 27 | // 用户类型 1:企业内部用户(内部添加) 2:共创用户 1024:企业注册用户(注册添加) | 27 | // 用户类型 1:企业内部用户(内部添加) 2:共创用户 1024:企业注册用户(注册添加) |
| 28 | - UsersType int `json:"usersType,omitempty"` | 28 | + UserType int `json:"userType,omitempty"` |
| 29 | // 用户编号 企业内标识 | 29 | // 用户编号 企业内标识 |
| 30 | - UsersCode string `json:"usersCode,omitempty"` | 30 | + UserCode string `json:"userCode,omitempty"` |
| 31 | // 组织机构 | 31 | // 组织机构 |
| 32 | OrganizationId int64 `json:"organizationId,omitempty"` | 32 | OrganizationId int64 `json:"organizationId,omitempty"` |
| 33 | + // 组织机构 | ||
| 34 | + Organization *Org `json:"org,omitempty"` | ||
| 33 | // 所属部门 | 35 | // 所属部门 |
| 34 | DepartmentId int64 `json:"departmentId,omitempty"` | 36 | DepartmentId int64 `json:"departmentId,omitempty"` |
| 35 | - // 用户信息 (冗余,数据存在usersBase里面) | ||
| 36 | - UsersInfo *UsersInfo `json:"usersInfo,omitempty"` | 37 | + // 部门 |
| 38 | + Department *Department `json:"department,omitempty"` | ||
| 39 | + // 用户信息 (冗余,数据存在userBase里面) | ||
| 40 | + UserInfo *UserInfo `json:"userInfo,omitempty"` | ||
| 37 | // 用户关联的组织 | 41 | // 用户关联的组织 |
| 38 | - UsersOrg []*Org `json:"usersOrg,omitempty"` | 42 | + UserOrg []*Org `json:"userOrg,omitempty"` |
| 39 | // 用户关联的角色 | 43 | // 用户关联的角色 |
| 40 | - UsersRole []*Role `json:"usersRole,omitempty"` | 44 | + UserRole []*Role `json:"userRole,omitempty"` |
| 41 | // 收藏的菜单(工作台)(菜单编码列表) | 45 | // 收藏的菜单(工作台)(菜单编码列表) |
| 42 | FavoriteMenus []string `json:"favoriteMenus,omitempty"` | 46 | FavoriteMenus []string `json:"favoriteMenus,omitempty"` |
| 43 | // 共创信息 (共创用户有效) | 47 | // 共创信息 (共创用户有效) |
| @@ -52,94 +56,94 @@ type Users struct { | @@ -52,94 +56,94 @@ type Users struct { | ||
| 52 | UpdatedAt time.Time `json:"updatedAt,omitempty"` | 56 | UpdatedAt time.Time `json:"updatedAt,omitempty"` |
| 53 | } | 57 | } |
| 54 | 58 | ||
| 55 | -type UsersRepository interface { | ||
| 56 | - Save(users *Users) (*Users, error) | ||
| 57 | - Remove(users *Users) (*Users, error) | ||
| 58 | - FindOne(queryOptions map[string]interface{}) (*Users, error) | ||
| 59 | - Find(queryOptions map[string]interface{}) (int64, []*Users, error) | 59 | +type UserRepository interface { |
| 60 | + Save(user *User) (*User, error) | ||
| 61 | + Remove(user *User) (*User, error) | ||
| 62 | + FindOne(queryOptions map[string]interface{}) (*User, error) | ||
| 63 | + Find(queryOptions map[string]interface{}) (int64, []*User, error) | ||
| 60 | } | 64 | } |
| 61 | 65 | ||
| 62 | -func (users *Users) Identify() interface{} { | ||
| 63 | - if users.UsersId == 0 { | 66 | +func (user *User) Identify() interface{} { |
| 67 | + if user.UserId == 0 { | ||
| 64 | return nil | 68 | return nil |
| 65 | } | 69 | } |
| 66 | - return users.UsersId | 70 | + return user.UserId |
| 67 | } | 71 | } |
| 68 | 72 | ||
| 69 | -func (users *Users) Update(data map[string]interface{}) error { | ||
| 70 | - if usersId, ok := data["usersId"]; ok { | ||
| 71 | - users.UsersId = usersId.(int64) | 73 | +func (user *User) Update(data map[string]interface{}) error { |
| 74 | + if userId, ok := data["userId"]; ok { | ||
| 75 | + user.UserId = userId.(int64) | ||
| 72 | } | 76 | } |
| 73 | if companyId, ok := data["companyId"]; ok { | 77 | if companyId, ok := data["companyId"]; ok { |
| 74 | - users.CompanyId = companyId.(int64) | 78 | + user.CompanyId = companyId.(int64) |
| 75 | } | 79 | } |
| 76 | - if usersBaseId, ok := data["usersBaseId"]; ok { | ||
| 77 | - users.UsersBaseId = usersBaseId.(int64) | 80 | + if userBaseId, ok := data["userBaseId"]; ok { |
| 81 | + user.UserBaseId = userBaseId.(int64) | ||
| 78 | } | 82 | } |
| 79 | - if usersType, ok := data["usersType"]; ok { | ||
| 80 | - users.UsersType = usersType.(int) | 83 | + if userType, ok := data["userType"]; ok { |
| 84 | + user.UserType = userType.(int) | ||
| 81 | } | 85 | } |
| 82 | - if usersCode, ok := data["usersCode"]; ok { | ||
| 83 | - users.UsersCode = usersCode.(string) | 86 | + if userCode, ok := data["userCode"]; ok { |
| 87 | + user.UserCode = userCode.(string) | ||
| 84 | } | 88 | } |
| 85 | if organizationId, ok := data["organizationId"]; ok { | 89 | if organizationId, ok := data["organizationId"]; ok { |
| 86 | - users.OrganizationId = organizationId.(int64) | 90 | + user.OrganizationId = organizationId.(int64) |
| 87 | } | 91 | } |
| 88 | if departmentId, ok := data["departmentId"]; ok { | 92 | if departmentId, ok := data["departmentId"]; ok { |
| 89 | - users.DepartmentId = departmentId.(int64) | 93 | + user.DepartmentId = departmentId.(int64) |
| 90 | } | 94 | } |
| 91 | - if usersName, ok := data["usersName"]; ok { | ||
| 92 | - users.UsersInfo.UsersName = usersName.(string) | 95 | + if userName, ok := data["userName"]; ok { |
| 96 | + user.UserInfo.UserName = userName.(string) | ||
| 93 | } | 97 | } |
| 94 | if phone, ok := data["phone"]; ok { | 98 | if phone, ok := data["phone"]; ok { |
| 95 | - users.UsersInfo.Phone = phone.(string) | 99 | + user.UserInfo.Phone = phone.(string) |
| 96 | } | 100 | } |
| 97 | if avatar, ok := data["avatar"]; ok { | 101 | if avatar, ok := data["avatar"]; ok { |
| 98 | - users.UsersInfo.Avatar = avatar.(string) | 102 | + user.UserInfo.Avatar = avatar.(string) |
| 99 | } | 103 | } |
| 100 | if email, ok := data["email"]; ok { | 104 | if email, ok := data["email"]; ok { |
| 101 | - users.UsersInfo.Email = email.(string) | 105 | + user.UserInfo.Email = email.(string) |
| 102 | } | 106 | } |
| 103 | - if usersOrg, ok := data["usersOrg"]; ok { | ||
| 104 | - users.UsersOrg = usersOrg.([]*Org) | 107 | + if userOrg, ok := data["userOrg"]; ok { |
| 108 | + user.UserOrg = userOrg.([]*Org) | ||
| 105 | } | 109 | } |
| 106 | - if usersRole, ok := data["usersRole"]; ok { | ||
| 107 | - users.UsersRole = usersRole.([]*Role) | 110 | + if userRole, ok := data["userRole"]; ok { |
| 111 | + user.UserRole = userRole.([]*Role) | ||
| 108 | } | 112 | } |
| 109 | if favoriteMenus, ok := data["favoriteMenus"]; ok { | 113 | if favoriteMenus, ok := data["favoriteMenus"]; ok { |
| 110 | - users.FavoriteMenus = favoriteMenus.([]string) | 114 | + user.FavoriteMenus = favoriteMenus.([]string) |
| 111 | } | 115 | } |
| 112 | if cooperationCompany, ok := data["cooperationCompany"]; ok { | 116 | if cooperationCompany, ok := data["cooperationCompany"]; ok { |
| 113 | - users.CooperationInfo.CooperationCompany = cooperationCompany.(string) | 117 | + user.CooperationInfo.CooperationCompany = cooperationCompany.(string) |
| 114 | } | 118 | } |
| 115 | if cooperationDeadline, ok := data["cooperationDeadline"]; ok { | 119 | if cooperationDeadline, ok := data["cooperationDeadline"]; ok { |
| 116 | - users.CooperationInfo.CooperationDeadline = cooperationDeadline.(time.Time) | 120 | + user.CooperationInfo.CooperationDeadline = cooperationDeadline.(time.Time) |
| 117 | } | 121 | } |
| 118 | if enableStatus, ok := data["enableStatus"]; ok { | 122 | if enableStatus, ok := data["enableStatus"]; ok { |
| 119 | - users.EnableStatus = enableStatus.(int) | 123 | + user.EnableStatus = enableStatus.(int) |
| 120 | } | 124 | } |
| 121 | - if usersName, ok := data["usersName"]; ok { | ||
| 122 | - users.Ext.UsersName = usersName.(string) | 125 | + if userName, ok := data["userName"]; ok { |
| 126 | + user.Ext.UserName = userName.(string) | ||
| 123 | } | 127 | } |
| 124 | if orgName, ok := data["orgName"]; ok { | 128 | if orgName, ok := data["orgName"]; ok { |
| 125 | - users.Ext.OrgName = orgName.(string) | 129 | + user.Ext.OrgName = orgName.(string) |
| 126 | } | 130 | } |
| 127 | if phone, ok := data["phone"]; ok { | 131 | if phone, ok := data["phone"]; ok { |
| 128 | - users.Ext.Phone = phone.(string) | 132 | + user.Ext.Phone = phone.(string) |
| 129 | } | 133 | } |
| 130 | if depName, ok := data["depName"]; ok { | 134 | if depName, ok := data["depName"]; ok { |
| 131 | - users.Ext.DepName = depName.(string) | 135 | + user.Ext.DepName = depName.(string) |
| 132 | } | 136 | } |
| 133 | if parentDepName, ok := data["parentDepName"]; ok { | 137 | if parentDepName, ok := data["parentDepName"]; ok { |
| 134 | - users.Ext.ParentDepName = parentDepName.(string) | 138 | + user.Ext.ParentDepName = parentDepName.(string) |
| 135 | } | 139 | } |
| 136 | if createdAt, ok := data["createdAt"]; ok { | 140 | if createdAt, ok := data["createdAt"]; ok { |
| 137 | - users.CreatedAt = createdAt.(time.Time) | 141 | + user.CreatedAt = createdAt.(time.Time) |
| 138 | } | 142 | } |
| 139 | if updatedAt, ok := data["updatedAt"]; ok { | 143 | if updatedAt, ok := data["updatedAt"]; ok { |
| 140 | - users.UpdatedAt = updatedAt.(time.Time) | 144 | + user.UpdatedAt = updatedAt.(time.Time) |
| 141 | } | 145 | } |
| 142 | return nil | 146 | return nil |
| 143 | } | 147 | } |
| 144 | 148 | ||
| 145 | -type UsersStatus int | 149 | +type UserStatus int |
| @@ -3,13 +3,13 @@ package domain | @@ -3,13 +3,13 @@ package domain | ||
| 3 | import "time" | 3 | import "time" |
| 4 | 4 | ||
| 5 | // 用户基础 | 5 | // 用户基础 |
| 6 | -type UsersBase struct { | 6 | +type UserBase struct { |
| 7 | // 用户基础数据id | 7 | // 用户基础数据id |
| 8 | - UsersBaseId int64 `json:"usersBaseId,omitempty"` | 8 | + UserBaseId int64 `json:"userBaseId,omitempty"` |
| 9 | // 用户信息 | 9 | // 用户信息 |
| 10 | - UsersInfo *UsersInfo `json:"usersInfo,omitempty"` | 10 | + UserInfo *UserInfo `json:"userInfo,omitempty"` |
| 11 | // 手机号码 | 11 | // 手机号码 |
| 12 | - Phone string `json:"phone,omitempty"` | 12 | + Account string `json:"phone,omitempty"` |
| 13 | // 密码 | 13 | // 密码 |
| 14 | Password string `json:"password,omitempty"` | 14 | Password string `json:"password,omitempty"` |
| 15 | // IM信息 | 15 | // IM信息 |
| @@ -24,59 +24,59 @@ type UsersBase struct { | @@ -24,59 +24,59 @@ type UsersBase struct { | ||
| 24 | UpdatedAt time.Time `json:"updatedAt,omitempty"` | 24 | UpdatedAt time.Time `json:"updatedAt,omitempty"` |
| 25 | } | 25 | } |
| 26 | 26 | ||
| 27 | -type UsersBaseRepository interface { | ||
| 28 | - Save(usersBase *UsersBase) (*UsersBase, error) | ||
| 29 | - Remove(usersBase *UsersBase) (*UsersBase, error) | ||
| 30 | - FindOne(queryOptions map[string]interface{}) (*UsersBase, error) | ||
| 31 | - Find(queryOptions map[string]interface{}) (int64, []*UsersBase, error) | 27 | +type UserBaseRepository interface { |
| 28 | + Save(userBase *UserBase) (*UserBase, error) | ||
| 29 | + Remove(userBase *UserBase) (*UserBase, error) | ||
| 30 | + FindOne(queryOptions map[string]interface{}) (*UserBase, error) | ||
| 31 | + Find(queryOptions map[string]interface{}) (int64, []*UserBase, error) | ||
| 32 | } | 32 | } |
| 33 | 33 | ||
| 34 | -func (usersBase *UsersBase) Identify() interface{} { | ||
| 35 | - if usersBase.UsersBaseId == 0 { | 34 | +func (userBase *UserBase) Identify() interface{} { |
| 35 | + if userBase.UserBaseId == 0 { | ||
| 36 | return nil | 36 | return nil |
| 37 | } | 37 | } |
| 38 | - return usersBase.UsersBaseId | 38 | + return userBase.UserBaseId |
| 39 | } | 39 | } |
| 40 | 40 | ||
| 41 | -func (usersBase *UsersBase) Update(data map[string]interface{}) error { | ||
| 42 | - if usersName, ok := data["usersName"]; ok { | ||
| 43 | - usersBase.UsersInfo.UsersName = usersName.(string) | 41 | +func (userBase *UserBase) Update(data map[string]interface{}) error { |
| 42 | + if userName, ok := data["userName"]; ok { | ||
| 43 | + userBase.UserInfo.UserName = userName.(string) | ||
| 44 | } | 44 | } |
| 45 | if phone, ok := data["phone"]; ok { | 45 | if phone, ok := data["phone"]; ok { |
| 46 | - usersBase.UsersInfo.Phone = phone.(string) | 46 | + userBase.UserInfo.Phone = phone.(string) |
| 47 | } | 47 | } |
| 48 | if avatar, ok := data["avatar"]; ok { | 48 | if avatar, ok := data["avatar"]; ok { |
| 49 | - usersBase.UsersInfo.Avatar = avatar.(string) | 49 | + userBase.UserInfo.Avatar = avatar.(string) |
| 50 | } | 50 | } |
| 51 | if email, ok := data["email"]; ok { | 51 | if email, ok := data["email"]; ok { |
| 52 | - usersBase.UsersInfo.Email = email.(string) | 52 | + userBase.UserInfo.Email = email.(string) |
| 53 | } | 53 | } |
| 54 | - if phone, ok := data["phone"]; ok { | ||
| 55 | - usersBase.Phone = phone.(string) | 54 | + if account, ok := data["account"]; ok { |
| 55 | + userBase.Account = account.(string) | ||
| 56 | } | 56 | } |
| 57 | if password, ok := data["password"]; ok { | 57 | if password, ok := data["password"]; ok { |
| 58 | - usersBase.Password = password.(string) | 58 | + userBase.Password = password.(string) |
| 59 | } | 59 | } |
| 60 | if accid, ok := data["accid"]; ok { | 60 | if accid, ok := data["accid"]; ok { |
| 61 | - usersBase.Im.Accid = accid.(string) | 61 | + userBase.Im.Accid = accid.(string) |
| 62 | } | 62 | } |
| 63 | if imToken, ok := data["imToken"]; ok { | 63 | if imToken, ok := data["imToken"]; ok { |
| 64 | - usersBase.Im.ImToken = imToken.(string) | 64 | + userBase.Im.ImToken = imToken.(string) |
| 65 | } | 65 | } |
| 66 | if csAccountId, ok := data["csAccountId"]; ok { | 66 | if csAccountId, ok := data["csAccountId"]; ok { |
| 67 | - usersBase.Im.CsAccountId = csAccountId.(string) | 67 | + userBase.Im.CsAccountId = csAccountId.(string) |
| 68 | } | 68 | } |
| 69 | - if relatedUsers, ok := data["relatedUsers"]; ok { | ||
| 70 | - usersBase.RelatedUsers = relatedUsers.([]int64) | 69 | + if relatedUser, ok := data["relatedUser"]; ok { |
| 70 | + userBase.RelatedUsers = relatedUser.([]int64) | ||
| 71 | } | 71 | } |
| 72 | if status, ok := data["status"]; ok { | 72 | if status, ok := data["status"]; ok { |
| 73 | - usersBase.Status = status.(int) | 73 | + userBase.Status = status.(int) |
| 74 | } | 74 | } |
| 75 | if createdAt, ok := data["createdAt"]; ok { | 75 | if createdAt, ok := data["createdAt"]; ok { |
| 76 | - usersBase.CreatedAt = createdAt.(time.Time) | 76 | + userBase.CreatedAt = createdAt.(time.Time) |
| 77 | } | 77 | } |
| 78 | if updatedAt, ok := data["updatedAt"]; ok { | 78 | if updatedAt, ok := data["updatedAt"]; ok { |
| 79 | - usersBase.UpdatedAt = updatedAt.(time.Time) | 79 | + userBase.UpdatedAt = updatedAt.(time.Time) |
| 80 | } | 80 | } |
| 81 | return nil | 81 | return nil |
| 82 | } | 82 | } |
| 1 | package domain | 1 | package domain |
| 2 | 2 | ||
| 3 | // 用户信息 (base) | 3 | // 用户信息 (base) |
| 4 | -type UsersInfo struct { | 4 | +type UserInfo struct { |
| 5 | // 用户姓名 | 5 | // 用户姓名 |
| 6 | - UsersName string `json:"usersName,omitempty"` | 6 | + UserName string `json:"userName,omitempty"` |
| 7 | // 手机号码 | 7 | // 手机号码 |
| 8 | Phone string `json:"phone,omitempty"` | 8 | Phone string `json:"phone,omitempty"` |
| 9 | // 头像 | 9 | // 头像 |
| @@ -10,7 +10,7 @@ type Menu struct { | @@ -10,7 +10,7 @@ type Menu struct { | ||
| 10 | MenuName string `comment:"菜单名称"` | 10 | MenuName string `comment:"菜单名称"` |
| 11 | // 菜单编码 SYSTEM_USER_EDIT / 100101 (字符编码) | 11 | // 菜单编码 SYSTEM_USER_EDIT / 100101 (字符编码) |
| 12 | Code string `comment:"菜单编码"` | 12 | Code string `comment:"菜单编码"` |
| 13 | - // 权限编码 users:edit | 13 | + // 权限编码 user:edit |
| 14 | AccessCode string `comment:"权限编码"` | 14 | AccessCode string `comment:"权限编码"` |
| 15 | // 菜单类型 (目录catalog、菜单menu、按钮button) | 15 | // 菜单类型 (目录catalog、菜单menu、按钮button) |
| 16 | MenuType string `comment:"菜单类型 (目录catalog、菜单menu、按钮button)"` | 16 | MenuType string `comment:"菜单类型 (目录catalog、菜单menu、按钮button)"` |
| @@ -5,28 +5,28 @@ import ( | @@ -5,28 +5,28 @@ import ( | ||
| 5 | "time" | 5 | "time" |
| 6 | ) | 6 | ) |
| 7 | 7 | ||
| 8 | -type Users struct { | ||
| 9 | - tableName string `pg:"users.users,alias:users"` | 8 | +type User struct { |
| 9 | + tableName string `pg:"users.user,alias:user"` | ||
| 10 | // 用户Id 用户唯一标识 | 10 | // 用户Id 用户唯一标识 |
| 11 | - UsersId int64 `comment:"用户Id"` | 11 | + UserId int64 `comment:"用户Id"` |
| 12 | // 企业id | 12 | // 企业id |
| 13 | CompanyId int64 `comment:"企业id"` | 13 | CompanyId int64 `comment:"企业id"` |
| 14 | // 用户基础数据id | 14 | // 用户基础数据id |
| 15 | - UsersBaseId int64 `comment:"用户基础数据id"` | 15 | + UserBaseId int64 `comment:"用户基础数据id"` |
| 16 | // 用户类型 1:企业内部用户(内部添加) 2:共创用户 1024:企业注册用户(注册添加) | 16 | // 用户类型 1:企业内部用户(内部添加) 2:共创用户 1024:企业注册用户(注册添加) |
| 17 | - UsersType int `comment:"用户类型 1:企业内部用户(内部添加) 2:共创用户 1024:企业注册用户(注册添加"` | 17 | + UserType int `comment:"用户类型 1:企业内部用户(内部添加) 2:共创用户 1024:企业注册用户(注册添加"` |
| 18 | // 用户编号 企业内标识 | 18 | // 用户编号 企业内标识 |
| 19 | - UsersCode string `comment:"用户编号"` | 19 | + UserCode string `comment:"用户编号"` |
| 20 | // 组织机构 | 20 | // 组织机构 |
| 21 | OrganizationId int64 `comment:"组织机构"` | 21 | OrganizationId int64 `comment:"组织机构"` |
| 22 | // 所属部门 | 22 | // 所属部门 |
| 23 | DepartmentId int64 `comment:"所属部门"` | 23 | DepartmentId int64 `comment:"所属部门"` |
| 24 | - // 用户信息 (冗余,数据存在usersBase里面) | ||
| 25 | - //UsersInfo *domain.UsersInfo | 24 | + // 用户信息 (冗余,数据存在userBase里面) |
| 25 | + //UserInfo *domain.UserInfo | ||
| 26 | // 用户关联的组织 | 26 | // 用户关联的组织 |
| 27 | - UsersOrg []*domain.Org `pg:",array" comment:"用户关联的组织"` | 27 | + UserOrg []*domain.Org `pg:",array" comment:"用户关联的组织"` |
| 28 | // 用户关联的角色 | 28 | // 用户关联的角色 |
| 29 | - UsersRole []*domain.Role `pg:",array" comment:"用户关联的角色"` | 29 | + UserRole []*domain.Role `pg:",array" comment:"用户关联的角色"` |
| 30 | // 收藏的菜单(工作台)(菜单编码列表) | 30 | // 收藏的菜单(工作台)(菜单编码列表) |
| 31 | FavoriteMenus []string `pg:",array" comment:"收藏的菜单"` | 31 | FavoriteMenus []string `pg:",array" comment:"收藏的菜单"` |
| 32 | // 共创信息 (共创用户有效) | 32 | // 共创信息 (共创用户有效) |
| @@ -5,20 +5,20 @@ import ( | @@ -5,20 +5,20 @@ import ( | ||
| 5 | "time" | 5 | "time" |
| 6 | ) | 6 | ) |
| 7 | 7 | ||
| 8 | -type UsersBase struct { | ||
| 9 | - tableName string `pg:"users.users_base,alias:users_base" comment:"用户基础"` | 8 | +type UserBase struct { |
| 9 | + tableName string `pg:"users.user_base,alias:user_base" comment:"用户基础"` | ||
| 10 | // 用户基础数据id | 10 | // 用户基础数据id |
| 11 | - UsersBaseId int64 `comment:"用户基础数据id"` | 11 | + UserBaseId int64 `comment:"用户基础数据id"` |
| 12 | // 用户信息 | 12 | // 用户信息 |
| 13 | - UsersInfo *domain.UsersInfo `comment:"用户信息"` | ||
| 14 | - // 手机号码 | ||
| 15 | - Phone string `comment:"手机号码"` | 13 | + UserInfo *domain.UserInfo `comment:"用户信息"` |
| 14 | + // 账号 | ||
| 15 | + Account string `comment:"手机号码"` | ||
| 16 | // 密码 | 16 | // 密码 |
| 17 | Password string `comment:"密码"` | 17 | Password string `comment:"密码"` |
| 18 | // IM信息 | 18 | // IM信息 |
| 19 | Im *domain.Im `comment:"IM信息"` | 19 | Im *domain.Im `comment:"IM信息"` |
| 20 | // 关联的用户 (冗余) | 20 | // 关联的用户 (冗余) |
| 21 | - RelatedUsers []int64 `pg:",array" comment:"关联的用户 (冗余)"` | 21 | + RelatedUser []int64 `pg:",array" comment:"关联的用户 (冗余)"` |
| 22 | // 账号状态 1:正常 2.禁用 3:注销 | 22 | // 账号状态 1:正常 2.禁用 3:注销 |
| 23 | Status int `comment:"账号状态 1:正常 2.禁用 3:注销"` | 23 | Status int `comment:"账号状态 1:正常 2.禁用 3:注销"` |
| 24 | // 创建时间 | 24 | // 创建时间 |
| @@ -5,23 +5,23 @@ import ( | @@ -5,23 +5,23 @@ import ( | ||
| 5 | "gitlab.fjmaimaimai.com/allied-creation/allied-creation-user/pkg/infrastructure/pg/models" | 5 | "gitlab.fjmaimaimai.com/allied-creation/allied-creation-user/pkg/infrastructure/pg/models" |
| 6 | ) | 6 | ) |
| 7 | 7 | ||
| 8 | -func TransformToUsersDomainModelFromPgModels(usersModel *models.Users) (*domain.Users, error) { | ||
| 9 | - return &domain.Users{ | ||
| 10 | - UsersId: usersModel.UsersId, | ||
| 11 | - CompanyId: usersModel.CompanyId, | ||
| 12 | - UsersBaseId: usersModel.UsersBaseId, | ||
| 13 | - UsersType: usersModel.UsersType, | ||
| 14 | - UsersCode: usersModel.UsersCode, | ||
| 15 | - OrganizationId: usersModel.OrganizationId, | ||
| 16 | - DepartmentId: usersModel.DepartmentId, | ||
| 17 | - //UsersInfo: usersModel.UsersInfo, | ||
| 18 | - UsersOrg: usersModel.UsersOrg, | ||
| 19 | - UsersRole: usersModel.UsersRole, | ||
| 20 | - FavoriteMenus: usersModel.FavoriteMenus, | ||
| 21 | - CooperationInfo: usersModel.CooperationInfo, | ||
| 22 | - EnableStatus: usersModel.EnableStatus, | ||
| 23 | - Ext: usersModel.Ext, | ||
| 24 | - CreatedAt: usersModel.CreatedAt, | ||
| 25 | - UpdatedAt: usersModel.UpdatedAt, | 8 | +func TransformToUserDomainModelFromPgModels(userModel *models.User) (*domain.User, error) { |
| 9 | + return &domain.User{ | ||
| 10 | + UserId: userModel.UserId, | ||
| 11 | + CompanyId: userModel.CompanyId, | ||
| 12 | + UserBaseId: userModel.UserBaseId, | ||
| 13 | + UserType: userModel.UserType, | ||
| 14 | + UserCode: userModel.UserCode, | ||
| 15 | + OrganizationId: userModel.OrganizationId, | ||
| 16 | + DepartmentId: userModel.DepartmentId, | ||
| 17 | + //UserInfo: userModel.UserInfo, | ||
| 18 | + UserOrg: userModel.UserOrg, | ||
| 19 | + UserRole: userModel.UserRole, | ||
| 20 | + FavoriteMenus: userModel.FavoriteMenus, | ||
| 21 | + CooperationInfo: userModel.CooperationInfo, | ||
| 22 | + EnableStatus: userModel.EnableStatus, | ||
| 23 | + Ext: userModel.Ext, | ||
| 24 | + CreatedAt: userModel.CreatedAt, | ||
| 25 | + UpdatedAt: userModel.UpdatedAt, | ||
| 26 | }, nil | 26 | }, nil |
| 27 | } | 27 | } |
| @@ -5,16 +5,16 @@ import ( | @@ -5,16 +5,16 @@ import ( | ||
| 5 | "gitlab.fjmaimaimai.com/allied-creation/allied-creation-user/pkg/infrastructure/pg/models" | 5 | "gitlab.fjmaimaimai.com/allied-creation/allied-creation-user/pkg/infrastructure/pg/models" |
| 6 | ) | 6 | ) |
| 7 | 7 | ||
| 8 | -func TransformToUsersBaseDomainModelFromPgModels(usersBaseModel *models.UsersBase) (*domain.UsersBase, error) { | ||
| 9 | - return &domain.UsersBase{ | ||
| 10 | - UsersBaseId: usersBaseModel.UsersBaseId, | ||
| 11 | - UsersInfo: usersBaseModel.UsersInfo, | ||
| 12 | - Phone: usersBaseModel.Phone, | ||
| 13 | - Password: usersBaseModel.Password, | ||
| 14 | - Im: usersBaseModel.Im, | ||
| 15 | - RelatedUsers: usersBaseModel.RelatedUsers, | ||
| 16 | - Status: usersBaseModel.Status, | ||
| 17 | - CreatedAt: usersBaseModel.CreatedAt, | ||
| 18 | - UpdatedAt: usersBaseModel.UpdatedAt, | 8 | +func TransformToUserBaseDomainModelFromPgModels(userBaseModel *models.UserBase) (*domain.UserBase, error) { |
| 9 | + return &domain.UserBase{ | ||
| 10 | + UserBaseId: userBaseModel.UserBaseId, | ||
| 11 | + UserInfo: userBaseModel.UserInfo, | ||
| 12 | + Account: userBaseModel.Account, | ||
| 13 | + Password: userBaseModel.Password, | ||
| 14 | + Im: userBaseModel.Im, | ||
| 15 | + RelatedUsers: userBaseModel.RelatedUser, | ||
| 16 | + Status: userBaseModel.Status, | ||
| 17 | + CreatedAt: userBaseModel.CreatedAt, | ||
| 18 | + UpdatedAt: userBaseModel.UpdatedAt, | ||
| 19 | }, nil | 19 | }, nil |
| 20 | } | 20 | } |
| @@ -69,7 +69,7 @@ func (repository *MenuRepository) Save(menu *domain.Menu) (*domain.Menu, error) | @@ -69,7 +69,7 @@ func (repository *MenuRepository) Save(menu *domain.Menu) (*domain.Menu, error) | ||
| 69 | &menu.IsPublish, | 69 | &menu.IsPublish, |
| 70 | &menu.EnableStatus, | 70 | &menu.EnableStatus, |
| 71 | ), | 71 | ), |
| 72 | - fmt.Sprintf("INSERT INTO users.menu (%s) VALUES (%s) RETURNING %s", insertFieldsSnippet, insertPlaceHoldersSnippet, returningFieldsSnippet), | 72 | + fmt.Sprintf("INSERT INTO user.menu (%s) VALUES (%s) RETURNING %s", insertFieldsSnippet, insertPlaceHoldersSnippet, returningFieldsSnippet), |
| 73 | menu.ParentId, | 73 | menu.ParentId, |
| 74 | menu.MenuName, | 74 | menu.MenuName, |
| 75 | menu.Code, | 75 | menu.Code, |
| @@ -102,7 +102,7 @@ func (repository *MenuRepository) Save(menu *domain.Menu) (*domain.Menu, error) | @@ -102,7 +102,7 @@ func (repository *MenuRepository) Save(menu *domain.Menu) (*domain.Menu, error) | ||
| 102 | &menu.IsPublish, | 102 | &menu.IsPublish, |
| 103 | &menu.EnableStatus, | 103 | &menu.EnableStatus, |
| 104 | ), | 104 | ), |
| 105 | - fmt.Sprintf("UPDATE users.menu SET %s WHERE menu_id=? RETURNING %s", updateFieldsSnippet, returningFieldsSnippet), | 105 | + fmt.Sprintf("UPDATE user.menu SET %s WHERE menu_id=? RETURNING %s", updateFieldsSnippet, returningFieldsSnippet), |
| 106 | menu.ParentId, | 106 | menu.ParentId, |
| 107 | menu.MenuName, | 107 | menu.MenuName, |
| 108 | menu.Code, | 108 | menu.Code, |
| @@ -12,11 +12,11 @@ import ( | @@ -12,11 +12,11 @@ import ( | ||
| 12 | "gitlab.fjmaimaimai.com/allied-creation/allied-creation-user/pkg/infrastructure/pg/transform" | 12 | "gitlab.fjmaimaimai.com/allied-creation/allied-creation-user/pkg/infrastructure/pg/transform" |
| 13 | ) | 13 | ) |
| 14 | 14 | ||
| 15 | -type UsersBaseRepository struct { | 15 | +type UserBaseRepository struct { |
| 16 | transactionContext *pgTransaction.TransactionContext | 16 | transactionContext *pgTransaction.TransactionContext |
| 17 | } | 17 | } |
| 18 | 18 | ||
| 19 | -func (repository *UsersBaseRepository) nextIdentify() (int64, error) { | 19 | +func (repository *UserBaseRepository) nextIdentify() (int64, error) { |
| 20 | IdWorker, err := snowflake.NewIdWorker(1) | 20 | IdWorker, err := snowflake.NewIdWorker(1) |
| 21 | if err != nil { | 21 | if err != nil { |
| 22 | return 0, err | 22 | return 0, err |
| @@ -24,14 +24,14 @@ func (repository *UsersBaseRepository) nextIdentify() (int64, error) { | @@ -24,14 +24,14 @@ func (repository *UsersBaseRepository) nextIdentify() (int64, error) { | ||
| 24 | id, err := IdWorker.NextId() | 24 | id, err := IdWorker.NextId() |
| 25 | return id, err | 25 | return id, err |
| 26 | } | 26 | } |
| 27 | -func (repository *UsersBaseRepository) Save(usersBase *domain.UsersBase) (*domain.UsersBase, error) { | 27 | +func (repository *UserBaseRepository) Save(userBase *domain.UserBase) (*domain.UserBase, error) { |
| 28 | sqlBuildFields := []string{ | 28 | sqlBuildFields := []string{ |
| 29 | - "users_base_id", | ||
| 30 | - "users_info", | 29 | + "user_base_id", |
| 30 | + "user_info", | ||
| 31 | "phone", | 31 | "phone", |
| 32 | "password", | 32 | "password", |
| 33 | "im", | 33 | "im", |
| 34 | - "related_users", | 34 | + "related_user", |
| 35 | "status", | 35 | "status", |
| 36 | "created_at", | 36 | "created_at", |
| 37 | "updated_at", | 37 | "updated_at", |
| @@ -39,84 +39,84 @@ func (repository *UsersBaseRepository) Save(usersBase *domain.UsersBase) (*domai | @@ -39,84 +39,84 @@ func (repository *UsersBaseRepository) Save(usersBase *domain.UsersBase) (*domai | ||
| 39 | insertFieldsSnippet := sqlbuilder.SqlFieldsSnippet(sqlBuildFields) | 39 | insertFieldsSnippet := sqlbuilder.SqlFieldsSnippet(sqlBuildFields) |
| 40 | insertPlaceHoldersSnippet := sqlbuilder.SqlPlaceHoldersSnippet(sqlBuildFields) | 40 | insertPlaceHoldersSnippet := sqlbuilder.SqlPlaceHoldersSnippet(sqlBuildFields) |
| 41 | returningFieldsSnippet := sqlbuilder.SqlFieldsSnippet(sqlBuildFields) | 41 | returningFieldsSnippet := sqlbuilder.SqlFieldsSnippet(sqlBuildFields) |
| 42 | - updateFields := sqlbuilder.RemoveSqlFields(sqlBuildFields, "usersBase_id") | 42 | + updateFields := sqlbuilder.RemoveSqlFields(sqlBuildFields, "userBase_id") |
| 43 | updateFieldsSnippet := sqlbuilder.SqlUpdateFieldsSnippet(updateFields) | 43 | updateFieldsSnippet := sqlbuilder.SqlUpdateFieldsSnippet(updateFields) |
| 44 | tx := repository.transactionContext.PgTx | 44 | tx := repository.transactionContext.PgTx |
| 45 | - if usersBase.Identify() == nil { | ||
| 46 | - usersBaseId, err := repository.nextIdentify() | 45 | + if userBase.Identify() == nil { |
| 46 | + userBaseId, err := repository.nextIdentify() | ||
| 47 | if err != nil { | 47 | if err != nil { |
| 48 | - return usersBase, err | 48 | + return userBase, err |
| 49 | } else { | 49 | } else { |
| 50 | - usersBase.UsersBaseId = usersBaseId | 50 | + userBase.UserBaseId = userBaseId |
| 51 | } | 51 | } |
| 52 | if _, err := tx.QueryOne( | 52 | if _, err := tx.QueryOne( |
| 53 | pg.Scan( | 53 | pg.Scan( |
| 54 | - &usersBase.UsersBaseId, | ||
| 55 | - &usersBase.UsersInfo, | ||
| 56 | - &usersBase.Phone, | ||
| 57 | - &usersBase.Password, | ||
| 58 | - &usersBase.Im, | ||
| 59 | - pg.Array(&usersBase.RelatedUsers), | ||
| 60 | - &usersBase.Status, | ||
| 61 | - &usersBase.CreatedAt, | ||
| 62 | - &usersBase.UpdatedAt, | 54 | + &userBase.UserBaseId, |
| 55 | + &userBase.UserInfo, | ||
| 56 | + &userBase.Account, | ||
| 57 | + &userBase.Password, | ||
| 58 | + &userBase.Im, | ||
| 59 | + pg.Array(&userBase.RelatedUsers), | ||
| 60 | + &userBase.Status, | ||
| 61 | + &userBase.CreatedAt, | ||
| 62 | + &userBase.UpdatedAt, | ||
| 63 | ), | 63 | ), |
| 64 | - fmt.Sprintf("INSERT INTO users_bases (%s) VALUES (%s) RETURNING %s", insertFieldsSnippet, insertPlaceHoldersSnippet, returningFieldsSnippet), | ||
| 65 | - usersBase.UsersBaseId, | ||
| 66 | - usersBase.UsersInfo, | ||
| 67 | - usersBase.Phone, | ||
| 68 | - usersBase.Password, | ||
| 69 | - usersBase.Im, | ||
| 70 | - pg.Array(usersBase.RelatedUsers), | ||
| 71 | - usersBase.Status, | ||
| 72 | - usersBase.CreatedAt, | ||
| 73 | - usersBase.UpdatedAt, | 64 | + fmt.Sprintf("INSERT INTO user_bases (%s) VALUES (%s) RETURNING %s", insertFieldsSnippet, insertPlaceHoldersSnippet, returningFieldsSnippet), |
| 65 | + userBase.UserBaseId, | ||
| 66 | + userBase.UserInfo, | ||
| 67 | + userBase.Account, | ||
| 68 | + userBase.Password, | ||
| 69 | + userBase.Im, | ||
| 70 | + pg.Array(userBase.RelatedUsers), | ||
| 71 | + userBase.Status, | ||
| 72 | + userBase.CreatedAt, | ||
| 73 | + userBase.UpdatedAt, | ||
| 74 | ); err != nil { | 74 | ); err != nil { |
| 75 | - return usersBase, err | 75 | + return userBase, err |
| 76 | } | 76 | } |
| 77 | } else { | 77 | } else { |
| 78 | if _, err := tx.QueryOne( | 78 | if _, err := tx.QueryOne( |
| 79 | pg.Scan( | 79 | pg.Scan( |
| 80 | - &usersBase.UsersBaseId, | ||
| 81 | - &usersBase.UsersInfo, | ||
| 82 | - &usersBase.Phone, | ||
| 83 | - &usersBase.Password, | ||
| 84 | - &usersBase.Im, | ||
| 85 | - pg.Array(&usersBase.RelatedUsers), | ||
| 86 | - &usersBase.Status, | ||
| 87 | - &usersBase.CreatedAt, | ||
| 88 | - &usersBase.UpdatedAt, | 80 | + &userBase.UserBaseId, |
| 81 | + &userBase.UserInfo, | ||
| 82 | + &userBase.Account, | ||
| 83 | + &userBase.Password, | ||
| 84 | + &userBase.Im, | ||
| 85 | + pg.Array(&userBase.RelatedUsers), | ||
| 86 | + &userBase.Status, | ||
| 87 | + &userBase.CreatedAt, | ||
| 88 | + &userBase.UpdatedAt, | ||
| 89 | ), | 89 | ), |
| 90 | - fmt.Sprintf("UPDATE users_bases SET %s WHERE users_base_id=? RETURNING %s", updateFieldsSnippet, returningFieldsSnippet), | ||
| 91 | - usersBase.UsersInfo, | ||
| 92 | - usersBase.Phone, | ||
| 93 | - usersBase.Password, | ||
| 94 | - usersBase.Im, | ||
| 95 | - pg.Array(usersBase.RelatedUsers), | ||
| 96 | - usersBase.Status, | ||
| 97 | - usersBase.CreatedAt, | ||
| 98 | - usersBase.UpdatedAt, | ||
| 99 | - usersBase.Identify(), | 90 | + fmt.Sprintf("UPDATE user_bases SET %s WHERE user_base_id=? RETURNING %s", updateFieldsSnippet, returningFieldsSnippet), |
| 91 | + userBase.UserInfo, | ||
| 92 | + userBase.Account, | ||
| 93 | + userBase.Password, | ||
| 94 | + userBase.Im, | ||
| 95 | + pg.Array(userBase.RelatedUsers), | ||
| 96 | + userBase.Status, | ||
| 97 | + userBase.CreatedAt, | ||
| 98 | + userBase.UpdatedAt, | ||
| 99 | + userBase.Identify(), | ||
| 100 | ); err != nil { | 100 | ); err != nil { |
| 101 | - return usersBase, err | 101 | + return userBase, err |
| 102 | } | 102 | } |
| 103 | } | 103 | } |
| 104 | - return usersBase, nil | 104 | + return userBase, nil |
| 105 | } | 105 | } |
| 106 | -func (repository *UsersBaseRepository) Remove(usersBase *domain.UsersBase) (*domain.UsersBase, error) { | 106 | +func (repository *UserBaseRepository) Remove(userBase *domain.UserBase) (*domain.UserBase, error) { |
| 107 | tx := repository.transactionContext.PgTx | 107 | tx := repository.transactionContext.PgTx |
| 108 | - usersBaseModel := new(models.UsersBase) | ||
| 109 | - usersBaseModel.UsersBaseId = usersBase.Identify().(int64) | ||
| 110 | - if _, err := tx.Model(usersBaseModel).WherePK().Delete(); err != nil { | ||
| 111 | - return usersBase, err | 108 | + userBaseModel := new(models.UserBase) |
| 109 | + userBaseModel.UserBaseId = userBase.Identify().(int64) | ||
| 110 | + if _, err := tx.Model(userBaseModel).WherePK().Delete(); err != nil { | ||
| 111 | + return userBase, err | ||
| 112 | } | 112 | } |
| 113 | - return usersBase, nil | 113 | + return userBase, nil |
| 114 | } | 114 | } |
| 115 | -func (repository *UsersBaseRepository) FindOne(queryOptions map[string]interface{}) (*domain.UsersBase, error) { | 115 | +func (repository *UserBaseRepository) FindOne(queryOptions map[string]interface{}) (*domain.UserBase, error) { |
| 116 | tx := repository.transactionContext.PgTx | 116 | tx := repository.transactionContext.PgTx |
| 117 | - usersBaseModel := new(models.UsersBase) | ||
| 118 | - query := sqlbuilder.BuildQuery(tx.Model(usersBaseModel), queryOptions) | ||
| 119 | - query.SetWhereByQueryOption("users_base.users_base_id = ?", "usersBaseId") | 117 | + userBaseModel := new(models.UserBase) |
| 118 | + query := sqlbuilder.BuildQuery(tx.Model(userBaseModel), queryOptions) | ||
| 119 | + query.SetWhereByQueryOption("user_base.user_base_id = ?", "userBaseId") | ||
| 120 | if err := query.First(); err != nil { | 120 | if err := query.First(); err != nil { |
| 121 | if err.Error() == "pg: no rows in result set" { | 121 | if err.Error() == "pg: no rows in result set" { |
| 122 | return nil, fmt.Errorf("没有此资源") | 122 | return nil, fmt.Errorf("没有此资源") |
| @@ -124,37 +124,37 @@ func (repository *UsersBaseRepository) FindOne(queryOptions map[string]interface | @@ -124,37 +124,37 @@ func (repository *UsersBaseRepository) FindOne(queryOptions map[string]interface | ||
| 124 | return nil, err | 124 | return nil, err |
| 125 | } | 125 | } |
| 126 | } | 126 | } |
| 127 | - if usersBaseModel.UsersBaseId == 0 { | 127 | + if userBaseModel.UserBaseId == 0 { |
| 128 | return nil, nil | 128 | return nil, nil |
| 129 | } else { | 129 | } else { |
| 130 | - return transform.TransformToUsersBaseDomainModelFromPgModels(usersBaseModel) | 130 | + return transform.TransformToUserBaseDomainModelFromPgModels(userBaseModel) |
| 131 | } | 131 | } |
| 132 | } | 132 | } |
| 133 | -func (repository *UsersBaseRepository) Find(queryOptions map[string]interface{}) (int64, []*domain.UsersBase, error) { | 133 | +func (repository *UserBaseRepository) Find(queryOptions map[string]interface{}) (int64, []*domain.UserBase, error) { |
| 134 | tx := repository.transactionContext.PgTx | 134 | tx := repository.transactionContext.PgTx |
| 135 | - var usersBaseModels []*models.UsersBase | ||
| 136 | - usersBases := make([]*domain.UsersBase, 0) | ||
| 137 | - query := sqlbuilder.BuildQuery(tx.Model(&usersBaseModels), queryOptions) | 135 | + var userBaseModels []*models.UserBase |
| 136 | + userBases := make([]*domain.UserBase, 0) | ||
| 137 | + query := sqlbuilder.BuildQuery(tx.Model(&userBaseModels), queryOptions) | ||
| 138 | query.SetOffsetAndLimit(20) | 138 | query.SetOffsetAndLimit(20) |
| 139 | - query.SetOrderDirect("users_base_id", "DESC") | 139 | + query.SetOrderDirect("user_base_id", "DESC") |
| 140 | if count, err := query.SelectAndCount(); err != nil { | 140 | if count, err := query.SelectAndCount(); err != nil { |
| 141 | - return 0, usersBases, err | 141 | + return 0, userBases, err |
| 142 | } else { | 142 | } else { |
| 143 | - for _, usersBaseModel := range usersBaseModels { | ||
| 144 | - if usersBase, err := transform.TransformToUsersBaseDomainModelFromPgModels(usersBaseModel); err != nil { | ||
| 145 | - return 0, usersBases, err | 143 | + for _, userBaseModel := range userBaseModels { |
| 144 | + if userBase, err := transform.TransformToUserBaseDomainModelFromPgModels(userBaseModel); err != nil { | ||
| 145 | + return 0, userBases, err | ||
| 146 | } else { | 146 | } else { |
| 147 | - usersBases = append(usersBases, usersBase) | 147 | + userBases = append(userBases, userBase) |
| 148 | } | 148 | } |
| 149 | } | 149 | } |
| 150 | - return int64(count), usersBases, nil | 150 | + return int64(count), userBases, nil |
| 151 | } | 151 | } |
| 152 | } | 152 | } |
| 153 | -func NewUsersBaseRepository(transactionContext *pgTransaction.TransactionContext) (*UsersBaseRepository, error) { | 153 | +func NewUserBaseRepository(transactionContext *pgTransaction.TransactionContext) (*UserBaseRepository, error) { |
| 154 | if transactionContext == nil { | 154 | if transactionContext == nil { |
| 155 | return nil, fmt.Errorf("transactionContext参数不能为nil") | 155 | return nil, fmt.Errorf("transactionContext参数不能为nil") |
| 156 | } else { | 156 | } else { |
| 157 | - return &UsersBaseRepository{ | 157 | + return &UserBaseRepository{ |
| 158 | transactionContext: transactionContext, | 158 | transactionContext: transactionContext, |
| 159 | }, nil | 159 | }, nil |
| 160 | } | 160 | } |
| @@ -12,11 +12,11 @@ import ( | @@ -12,11 +12,11 @@ import ( | ||
| 12 | "gitlab.fjmaimaimai.com/allied-creation/allied-creation-user/pkg/infrastructure/pg/transform" | 12 | "gitlab.fjmaimaimai.com/allied-creation/allied-creation-user/pkg/infrastructure/pg/transform" |
| 13 | ) | 13 | ) |
| 14 | 14 | ||
| 15 | -type UsersRepository struct { | 15 | +type UserRepository struct { |
| 16 | transactionContext *pgTransaction.TransactionContext | 16 | transactionContext *pgTransaction.TransactionContext |
| 17 | } | 17 | } |
| 18 | 18 | ||
| 19 | -func (repository *UsersRepository) nextIdentify() (int64, error) { | 19 | +func (repository *UserRepository) nextIdentify() (int64, error) { |
| 20 | IdWorker, err := snowflake.NewIdWorker(1) | 20 | IdWorker, err := snowflake.NewIdWorker(1) |
| 21 | if err != nil { | 21 | if err != nil { |
| 22 | return 0, err | 22 | return 0, err |
| @@ -24,18 +24,18 @@ func (repository *UsersRepository) nextIdentify() (int64, error) { | @@ -24,18 +24,18 @@ func (repository *UsersRepository) nextIdentify() (int64, error) { | ||
| 24 | id, err := IdWorker.NextId() | 24 | id, err := IdWorker.NextId() |
| 25 | return id, err | 25 | return id, err |
| 26 | } | 26 | } |
| 27 | -func (repository *UsersRepository) Save(users *domain.Users) (*domain.Users, error) { | 27 | +func (repository *UserRepository) Save(user *domain.User) (*domain.User, error) { |
| 28 | sqlBuildFields := []string{ | 28 | sqlBuildFields := []string{ |
| 29 | - "users_id", | 29 | + "user_id", |
| 30 | "company_id", | 30 | "company_id", |
| 31 | - "users_base_id", | ||
| 32 | - "users_type", | ||
| 33 | - "users_code", | 31 | + "user_base_id", |
| 32 | + "user_type", | ||
| 33 | + "user_code", | ||
| 34 | "organization_id", | 34 | "organization_id", |
| 35 | "department_id", | 35 | "department_id", |
| 36 | - "users_info", | ||
| 37 | - "users_org", | ||
| 38 | - "users_role", | 36 | + "user_info", |
| 37 | + "user_org", | ||
| 38 | + "user_role", | ||
| 39 | "favorite_menus", | 39 | "favorite_menus", |
| 40 | "cooperation_info", | 40 | "cooperation_info", |
| 41 | "enable_status", | 41 | "enable_status", |
| @@ -46,112 +46,112 @@ func (repository *UsersRepository) Save(users *domain.Users) (*domain.Users, err | @@ -46,112 +46,112 @@ func (repository *UsersRepository) Save(users *domain.Users) (*domain.Users, err | ||
| 46 | insertFieldsSnippet := sqlbuilder.SqlFieldsSnippet(sqlBuildFields) | 46 | insertFieldsSnippet := sqlbuilder.SqlFieldsSnippet(sqlBuildFields) |
| 47 | insertPlaceHoldersSnippet := sqlbuilder.SqlPlaceHoldersSnippet(sqlBuildFields) | 47 | insertPlaceHoldersSnippet := sqlbuilder.SqlPlaceHoldersSnippet(sqlBuildFields) |
| 48 | returningFieldsSnippet := sqlbuilder.SqlFieldsSnippet(sqlBuildFields) | 48 | returningFieldsSnippet := sqlbuilder.SqlFieldsSnippet(sqlBuildFields) |
| 49 | - updateFields := sqlbuilder.RemoveSqlFields(sqlBuildFields, "users_id") | 49 | + updateFields := sqlbuilder.RemoveSqlFields(sqlBuildFields, "user_id") |
| 50 | updateFieldsSnippet := sqlbuilder.SqlUpdateFieldsSnippet(updateFields) | 50 | updateFieldsSnippet := sqlbuilder.SqlUpdateFieldsSnippet(updateFields) |
| 51 | tx := repository.transactionContext.PgTx | 51 | tx := repository.transactionContext.PgTx |
| 52 | - if users.Identify() == nil { | ||
| 53 | - usersId, err := repository.nextIdentify() | 52 | + if user.Identify() == nil { |
| 53 | + userId, err := repository.nextIdentify() | ||
| 54 | if err != nil { | 54 | if err != nil { |
| 55 | - return users, err | 55 | + return user, err |
| 56 | } else { | 56 | } else { |
| 57 | - users.UsersId = usersId | 57 | + user.UserId = userId |
| 58 | } | 58 | } |
| 59 | if _, err := tx.QueryOne( | 59 | if _, err := tx.QueryOne( |
| 60 | pg.Scan( | 60 | pg.Scan( |
| 61 | - &users.UsersId, | ||
| 62 | - &users.CompanyId, | ||
| 63 | - &users.UsersBaseId, | ||
| 64 | - &users.UsersType, | ||
| 65 | - &users.UsersCode, | ||
| 66 | - &users.OrganizationId, | ||
| 67 | - &users.DepartmentId, | ||
| 68 | - pg.Array(&users.UsersInfo), | ||
| 69 | - pg.Array(&users.UsersOrg), | ||
| 70 | - pg.Array(&users.UsersRole), | ||
| 71 | - pg.Array(&users.FavoriteMenus), | ||
| 72 | - &users.CooperationInfo, | ||
| 73 | - &users.EnableStatus, | ||
| 74 | - &users.Ext, | ||
| 75 | - &users.CreatedAt, | ||
| 76 | - &users.UpdatedAt, | 61 | + &user.UserId, |
| 62 | + &user.CompanyId, | ||
| 63 | + &user.UserBaseId, | ||
| 64 | + &user.UserType, | ||
| 65 | + &user.UserCode, | ||
| 66 | + &user.OrganizationId, | ||
| 67 | + &user.DepartmentId, | ||
| 68 | + pg.Array(&user.UserInfo), | ||
| 69 | + pg.Array(&user.UserOrg), | ||
| 70 | + pg.Array(&user.UserRole), | ||
| 71 | + pg.Array(&user.FavoriteMenus), | ||
| 72 | + &user.CooperationInfo, | ||
| 73 | + &user.EnableStatus, | ||
| 74 | + &user.Ext, | ||
| 75 | + &user.CreatedAt, | ||
| 76 | + &user.UpdatedAt, | ||
| 77 | ), | 77 | ), |
| 78 | - fmt.Sprintf("INSERT INTO userss (%s) VALUES (%s) RETURNING %s", insertFieldsSnippet, insertPlaceHoldersSnippet, returningFieldsSnippet), | ||
| 79 | - users.UsersId, | ||
| 80 | - users.CompanyId, | ||
| 81 | - users.UsersBaseId, | ||
| 82 | - users.UsersType, | ||
| 83 | - users.UsersCode, | ||
| 84 | - users.OrganizationId, | ||
| 85 | - users.DepartmentId, | ||
| 86 | - pg.Array(users.UsersInfo), | ||
| 87 | - pg.Array(users.UsersOrg), | ||
| 88 | - pg.Array(users.UsersRole), | ||
| 89 | - pg.Array(users.FavoriteMenus), | ||
| 90 | - users.CooperationInfo, | ||
| 91 | - users.EnableStatus, | ||
| 92 | - users.Ext, | ||
| 93 | - users.CreatedAt, | ||
| 94 | - users.UpdatedAt, | 78 | + fmt.Sprintf("INSERT INTO users (%s) VALUES (%s) RETURNING %s", insertFieldsSnippet, insertPlaceHoldersSnippet, returningFieldsSnippet), |
| 79 | + user.UserId, | ||
| 80 | + user.CompanyId, | ||
| 81 | + user.UserBaseId, | ||
| 82 | + user.UserType, | ||
| 83 | + user.UserCode, | ||
| 84 | + user.OrganizationId, | ||
| 85 | + user.DepartmentId, | ||
| 86 | + pg.Array(user.UserInfo), | ||
| 87 | + pg.Array(user.UserOrg), | ||
| 88 | + pg.Array(user.UserRole), | ||
| 89 | + pg.Array(user.FavoriteMenus), | ||
| 90 | + user.CooperationInfo, | ||
| 91 | + user.EnableStatus, | ||
| 92 | + user.Ext, | ||
| 93 | + user.CreatedAt, | ||
| 94 | + user.UpdatedAt, | ||
| 95 | ); err != nil { | 95 | ); err != nil { |
| 96 | - return users, err | 96 | + return user, err |
| 97 | } | 97 | } |
| 98 | } else { | 98 | } else { |
| 99 | if _, err := tx.QueryOne( | 99 | if _, err := tx.QueryOne( |
| 100 | pg.Scan( | 100 | pg.Scan( |
| 101 | - &users.UsersId, | ||
| 102 | - &users.CompanyId, | ||
| 103 | - &users.UsersBaseId, | ||
| 104 | - &users.UsersType, | ||
| 105 | - &users.UsersCode, | ||
| 106 | - &users.OrganizationId, | ||
| 107 | - &users.DepartmentId, | ||
| 108 | - pg.Array(&users.UsersInfo), | ||
| 109 | - pg.Array(&users.UsersOrg), | ||
| 110 | - pg.Array(&users.UsersRole), | ||
| 111 | - pg.Array(&users.FavoriteMenus), | ||
| 112 | - &users.CooperationInfo, | ||
| 113 | - &users.EnableStatus, | ||
| 114 | - &users.Ext, | ||
| 115 | - &users.CreatedAt, | ||
| 116 | - &users.UpdatedAt, | 101 | + &user.UserId, |
| 102 | + &user.CompanyId, | ||
| 103 | + &user.UserBaseId, | ||
| 104 | + &user.UserType, | ||
| 105 | + &user.UserCode, | ||
| 106 | + &user.OrganizationId, | ||
| 107 | + &user.DepartmentId, | ||
| 108 | + pg.Array(&user.UserInfo), | ||
| 109 | + pg.Array(&user.UserOrg), | ||
| 110 | + pg.Array(&user.UserRole), | ||
| 111 | + pg.Array(&user.FavoriteMenus), | ||
| 112 | + &user.CooperationInfo, | ||
| 113 | + &user.EnableStatus, | ||
| 114 | + &user.Ext, | ||
| 115 | + &user.CreatedAt, | ||
| 116 | + &user.UpdatedAt, | ||
| 117 | ), | 117 | ), |
| 118 | - fmt.Sprintf("UPDATE userss SET %s WHERE users_id=? RETURNING %s", updateFieldsSnippet, returningFieldsSnippet), | ||
| 119 | - users.CompanyId, | ||
| 120 | - users.UsersBaseId, | ||
| 121 | - users.UsersType, | ||
| 122 | - users.UsersCode, | ||
| 123 | - users.OrganizationId, | ||
| 124 | - users.DepartmentId, | ||
| 125 | - pg.Array(users.UsersInfo), | ||
| 126 | - pg.Array(users.UsersOrg), | ||
| 127 | - pg.Array(users.UsersRole), | ||
| 128 | - pg.Array(users.FavoriteMenus), | ||
| 129 | - users.CooperationInfo, | ||
| 130 | - users.EnableStatus, | ||
| 131 | - users.Ext, | ||
| 132 | - users.CreatedAt, | ||
| 133 | - users.UpdatedAt, | ||
| 134 | - users.Identify(), | 118 | + fmt.Sprintf("UPDATE users SET %s WHERE user_id=? RETURNING %s", updateFieldsSnippet, returningFieldsSnippet), |
| 119 | + user.CompanyId, | ||
| 120 | + user.UserBaseId, | ||
| 121 | + user.UserType, | ||
| 122 | + user.UserCode, | ||
| 123 | + user.OrganizationId, | ||
| 124 | + user.DepartmentId, | ||
| 125 | + pg.Array(user.UserInfo), | ||
| 126 | + pg.Array(user.UserOrg), | ||
| 127 | + pg.Array(user.UserRole), | ||
| 128 | + pg.Array(user.FavoriteMenus), | ||
| 129 | + user.CooperationInfo, | ||
| 130 | + user.EnableStatus, | ||
| 131 | + user.Ext, | ||
| 132 | + user.CreatedAt, | ||
| 133 | + user.UpdatedAt, | ||
| 134 | + user.Identify(), | ||
| 135 | ); err != nil { | 135 | ); err != nil { |
| 136 | - return users, err | 136 | + return user, err |
| 137 | } | 137 | } |
| 138 | } | 138 | } |
| 139 | - return users, nil | 139 | + return user, nil |
| 140 | } | 140 | } |
| 141 | -func (repository *UsersRepository) Remove(users *domain.Users) (*domain.Users, error) { | 141 | +func (repository *UserRepository) Remove(user *domain.User) (*domain.User, error) { |
| 142 | tx := repository.transactionContext.PgTx | 142 | tx := repository.transactionContext.PgTx |
| 143 | - usersModel := new(models.Users) | ||
| 144 | - usersModel.UsersId = users.Identify().(int64) | ||
| 145 | - if _, err := tx.Model(usersModel).WherePK().Delete(); err != nil { | ||
| 146 | - return users, err | 143 | + userModel := new(models.User) |
| 144 | + userModel.UserId = user.Identify().(int64) | ||
| 145 | + if _, err := tx.Model(userModel).WherePK().Delete(); err != nil { | ||
| 146 | + return user, err | ||
| 147 | } | 147 | } |
| 148 | - return users, nil | 148 | + return user, nil |
| 149 | } | 149 | } |
| 150 | -func (repository *UsersRepository) FindOne(queryOptions map[string]interface{}) (*domain.Users, error) { | 150 | +func (repository *UserRepository) FindOne(queryOptions map[string]interface{}) (*domain.User, error) { |
| 151 | tx := repository.transactionContext.PgTx | 151 | tx := repository.transactionContext.PgTx |
| 152 | - usersModel := new(models.Users) | ||
| 153 | - query := sqlbuilder.BuildQuery(tx.Model(usersModel), queryOptions) | ||
| 154 | - query.SetWhereByQueryOption("users.users_id = ?", "usersId") | 152 | + userModel := new(models.User) |
| 153 | + query := sqlbuilder.BuildQuery(tx.Model(userModel), queryOptions) | ||
| 154 | + query.SetWhereByQueryOption("user.user_id = ?", "userId") | ||
| 155 | if err := query.First(); err != nil { | 155 | if err := query.First(); err != nil { |
| 156 | if err.Error() == "pg: no rows in result set" { | 156 | if err.Error() == "pg: no rows in result set" { |
| 157 | return nil, fmt.Errorf("没有此资源") | 157 | return nil, fmt.Errorf("没有此资源") |
| @@ -159,37 +159,37 @@ func (repository *UsersRepository) FindOne(queryOptions map[string]interface{}) | @@ -159,37 +159,37 @@ func (repository *UsersRepository) FindOne(queryOptions map[string]interface{}) | ||
| 159 | return nil, err | 159 | return nil, err |
| 160 | } | 160 | } |
| 161 | } | 161 | } |
| 162 | - if usersModel.UsersId == 0 { | 162 | + if userModel.UserId == 0 { |
| 163 | return nil, nil | 163 | return nil, nil |
| 164 | } else { | 164 | } else { |
| 165 | - return transform.TransformToUsersDomainModelFromPgModels(usersModel) | 165 | + return transform.TransformToUserDomainModelFromPgModels(userModel) |
| 166 | } | 166 | } |
| 167 | } | 167 | } |
| 168 | -func (repository *UsersRepository) Find(queryOptions map[string]interface{}) (int64, []*domain.Users, error) { | 168 | +func (repository *UserRepository) Find(queryOptions map[string]interface{}) (int64, []*domain.User, error) { |
| 169 | tx := repository.transactionContext.PgTx | 169 | tx := repository.transactionContext.PgTx |
| 170 | - var usersModels []*models.Users | ||
| 171 | - userss := make([]*domain.Users, 0) | ||
| 172 | - query := sqlbuilder.BuildQuery(tx.Model(&usersModels), queryOptions) | 170 | + var userModels []*models.User |
| 171 | + users := make([]*domain.User, 0) | ||
| 172 | + query := sqlbuilder.BuildQuery(tx.Model(&userModels), queryOptions) | ||
| 173 | query.SetOffsetAndLimit(20) | 173 | query.SetOffsetAndLimit(20) |
| 174 | - query.SetOrderDirect("users_id", "DESC") | 174 | + query.SetOrderDirect("user_id", "DESC") |
| 175 | if count, err := query.SelectAndCount(); err != nil { | 175 | if count, err := query.SelectAndCount(); err != nil { |
| 176 | - return 0, userss, err | 176 | + return 0, users, err |
| 177 | } else { | 177 | } else { |
| 178 | - for _, usersModel := range usersModels { | ||
| 179 | - if users, err := transform.TransformToUsersDomainModelFromPgModels(usersModel); err != nil { | ||
| 180 | - return 0, userss, err | 178 | + for _, userModel := range userModels { |
| 179 | + if user, err := transform.TransformToUserDomainModelFromPgModels(userModel); err != nil { | ||
| 180 | + return 0, users, err | ||
| 181 | } else { | 181 | } else { |
| 182 | - userss = append(userss, users) | 182 | + users = append(users, user) |
| 183 | } | 183 | } |
| 184 | } | 184 | } |
| 185 | - return int64(count), userss, nil | 185 | + return int64(count), users, nil |
| 186 | } | 186 | } |
| 187 | } | 187 | } |
| 188 | -func NewUsersRepository(transactionContext *pgTransaction.TransactionContext) (*UsersRepository, error) { | 188 | +func NewUserRepository(transactionContext *pgTransaction.TransactionContext) (*UserRepository, error) { |
| 189 | if transactionContext == nil { | 189 | if transactionContext == nil { |
| 190 | return nil, fmt.Errorf("transactionContext参数不能为nil") | 190 | return nil, fmt.Errorf("transactionContext参数不能为nil") |
| 191 | } else { | 191 | } else { |
| 192 | - return &UsersRepository{ | 192 | + return &UserRepository{ |
| 193 | transactionContext: transactionContext, | 193 | transactionContext: transactionContext, |
| 194 | }, nil | 194 | }, nil |
| 195 | } | 195 | } |
| 1 | +package controllers | ||
| 2 | + | ||
| 3 | +import ( | ||
| 4 | + "github.com/linmadan/egglib-go/web/beego" | ||
| 5 | + "gitlab.fjmaimaimai.com/allied-creation/allied-creation-user/pkg/application/common/service" | ||
| 6 | +) | ||
| 7 | + | ||
| 8 | +type CommonController struct { | ||
| 9 | + beego.BaseController | ||
| 10 | +} | ||
| 11 | + | ||
| 12 | +func (controller *CommonController) DictionarySearch() { | ||
| 13 | + menuService := service.CommonService{} | ||
| 14 | + type search struct { | ||
| 15 | + DictCodes []string `json:"dictCodes"` | ||
| 16 | + } | ||
| 17 | + query := &search{} | ||
| 18 | + controller.Unmarshal(query) | ||
| 19 | + data, err := menuService.DictionarySearch(query.DictCodes) | ||
| 20 | + controller.Response(data, err) | ||
| 21 | +} |
| @@ -19,4 +19,6 @@ func init() { | @@ -19,4 +19,6 @@ func init() { | ||
| 19 | web.Router("/v1/web/menus/:menuId", &controllers.MenuController{}, "Delete:RemoveMenu") | 19 | web.Router("/v1/web/menus/:menuId", &controllers.MenuController{}, "Delete:RemoveMenu") |
| 20 | web.Router("/v1/web/menus/search", &controllers.MenuController{}, "Get:ListMenu") | 20 | web.Router("/v1/web/menus/search", &controllers.MenuController{}, "Get:ListMenu") |
| 21 | web.Router("/v1/web/menus/search", &controllers.MenuController{}, "Post:SearchMenu") | 21 | web.Router("/v1/web/menus/search", &controllers.MenuController{}, "Post:SearchMenu") |
| 22 | + | ||
| 23 | + web.Router("/v1/web/common/dictionary/search", &controllers.CommonController{}, "Post:DictionarySearch") | ||
| 22 | } | 24 | } |
| @@ -39,7 +39,7 @@ var _ = Describe("创建菜单服务", func() { | @@ -39,7 +39,7 @@ var _ = Describe("创建菜单服务", func() { | ||
| 39 | }) | 39 | }) |
| 40 | }) | 40 | }) |
| 41 | AfterEach(func() { | 41 | AfterEach(func() { |
| 42 | - _, err := pG.DB.Exec("DELETE FROM users.menu WHERE true") | 42 | + _, err := pG.DB.Exec("DELETE FROM user.menu WHERE true") |
| 43 | Expect(err).NotTo(HaveOccurred()) | 43 | Expect(err).NotTo(HaveOccurred()) |
| 44 | }) | 44 | }) |
| 45 | }) | 45 | }) |
| @@ -15,7 +15,7 @@ var _ = Describe("返回菜单服务", func() { | @@ -15,7 +15,7 @@ var _ = Describe("返回菜单服务", func() { | ||
| 15 | BeforeEach(func() { | 15 | BeforeEach(func() { |
| 16 | _, err := pG.DB.QueryOne( | 16 | _, err := pG.DB.QueryOne( |
| 17 | pg.Scan(&menuId), | 17 | pg.Scan(&menuId), |
| 18 | - "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", | 18 | + "INSERT INTO user.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", |
| 19 | 1, 0, "testMenuName", "testCode", "testAccessCode", "testMenuType", "testIcon", 1, "testDesc", "testCategory", "testParentPath", 1, 1) | 19 | 1, 0, "testMenuName", "testCode", "testAccessCode", "testMenuType", "testIcon", 1, "testDesc", "testCategory", "testParentPath", 1, 1) |
| 20 | Expect(err).NotTo(HaveOccurred()) | 20 | Expect(err).NotTo(HaveOccurred()) |
| 21 | }) | 21 | }) |
| @@ -36,7 +36,7 @@ var _ = Describe("返回菜单服务", func() { | @@ -36,7 +36,7 @@ var _ = Describe("返回菜单服务", func() { | ||
| 36 | }) | 36 | }) |
| 37 | }) | 37 | }) |
| 38 | AfterEach(func() { | 38 | AfterEach(func() { |
| 39 | - _, err := pG.DB.Exec("DELETE FROM users.menu WHERE true") | 39 | + _, err := pG.DB.Exec("DELETE FROM user.menu WHERE true") |
| 40 | Expect(err).NotTo(HaveOccurred()) | 40 | Expect(err).NotTo(HaveOccurred()) |
| 41 | }) | 41 | }) |
| 42 | }) | 42 | }) |
| @@ -15,7 +15,7 @@ var _ = Describe("返回菜单服务列表", func() { | @@ -15,7 +15,7 @@ var _ = Describe("返回菜单服务列表", func() { | ||
| 15 | BeforeEach(func() { | 15 | BeforeEach(func() { |
| 16 | _, err := pG.DB.QueryOne( | 16 | _, err := pG.DB.QueryOne( |
| 17 | pg.Scan(&menuId), | 17 | pg.Scan(&menuId), |
| 18 | - "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", | 18 | + "INSERT INTO user.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", |
| 19 | 1, 0, "testMenuName", "testCode", "testAccessCode", "testMenuType", "testIcon", 1, "testDesc", "testCategory", "testfullPath", 1, 1) | 19 | 1, 0, "testMenuName", "testCode", "testAccessCode", "testMenuType", "testIcon", 1, "testDesc", "testCategory", "testfullPath", 1, 1) |
| 20 | Expect(err).NotTo(HaveOccurred()) | 20 | Expect(err).NotTo(HaveOccurred()) |
| 21 | }) | 21 | }) |
| @@ -40,7 +40,7 @@ var _ = Describe("返回菜单服务列表", func() { | @@ -40,7 +40,7 @@ var _ = Describe("返回菜单服务列表", func() { | ||
| 40 | }) | 40 | }) |
| 41 | }) | 41 | }) |
| 42 | AfterEach(func() { | 42 | AfterEach(func() { |
| 43 | - _, err := pG.DB.Exec("DELETE FROM users.menu WHERE true") | 43 | + _, err := pG.DB.Exec("DELETE FROM user.menu WHERE true") |
| 44 | Expect(err).NotTo(HaveOccurred()) | 44 | Expect(err).NotTo(HaveOccurred()) |
| 45 | }) | 45 | }) |
| 46 | }) | 46 | }) |
| @@ -15,7 +15,7 @@ var _ = Describe("移除菜单服务", func() { | @@ -15,7 +15,7 @@ var _ = Describe("移除菜单服务", func() { | ||
| 15 | BeforeEach(func() { | 15 | BeforeEach(func() { |
| 16 | _, err := pG.DB.QueryOne( | 16 | _, err := pG.DB.QueryOne( |
| 17 | pg.Scan(&menuId), | 17 | pg.Scan(&menuId), |
| 18 | - "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", | 18 | + "INSERT INTO user.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", |
| 19 | 1, 0, "testMenuName", "testCode", "testAccessCode", "testMenuType", "testIcon", 1, "testDesc", "testCategory", "testfullPath", 1, 1) | 19 | 1, 0, "testMenuName", "testCode", "testAccessCode", "testMenuType", "testIcon", 1, "testDesc", "testCategory", "testfullPath", 1, 1) |
| 20 | Expect(err).NotTo(HaveOccurred()) | 20 | Expect(err).NotTo(HaveOccurred()) |
| 21 | }) | 21 | }) |
| @@ -36,7 +36,7 @@ var _ = Describe("移除菜单服务", func() { | @@ -36,7 +36,7 @@ var _ = Describe("移除菜单服务", func() { | ||
| 36 | }) | 36 | }) |
| 37 | }) | 37 | }) |
| 38 | AfterEach(func() { | 38 | AfterEach(func() { |
| 39 | - _, err := pG.DB.Exec("DELETE FROM users.menu WHERE true") | 39 | + _, err := pG.DB.Exec("DELETE FROM user.menu WHERE true") |
| 40 | Expect(err).NotTo(HaveOccurred()) | 40 | Expect(err).NotTo(HaveOccurred()) |
| 41 | }) | 41 | }) |
| 42 | }) | 42 | }) |
| @@ -15,7 +15,7 @@ var _ = Describe("更新菜单服务", func() { | @@ -15,7 +15,7 @@ var _ = Describe("更新菜单服务", func() { | ||
| 15 | BeforeEach(func() { | 15 | BeforeEach(func() { |
| 16 | _, err := pG.DB.QueryOne( | 16 | _, err := pG.DB.QueryOne( |
| 17 | pg.Scan(&menuId), | 17 | pg.Scan(&menuId), |
| 18 | - "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", | 18 | + "INSERT INTO user.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", |
| 19 | 1, 0, "testMenuName", "testCode", "testAccessCode", "testMenuType", "testIcon", 1, "testDesc", "testCategory", "testfullPath", 1, 1) | 19 | 1, 0, "testMenuName", "testCode", "testAccessCode", "testMenuType", "testIcon", 1, "testDesc", "testCategory", "testfullPath", 1, 1) |
| 20 | Expect(err).NotTo(HaveOccurred()) | 20 | Expect(err).NotTo(HaveOccurred()) |
| 21 | }) | 21 | }) |
| @@ -48,7 +48,7 @@ var _ = Describe("更新菜单服务", func() { | @@ -48,7 +48,7 @@ var _ = Describe("更新菜单服务", func() { | ||
| 48 | }) | 48 | }) |
| 49 | }) | 49 | }) |
| 50 | AfterEach(func() { | 50 | AfterEach(func() { |
| 51 | - _, err := pG.DB.Exec("DELETE FROM users.menu WHERE true") | 51 | + _, err := pG.DB.Exec("DELETE FROM user.menu WHERE true") |
| 52 | Expect(err).NotTo(HaveOccurred()) | 52 | Expect(err).NotTo(HaveOccurred()) |
| 53 | }) | 53 | }) |
| 54 | }) | 54 | }) |
-
请 注册 或 登录 后发表评论