namespace Tiobon.Core.Services;

/// <summary>
/// Ghrs_LangKey (服务)
/// </summary>
public class Ghrs_LangKeyServices : BaseServices<Ghrs_LangKey, Ghrs_LangKeyDto, InsertGhrs_LangKeyInput, EditGhrs_LangKeyInput>, IGhrs_LangKeyServices
{
    private readonly IBaseRepository<Ghrs_LangKey> _dal;
    public Ghrs_LangKeyServices(ICaching caching, IBaseRepository<Ghrs_LangKey> dal)
    {
        this._dal = dal;
        base.BaseDal = dal;
        base._caching = caching;
    }

    public async Task<ServiceResult> Generate()
    {

        var entity =await base.QuerySingle(9801);
        for (int i = 1; i < 51; i++)
        {
            entity.CreateTime = DateTime.Now;
            entity.UpdateTime = null;
            entity.LangKey = "M_ManReqMainten_" + i.ToString().PadLeft(4, '0'); ;
            await Db.Insertable(entity).ExecuteReturnIdentityAsync();

        }

        return ServiceResult.OprateSuccess();

    }
}