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

namespace Hh.Mes.Service.QuartzJobService
{
    public class ClearLogJobService : RepositorySqlSugar<sys_job>
    {
        public void Execute()
        {
           string sql = Context.Queryable<sys_job>().First(x => x.methodName == "ClearLogJob").jobSql;
            //示例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);
        }
    }
}