getScoreList(ScoreVO vo) { return jdbcTemplate.query(SCORE_LIST, new ScoreRowMapper()); } }"> getScoreList(ScoreVO vo) { return jdbcTemplate.query(SCORE_LIST, new ScoreRowMapper()); } }"> getScoreList(ScoreVO vo) { return jdbcTemplate.query(SCORE_LIST, new ScoreRowMapper()); } }">
package com.score.template;
import java.util.List;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.jdbc.core.JdbcTemplate;
import org.springframework.stereotype.Repository;
// @Repository
// - DAO Class에 사용
// - database 에 접근하는 메서드를 가지고 있는 Class에 사용.
@Repository
public class ScoreDAO {
@Autowired
private JdbcTemplate jdbcTemplate;
private final String SCORE_INSERT = "INSERT INTO SCORE VALUES (?,?,?,?,?,?,?,sysdate)";
private final String SCORE_LIST = "SELECT * FROM SCORE ORDER BY NO ASC";
// 성적 입력
public int insertScore(ScoreVO vo) {
return jdbcTemplate.update(SCORE_INSERT, vo.getNo(), vo.getName(), vo.getKor(), vo.getEng(), vo.getMat(), vo.getTot(), vo.getAvg());
}
// 도서 목록
public List<ScoreVO> getScoreList(ScoreVO vo) {
return jdbcTemplate.query(SCORE_LIST, new ScoreRowMapper());
}
}