using learun.iapplication; using learun.util; using System; using System.Collections.Generic; using System.Text; using System.Threading.Tasks; namespace learun.application { /// /// 版 本 EasyCode EC管理后台 /// Copyright (c) 2019-present EC管理有限公司 /// 创建人:tobin /// 日 期:2019.11.01 /// 描 述:任务执行日志 /// public class TSLogService : ServiceBase { #region 获取数据 /// /// 获取页面显示列表数据 /// /// 分页参数 /// 查询参数 /// public Task> GetPageList(Pagination pagination, string queryJson) { var strSql = new StringBuilder(); strSql.Append(@" SELECT t.F_Id, t.F_Name, t.F_ExecuteResult, t.F_CreateDate, t.F_Des FROM LR_TS_Log t "); strSql.Append(" WHERE 1=1 "); var queryParam = queryJson.ToJObject(); DateTime startTime = DateTime.Now, endTime = DateTime.Now; if (!queryParam["StartTime"].IsEmpty() && !queryParam["EndTime"].IsEmpty()) { startTime = queryParam["StartTime"].ToDate(); endTime = queryParam["EndTime"].ToDate(); strSql.Append(" AND ( t.F_CreateDate >= @startTime AND t.F_CreateDate <= @endTime ) "); } string keyword = ""; if (!queryParam["keyword"].IsEmpty()) { keyword = "%" + queryParam["keyword"].ToString() + "%"; strSql.Append(" AND ( t.F_Name like @keyword ) "); } int executeResult = 1; if (!queryParam["executeResult"].IsEmpty()) { executeResult = Convert.ToInt32(queryParam["executeResult"].ToString()); strSql.Append(" AND t.F_ExecuteResult = @executeResult "); } return this.BaseRepository().FindList(strSql.ToString(), new { startTime, endTime, keyword, executeResult }, pagination); } /// /// 获取LR_TS_Log表实体数据 /// /// 主键 /// public Task GetLogEntity(string keyValue) { return this.BaseRepository().FindEntityByKey(keyValue); } #endregion 获取数据 #region 提交数据 /// /// 删除实体数据 /// /// 主键 /// public async Task DeleteEntity(string keyValue) { await this.BaseRepository().DeleteAny(new { F_Id = keyValue }); } /// /// 保存实体数据(新增、修改) /// /// 主键 /// 实体 /// public async Task SaveEntity(string keyValue, TSLogEntity entity) { if (!string.IsNullOrEmpty(keyValue)) { entity.F_Id = keyValue; await this.BaseRepository().Update(entity); } else { entity.F_Id = Guid.NewGuid().ToString(); entity.F_CreateDate = DateTime.Now; await this.BaseRepository().Insert(entity); } } #endregion 提交数据 } }