Esempio n. 1
0
        /// <summary>
        /// 构建主表的查询结果字段语句
        /// </summary>
        /// <param name="_qv"></param>
        /// <param name="_ResultTable"></param>
        /// <returns></returns>
        public static string CreateDisplayString(MDModel_QueryModel _qv, MDQuery_ResultTable _ResultTable, List <MD_SecretFieldItem> _secretFields)
        {
            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(MySqlResultItemBuilder.BuildItem(_rc, _qv));
                if (_rc.SecretLevel > 0)
                {
                    // 字符串类型才进行解密
                    switch (_rc.ColumnDataType.ToUpper())
                    {
                    case "CHAR":
                    case "VARCHAR":
                    case "NVARCHAR":
                    case "NVARCHAR2":
                    case "VARCHAR2":
                        _secretFields.Add(new MD_SecretFieldItem()
                        {
                            TableName = _rc.TableName, FieldName = _rc.ColumnAlias
                        });
                        break;
                    }
                }
            }
            return(_sql.ToString());
        }
Esempio n. 2
0
        public static string GetChildTableData(MDModel_Table _maintable, MDModel_Table _childTable, string _keyid, List <MD_SecretFieldItem> _secretFields)
        {
            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(MySqlResultItemBuilder.BuildItem(_tc));
                    _fg = ",";
                }
                if (_tc.SecretLevel > 0)
                {
                    // 字符串类型才进行解密
                    switch (_tc.ColumnDataType.ToUpper())
                    {
                    case "CHAR":
                    case "VARCHAR":
                    case "NVARCHAR":
                    case "NVARCHAR2":
                    case "VARCHAR2":
                        _secretFields.Add(new MD_SecretFieldItem()
                        {
                            TableName = _tc.TableName, FieldName = _tc.ColumnAlias
                        });
                        break;
                    }
                }
            }
            _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());
        }