ClearLogJobService.cs 855 Bytes
using Hh.Mes.POJO.Entity;
using Hh.Mes.Service.Repository;

namespace Hh.Mes.Service.QuartzJobService
{
    public class ClearLogJobService : RepositorySqlSugar<SysJobBySugar>
    {
        public void Execute()
        {
            string sql = Context.Queryable<SysJobBySugar>().First(x => x.MethodName == "ClearLogJob").Sql;
            //示例SQL
            //"declare @deleteTime datetime;
            //set @deleteTime=dateadd(month,-2,getdate());
            // select   @deleteTime
            //delete  from sys_job_log where createTime <= @deleteTime
            //delete  from sys_interface_log where createTime <= @deleteTime
            //delete  from sys_oper_log where createTime <= @deleteTime
            //delete  from sys_login_log where createTime <= @deleteTime";

            Context.Ado.ExecuteCommand(sql);
        }
    }
}