| | |
| | | private bool InsertOrUpdateStaff(SqlSugarScope db, SysUser sysUser, |
| | | MesStaff entity) |
| | | { |
| | | db.Deleteable<SysUser>() |
| | | .Where(s => s.Account == sysUser.Account).ExecuteCommand(); |
| | | |
| | | var exists = db.Queryable<SysUser>().Any(u => u.Account == sysUser.Account); |
| | | if (!exists) |
| | | { |
| | | var insertUser = db.Insertable(sysUser).ExecuteCommand(); |
| | | if (insertUser <= 0) return false; |
| | | } |
| | | |
| | | //db.Deleteable<SysUser>() |
| | | // .Where(s => s.Account == sysUser.Account).ExecuteCommand(); |
| | | |
| | | db.Deleteable<MesStaff>() |
| | | .Where(s => s.Id == entity.Id).ExecuteCommand(); |
| | | |
| | | var insertUser = db.Insertable(sysUser).ExecuteCommand(); |
| | | if (insertUser <= 0) return false; |
| | | |
| | | |
| | | var insertStaff = db.Insertable(entity).ExecuteCommand(); |
| | | return insertStaff > 0; |
| | | } |
| | |
| | | UserName = staff.FName, |
| | | Password = "E1ADC3949BA59ABBE56E057F2F883E", // 初始密码 |
| | | DepartNo = staff.FPostDept, |
| | | Type = staff.Type |
| | | Type = staff.Type, |
| | | CreateTime = DateTime.Now |
| | | }; |
| | | } |
| | | |