package com.system.file.ftp.action;
import java.io.IOException;
import java.io.UnsupportedEncodingException;
import java.net.URLDecoder;
import java.util.List;
import org.apache.poi.hssf.record.formula.functions.Count;
import net.sf.json.JSONArray;
import net.sf.json.JSONObject;
import com.system.action.SystemAction;
import com.system.common.Constants;
import com.system.common.IpUtils;
import com.system.db.C3P0Utils;
import com.system.file.model.Prog;
import com.system.file.model.TBFile;
import com.system.file.utils.FilePath;
import com.system.utils.Tools;
@SuppressWarnings(“serial”)
public class FileAction extends SystemAction {
@SuppressWarnings("unchecked")
public String list() {
String tf_name = res.getParameter(request, "tf_name", "");
String hql = "";
String total_hql = "";
if(!"".equals(tf_name)){
hql = "from TBFile f where (f.tf_relName like '%" + tf_name + "%' or f.tf_no like '%" + tf_name
+ "%') and f.tf_state = '1' order by f.tf_inputdate";
total_hql = "select count(tf_id) total from tb_file f where f.tf_state='1' and tf_name like '%"+ tf_name +"%'";
request.setAttribute("tf_name", tf_name);
}else{
total_hql = "select count(tf_id) total from tb_file f where f.tf_state='1'";
hql = "from TBFile f where f.tf_state = '1' order by f.tf_inputdate desc";
}
Integer total=C3P0Utils.getTotal(total_hql);
//int total = systemService.getTotal(hql);
request.setAttribute("total", total);
// 有多少页可以浏览
int countPage = (total / Constants.WEBPAGESIZE) + (total % Constants.WEBPAGESIZE > 0 ? 1