public IActionResult AddOrUpdate([FromForm] Sys_dept dept, [FromForm] string id)
        {
            var validator = new SysDeptFluent();
            var results   = validator.Validate(dept);
            var success   = results.IsValid;

            if (!success)
            {
                string msg = results.Errors.Aggregate("", (current, item) => (item.ErrorMessage + "</br>"));
                //foreach (var item in results.Errors)
                //{
                //    msg += item.ErrorMessage + "</br>";
                //}
                return(BootJsonH((PubEnum.Failed.ToInt32(), msg)));
            }
            if (id.IsEmptyZero())
            {
                if (_deptServices.IsAny(c => c.DeptNo == dept.DeptNo))
                {
                    return(BootJsonH((false, PubConst.Dept2)));
                }
                dept.DeptId   = PubId.SnowflakeId;
                dept.CreateBy = UserDtoCache.UserId;
                bool flag = _deptServices.Insert(dept);
                return(BootJsonH(flag ? (flag, PubConst.Add1) : (flag, PubConst.Add2)));
            }
            else
            {
                dept.DeptId       = id.ToInt64();
                dept.ModifiedBy   = UserDtoCache.UserId;
                dept.ModifiedDate = DateTimeExt.DateTime;
                var flag = _deptServices.Update(dept);
                return(BootJsonH(flag ? (flag, PubConst.Update1) : (flag, PubConst.Update2)));
            }
        }
        public IActionResult Add(string id)
        {
            Sys_dept dept = new Sys_dept();

            if (id.IsEmpty())
            {
                return(View(dept));
            }
            else
            {
                dept = _deptServices.QueryableToEntity(c => c.DeptId == SqlFunc.ToInt64(id));
                return(View(dept));
            }
        }