You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

56 lines
1.5 KiB

using Furion.DependencyInjection;
using GDZZ.Core;
using GDZZ.FlowCenter.Entity;
using System;
using System.Threading.Tasks;
using Yitter.IdGenerator;
namespace GDZZ.FlowCenter.Service;
/// <summary>
/// 自定义表格服务
/// </summary>
public class FlcCustomFormService : IFlcCustomFormService, ITransient
{
private readonly SqlSugarRepository<FlcCustomForm> _rep;
public FlcCustomFormService(SqlSugarRepository<FlcCustomForm> rep)
{
_rep = rep;
}
/// <summary>
/// 新增
/// </summary>
/// <param name="flowInstanceId"></param>
/// <param name="frmData"></param>
/// <returns></returns>
public async Task Add(long flowInstanceId, string frmData)
{
var req = frmData.ToObject<FlcCustomForm>();
req.FlowInstanceId = flowInstanceId;
req.Id = YitIdHelper.NextId();
req.CreatedUserId = UserManager.UserId;
req.CreatedUserName = UserManager.Name;
req.CreatedTime = DateTime.Now;
await _rep.InsertAsync(req);
}
/// <summary>
/// 编辑
/// </summary>
/// <param name="flowInstanceId"></param>
/// <param name="frmData"></param>
/// <returns></returns>
public async Task Edit(long flowInstanceId, string frmData)
{
var req = frmData.ToObject<FlcCustomForm>();
req.FlowInstanceId = flowInstanceId;
await _rep.UpdateAsync(a => a.FlowInstanceId == req.FlowInstanceId, a => new FlcCustomForm
{
Remark = a.Remark,
Sort = a.Sort,
Name = a.Name
});
}
}