資料庫期末專案

杜杰 資訊科學與工程學系
黃冕 資訊科學與工程學系
彭成傑 資訊科學與工程學系

中興選課輔助系統

前情提要

  • 現行的查詢課程系統不夠人性化
  • 舊版本課程資料需全部載入非常耗時

圖片取自:Pro REST API Development with Node.js (p.29)

Sequelize

PostgreSQL | MySQL | SQLite | MSSQL

var sequelize = new Sequelize(
    'sample', // 資料庫名稱
    'root',   // 用户名
    'zuki',   // 用户密碼
    {
        'dialect': 'mysql',  // 資料庫使用mysql
        'host': 'localhost', // 資料庫服务器ip
        'port': 3306,        // 資料庫port
        'define': {
            'underscored': true
        }
    }
)
var user = User.build({
    'emp_id': '1',
    'nick': 'Sakamoto',
    'department': 'IT'
})
user = yield user.save()
INSERT INTO `users` (`id`, `emp_id`, `nick`, `department`, `updated_at`, `created_at`) 
var users = yield User.findAll({
    'attributes': ['emp_id', 'nick']
})
SELECT `emp_id`, `nick` FROM `users`;

GET /year/:year/code/:code
GET /year/:year/professor/:professor
GET /year/:year/professor/:professor/week/:week
GET /year/:year/professor/:professor/week/:week/time/:time
GET /year/:year/title/:title
GET /year/:year/title/:title/week/:week
GET /year/:year/title/:title/week/:week/time/:time
GET /year/:year/dept/:dept
GET /year/:year/dept/:dept/week/:week
GET /year/:year/dept/:dept/week/:week/time/:time
GET /year/:year/dept/:dept/level/:level
GET /year/:year/dept/:dept/level/:level/week/:week
GET /year/:year/dept/:dept/level/:level/week/:week/time/:time
GET /year/:year/week/:week
GET /year/:year/week/:week/time/:time
GET /year/:year/general/:general
GET /year/:year/general/:general/week/:week
GET /year/:year/general/:general/week/:week/time/:time
GET /year/:year/common/:common
GET /year/:year/common/:common/week/:week
GET /year/:year/common/:common/week/:week/time/:time

GET /year/1061/code/2010

[
    {
        "id": "10612010",
        "term": "1061",
        "code": "2010",
        "title_zhTW": "現代小說",
        "title_enUS": "Modern Fiction",
        "for_dept": "中國文學系學士班",
        "location_1": "A203-2",
        "location_2": "",
        "intern_location": "",
        "department": "中國文學系學士班",
        "class": "2",
        "prerequisite": "",
        "professor": "石美玲",
        "time_1": "1.05.06",
        "time_2": "",
        "discipline": "",
        "category": "",
        "url": "1998",
        "credits": 2,
        "obligatory": 0,
        "number": 50,
        "note": ""
    }
]

GET /year/1061/title/國文

