|
楼主 |
发表于 2017-5-16 10:45:38
|
显示全部楼层
本帖最后由 qweasdzxc 于 2017-5-16 10:53 编辑
public static Table getOutData(){
try {
String sql = "select t.*,row_number() OVER(ORDER BY t.flag DESC)AS sort from (SELECT Count(a.fAssetId) AS flag,MAX(a.fAssetName) AS assetName,a.fAssetId AS assetId FROM SAM_AssetOutDetail a left join SAM_AssetOutList b on a.fAssetOutListID=b.fid where b.fBizState='bsFinished' GROUP BY a.fAssetId ORDER BY flag DESC) t WHERE ROWNUM <=10";
return SQL.select(sql, null, "/SAM/assetManage/data", null);
} catch (Exception e) {
throw new RuntimeException(e.getMessage());
}
}
var ctx = this.getContext();
var params = new biz.Request.ActionParam();
var options = {
context : ctx,
process : ctx.getCurrentProcess(),
activity : ctx.getCurrentActivity(),
action : "getOutData",
parameters : params,
callback : function(data) {
if (data.state) {
// 成功
var options = {defaultValues:[]};
var rows = data.response.rows;
if(rows.length > 0){
for (var i = 0; i < rows.length; i++) {
options.defaultValues.push({assetId: rows.ASSETID.value, assetName: rows.ASSETNAME.value, num: rows.FLAG.value});
}
outData.newData(options);
}
}
}
};
biz.Request.sendBizRequest(options);
用sql查询完后怎么关闭连接?像我这样写是一直开着连接吗?查询多次会影响效率吧
|
|