^1640696310178
@
sname
DbQueryConfig
slabel
DbQueryConfig
sdescriptors
xworker.lang.MetaDescriptor3
sextends
xworker.dataObject.db.DbDataObject,xworker.dataObject.DataObject
smany
true
seditCols
2
sinitialization
false
sgroup
xworker.app.query
smodifier
public
sinheritDescription
false
Sdescription
#$@text#$@
<p>数据库查询配置，可以做一些简单的分组和聚合操作等。</p>

<p><strong>1.原理和查询过程</strong></p>

<p>&nbsp;&nbsp;&nbsp; 其原理是根据分组和聚合属性动态生成新的DbDataObject，通过新的DbDataObject执行查询。</p>

<p><strong>1.1.分组聚合查询</strong></p>

<p>&nbsp;&nbsp;&nbsp; 获取分组属性，如果查询条件中包含groupColumns，其中groupColumns是可分组属性的列表，如groupName1,groupName2。</p>

<p>&nbsp;&nbsp;&nbsp; 获取聚合属性，要聚合的属性从查询条件aggregateColumns中获取，如aggregate1,aggregate2。</p>

<p>&nbsp;&nbsp;&nbsp; 如果分组属性和聚合属性都不为空，那么执行分组聚合操作，否则执行普通的查询。</p>

<p><strong>1.2.普通查询</strong></p>

<p>&nbsp;&nbsp;&nbsp; 如果不是分组聚合查询就是普通查询，普通查询忽略分组和聚合属性，此时使用attribute普通属性，另外attrirubte普通属性也可以作为分组聚合操作的条件属性。</p>

<p><strong>2.注意事项</strong></p>

<ul>
	<li>需要设置分组（group)属性和聚合(aggregate)属性</li>
	<li>目前支持单表，不支持修改等。</li>
</ul>

<p><strong>3.数据对象缓存</strong></p>

<p>&nbsp;&nbsp;&nbsp; 生成的数据对象放在缓存里，可以通过clearCache清除。</p>

<p><strong>4.事件</strong></p>

<ul>
	<li><strong>void afterDataObjectGenerated(Thing dataObject)</strong><br />
	当新的数据对象生成后的事件。</li>
</ul>

<p>&nbsp;</p>