[
    {
        "id": "10611521",
        "term": "1061",
        "code": "1521",
        "title_zhTW": "國文B",
        "title_enUS": "Chinese",
        "for_dept": "外國語文學系進修學士班",
        "location_1": "Y208",
        "location_2": "",
        "intern_location": "",
        "department": "中國文學系進修學士班",
        "class": "1",
        "prerequisite": "",
        "professor": "柯混瀚",
        "time_1": "5.10.11.12",
        "time_2": "",
        "discipline": "",
        "category": "",
        "url": "3496",
        "credits": 3,
        "obligatory": 1,
        "number": 50,
        "note": ""
    },
    {
        "id": "10611536",
        "term": "1061",
        "code": "1536",
        "title_zhTW": "國文A",
        "title_enUS": "Chinese",
        "for_dept": "中國文學系進修學士班",
        "location_1": "Y206",
        "location_2": "",
        "intern_location": "",
        "department": "中國文學系進修學士班",
        "class": "1",
        "prerequisite": "",
        "professor": "周安邦",
        "time_1": "2.10.11.12",
        "time_2": "",
        "discipline": "",
        "category": "",
        "url": "1747",
        "credits": 3,
        "obligatory": 1,
        "number": 45,
        "note": ""
    },
    {
        "id": "10611537",
        "term": "1061",
        "code": "1537",
        "title_zhTW": "國文E",
        "title_enUS": "Chinese",
        "for_dept": "創新產業經營學士學位學程",
        "location_1": "Y308",
        "location_2": "",
        "intern_location": "",
        "department": "中國文學系進修學士班",
        "class": "1",
        "prerequisite": "",
        "professor": "王毓榮",
        "time_1": "4.10.11.12",
        "time_2": "",
        "discipline": "",
        "category": "",
        "url": "1748",
        "credits": 3,
        "obligatory": 1,
        "number": 50,
        "note": ""
    },
    {
        "id": "10611538",
        "term": "1061",
        "code": "1538",
        "title_zhTW": "國文D",
        "title_enUS": "Chinese",
        "for_dept": "文化創意產業學士學位學程",
        "location_1": "Y207",
        "location_2": "",
        "intern_location": "",
        "department": "中國文學系進修學士班",
        "class": "1",
        "prerequisite": "",
        "professor": "蔡金昌",
        "time_1": "4.10.11.12",
        "time_2": "",
        "discipline": "",
        "category": "",
        "url": "1749",
        "credits": 3,
        "obligatory": 1,
        "number": 50,
        "note": ""
    },
    {
        "id": "10611540",
        "term": "1061",
        "code": "1540",
        "title_zhTW": "國文C",
        "title_enUS": "Chinese",
        "for_dept": "生物產業管理學士學位學程",
        "location_1": "Y201",
        "location_2": "",
        "intern_location": "",
        "department": "中國文學系進修學士班",
        "class": "1",
        "prerequisite": "",
        "professor": "張錦瑤",
        "time_1": "3.10.11.09",
        "time_2": "",
        "discipline": "",
        "category": "",
        "url": "1751",
        "credits": 3,
        "obligatory": 1,
        "number": 50,
        "note": ""
    },
    {
        "id": "10613516",
        "term": "1061",
        "code": "3516",
        "title_zhTW": "中國文學史",
        "title_enUS": "History of Chinese Literature",
        "for_dept": "中國文學系進修學士班",
        "location_1": "Y208",
        "location_2": "",
        "intern_location": "",
        "department": "中國文學系進修學士班",
        "class": "3",
        "prerequisite": "",
        "professor": "黃東陽",
        "time_1": "1.10.11.12",
        "time_2": "",
        "discipline": "",
        "category": "",
        "url": "2903",
        "credits": 3,
        "obligatory": 1,
        "number": 45,
        "note": ""
    },
    {
        "id": "10613518",
        "term": "1061",
        "code": "3518",
        "title_zhTW": "中國文學批評史",
        "title_enUS": "History of Chinese Literary Criticism",
        "for_dept": "中國文學系進修學士班",
        "location_1": "Y302",
        "location_2": "",
        "intern_location": "",
        "department": "中國文學系進修學士班",
        "class": "3",
        "prerequisite": "",
        "professor": "陳昌遠",
        "time_1": "3.10.11",
        "time_2": "",
        "discipline": "",
        "category": "",
        "url": "2652",
        "credits": 2,
        "obligatory": 0,
        "number": 40,
        "note": ""
    },
    {
        "id": "10613525",
        "term": "1061",
        "code": "3525",
        "title_zhTW": "英國文學:中古與文藝復興時期",
        "title_enUS": "English Literature :Medieval and Renaissance Periods",
        "for_dept": "外國語文學系進修學士班",
        "location_1": "Y304",
        "location_2": "",
        "intern_location": "",
        "department": "外國語文學系進修學士班",
        "class": "3",
        "prerequisite": "",
        "professor": "鄭仁隆",
        "time_1": "2.10.11.12",
        "time_2": "",
        "discipline": "",
        "category": "",
        "url": "2911",
        "credits": 3,
        "obligatory": 1,
        "number": 65,
        "note": ""
    },
    {
        "id": "10614520",
        "term": "1061",
        "code": "4520",
        "title_zhTW": "美國文學:二十世紀前",
        "title_enUS": "American Literature: Before 20 Century",
        "for_dept": "外國語文學系進修學士班",
        "location_1": "Y402",
        "location_2": "",
        "intern_location": "",
        "department": "外國語文學系進修學士班",
        "class": "4",
        "prerequisite": "",
        "professor": "林依蓉",
        "time_1": "3.10.11.12",
        "time_2": "",
        "discipline": "",
        "category": "",
        "url": "3274",
        "credits": 3,
        "obligatory": 1,
        "number": 65,
        "note": ""
    },
    {
        "id": "10614524",
        "term": "1061",
        "code": "4524",
        "title_zhTW": "英國文學:浪漫與維多利亞時期",
        "title_enUS": "English Literature: Romantic and Victorian Periods",
        "for_dept": "外國語文學系進修學士班",
        "location_1": "Y410",
        "location_2": "",
        "intern_location": "",
        "department": "外國語文學系進修學士班",
        "class": "4",
        "prerequisite": "",
        "professor": "鄭仁隆",
        "time_1": "4.10.11.12",
        "time_2": "",
        "discipline": "",
        "category": "",
        "url": "3276",
        "credits": 3,
        "obligatory": 1,
        "number": 65,
        "note": ""
    },
    {
        "id": "10615511",
        "term": "1061",
        "code": "5511",
        "title_zhTW": "德國文化與觀光產業(一)",
        "title_enUS": "German Culture and Tourism Industry(I)",
        "for_dept": "文化創意產業學士學位學程",
        "location_1": "Y410",
        "location_2": "",
        "intern_location": "",
        "department": "文化創意產業學士學位學程",
        "class": "5",
        "prerequisite": "",
        "professor": "待聘",
        "time_1": "1.10.11",
        "time_2": "",
        "discipline": "",
        "category": "",
        "url": "3698",
        "credits": 2,
        "obligatory": 0,
        "number": 45,
        "note": ""
    },
    {
        "id": "10611038",
        "term": "1061",
        "code": "1038",
        "title_zhTW": "大學國文",
        "title_enUS": "College Chinese",
        "for_dept": "中國文學系學士班",
        "location_1": "A421",
        "location_2": "",
        "intern_location": "",
        "department": "中國文學系學士班",
        "class": "1",
        "prerequisite": "",
        "professor": "黃東陽",
        "time_1": "3.01.02",
        "time_2": "",
        "discipline": "",
        "category": "",
        "url": "1434",
        "credits": 2,
        "obligatory": 1,
        "number": 70,
        "note": ""
    },
    {
        "id": "10612001",
        "term": "1061",
        "code": "2001",
        "title_zhTW": "中國文學史",
        "title_enUS": "History of Chinese Literature",
        "for_dept": "中國文學系學士班",
        "location_1": "A311-1",
        "location_2": "",
        "intern_location": "",
        "department": "中國文學系學士班",
        "class": "2",
        "prerequisite": "",
        "professor": "蔡妙真",
        "time_1": "2.07.08.09",
        "time_2": "",
        "discipline": "",
        "category": "",
        "url": "1989",
        "credits": 3,
        "obligatory": 1,
        "number": 60,
        "note": ""
    },
    {
        "id": "10612031",
        "term": "1061",
        "code": "2031",
        "title_zhTW": "英國文學:中古與文藝復興時期",
        "title_enUS": "English Literature :Medieval and Renaissance Periods",
        "for_dept": "外國語文學系學士班",
        "location_1": "A317",
        "location_2": "",
        "intern_location": "",
        "department": "外國語文學系學士班",
        "class": "2",
        "prerequisite": "",
        "professor": "陳淑卿",
        "time_1": "2.02.03.04",
        "time_2": "",
        "discipline": "",
        "category": "",
        "url": "2018",
        "credits": 3,
        "obligatory": 1,
        "number": 56,
        "note": ""
    },
    {
        "id": "10612058",
        "term": "1061",
        "code": "2058",
        "title_zhTW": "英國文學:浪漫與維多利亞時期",
        "title_enUS": "English Literature:Romantic and Victorian Periods",
        "for_dept": "外國語文學系學士班",
        "location_1": "A422",
        "location_2": "",
        "intern_location": "",
        "department": "外國語文學系學士班",
        "class": "2",
        "prerequisite": "",
        "professor": "周幸君",
        "time_1": "3.06",
        "time_2": "2.05.06",
        "discipline": "",
        "category": "",
        "url": "2424",
        "credits": 3,
        "obligatory": 1,
        "number": 50,
        "note": ""
    },
    {
        "id": "10613022",
        "term": "1061",
        "code": "3022",
        "title_zhTW": "美國文學:二十世紀前",
        "title_enUS": "American Literature before the 20th Century",
        "for_dept": "外國語文學系學士班",
        "location_1": "A311-1",
        "location_2": "",
        "intern_location": "",
        "department": "外國語文學系學士班",
        "class": "3",
        "prerequisite": "",
        "professor": "林建光",
        "time_1": "4.02.03.04",
        "time_2": "",
        "discipline": "",
        "category": "",
        "url": "2423",
        "credits": 3,
        "obligatory": 1,
        "number": 40,
        "note": ""
    },
    {
        "id": "10613062",
        "term": "1061",
        "code": "3062",
        "title_zhTW": "美國文學:二十世紀迄今",
        "title_enUS": "American Literatrue since the 20th Century",
        "for_dept": "外國語文學系學士班",
        "location_1": "A204-1",
        "location_2": "",
        "intern_location": "",
        "department": "外國語文學系學士班",
        "class": "3",
        "prerequisite": "",
        "professor": "貝格泰",
        "time_1": "2.02.03.04",
        "time_2": "",
        "discipline": "",
        "category": "",
        "url": "4873",
        "credits": 3,
        "obligatory": 1,
        "number": 40,
        "note": ""
    }
]

