JobDbService.cs 1.2 KB

123456789101112131415161718192021222324252627282930313233343536
  1. using Dapper;
  2. using System;
  3. using System.Collections.Generic;
  4. using System.Linq;
  5. using System.Text;
  6. using System.Threading.Tasks;
  7. using XYY.Core.Standard.Data.Infrastructure;
  8. namespace XYY.Service.JobManage
  9. {
  10. public class JobDbService : IJobDbService
  11. {
  12. IUnitOfWork unitOfWork;
  13. public JobDbService(IUnitOfWork unitOfWork)
  14. {
  15. this.unitOfWork = unitOfWork;
  16. }
  17. public void AddResultLog(ExecuteJobReturn executeJobReturn)
  18. {
  19. string sql = @"INSERT INTO [dbo].[ExecuteJobReturn]([Key1],[Key2],[StartTime],[JobModelId],[JobType],[Data],[ExecuteJobTime],[ResultId],[IsSuccess],[ErrorMsg],[Result])
  20. values (@Key1 ,@Key2 ,@StartTime ,@JobModelId ,@JobType ,@Data ,@ExecuteJobTime ,@ResultId ,@IsSuccess ,@ErrorMsg ,@Result)";
  21. this.unitOfWork.Connection.Execute(sql, executeJobReturn);
  22. }
  23. public void AddWaitLog(BaseJobModelWaitLog model)
  24. {
  25. string sql = @"INSERT INTO [dbo].[BaseJobModelWaitLog]([Key1],[Key2],[StartTime],[JobModelId],[JobType],[Data])
  26. values (@Key1,@Key2,@StartTime,@JobModelId,@JobType,@Data)";
  27. this.unitOfWork.Connection.Execute(sql, model);
  28. }
  29. }
  30. }