Beispiel #1
0
        /// <summary>
        /// 获取相关的任务
        /// </summary>
        /// <param name="page">分页</param>
        /// <param name="taskRequestData">查询的数据</param>
        /// <returns></returns>
        public async Task <ResponseData> GetTask(Page page, SelectRequestData taskRequestData)
        {
            //var TaskDataMap = mapper.Map<SelectRequestData>(taskRequestData);
            var sql  = helperFunction.SqlAssembly(taskRequestData);
            var Data = await Db.PageAsync <TaskData>(page.PageNumber, page.PageSize, sql);

            return(new ResponseData("查询成功", Data, StatusCode.Success));
        }
        public Sql SqlAssembly(SelectRequestData taskDataMap)
        {
            Sql selectSql = new Sql();

            selectSql.Append("select * from Tasks where Task_IsExists=1 ");
            if (taskDataMap != null)
            {
                //任务名字不为空
                if (!string.IsNullOrEmpty(taskDataMap.Task_Name))
                {
                    selectSql.Append("and Task_Name like @0", "%" + taskDataMap.Task_Name + "%");
                }
                //任务类型不为空
                if (!string.IsNullOrEmpty(taskDataMap.Task_TaskType))
                {
                    selectSql.Append("and Task_TaskType like @0", "%" + taskDataMap.Task_TaskType + "%");
                }
                //业务类型不为空
                if (!string.IsNullOrEmpty(taskDataMap.Task_BusinessType))
                {
                    selectSql.Append("and Task_BusinessType like @0", "%" + taskDataMap.Task_BusinessType + "%");
                }
                //创建时间不为空
                if (!string.IsNullOrEmpty(taskDataMap.Task_CreateTime))
                {
                    selectSql.Append("and Task_CreateTime like @0", "%" + taskDataMap.Task_CreateTime + "%");
                }
                //预定时间不为空
                if (!string.IsNullOrEmpty(taskDataMap.Task_PresetTime))
                {
                    selectSql.Append("and Task_PresetTime like @0", "%" + taskDataMap.Task_PresetTime + "%");
                }
                //时间间隔不为空
                if (!string.IsNullOrEmpty(taskDataMap.Task_Interval))
                {
                    selectSql.Append("and Task_Interval like @0", "%" + taskDataMap.Task_Interval + "%");
                }
                ////间隔时间
                //if (!string.IsNullOrEmpty(taskDataMap.Task_IntervalTime))
                //{
                //    selectSql.Append("and Task_Interval like @0", "%" + taskDataMap.Task_IntervalTime + "%");
                //}
            }

            //完成状态不为空
            if (taskDataMap.Task_ExecuteReuslt == 0 || taskDataMap.Task_ExecuteReuslt == 1)
            {
                selectSql.Append("and Task_ExecuteReuslt like @0", taskDataMap.Task_ExecuteReuslt);
            }
            //创建时间
            selectSql.Append(PeriodOfTimeQuery("Task_CreateTime", taskDataMap.CreatTimeStart, taskDataMap.CreatTimeEnd));
            //预定时间
            selectSql.Append(PeriodOfTimeQuery("Task_PresetTime", taskDataMap.TaskPresetTimeStart, taskDataMap.TaskPresetTimeEnd));
            //执行时间
            selectSql.Append(PeriodOfTimeQuery("Task_LastExecuteTime", taskDataMap.TaskLastExecuteTimeStart, taskDataMap.TaskLastExecuteTimeEnd));
            return(selectSql);
        }
Beispiel #3
0
 public async Task <IActionResult> GetTask([FromQuery] Page page, [FromBody] SelectRequestData taskRequestData)
 {
     return(Ok(await tasksServer.GetTask(page, taskRequestData)));
 }