@Resource public void setSqlSessionFactory(SqlSessionFactory sqlSessionFactory) { super.setSqlSessionFactory(sqlSessionFactory); } //全部数据集 public List<T> selectAll() throws DataAccessException { List<T> result = new ArrayList<T>(); try { result = this.getSqlSession().selectList( getMapperNamespace() + "." + "selectAll"); } catch (DataAccessException e) { throw e; } return result; } public Integer getTotalCount(Object params) throws DataAccessException { return getSqlSession().selectOne( getMapperNamespace() + "." + "getTotalCount", params); } //插入一条数据 @Override public boolean insertSelective(T entity) throws DataAccessException { return insert("insertSelective", entity); } //根据主键查询 @Override public T selectByPrimaryKey(Integer pk) throws DataAccessException { T result = null; try { result = (T) this.getSqlSession().selectOne( getMapperNamespace() + "." + "selectByPrimaryKey", pk); } catch (DataAccessException e) { throw e; } return result; } //根据参数查询 @Override public boolean updateByMap(String id, Map<String, Object> map) throws DataAccessException { boolean flag = this.getSqlSession().update(getMapperNamespace() + "." + id, map) > 0 ? true : false; return flag; }