org.beangle.ems.database.action.QueryAction Maven / Gradle / Ivy
/*
* Beangle, Agile Java/Scala Development Scaffold and Toolkit
*
* Copyright (c) 2005-2013, Beangle Software.
*
* Beangle is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* Beangle is distributed in the hope that it will be useful.
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with Beangle. If not, see .
*/
package org.beangle.ems.database.action;
import java.util.ArrayList;
import java.util.Collection;
import java.util.Collections;
import java.util.List;
import java.util.Map;
import javax.sql.DataSource;
import org.beangle.commons.collection.CollectUtils;
import org.beangle.commons.collection.page.Page;
import org.beangle.commons.collection.page.PageLimit;
import org.beangle.commons.collection.page.SinglePage;
import org.beangle.commons.lang.Strings;
import org.beangle.commons.lang.Throwables;
import org.beangle.ems.database.service.SqlService;
import org.beangle.ems.web.action.SecurityActionSupport;
import com.opensymphony.xwork2.ActionContext;
/**
* 查询
*
* @author chaostone
*/
public class QueryAction extends SecurityActionSupport {
private String sql;
private SqlService sqlService;
private void processSql() {
sql = get("sql");
if (null != sql) sql = sql.trim();
}
protected Collection> getExportDatas() {
processSql();
String newSql = sql;
if (Strings.isEmpty(newSql)) { return Collections.emptyList(); }
boolean thisPage = getBool("thisPage");
if (thisPage) {
PageLimit limit = getPageLimit();
newSql = sqlService.getLimitString(sql, limit);
}
List
© 2015 - 2025 Weber Informatics LLC | Privacy Policy