天翎MyApps技术社区 - 低代码平台 | 流程管理系统 | BPM软件

 找回密码
 注册成为天翎用户
查看: 635|回复: 0

[常见问题] 获取登陆用户的默认部门Id

[复制链接]
admin 发表于 2020-12-27 00:26:44 | 显示全部楼层 |阅读模式
【myApps/OBPM版本号】:4.4stable sp21
【浏览器类型】:Chrome
【技术QQ群】:182378297
【问题描述】:如何获取登陆用户的默认部门Id

【解决方法】:
  1. (function(){
  2.         var user = getWebUser();
  3.         var DepartmentId = user.getDefaultDepartment();  
  4. })()

  5. /**
  6. *判断指定的用户在指定部门是否具有指定的角色
  7. *roleCode:角色编号   department:部门id
  8. *userId:用户ID
  9. */
  10. function isTheUserOwenTheDeptRolesByCode(userId, roleCode, department) {
  11.     var doc = getCurrentDocument();
  12.     var flag = false;
  13.     var process = new Packages.cn.myapps.designtime.role.service.RoleServiceImpl();
  14.     var role = process.findByRoleNo(roleCode, doc.getApplicationid());
  15.     var roleId = role.getId();
  16.     var sql = "select  '" + getDomainid() + "'AS DOMAINID , userid as item_userid from " + DATASOURENAME + ".t_user_department_role_set where departmentid='" + department + "' and roleid='" + roleId + "' and userid='" + userId + "' ";
  17.     var count = countBySQL(sql);
  18.     if (count > 0) {
  19.         flag = true;
  20.     }
  21.     return flag;
  22. };
复制代码

本版积分规则

QQ|手机版|天翎MyApps技术社区 ( 粤ICP备11093750号 )

GMT+8, 2026-8-12 10:40

Powered by Discuz! X3.4

Copyright © 2001-2020, Tencent Cloud.

快速回复 返回顶部 返回列表