📄 grouptrafficstatdaoimpl.java.svn-base
字号:
/**
* 该文件由自动生成代码器生成
*/
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 {
/**
* 可以根据其他字段的查询条件来获取唯一的数据
*/
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);
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -