package com.wyu.online.dao;
import com.wyu.online.utils.C3poUtils;
import com.wyu.online.utils.DaoConnection;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
/**
* Created by Administrator on 2018/7/13
*/
public class SubjectDao {
public List<Map<String,String>> getAllSubjects() {
List<Map<String,String>> subjects = new ArrayList<>();
try {
PreparedStatement preparedStatement = C3poUtils.getPreparedStatement("select * from kskm");
ResultSet rs = preparedStatement.executeQuery();
while (rs.next()){
String id = rs.getString("id");
String subejct = rs.getString("subject");
String teacher = rs.getString("teacher");
Map<String,String> map = new HashMap<>();
map.put("id",id);
map.put("subject",subejct);
map.put("teacher",teacher);
subjects.add(map);
}
return subjects;
} catch (SQLException e) {
e.printStackTrace();
return null;
}
}
public static void main(String[] args) {
List<Map<String,String>> list = new SubjectDao().getAllSubjects();
System.out.println();
}
}
最近下载更多
最近浏览更多
lbx1234567
2025年12月23日
暂无贡献等级
yqplayer
2025年12月22日
暂无贡献等级
1271247100 LV9
2025年11月22日
bigbiaoge LV14
2025年11月7日
wjy808015 LV2
2025年10月30日
perfect LV17
2025年10月11日
vincemokea LV9
2025年9月12日
yangchengshuai LV16
2025年9月3日
是数据库 LV3
2025年8月7日
kbacbond
2025年7月5日
暂无贡献等级