<p>&nbsp;</p>
#$@text#$@
snotXmlAttribute
false
sjson_isArray
false
sth_createIndex
true
sth_registThing
child|xworker.lang.util.DescriptorsIndex
sth_registMyChilds
false
sth_registDisabled
false
sth_mark
false
  @/@actions
  sname
  actions
  slabel
  actions
  sdescriptors
  xworker.lang.MetaDescriptor3/@actions
  sid
  actions
    @/@actions/@query1
    sname
    doQuery
    sisSynchronized
    false
    sthrowException
    true
    suseOtherAction
    false
    suseOuterJava
    true
    suseInnerJava
    false
    souterClassName
    xworker.dataObject.query.DbQuery
    smethodName
    query
    sdisableGlobalContext
    false
    sattributeTemplate
    false
    sinterpretationType
    Action
    svarScope
    Global
    screateLocalVarScope
    false
    ssaveReturn
    false
    sswitchResult
    false
    sdebugLog
    false
    sdescriptors
    xworker.lang.actions.Actions/@JavaAction
    sinheritDescription
    false
    sth_createIndex
    false
    sth_registMyChilds
    false
    sth_mark
    false
    sid
    query1
      @/@actions/@query1/@contexts
      sname
      contexts
      slabel
      contexts
      sdescriptors
      xworker.lang.actions.Inout/@contexts
      sid
      contexts
        @/@actions/@query1/@contexts/@dataSource
        sname
        dataSource
        sconnectionName
        con
        stransaction
        false
        sdataSourcePath
        self.dataSource
        sdisable
        false
        sonError
        ignore
        spreventError
        false
        sinherit
        true
        sdescriptors
        xworker.lang.db.jdbc.DataSouceActionContext,xworker.lang.actions.Inout/@contexts/@context
        sid
        dataSource
      @/@actions/@query1/@ins
      sisValidate
      false
      sname
      ins
      slabel
      ins
      sdescriptors
      xworker.lang.actions.Inout/@ins
      sid
      ins
        @/@actions/@query1/@ins/@datas
        sname
        conditionData
        stypeCheck
        false
        soptional
        true
        scheck
        false
        scheckLevel
        exception
        sdescription
        <p>查询参数</p>
        sdescriptors
        xworker.lang.actions.Inout/@ins/@param
        sid
        datas
        @/@actions/@query1/@ins/@condition
        sname
        condition
        stypeCheck
        false
        soptional
        true
        scheck
        false
        scheckLevel
        exception
        sdescription
        <p>查询条件定义</p>
        sdescriptors
        xworker.lang.actions.Inout/@ins/@param
        sid
        condition
        @/@actions/@query1/@ins/@aggregateColumns
        sname
        aggregateColumns
        stypeCheck
        false
        soptional
        true
        scheck
        false
        scheckLevel
        exception
        sdescription
        <p>查询结果中包含的聚合列，字符串，如有多个使用,号隔开。</p>
        sdescriptors
        xworker.lang.actions.Inout/@ins/@param
        sid
        aggregateColumns
        @/@actions/@query1/@ins/@groupColumns
        sname
        groupColumns
        stypeCheck
        false
        soptional
        true
        scheck
        false
        scheckLevel
        exception
        sdescription
        <p>汇总时的分组列，如有多个使用,号隔开。</p>
        sdescriptors
        xworker.lang.actions.Inout/@ins/@param
        sid
        groupColumns
    @/@actions/@clearCache
    sname
    clearCache
    sisSynchronized
    false
    sthrowException
    true
    suseOtherAction
    false
    suseOuterJava
    true
    souterClassName
    xworker.dataObject.query.DbQueryConfigActions
    smethodName
    clearCache
    sdisableGlobalContext
    false
    sinterpretationType
    Action
    svarScope
    Local
    screateLocalVarScope
    false
    ssaveReturn
    false
    sdebugLog
    false
    sdescriptors
    xworker.lang.actions.Actions/@JavaAction
    sinheritDescription
    false
    sth_createIndex
    false
    sth_registMyChilds
    false
    sth_mark
    false
    sid
    clearCache
    @/@actions/@iterator
    sname
    iterator
    sisSynchronized
    false
    sthrowException
    true
    suseOtherAction
    false
    suseOuterJava
    true
    suseInnerJava
    false
    souterClassName
    xworker.dataObject.query.DbQuery
    smethodName
    iterator
    sdisableGlobalContext
    false
    Scode
#$@text#$@
//读取SpInfo
def spInfos = loadDatas("wingtech.wapjump.dataobjects.SpInfo");
def sp = [:];
for(spInfo in spInfos){
    
}

