com.naver.timetable.dao.TimeTableDAO.java Source code

Java tutorial

Introduction

Here is the source code for com.naver.timetable.dao.TimeTableDAO.java

Source

/*
 * @(#)TimeTableDAO.java $version 2014. 8. 21.
 *
 * Copyright 2007 NHN Corp. All rights Reserved. 
 * NAVER Corp. PROPRIETARY/CONFIDENTIAL. Use is subject to license terms.
 */

package com.naver.timetable.dao;

import java.util.List;
import java.util.Map;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.orm.ibatis.SqlMapClientTemplate;
import org.springframework.stereotype.Repository;

import com.google.common.collect.Maps;

import com.naver.timetable.model.Lecture;

/**
 * @author younghan
 */
@Repository
public class TimeTableDAO {
    @Autowired
    @Qualifier("hufsCubrid")
    SqlMapClientTemplate hufsCubrid;

    /**
     *   ?? ?  .
     * @param studentNum
     * @param year
     * @param season
     * @return
     */
    public List<Lecture> getTimeTable(String studentNum, String year, String season) {
        Map<String, Object> parameterMap = Maps.newHashMap();
        parameterMap.put("studentNum", studentNum);
        parameterMap.put("lecture_year", year);
        parameterMap.put("lecture_season", season);
        return hufsCubrid.queryForList("getTimeTable", parameterMap);
    }

    //3? ?. JOIN
    public int checkTimeTable(String studentNum, String year, String season, List<String> lectureTimes) {
        Map<String, Object> parameterMap = Maps.newHashMap();
        parameterMap.put("studentNum", studentNum);
        parameterMap.put("lectureTimes", lectureTimes);
        parameterMap.put("lecture_year", year);
        parameterMap.put("lecture_season", season);
        return (Integer) hufsCubrid.queryForObject("checkTimeTable", parameterMap);
    }

    public void addLecture(String studentNum, String lectureID) {
        Map<String, Object> parameterMap = Maps.newHashMap();
        parameterMap.put("studentNum", studentNum);
        parameterMap.put("lectureID", lectureID);
        hufsCubrid.insert("addLecture", parameterMap);
    }

    /**
     * ? ?? ?  ??  ? .
     * @param studentNum
     * @param lectureID
     * @return
     */
    public int isExistLecture(String studentNum, String lectureID) {
        Map<String, Object> parameterMap = Maps.newHashMap();
        parameterMap.put("studentNum", studentNum);
        parameterMap.put("lectureID", lectureID);
        return (Integer) hufsCubrid.queryForObject("isExistLecture", parameterMap);
    }
}