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();
    }
}
最近下载更多
hongdongdong  LV12 2023年12月2日
li246520  LV2 2023年6月26日
流连瓦盖法  LV7 2023年6月25日
yjhusst  LV1 2022年11月26日
云翳tel青  LV11 2022年11月19日
cx0127  LV13 2022年10月30日
1535316910  LV7 2022年6月16日
y1214435276  LV9 2022年5月14日
weilaizhisheng  LV21 2022年3月14日
314997zf  LV4 2021年12月24日
最近浏览更多
pokerf  LV5 4月7日
好的好的  LV8 3月4日
auqfnifc  LV3 2月7日
asddwh  LV12 2023年12月29日
WBelong  LV7 2023年12月27日
hanzhuohong  LV1 2023年12月25日
微信网友_6709209201250304  LV2 2023年12月11日
fesfefe  LV13 2023年12月3日
gnnhka  LV10 2023年12月3日
hongdongdong  LV12 2023年12月2日
顶部 客服 微信二维码 底部
>扫描二维码关注最代码为好友扫描二维码关注最代码为好友