Example #1
0
        public static string GetChildTableData(MDModel_Table _maintable, MDModel_Table _childTable, string _keyid)
        {
            StringBuilder _sql = new StringBuilder();

            _sql.Append("select ");
            string _fg = "";

            foreach (MDModel_Table_Column _tc in _childTable.Columns)
            {
                if (_tc.ColumnDefine.TableColumn.CanDisplay && _tc.ColumnDefine.CanShowAsResult)
                {
                    _sql.Append(_fg);
                    _sql.Append(OraResultItemBuilder.BuildItem(_tc));
                    _fg = ",";
                }
            }
            _sql.Append(" from ");
            _sql.Append(string.Format(" {0},{1} ", _maintable.TableName, _childTable.TableName));
            _sql.Append(" where ");
            _sql.Append(string.Format(" {0}.{1} ", _maintable.TableName, _maintable.TableDefine.Table.MainKey));
            _sql.Append(" = '");
            _sql.Append(_keyid);
            _sql.Append("'  and ");
            _sql.Append(_childTable.TableDefine.RelationString);
            return(_sql.ToString());
        }
Example #2
0
        public static string GetMainTableData(MDModel_Table _maintable, string _keyid)
        {
            StringBuilder _sql = new StringBuilder();

            _sql.Append("select ");
            string _fg = "";

            foreach (MDModel_Table_Column _tc in _maintable.Columns)
            {
                if (_tc.ColumnDefine.TableColumn.CanDisplay)
                {
                    _sql.Append(_fg);
                    _sql.Append(OraResultItemBuilder.BuildItem(_tc));
                    _fg = ",";
                }
            }
            _sql.Append(" from ");
            _sql.Append(_maintable.TableName);
            _sql.Append(" where ");
            _sql.Append(_maintable.TableDefine.Table.MainKey);
            _sql.Append(" = '");
            _sql.Append(_keyid);
            _sql.Append("' ");
            return(_sql.ToString());
        }
Example #3
0
        /// <summary>
        /// 构建主表的查询结果字段语句
        /// </summary>
        /// <param name="_qv"></param>
        /// <param name="_ResultTable"></param>
        /// <returns></returns>
        public static string CreateDisplayString(MDModel_QueryModel _qv, MDQuery_ResultTable _ResultTable)
        {
            StringBuilder _sql = new StringBuilder();

            _sql.Append(string.Format("{0}.{1} MAINID", _qv.MainTable.TableName, _qv.MainTable.TableDefine.Table.MainKey));
            foreach (MDQuery_TableColumn _rc in _ResultTable.Columns)
            {
                _sql.Append(OraResultItemBuilder.BuildItem(_rc, _qv));
            }
            return(_sql.ToString());
        }
Example #4
0
        /// <summary>
        /// 建立单结果查询语句
        /// </summary>
        /// <param name="_qv"></param>
        /// <param name="_queryRequest"></param>
        /// <returns></returns>
        private static string CreateSingleDisplayString(MDModel_QueryModel _qv, MDQuery_Request _queryRequest)
        {
            StringBuilder _sql = new StringBuilder();

            _sql.Append(string.Format("{0}.{1} MAINID", _qv.MainTable.TableName, _qv.MainTable.TableDefine.Table.MainKey));
            foreach (MDQuery_TableColumn _rc in _queryRequest.MainResultTable.Columns)
            {
                _sql.Append(OraResultItemBuilder.BuildItem(_rc, _qv));
            }
            if (_queryRequest.ChildResultTables != null)
            {
                foreach (MDQuery_ResultTable _rResultTable in _queryRequest.ChildResultTables)
                {
                    foreach (MDQuery_TableColumn _rc in _rResultTable.Columns)
                    {
                        _sql.Append(OraResultItemBuilder.BuildItem(_rc, _qv));
                    }
                }
            }
            return(_sql.ToString());
        }