/// <summary> /// 检查部门代码是否存在 /// </summary> /// <param name="userCode"></param> /// <param name="tenantId"></param> /// <returns></returns> public bool CheckDeptCodeExists(string deptcode, int deptId, int parentId, int tenantId) { if (string.IsNullOrEmpty(deptcode)) { return(false); } string where = "Sys_Department.Status = 0 AND Sys_Department.TenantId=@tenantId AND Sys_Department.DeptCode=@deptcode"; //" AND Sys_Department.parentId=@parentId"; if (deptId > 0) { where += " and Sys_Department.DeptId <> " + deptId; } int count = _dataAccess.GetCount <SysDepartment>(where, new { tenantId, deptcode, parentId }); return(count > 0); }
/// <summary> /// 检查岗位名称是否存在 /// </summary> /// <param name="postname"></param> /// <param name="tenantId"></param> /// <returns></returns> public bool CheckPostNameExists(string postname, int postId, int deptId, int tenantId) { if (string.IsNullOrEmpty(postname)) { return(false); } string where = "Sys_Posts.Status = 0 AND Sys_Posts.TenantId=@tenantId AND Sys_Posts.PostName=@postname AND Sys_Posts.DeptId=@deptId"; if (postId > 0) { where += " and Sys_Posts.PostId <> " + postId; } int count = _dataAccess.GetCount <SysPost>(where, new { tenantId, postname, deptId }); return(count > 0); }
/// <summary> /// 检查角色名称是否存在 /// </summary> /// <param name="roleName"></param> /// <param name="roleId"></param> /// <param name="tenantId"></param> /// <returns></returns> public bool CheckRoleNameExists(string roleName, int roleId, int tenantId) { if (string.IsNullOrEmpty(roleName)) { return(false); } string where = "Sys_Roles.Status = 0 AND Sys_Roles.TenantId=@tenantId AND Sys_Roles.RoleName=@roleName"; if (roleId > 0) { where += " and Sys_Roles.RoleId <> " + roleId; } int count = _dataAccess.GetCount <SysRole>(where, new { roleName, tenantId }); return(count > 0); }
/// <summary> /// 获取当前系统中注册的总人数 /// </summary> /// <param name="tenantId"></param> /// <returns></returns> public int GetUserCount(int tenantId) { return(_dataAccess.GetCount <SysUser>("Sys_Users.Status=0")); }