package dao;

import java.sql.*;
import java.util.*;

import db.DBManager;
import model.Type;


public class TypeDAO {
	// 偌煦濬脤戙妀こ
			public List<Type> queryByTypeID(int typeID) {
				Connection conn = DBManager.getConn();
				PreparedStatement pstmt = null;
				List<Type> type = new ArrayList<Type>();
				try {
					try {
						String sql = null;
						if(typeID == -1){
							sql = "select * from type";
							pstmt = conn.prepareStatement(sql);
						}else{
							sql = " select * from type where typeID=?";
							pstmt = conn.prepareStatement(sql);
							pstmt.setInt(typeID, 1);						
					}
						ResultSet rs = pstmt.executeQuery();
						while (rs.next()) {
							Type type1 = new Type();
							type1.setTypeID(rs.getInt("typeID"));
							type1.setTypename(rs.getString("typename"));
							type.add(type1);
						}
					}finally {
						conn.close();
					}
				} catch (Exception e) {
					e.printStackTrace();
				}
				return type;
			}
			
			
}
最近下载更多
微信网友_7294439741132800  LV1 2024年12月18日
krispeng  LV13 2024年10月28日
www的行为  LV2 2024年6月20日
sdfddd  LV4 2024年5月16日
abandan  LV4 2023年11月6日
微信网友_6699076084797440  LV7 2023年11月2日
微信网友_6680567232876544  LV8 2023年10月10日
zhuorui  LV3 2023年10月7日
936684178  LV2 2023年6月26日
768881787  LV7 2023年6月26日
最近浏览更多
1125742469 2024年12月27日
暂无贡献等级
打死王二狗  LV1 2024年12月18日
hbyl123 2024年12月15日
暂无贡献等级
我做梦  LV2 2024年12月14日
微信网友_7294439741132800  LV1 2024年12月13日
huangzy  LV12 2024年12月13日
韩同学 2024年11月23日
暂无贡献等级
lqzixi  LV4 2024年11月6日
xxm111  LV1 2024年10月29日
krispeng  LV13 2024年10月28日
顶部 客服 微信二维码 底部
>扫描二维码关注最代码为好友扫描二维码关注最代码为好友