package data;
import java.sql.ResultSet;
import java.util.ArrayList;
import java.util.List;
import entity.Reader;
public class ReaderDao {
	//根据读者编号,获得单个读者实体
	public static Reader selectReader(String id) {
		String sql = "select *  from reader where id='" + id +"'";
		ResultSet rs = BaseDao.executeQuery(sql);
		Reader reader = null;
		try {
			if (rs.next()) {
				reader = new Reader();
				reader.setId(rs.getString("id"));
				reader.setType(rs.getString("type"));
				reader.setName(rs.getString("name"));
				reader.setSex(rs.getString("sex"));
				reader.setMax_num(rs.getString("max_num"));
				reader.setDays_num(rs.getInt("days_num"));
			}
		} catch (Exception e) {
			e.printStackTrace();
		}
		BaseDao.close();
		return reader;
	}
	
	//获得满足sql语句的读者实体列表
	public static List selectReaderList(String sql) {
		List list = new ArrayList();
		ResultSet rs = BaseDao.executeQuery(sql);
		Reader reader = null;
		try {
			while (rs.next()) {
				reader = new Reader();
				reader.setId(rs.getString("id"));
				reader.setType(rs.getString("type"));
				reader.setName(rs.getString("name"));
				reader.setSex(rs.getString("sex"));
				reader.setMax_num(rs.getString("max_num"));
				reader.setDays_num(rs.getInt("days_num"));
				list.add(reader);
			}
		} catch (Exception e) {
			e.printStackTrace();
		}
		BaseDao.close();
		return list;
	}
}
 最近下载更多
最近下载更多
                
                微信网友_6445756515635200     LV3
                2023年12月21日
            
            
        
                KAIzx11     LV8
                2023年6月24日
            
            
        
                huangzy     LV12
                2023年6月11日
            
            
        
                122378     LV3
                2022年12月14日
            
            
        
                微信网友_6191697646571520     LV6
                2022年10月31日
            
            
        
                13112360     LV2
                2022年9月20日
            
            
        
                gnnhka     LV10
                2022年6月16日
            
            
        
                fantesy     LV17
                2022年5月15日
            
            
        
                喃喵xxxx     LV6
                2022年5月11日
            
            
        
                543666826     LV34
                2022年3月12日
            
            
         最近浏览更多
最近浏览更多
                
                无异偶     LV3
                2024年12月30日
            
            
        
                ZALZXB20030525    
                2024年7月1日
            
            
                    暂无贡献等级
            
        
                xzw135246789     LV1
                2024年6月15日
            
            
        
                微信网友_6808953284677632     LV2
                2024年6月5日
            
            
        
                123456cjj     LV1
                2024年6月2日
            
            
        
                sodkj123     LV16
                2024年4月29日
            
            
        
                akittyboy     LV9
                2024年3月22日
            
            
        
                asddwh     LV13
                2023年12月26日
            
            
        
                求学的熊猫     LV11
                2023年12月25日
            
            
        
                微信网友_6786215447367680     LV5
                2023年12月21日
            
            
        
 
                 
                 
                