Exemple #1
0
        /// <summary>
        /// 根据业务对象类型和过滤条件获取对象列表
        /// </summary>
        /// <param name="bot"></param>
        /// <param name="filter"></param>
        /// <returns></returns>
        public BOCollection GetBOListByType(string bot, string filter)
        {
            BOCollection  list   = new BOCollection();
            StringBuilder strSql = new StringBuilder();

            strSql.Append(" SELECT DISTINCT T.BOID, T.NAME, T1.BOT FROM  ");
            strSql.Append(" BO T,");
            strSql.Append(" OBJECTTYPE T1 ");
            //属性过滤条件不为空
            if (!string.IsNullOrEmpty(filter))
            {
                strSql.Append(" ,PROPERTY PROPERTY  ");
            }
            strSql.Append(string.Format(" WHERE T1.BOT = '{0}' ", bot));
            strSql.Append(" AND T.BOTID = T1.BOTID ");
            //属性过滤条件不为空
            if (!string.IsNullOrEmpty(filter))
            {
                strSql.Append(" AND PROPERTY.BOID = T.BOID ");
            }
            if (!string.IsNullOrEmpty(filter))
            {
                strSql.Append(" AND " + "(" + MongoJsonToSql.JsonToSql(filter, bot).ToString() + ")");
            }
            list.AddRange(SqlServerDBHelper.ExecuteQueryText <BO>(strSql.ToString()));
            return(list);
        }
Exemple #2
0
        /// <summary>
        /// 根据应用场景和过滤条件查询业务对象。通过对象的参数集进行过滤,返回符合条件的对象列表
        /// </summary>
        /// <param name="bot">业务对象类型</param>
        /// <param name="wktBBox">空间范围</param>
        /// <param name="filte">过滤条件</param>
        /// <returns></returns>
        public BOCollection GetBOListByFilter(string bot, string wktBBox, string filte)
        {
            //sdo_point_type(坐下坐标,右上坐标)。
            BOCollection  list   = new BOCollection();
            StringBuilder strSql = new StringBuilder();

            strSql.Append(" SELECT DISTINCT T.BOID, T.NAME, T1.BOT ");
            strSql.Append(" FROM ");
            if (!string.IsNullOrEmpty(wktBBox))
            {
                strSql.Append(" V_GEOMETRY   A,");
            }
            strSql.Append(" BO T,");
            strSql.Append(" OBJECTTYPE T1 ");
            //属性过滤条件不为空
            if (!string.IsNullOrEmpty(filte))
            {
                strSql.Append(" ,PROPERTY PROPERTY  ");
            }
            strSql.Append(string.Format(" WHERE T1.BOT = '{0}' ", bot));
            if (!string.IsNullOrEmpty(wktBBox))
            {
                //strSql.Append(" GEOMETRY   A,");
                strSql.Append(" AND A.BOID = T.BOID ");
            }
            strSql.Append(" AND T.BOTID = T1.BOTID ");
            //属性过滤条件不为空
            if (!string.IsNullOrEmpty(filte))
            {
                strSql.Append(" AND PROPERTY.BOID = T.BOID ");
            }
            //空间范围不为空
            if (!string.IsNullOrEmpty(wktBBox))
            {
                strSql.Append(string.Format(" AND ( A.GEOMETRY.STWithin(GEOGRAPHY::STGeomFromText('{0}', 4326))=1 or ", wktBBox));
                strSql.Append(string.Format("  A.GEOMETRY.STIntersects(GEOGRAPHY::STGeomFromText('{0}', 4326))=1  )  ", wktBBox));
            }
            if (!string.IsNullOrEmpty(filte))
            {
                strSql.Append(" AND " + "( " + MongoJsonToSql.JsonToSql(filte, bot).ToString() + " )");
            }
            list.AddRange(SqlServerDBHelper.ExecuteQueryText <BO>(strSql.ToString()));
            return(list);
        }