📄 sqlmapquerydao.java
字号:
package com.esri.solutions.jitk.personalization.dao;
import java.util.*;
import org.springframework.orm.ibatis.support.SqlMapClientDaoSupport;
import org.springframework.dao.DataAccessException;
/**
* @author Susan Herdina
* @version 1.0
* @created 05-Nov-2007 10:29:29 AM
*
* This class implements the IQueryDAO and provides functionality to read and write
* Query Records to and from the database.
*/
public class SqlMapQueryDAO extends SqlMapClientDaoSupport implements IQueryDAO {
public void insert(QueryRecord query)
throws PersonalizationDAOException {
try{
query.setTimeModified(new java.sql.Timestamp(System.currentTimeMillis()));
getSqlMapClientTemplate().insert("insertQuery", query);
}
catch(DataAccessException e){
throw new PersonalizationDAOException( e );
}
}
public List<QueryInfoRecord> selectAll(Criteria criteria)
throws PersonalizationDAOException {
try{
return getSqlMapClientTemplate().queryForList("selectAllQueries", criteria);
}
catch(DataAccessException e){
throw new PersonalizationDAOException( e );
}
}
public int selectAllCount(Criteria criteria) throws PersonalizationDAOException {
try{
return Integer.parseInt(getSqlMapClientTemplate().queryForObject("selectCountQueries", criteria).toString());
}
catch(DataAccessException e){
throw new PersonalizationDAOException( e );
}
}
public List<QueryInfoRecord> selectPage(Criteria criteria, PageInfo pageInfo)
throws PersonalizationDAOException {
try{
int skipResults = (pageInfo.getPageIndex() * pageInfo.getPageSize());
return getSqlMapClientTemplate().queryForList("selectPageQueries", criteria, skipResults, pageInfo.getPageSize());
}
catch(DataAccessException e){
throw new PersonalizationDAOException( e );
}
}
public QueryRecord selectOne(String id)
throws PersonalizationDAOException {
try{
return (QueryRecord)getSqlMapClientTemplate().queryForObject("selectOneQuery", id);
}
catch(DataAccessException e){
throw new PersonalizationDAOException( e );
}
}
public void update(QueryRecord query)
throws PersonalizationDAOException {
try{
query.setTimeModified(new java.sql.Timestamp(System.currentTimeMillis()));
getSqlMapClientTemplate().update("updateQuery", query);
}
catch(DataAccessException e){
throw new PersonalizationDAOException( e );
}
}
public void delete(String id) throws PersonalizationDAOException {
try{
getSqlMapClientTemplate().delete("deleteQuery", id);
}
catch(DataAccessException e){
throw new PersonalizationDAOException( e );
}
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -