/// <summary> /// 新增部门,去除token /// </summary> /// <param name="data"></param> /// <param name="companyId"></param> /// <returns></returns> public static int CreateDepartment(CreateDepartmentData data, int companyId) { using (var c = Sql.CreateConnection()) { return(c.SelectScalar <int>(Sql.CreateDepartmentSql, new { data.DepartmentName, companyId })); } }
/// <summary> /// 新增部门 /// </summary> /// <param name="data"></param> /// <param name="token"></param> /// <returns></returns> public static int CreatDepartment(CreateDepartmentData data, string token) { if (string.IsNullOrWhiteSpace(token)) { throw new ArgumentException("token不能为空"); } if (data == null) { throw new ArgumentException("data 参数不能为空"); } var tokenData = DisassembleProtocol(token); var companyId = Convert.ToInt32(tokenData["CompanyId"]); return(CreateDepartment(data, companyId)); }