?? grouptrafficstatdaoimpl.java.svn-base
字號(hào):
/**
* 該文件由自動(dòng)生成代碼器生成
*/
package com.xunlei.callcenter.dao;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.util.*;
import org.springframework.jdbc.core.RowCallbackHandler;
import com.xunlei.common.util.*;
import com.xunlei.callcenter.vo.Groups;
import com.xunlei.callcenter.vo.Grouptrafficstat;
/**
* @author Administrator
* @date 2008-03-20 20:48:55
*
*/
public class GrouptrafficstatDaoImpl extends BaseDao implements
IGrouptrafficstatDao {
/**
* 可以根據(jù)其他字段的查詢條件來(lái)獲取唯一的數(shù)據(jù)
*/
public Grouptrafficstat findGrouptrafficstat(Grouptrafficstat data) {
String sql = "select * from grouptrafficstat";
String countsql = "select count(1) from grouptrafficstat";
StringBuilder where = new StringBuilder(" where 1=1");
if (null != data) {
if (data.getSeqid() > 0) {
return this.getGrouptrafficstatById(data.getSeqid());
}
// TODO: 添加你的代碼,查詢條件
countsql += where.toString();
sql += where.toString();
if (this.getSingleInt(countsql) == 1) {
return this.queryOne(Grouptrafficstat.class, sql);
}
}
return null;
}
public Sheet getQueryGroupslist(String sql, String countsql,
PagedFliper fliper) {
int rowcount = super.getSingleInt(countsql);
if (rowcount == 0)
return Sheet.EMPTY;
if (fliper != null) {
sql = (new StringBuilder(String.valueOf(sql))).append(
fliper.limitsql(rowcount)).toString();
}
return new Sheet(rowcount, (Collection) query(String[].class, sql,
new String[0]));
}
public List<Groups> getAllGroups() {
String sql = "select g from Groups as g order by g.groupid";
return getHibernateTemplate().find(sql);
}
public List<List> getGrouptrafficstatView(String sql, int rowcount,
int pagesize, int pageno) {
final List<List> datas = new ArrayList<List>();
String condition = "";
sql = addLimitToSql(sql, rowcount, pagesize, pageno);
final List<Groups> groups = getAllGroups();
getJdbcTemplate().query(sql, new RowCallbackHandler() {
public void processRow(ResultSet rs) throws SQLException {
List<Map<String,String>> data = new ArrayList<Map<String,String>>();
Map<String,String> map = new HashMap<String,String>();
map.put("groupname", "-1");
map.put("value", rs.getString("BalanceDate"));
data.add(map);
for(int k=0;k<groups.size();k++){
Groups group = (Groups)groups.get(k);
if(group.getPgroupidid().equals("-1"))continue;
map = new HashMap<String,String>();
map.put("groupname", group.getGroupidname());
map.put("value", rs.getString("a"+group.getGroupid()));
data.add(map);
}
map = new HashMap<String,String>();
map.put("groupname", "-2");
map.put("value", rs.getString("total"));
data.add(map);
datas.add(data);
}
});
return datas;
}
public Grouptrafficstat getGrouptrafficstatById(long seqid) {
return findObject(Grouptrafficstat.class, seqid);
}
}
?? 快捷鍵說(shuō)明
復(fù)制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號(hào)
Ctrl + =
減小字號(hào)
Ctrl + -