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