Example #1
0
        // -------------------------------------------------------
        // 自定义查询条件
        // -------------------------------------------------------

        #region 属性:BuildWhereClause(DataQuery query)
        /// <summary>根据场景名称构建查询条件</summary>
        /// <param name="query"></param>
        /// <returns></returns>
        private string BuildWhereClause(DataQuery query)
        {
            string whereClause = string.Empty;

            string scence = query.Variables["scence"];

            if (string.IsNullOrEmpty(scence))
            {
                // 默认查询方式
                whereClause = query.GetWhereSql(new Dictionary <string, string>()
                {
                    { "AttachmentName", "LIKE" }
                });
            }
            else
            {
                StringBuilder outString = new StringBuilder();

                if (scence == "Query")
                {
                    DataQueryBuilder.Equal(query.Where, "id", outString);
                    DataQueryBuilder.Equal(query.Where, "attachmentName", outString);
                    DataQueryBuilder.Equal(query.Where, "entityId", outString);

                    DataQueryBuilder.Between(query.Where, "createdDate", "beginDate", "endDate", outString);

                    return(outString.ToString());
                }
            }

            return(whereClause);
        }