[JAVA]使用struts,ibaits和JSTL开发简便通用的文..
时间:2005-12-25 来源:blueday
使用struts,ibaits和JSTL开发简便通用的文件上传系统(6)
下一小就是建立数据操作层的类代码
下一小就是建立数据操作层的类代码
/* * Created on 2003-10-11 * * To change the template for this generated file go to * Window - Preferences - Java - Code Generation - Code and Comments */ package com.ewuxi.champion.persistence.dao; |
import java.util.HashMap; import java.util.List; |
import com.ewuxi.champion.exception.DaoException; import com.ibatis.db.sqlmap.SqlMap; |
/** * @author champion * *attachment数据库操作对象 */ |
public class AttachDb { |
/** * @param vo * @throws DaoException * 插入一条记录 */ public void insert(HashMap vo) throws DaoException { try { SqlMap sqlMap = DaoCommon.getSqlMap(DaoCommon.getDefautDao()); sqlMap.executeUpdate("insertattachmentDao", vo); } catch (Exception e) { throw new DaoException(e); } } /** * @param vo * @throws DaoException * 删除一条记录 */ public void delete(HashMap vo) throws DaoException { try { SqlMap sqlMap = DaoCommon.getSqlMap(DaoCommon.getDefautDao()); sqlMap.executeUpdate("deleteByPrimaryKeyattachmentDao", vo); } catch (Exception e) { throw new DaoException(e); } } /** * @param vo * @throws DaoException * 修改一条记录 */ public void update(HashMap vo) throws DaoException { try { SqlMap sqlMap = DaoCommon.getSqlMap(DaoCommon.getDefautDao()); sqlMap.executeUpdate("updateByPrimaryKeyattachmentDao", vo); } catch (Exception e) { throw new DaoException(e); } } /** * @param vo * @return * @throws DaoException * 查找一条记录 */ public HashMap findByPk(HashMap vo) throws DaoException { try { SqlMap sqlMap = DaoCommon.getSqlMap(DaoCommon.getDefautDao()); return (HashMap) sqlMap.executeQueryForObject( "findByPrimaryKeyattachmentDao", vo); } catch (Exception e) { throw new DaoException(e); } } public List find(Object vo) throws DaoException { try { SqlMap sqlMap = DaoCommon.getSqlMap(DaoCommon.getDefautDao()); return (List) sqlMap.executeQueryForList("findattachmentDao", vo); } catch (Exception e) { throw new DaoException(e); } } } |
相关阅读 更多 +