示例#1
0
        protected override GeneratorDelegate CreateGenerator()
        {
            return((out IDbParameters pms) =>
            {
                List <string> list = new List <string>();
                pms = Template.CreateDbParameters();

                #region 基本

                if (!string.IsNullOrWhiteSpace(Id))
                {
                    list.Add("t.\"Id\"=@Id");
                    pms.AddWithValue("Id", Id);
                }
                if (!string.IsNullOrWhiteSpace(OperatorId))
                {
                    list.Add("t.\"OperatorId\"=@OperatorId");
                    pms.AddWithValue("OperatorId", OperatorId);
                }
                if (StartCreateTime != null)
                {
                    list.Add("t.\"CreateTime\">=@StartCreateTime");
                    pms.AddWithValue("StartCreateTime", StartCreateTime);
                }
                if (EndCreateTime != null)
                {
                    list.Add("t.\"CreateTime\"<=@EndCreateTime");
                    pms.AddWithValue("EndCreateTime", EndCreateTime);
                }
                if (!string.IsNullOrWhiteSpace(Remark))
                {
                    list.Add("t.\"Remark\" like @Remark");
                    pms.AddWithValue("Remark", Remark.Wrap("%"));
                }

                if (!string.IsNullOrWhiteSpace(PrincipalId))
                {
                    list.Add("t.\"PrincipalId\" = @PrincipalId");
                    pms.AddWithValue("PrincipalId", PrincipalId);
                }

                #endregion

                if (!string.IsNullOrWhiteSpace(SheepId))
                {
                    list.Add("\"SheepId\"=@SheepId");
                    pms.AddWithValue("SheepId", SheepId);
                }

                if (!string.IsNullOrWhiteSpace(Symptom))
                {
                    list.Add("\"Symptom\" like @Symptom");
                    pms.AddWithValue("Symptom", Symptom.Wrap("%"));
                }

                if (StartStartDate != null)
                {
                    list.Add("\"StartDate\">=@StartStartDate");
                    pms.AddWithValue("StartStartDate", StartStartDate);
                }
                if (EndStartDate != null)
                {
                    list.Add("\"StartDate\"<=@EndStartDate");
                    pms.AddWithValue("EndStartDate", EndStartDate);
                }


                if (!string.IsNullOrWhiteSpace(Disease))
                {
                    list.Add("\"Disease\" like @Disease");
                    pms.AddWithValue("Disease", Disease.Wrap("%"));
                }

                if (!string.IsNullOrWhiteSpace(TreatmentPlan))
                {
                    list.Add("\"TreatmentPlan\" like @TreatmentPlan");
                    pms.AddWithValue("TreatmentPlan", TreatmentPlan.Wrap("%"));
                }

                if (!string.IsNullOrWhiteSpace(Effect))
                {
                    list.Add("\"Effect\" like @Effect");
                    pms.AddWithValue("Effect", Effect.Wrap("%"));
                }


                return list;
            });
        }