public async Task <IResponseEntity> UpdateAsync(ConfigEditRequest req) { if (req == null || req?.Id == "") { return(ResponseEntity.Error("更新的实体主键丢失")); } var entity = _mapper.Map <SysConfigEntity>(req); await _sysConfigRepository.UpdateAsync(entity); return(ResponseEntity.Ok("更新成功")); }
/// <summary> /// 修改配置信息 /// </summary> /// <param name="sysConfigModel">配置信息</param> /// <returns>操作结果</returns> public Task <OperateResult> EditConfigAsync(SysConfigModel sysConfigModel) { return(OperateUtil.ExecuteAsync(async() => { var sysConfigInfo = _sysConfigDomainService.Create(sysConfigModel); var flag = await LockUtil.ExecuteWithLockAsync(Lock_SysConfigModify, sysConfigInfo.FKey, TimeSpan.FromMinutes(2), async() => { await _sysConfigDomainService.CheckAsync(sysConfigInfo); await _sysConfigRepository.UpdateAsync(sysConfigInfo, m => m.FID == sysConfigInfo.FID, ignoreFields: IDAndCreate); _operateLogDomainService.AddOperateLog(sysConfigModel.OperateUserID.Value, OperateModule.SysConfig, OperateModuleNode.Edit, $"{sysConfigInfo.GetOperateDesc()}"); _sysConfigDomainService.ConfigChanged(OperateType.Modify, sysConfigInfo.FID); return true; }, defaultValue: false); if (!flag) { throw new BizException("修改失败"); } }, callMemberName: "SysConfigApplication-EditConfigAsync")); }