Beispiel #1
0
        /// <summary>
        /// 获取项目动态 提交情况
        /// </summary>
        /// <param name="projectId"></param>
        /// <returns></returns>
        public Dictionary <string, object> getTaskRecordByProjectId(QueryTaskRecordRequest request)
        {
            var dateQuery = Db.Queryable <TaskRecord, Task, Project>((tr, t, p) => new object[]
            {
                JoinType.Left, tr.TaskId == t.Id, JoinType.Left, t.ProjectId == p.Id
            }).Where((tr, t, p) => t.ProjectId == request.projectOrTaskId && tr.Status == 1);

            if (!string.IsNullOrEmpty(request.startTime) && !string.IsNullOrEmpty(request.endTime))
            {
                dateQuery = dateQuery.Where((tr, t, p) =>
                                            SqlFunc.Between(tr.CreateTime, request.startTime, request.endTime));
            }

            var dateList = dateQuery.GroupBy((tr, t, p) => SqlFunc.DateValue(tr.CreateTime, DateType.Year) + "-" +
                                             SqlFunc.DateValue(tr.CreateTime, DateType.Month) + "-" +
                                             SqlFunc.DateValue(tr.CreateTime, DateType.Day))
                           .OrderBy((tr, t, p) => tr.CreateTime)
                           .Select((tr, t, p) => tr.CreateTime).ToList();

            var dict = new Dictionary <string, object>();

            foreach (var date in dateList)
            {
                var taskRecordList = Db.Queryable <TaskRecord>().Where(u => SqlFunc.DateIsSame(date, u.CreateTime))
                                     .ToList();
                dict.Add(date.ToString("yyyy-MM-dd"), taskRecordList);
            }

            return(dict);
        }
Beispiel #2
0
        private void DateValue()
        {
            var x2 = DateTime.Now;
            Expression <Func <Student, bool> > exp        = it => SqlFunc.DateValue(x2, DateType.Year) == 1;
            SqliteExpressionContext            expContext = new SqliteExpressionContext();

            expContext.Resolve(exp, ResolveExpressType.WhereSingle);
            var value = expContext.Result.GetString();
            var pars  = expContext.Parameters;

            base.Check(value, pars, "(CAST(STRFTIME('%Y', DATETIME(DATETIME(@MethodConst0), 'LOCALTIME')) AS INTEGER) = @Const2 )", new List <SugarParameter>()
            {
                new SugarParameter("@MethodConst0", x2), new SugarParameter("@Const2", 1)
            }, "DateValue error");
        }
Beispiel #3
0
        private void DateValue()
        {
            var x2 = DateTime.Now;
            Expression <Func <Student, bool> > exp        = it => SqlFunc.DateValue(x2, DateType.Year) == 1;
            SqlServerExpressionContext         expContext = new SqlServerExpressionContext();

            expContext.Resolve(exp, ResolveExpressType.WhereSingle);
            var value = expContext.Result.GetString();
            var pars  = expContext.Parameters;

            base.Check(value, pars, " ((@MethodConst1(@MethodConst0)) = @Const2 ) ", new List <SugarParameter>()
            {
                new SugarParameter("@MethodConst0", x2), new SugarParameter("@MethodConst1", DateType.Year), new SugarParameter("@Const2", 1)
            }, "DateValue error");
        }
Beispiel #4
0
        private void DateValue()
        {
            var x2 = DateTime.Now;
            Expression <Func <Student, bool> > exp        = it => SqlFunc.DateValue(x2, DateType.Year) == 1;
            OracleExpressionContext            expContext = new OracleExpressionContext();

            expContext.Resolve(exp, ResolveExpressType.WhereSingle);
            var value = expContext.Result.GetString();
            var pars  = expContext.Parameters;

            base.Check(value, pars, " ((CAST(TO_CHAR(:MethodConst0,'yyyy') AS NUMBER) = :Const2 )", new List <SugarParameter>()
            {
                new SugarParameter(":MethodConst0", x2), new SugarParameter(":Const2", 1)
            }, "DateValue error");
        }