首页>代码>Android开发小巫新闻客户端>/服务端源代码/web/src/com/szy/web/dao/CategoryDAO.java
package com.szy.web.dao;

import java.io.IOException;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.util.ArrayList;

import sun.reflect.generics.reflectiveObjects.NotImplementedException;

import com.szy.web.model.Category;

/**
 *@author coolszy
 *@date Feb 19, 2012
 *@blog http://blog.92coding.com
 */
public class CategoryDAO
{
	SqlManager manager;
	String sql = "";
	ResultSet rs;
	
	public CategoryDAO() throws IOException, ClassNotFoundException
	{
		manager = SqlManager.createInstance();
	}
	
	/**
	 * 获取新闻类型
	 * @param startTid 起始类型编号
	 * @param count 数量
	 * @return
	 * @throws SQLException
	 */
	public ArrayList<Category> getTypes(int startTid,int count) throws SQLException
	{
		ArrayList<Category> list = new ArrayList<Category>();
		sql = "select cid,title from t_category where deleted = false order by sequnce LIMIT ?,?";
		Object[] params = new Object[]{startTid,count};
		manager.connectDB();
		rs = manager.executeQuery(sql, params);
		while(rs.next())
		{
			Category category = new Category(rs.getInt("cid"), rs.getString("title"));
			list.add(category);
		}
		manager.closeDB();
		return list;
	}
	
	public void add(Category category)
	{
		throw new NotImplementedException();
	}
	
	public void update(Category category)
	{
		throw new NotImplementedException();
	}
	
	public void delete(int tid)
	{
		throw new NotImplementedException();
	}
	
	public ArrayList<Category> getAllTypes()
	{
		throw new NotImplementedException();
	}
}
最近下载更多
yyyyyyzh  LV8 2023年6月11日
qjg12345  LV1 2022年10月25日
_nrxsh  LV12 2022年10月22日
萌了个乖乖  LV12 2022年5月21日
511076827  LV33 2022年4月10日
刘嘉晨11111  LV7 2022年3月31日
hedu53  LV1 2022年2月7日
RunGe946  LV3 2021年12月27日
凡先生  LV19 2021年12月19日
jkysll  LV7 2021年11月14日
最近浏览更多
xiaoaitx  LV8 6月15日
appppp  LV1 2024年12月21日
chenranr  LV10 2024年12月20日
652654393  LV5 2024年11月18日
wwwqwq 2024年6月21日
暂无贡献等级
AIWU1234  LV2 2024年6月9日
今晚都别睡啦  LV9 2024年5月29日
求学的熊猫  LV11 2024年5月6日
微信网友_6522007290040320  LV2 2024年4月15日
77777七  LV1 2024年2月26日
顶部 客服 微信二维码 底部
>扫描二维码关注最代码为好友扫描二维码关注最代码为好友