类 DTTable

java.lang.Object
com.gdxsoft.easyweb.data.DTTable
所有已实现的接口:
Serializable

public class DTTable extends Object implements Serializable
另请参阅:
  • 构造器详细资料

    • DTTable

      public DTTable()
  • 方法详细资料

    • getTimeDiffMinutes

      public int getTimeDiffMinutes()
      用户和系统的时差(分钟)
      返回:
    • setTimeDiffMinutes

      public void setTimeDiffMinutes(int timeDiffMinutes)
      用户和系统的时差(分钟)
      参数:
      timeDiffMinutes - 分钟
    • getJsonBinaryHandle

      public IBinaryHandle getJsonBinaryHandle()
      设置JSON处理二进制的方法
      返回:
    • setJsonBinaryHandle

      public void setJsonBinaryHandle(IBinaryHandle binaryHandle)
      设置JSON处理二进制的方法
      参数:
      binaryHandle -
    • getCachedTable

      public static DTTable getCachedTable(String sql, int intLifeSeconds, String dataSourceName, RequestValue rv) throws IOException, ClassNotFoundException
      获取 cached 表数据
      参数:
      sql -
      intLifeSeconds - 最长生命时间
      dataSourceName -
      rv -
      返回:
      抛出:
      IOException
      ClassNotFoundException
    • getCachedTable

      public static DTTable getCachedTable(String sql, int intLifeSeconds, DataConnection cnn) throws IOException, ClassNotFoundException
      获取 cached 表数据
      参数:
      sql -
      intLifeSeconds - 最长生命时间
      cnn - 数据库连接
      返回:
      抛出:
      IOException
      ClassNotFoundException
    • replaceParameters

      public static String replaceParameters(String source, RequestValue rv)
      替换原始字符串中的@参数
      参数:
      source -
      rv -
      返回:
    • getJdbcTable

      public static DTTable getJdbcTable(String sql)
      获取 JDBC 表,自动关闭连接,使用默认的数据库连接
      参数:
      sql -
      返回:
    • getJdbcTable

      public static DTTable getJdbcTable(String sql, String dataSourceName)
      获取 JDBC 表,自动关闭连接
      参数:
      sql -
      dataSourceName -
      返回:
    • getJdbcTable

      public static DTTable getJdbcTable(String sql, String dataSourceName, RequestValue rv)
      获取 JDBC 表,自动关闭连接
      参数:
      sql -
      dataSourceName - 指定连接源
      rv -
      返回:
    • getJdbcTable

      public static DTTable getJdbcTable(String sql, RequestValue rv)
      获取 JDBC 表,自动关闭连接
      参数:
      sql -
      rv -
      返回:
    • getJdbcTable

      public static DTTable getJdbcTable(String sql, DataConnection conn)
      获取 JDBC 表,注意没有关闭数据库连接,请手动关闭
      获取数据后,移除该查询的数据集
      参数:
      sql -
      conn -
      返回:
    • getJdbcTable

      public static DTTable getJdbcTable(String sql, String pkFiled, int pageSize, int curPage, String dataSourceName)
      获取 JDBC 分页表,自动关闭连接
      参数:
      sql - 执行查询的语句
      pkFiled - 主键
      pageSize - 每页的记录数
      curPage - 当前页
      dataSourceName - 数据源
      返回:
    • getJdbcTable

      public static DTTable getJdbcTable(String sql, String pkFiled, int pageSize, int curPage, String dataSourceName, RequestValue rv)
      获取 JDBC 分页表,自动关闭连接
      参数:
      sql - 执行查询的语句
      pkFiled - 主键
      pageSize - 每页的记录数
      curPage - 当前页
      dataSourceName - 数据源
      rv - RequestValue
      返回:
    • getJdbcTable

      public static DTTable getJdbcTable(String sql, String pkFiled, int pageSize, int curPage, DataConnection conn)
      获取 JDBC 表,注意没有关闭数据库连接,请手动关闭
      参数:
      sql - 执行查询的语句
      pkFiled - 主键
      pageSize - 每页的记录数
      curPage - 当前页
      conn - 数据库连接,请手动关闭
      返回:
    • fromSerialize

      public static DTTable fromSerialize(byte[] buf) throws IOException, ClassNotFoundException
      从序列化二进制中获取表
      参数:
      buf -
      返回:
      抛出:
      IOException
      ClassNotFoundException
    • toClasses

      public List<?> toClasses(Class<?> objectClass) throws Exception
      映射表数据到 根据 objectClass 的类
      Map the table rows to the target class list
      参数:
      objectClass - the target class
      返回:
      the target class list
      抛出:
      Exception - the exception
    • toSerialize

      public byte[] toSerialize() throws IOException
      序列化表
      Serialize the table
      返回:
      the serialized binary
      抛出:
      IOException - the exception
    • initXmlColumnsByFields

      public void initXmlColumnsByFields(String[] fields, boolean isAttribute)
      根据指定的字段初始化字段的XML属性,是否从XML的属性中获取
      Initialize the table columns XML "isAttribute" according to the specified, Whether to get the value from the XML element attribute fields
      参数:
      fields - the fields name
      isAttribute - 是否从XML的属性中获取
      Whether to get the value from the XML element attribute
    • initData

      public void initData(Document doc, String xmlTagName)
      根据XML Document 初始化数据
      Initialize the table data from the XML document
      参数:
      doc - the XML document
      xmlTagName - the tag name
    • initData

      public void initData(String xml, String xmlTagName)
      根据Xml字符串 初始化数据
      Initialize the table data from the XML string
      参数:
      xml - the XML string
      xmlTagName - the XML tag name
    • initDataByXmlChildNodes

      public void initDataByXmlChildNodes(Document doc, String dataTag)
      通过节点的子节点的textcontent获取数据
      Initialize the table data from specified text node of the XML document
      参数:
      doc - the XML document
      dataTag - the text node tag name
    • initDataByXmlChildNodes

      public void initDataByXmlChildNodes(String xml, String dataTag)
      通过节点的子节点的textcontent获取数据
      Initialize the table data from specified text node of the XML document
      参数:
      xml - the XML string
      dataTag - the XML tag name
    • join

      public void join(DTTable fromTable, String[] fromKeys, String[] toKeys) throws Throwable
      连接两个表,将需要连接的表数据放到本表中类似数据库的左联
      {"TYPE": "JOIN", "FROM_KEYS": "BAS_TAG", "TO_KEYS": "VIS_STATUS"}
      参数:
      fromTable - 需要连接的表
      fromKeys - 需要连接的表的主键
      toKeys - 当前表的主键
      抛出:
      Throwable - the exception
    • joinHor

      public void joinHor(DTTable fromTable, String[] fromKeys, String[] toKeys, String[] fields, String namedField, String valueField) throws Throwable
      合并垂直表
      参数:
      fromTable - 来源的纵向表
      fromKeys - 来源和当前表关联的字段
      toKeys - 当前表和来源表关联的字段
      fields - 需要附加的字段
      namedField - 来源表标记为字段名称的字段 *
      valueField - 取值用的字段
      抛出:
      Throwable - the exception
    • addRow

      public DTRow addRow()
      新增一行数据
    • toJSONArray

      public org.json.JSONArray toJSONArray() throws org.json.JSONException
      返回JSON对象 含有图片的最多返回50条记录,其它最多1000条数据
      返回:
      the JSON array
      抛出:
      org.json.JSONException - the exception
    • getCellValueByJson

      public Object getCellValueByJson(DTCell cell, String contentpath)
      创建JSON时,获取Cell值的方法
      参数:
      cell - the table cell
      contentpath - the binary value save to
      返回:
      the value
    • toJSONArrayBinaryToFile

      public org.json.JSONArray toJSONArrayBinaryToFile(String http) throws org.json.JSONException
      返回JSON对象,二进制数据转换成文件
      特征码:##BINARY_FILE["+objBinFile.toString()+"]BINARY_FILE##
      返回:
      the JSON array
      抛出:
      org.json.JSONException - the exception
    • toJson

      public String toJson(RequestValue rv)
      返回JSON数据 含有图片的最多返回50条记录,其它最多1000条数据
      参数:
      rv - 现在没啥用了
      返回:
      JSONObject
    • toXml

      public String toXml(RequestValue rv)
      Convert to the XML String
      参数:
      rv - the RequestValue
      返回:
      the XML String
    • addXmlNewRow

      public DTRow addXmlNewRow()
    • initData

      public void initData(ResultSet rs)
      根据ResultSet初始化数据
      Initialize the table data from the JDBC ResultSet
      参数:
      rs - the JDBC ResultSet
    • initData

      public void initData(ResultSet rs, int limit)
      根据ResultSet初始化数据
      Initialize the table data from the JDBC ResultSet
      参数:
      rs - the JDBC ResultSet
      limit - 限制返回数量,<=0为不限制
    • initData

      public void initData(ResultSet rs, String[] keys, int limit)
      根据ResultSet初始化数据 Initialize the table data from the JDBC ResultSet
      参数:
      rs - the JDBC ResultSet
      keys - 主键表达式 the data keys
      limit - 限制返回数量,<=0为不限制
    • initData

      public void initData(ResultSet rs, String[] keys)
      根据ResultSet初始化数据 Initialize the table data from the JDBC ResultSet
      参数:
      rs - the JDBC ResultSet
      keys - 主键表达式 the data keys
    • getRowByKeys

      public DTRow getRowByKeys(DTColumn[] cols, Object[] vals)
      根据keys值获取数据行
      Returns the row form the keys
      参数:
      cols - keys的字段
      vals - keys值
      返回:
      the row
    • getRowByKeys

      public DTRow getRowByKeys(String[] colsNames, Object[] vals) throws Exception
      根据keys值获取数据行
      Returns the row form the keys
      参数:
      colsNames - keys的字段名称
      vals - keys值
      返回:
      the row
      抛出:
      Exception - the Exception
    • rebuildIndex

      public void rebuildIndex()
      重建索引
      Rebuild the table index
    • getRowByKey

      public DTRow getRowByKey(DTColumn col, Object val)
      根据key值获取数据行
      Returns the row form the key
      参数:
      col - the key column
      val - the key value
      返回:
      the row
    • getRowByKey

      public DTRow getRowByKey(String colName, Object val)
      根据key值获取数据行
      Returns the row form the key
      参数:
      colName - 字段名称
      the key column name
      val - 字段值
      the key value
      返回:
      the row
    • initData

      public void initData(Map<?,?> mapData)
      根据HashMap类初始化数据
      Initialize the data from the Map data
      参数:
      mapData - the Map data
    • initData

      public void initData(List<?> listData)
      根据List类初始化数据 Initialize the data from the List data
      参数:
      listData - the List data
    • initData

      public void initData(org.json.JSONArray arr) throws Exception
      通过JSONArray创建表
      Initialize the table data from the JSON array
      参数:
      arr - the JSON array
      抛出:
      Exception - the exception
    • initColumns

      public void initColumns(ResultSet rs)
      根据ResultSet初始化字段信息
      Initialize the table columns from the JDBC result
      参数:
      rs - the JDBC result
    • getRow

      public DTRow getRow(int index)
    • getRowIndex

      public int getRowIndex()
    • getColumns

      public DTColumns getColumns()
      返回:
      the _Columns
    • setColumns

      public void setColumns(DTColumns columns)
      参数:
      columns - the _Columns to set
    • getRows

      public DTRows getRows()
      返回:
      the _Rows
    • setRows

      public void setRows(DTRows rows)
      参数:
      rows - the _Rows to set
    • isOk

      public boolean isOk()
      返回:
      the _IsOk
    • getErrorInfo

      public String getErrorInfo()
      返回:
      the _ErrorInfo
    • getCurRow

      public DTRow getCurRow()
      返回:
      the _CurRow
    • getCount

      public int getCount()
      获取数据行数
      返回:
      the table rows count
    • getCell

      public DTCell getCell(int rowIndex, int colIndex)
    • getCell

      public DTCell getCell(int rowIndex, String colName) throws Exception
      抛出:
      Exception
    • getXmlDataTag

      public String getXmlDataTag()
      返回:
      the _XmlDataTag
    • setXmlDataTag

      public void setXmlDataTag(String xmlDataTag)
      参数:
      xmlDataTag - the _XmlDataTag to set
    • isBuildIndex

      public boolean isBuildIndex()
      返回:
      the _IsBuildIndex
    • setIsBuildIndex

      public void setIsBuildIndex(boolean isBuildIndex)
      参数:
      isBuildIndex - the _IsBuildIndex to set
    • getIndexes

      public DTIndexes getIndexes()
      返回:
      the Indexes
    • getXmlNodeDataParent

      public Node getXmlNodeDataParent()
      获取XML数据的数据节点父节点
      返回:
      the XmlNodeDataParent
    • getXmlDataNodeName

      public String getXmlDataNodeName()
      获取XML数据的节点名称
      返回:
      the XmlDataNodeName
    • getName

      public String getName()
      返回:
      the _Name
    • setName

      public void setName(String name)
      参数:
      name - the _Name to set
    • getRowSum

      public Double getRowSum(int rowIndex)
      获取行合计
      Sum the field
      参数:
      rowIndex - the field index
      返回:
      the sum result
    • getRowAvg

      public Double getRowAvg(int rowIndex)
      获取行平均值
      参数:
      rowIndex -
      返回:
    • getRowMax

      public Double getRowMax(int rowIndex)
      获取行最大值
      参数:
      rowIndex -
      返回:
    • getRowMin

      public Double getRowMin(int rowIndex)
      获取行最小值
      参数:
      rowIndex -
      返回:
    • getColSum

      public Double getColSum(int colIndex)
      获取列合计值
      参数:
      colIndex -
      返回:
    • getColCalc

      public Double getColCalc(int colIndex)
    • getColAvg

      public Double getColAvg(int colIndex)
      获取列平均值
      参数:
      colIndex -
      返回:
    • getColMin

      public Double getColMin(int colIndex)
      获取列最小值
      参数:
      colIndex -
      返回:
    • getColMax

      public Double getColMax(int colIndex)
      获取列最大值
      参数:
      colIndex -
      返回:
    • getAttsTable

      public com.gdxsoft.easyweb.utils.msnet.MTable getAttsTable()
      附加对象,可以添加任意类型对象
      返回:
      the _AttsTable
    • joinIds

      public String joinIds(String fieldName, boolean addQuotationMarks)
      将表字段拼接为用“,”分割的字符串表达式,例如:'abc', 'cdf', 'aaa',用于数据库查询的ID
      参数:
      fieldName -
      addQuotationMarks -
      返回:
    • setOk

      public void setOk(boolean isOk)
    • setErrorInfo

      public void setErrorInfo(String errorInfo)