GET /year/1061/dept/U56/level/2

[
    {
        "id": "10612185",
        "term": "1061",
        "code": "2185",
        "title_zhTW": "正規語言",
        "title_enUS": "Formal Languages",
        "for_dept": "資訊科學與工程學系學士班",
        "location_1": "S702A",
        "location_2": "",
        "intern_location": "",
        "department": "資訊科學與工程學系學士班",
        "class": "2",
        "prerequisite": "",
        "professor": "廖宜恩",
        "time_1": "2.06.07.08",
        "time_2": "",
        "discipline": "",
        "category": "",
        "url": "4135",
        "credits": 3,
        "obligatory": 0,
        "number": 60,
        "note": ""
    },
    {
        "id": "10612291",
        "term": "1061",
        "code": "2291",
        "title_zhTW": "Unix系統與Script程式設計",
        "title_enUS": "Unix System and Script Programing",
        "for_dept": "資訊科學與工程學系學士班",
        "location_1": "S821",
        "location_2": "",
        "intern_location": "",
        "department": "資訊科學與工程學系學士班",
        "class": "2",
        "prerequisite": "",
        "professor": "王丕中",
        "time_1": "3.06.07.08",
        "time_2": "",
        "discipline": "",
        "category": "",
        "url": "2279",
        "credits": 3,
        "obligatory": 1,
        "number": 66,
        "note": ""
    },
    {
        "id": "10612292",
        "term": "1061",
        "code": "2292",
        "title_zhTW": "線性代數",
        "title_enUS": "Linear Algebra",
        "for_dept": "資訊科學與工程學系學士班",
        "location_1": "S1001",
        "location_2": "",
        "intern_location": "",
        "department": "資訊科學與工程學系學士班",
        "class": "2",
        "prerequisite": "",
        "professor": "洪國寶",
        "time_1": "1.02.03.04",
        "time_2": "",
        "discipline": "",
        "category": "",
        "url": "2280",
        "credits": 3,
        "obligatory": 1,
        "number": 72,
        "note": ""
    },
    {
        "id": "10612293",
        "term": "1061",
        "code": "2293",
        "title_zhTW": "邏輯設計",
        "title_enUS": "Logic Design",
        "for_dept": "資訊科學與工程學系學士班",
        "location_1": "S1001",
        "location_2": "",
        "intern_location": "",
        "department": "資訊科學與工程學系學士班",
        "class": "2",
        "prerequisite": "",
        "professor": "張延任",
        "time_1": "3.02.03.04",
        "time_2": "",
        "discipline": "",
        "category": "",
        "url": "2281",
        "credits": 3,
        "obligatory": 1,
        "number": 75,
        "note": ""
    },
    {
        "id": "10612294",
        "term": "1061",
        "code": "2294",
        "title_zhTW": "資料結構",
        "title_enUS": "Data Structures",
        "for_dept": "資訊科學與工程學系學士班",
        "location_1": "S1001",
        "location_2": "",
        "intern_location": "",
        "department": "資訊科學與工程學系學士班",
        "class": "2",
        "prerequisite": "",
        "professor": "曾學文",
        "time_1": "2.02.03.04",
        "time_2": "",
        "discipline": "",
        "category": "",
        "url": "2282",
        "credits": 3,
        "obligatory": 1,
        "number": 60,
        "note": ""
    }
]

Demo

Made with Slides.com