Fork me on GitHub

隐患排查记录批量修改排查人.

/// <summary>
/// 隐患排查记录批量修改排查人.
/// </summary>
/// <returns></returns>
[HttpGet("Yhpc")]
[AllowAnonymous]
[IgnoreLog]

public async Task<dynamic> Yhpc()
{
Random ran = new Random();
var dbLink = await _repository.AsSugarClient().Queryable<DbLinkEntity>().FirstAsync(it => it.Id.Equals("08dae333-158b-4fa1-832f-7d9876592a9e"));
_sqlSugarClient = _dataBaseManager.ChangeDataBase(dbLink);
List<HiddenScreenrecordEntity> hiddenScreenrecords = new List<HiddenScreenrecordEntity>();
var data = await _sqlSugarClient.Queryable<HiddenScreenrecordEntity>()
.Where(it => it.DeleteMark == 0)
.Where(it => it.OrganizeId == "08dab954-a0e9-4716-83b6-fb4817e89710")
.Where(it => it.CheckStatus == "2").ToListAsync();
await _repository.AsSugarClient().ThenMapperAsync(data, async item =>
{
if (item.CheckBy != null)
{
Random random = new Random();
int minute = random.Next(0, 30);
HiddenScreenrecordEntity hiddenScreenrecordEntity = new HiddenScreenrecordEntity();
var postLeaderUserSelect = item.CheckBy.ToObject<List<string>>();
hiddenScreenrecordEntity.RecordId = item.RecordId;
hiddenScreenrecordEntity.CheckBy = "[\"" + postLeaderUserSelect[ran.Next(0, postLeaderUserSelect.Count() - 1)] + "\"]";
hiddenScreenrecordEntity.CheckStatus = "0";
hiddenScreenrecordEntity.CheckTime = item.TaskStartTime.Value.AddMinutes(minute);
hiddenScreenrecords.Add(hiddenScreenrecordEntity);
}
});
var isok = await _sqlSugarClient.Updateable<HiddenScreenrecordEntity>(hiddenScreenrecords).UpdateColumns(it => new
{
it.CheckBy,
it.CheckStatus,
it.CheckTime
}).ExecuteCommandAsync();
return isok;
}

posted @ 2023-06-15 16:24  残风飞雪  阅读(10)  评论(0编辑  收藏  举报

博客地址 - 创建于 2022年4月12日

这是一位.Net软件研发工程师的个人站,内容主要是网站开发方面的技术文章,大部分来自学习或工作,部分来源于网络,希望对大家有所帮助。

致力于web网站开发工作,专注软件开发,关注互联网前沿技术与趋势。


Font Awesome Bootstrap中文网