def loadDatas(dataObject){
    def dobj = world.getThing(dataObject);
    return dobj.doAction("query", actionContext);
}
#$@text#$@
    sattributeTemplate
    false
    sinterpretationType
    Action
    svarScope
    Global
    screateLocalVarScope
    false
    ssaveReturn
    false
    sdebugLog
    false
    sdescriptors
    xworker.lang.actions.Actions/@JavaAction
    sinheritDescription
    false
    sth_createIndex
    false
    sth_registMyChilds
    false
    sth_mark
    false
    sid
    iterator
      @/@actions/@iterator/@contexts
      sname
      contexts
      slabel
      contexts
      sdescriptors
      xworker.lang.actions.Inout/@contexts
      sid
      contexts
        @/@actions/@iterator/@contexts/@dataSource
        sname
        dataSource
        sconnectionName
        con
        stransaction
        false
        sdataSourcePath
        self.dataSource
        sdisable
        false
        sonError
        ignore
        spreventError
        false
        sinherit
        true
        sdescriptors
        xworker.lang.db.jdbc.DataSouceActionContext,xworker.lang.actions.Inout/@contexts/@context
        sid
        dataSource
    @/@actions/@afterDataObjectGenerated
    sname
    afterDataObjectGenerated
    sunimplementedException
    false
    sdescriptors
    xworker.lang.actions.Actions/@NOOP
    sinterpretationType
    Self
    sattributeTemplate
    false
    schildsAttributeTemplate
    false
    svarScope
    Local
    sisSynchronized
    false
    sthrowException
    true
    suseOtherAction
    false
    screateLocalVarScope
    false
    ssaveReturn
    false
    sdisableGlobalContext
    false
    sdebugLog
    false
    sinheritDescription
    false
    sth_createIndex
    false
    sth_registMyChilds
    false
    sth_registDisabled
    false
    sth_mark
    false
    sid
    afterDataObjectGenerated
  @/@name
  sname
  name
  sgroup
  DB
  sinheritDescription
  false
  LvalidateOnBlur
  false
  LallowDecimals
  false
  LallowNegative
  false
  sdescriptors
  xworker.lang.MetaDescriptor3/@attribute
  sid
  name
  @/@label
  sname
  label
  sgroup
  DB
  sinheritDescription
  false
  LvalidateOnBlur
  false
  LallowDecimals
  false
  LallowNegative
  false
  sdescriptors
  xworker.lang.MetaDescriptor3/@attribute
  sid
  label
  @/@tableName
  sname
  tableName
  slabel
  表名
  sinputtype
  openWindow
  ssize
  40
  scolspan
  2
  sgroup
  DB
  sinputattrs
  xworker.swt.dataObject.SelectDBTableNameDialog/@shell
  sreadOnly
  false
  sinheritDescription
  false
  svalidateAllowBlank
  true
  LvalidateOnBlur
  true
  LallowDecimals
  true
  LallowNegative
  true
  sdescriptors
  xworker.lang.MetaDescriptor3/@attribute
  sid
  tableName
  @/@dbConfigPath
  sname
  dataSource
  slabel
  数据源
  sinputtype
  openWindow
  ssize
  60
  scolspan
  2
  sgroup
  DB
  sinputattrs
  xworker.swt.xworker.attributeEditor.openWins.SelectThingOpenWindow/@shell|descriptor=xworkerdbjdbc.DataSource,returnType=path
  sreadOnly
  false
  sinheritDescription
  false
  svalidateAllowBlank
  true
  LvalidateOnBlur
  true
  LallowDecimals
  true
  LallowNegative
  true
  sdescriptors
  xworker.lang.MetaDescriptor3/@attribute
  sid
  dbConfigPath
  @/@groupFirst
  sname
  groupFirst
  sinputtype
  truefalse
  sgroup
  DB
  sshowLabel
  true
  smodifier
  public
  sreadOnly
  false
  sdefault
  false
  sinheritDescription
  false
  sdescription
  <p>在自动生成的查询数据对象里，是否分组列放在前面，默认是放在聚合列的后面的。</p>
  svalidateAllowBlank
  true
  LvalidateOnBlur
  true
  LallowDecimals
  true
  LallowNegative
  true
  snotXmlAttribute
  false
  sdescriptors
  xworker.lang.MetaDescriptor3/@attribute
  sth_createIndex
  false
  sth_registMyChilds
  false
  sth_registDisabled
  false
  sth_mark
  false
  sid
  groupFirst
  @/@showSql
  sname
  showSql
  sinputtype
  truefalse
  sgroup
  DB
  sdefault
  false
  sinheritDescription
  false
  sdescription
  <p>是否显示SQL语句。</p>
  LvalidateOnBlur
  false
  LallowDecimals
  false
  LallowNegative
  false
  sdescriptors
  xworker.lang.MetaDescriptor3/@attribute
  sid
  showSql
  @/@querySql
  sname
  querySql
  slabel
  查询SQL
  sinputtype
  textarea
  scolspan
  2
  sgroup
  DB
  sreadOnly
  false
  sinheritDescription
  false
  sdescription
  <p>如果表名不存在，可以吃用查询SQL（一般是子查询）作为查询的表。</p>
  svalidateAllowBlank
  true
  LvalidateOnBlur
  false
  LallowDecimals
  false
  LallowNegative
  false
  sdescriptors
  xworker.lang.MetaDescriptor3/@attribute
  sid
  querySql
  @/@aggregate
  sname
  aggregate
  slabel
  聚合属性
  sdescriptors
  xworker.lang.MetaDescriptor3/@thing
  sextends
  xworker.dataObject.Attribute
  smany
  true
  seditCols
  2
  sinitialization
  false
  smodifier
  public
  sinheritDescription
  false
  sicon
  icons/arrow_in.png
  snotXmlAttribute
  false
  sjson_isArray
  false
  sid
  aggregate
    @/@aggregate/@name
    sname
    name
    slabel
    名字
    sgroup
    Attribute
    sshowLabel
    true
    sreadOnly
    false
    sinheritDescription
    false
    svalidateAllowBlank
    true
    LvalidateOnBlur
    true
    LallowDecimals
    true
    LallowNegative
    true
    snotXmlAttribute
    false
    sdescriptors
    xworker.lang.MetaDescriptor3/@attribute
    sth_createIndex
    false
    sth_registMyChilds
    false
    sth_registDisabled
    false
    sth_mark
    false
    sid
    name
    @/@aggregate/@label
    sname
    label
    slabel
    标签
    sgroup
    Attribute
    sshowLabel
    true
    sreadOnly
    false
    sinheritDescription
    false
    svalidateAllowBlank
    true
    LvalidateOnBlur
    true
    LallowDecimals
    true
    LallowNegative
    true
    snotXmlAttribute
    false
    sdescriptors
    xworker.lang.MetaDescriptor3/@attribute
    sth_createIndex
    false
    sth_registMyChilds
    false
    sth_registDisabled
    false
    sth_mark
    false
    sid
    label
    @/@aggregate/@fieldName
    sname
    fieldName
    slabel
    字段名
    ssize
    60
    scolspan
    2
    sgroup
    Attribute
    sreadOnly
    false
    sinheritDescription
    false
    sdescription
    <p>对应数据库中的字段名，如果没有那么数据库的字段名默认为属性名。</p>
    svalidateAllowBlank
    true
    LvalidateOnBlur
    false
    LallowDecimals
    false
    LallowNegative
    false
    sdescriptors
    xworker.lang.MetaDescriptor3/@attribute
    sid
    fieldName
  @/@group
  sname
  group
  slabel
  分组列
  sdescriptors
  xworker.lang.MetaDescriptor3/@thing
  sextends
  xworker.dataObject.Attribute
  smany
  true
  seditCols
  2
  sinitialization
  false
  smodifier
  public
  sinheritDescription
  false
  sicon
  icons/folder_database.png
  snotXmlAttribute
  false
  sjson_isArray
  false
  sid
  group
    @/@group/@name
    sname
    name
    slabel
    名字
    sgroup
    Attribute
    sshowLabel
    true
    sreadOnly
    false
    sinheritDescription
    false
    svalidateAllowBlank
    true
    LvalidateOnBlur
    true
    LallowDecimals
    true
    LallowNegative
    true
    snotXmlAttribute
    false
    sdescriptors
    xworker.lang.MetaDescriptor3/@attribute
    sth_createIndex
    false
    sth_registMyChilds
    false
    sth_registDisabled
    false
    sth_mark
    false
    sid
    name
    @/@group/@label
    sname
    label
    slabel
    标签
    sgroup
    Attribute
    sshowLabel
    true
    sreadOnly
    false
    sinheritDescription
    false
    svalidateAllowBlank
    true
    LvalidateOnBlur
    true
    LallowDecimals
    true
    LallowNegative
    true
    snotXmlAttribute
    false
    sdescriptors
    xworker.lang.MetaDescriptor3/@attribute
    sth_createIndex
    false
    sth_registMyChilds
    false
    sth_registDisabled
    false
    sth_mark
    false
    sid
    label
    @/@group/@fieldName
    sname
    fieldName
    slabel
    字段名
    ssize
    60
    scolspan
    2
    sgroup
    Attribute
    sreadOnly
    false
    sinheritDescription
    false
    sdescription
    <p>对应数据库中的字段名，如果没有那么数据库的字段名默认为属性名。</p>
    svalidateAllowBlank
    true
    LvalidateOnBlur
    false
    LallowDecimals
    false
    LallowNegative
    false
    sdescriptors
    xworker.lang.MetaDescriptor3/@attribute
    sid
    fieldName
