namespace Tiobon.Core.Services;

/// <summary>
/// 简历组别 (服务)
/// </summary>
public class Ghrh_ResumeInfoGroupServices : BaseServices<Ghrh_ResumeInfoGroup, Ghrh_ResumeInfoGroupDto, InsertGhrh_ResumeInfoGroupInput, EditGhrh_ResumeInfoGroupInput>, IGhrh_ResumeInfoGroupServices
{
    private readonly IBaseRepository<Ghrh_ResumeInfoGroup> _dal;
    public Ghrh_ResumeInfoGroupServices(ICaching caching, IBaseRepository<Ghrh_ResumeInfoGroup> dal)
    {
        this._dal = dal;
        base.BaseDal = dal;
        base._caching = caching;
    }

    public override async Task<long> Add(InsertGhrh_ResumeInfoGroupInput entity)
    {
        entity.GroupType = entity.GroupType ?? "Other";
        var SortNo = await Db.Queryable<Ghrh_ResumeInfoGroup>().MaxAsync(it => it.SortNo);
        entity.SortNo = SortNo + 1;


        return await base.Add(entity);
    }
}