basedao.java

来自「网上购书系统的完整代码」· Java 代码 · 共 42 行

JAVA
42
字号
package org.myrose.dao;

import java.util.List;
import org.myrose.conn.MyConn;

import com.ibatis.sqlmap.client.SqlMapClient;

public class BaseDAO {
	public List findList(String sqlId) throws Exception {
		SqlMapClient sqlMapper = MyConn.getSqlMapper();
		List list = sqlMapper.queryForList(sqlId);
		return list;
	}

	public List findList(String sqlId, Object obj) throws Exception {
		SqlMapClient sqlMapper = MyConn.getSqlMapper();
		List list = sqlMapper.queryForList(sqlId, obj);
		return list;
	}

	public Object findEntity(String sqlId, Object obj) throws Exception {
		SqlMapClient sqlMapper = MyConn.getSqlMapper();
		Object result = sqlMapper.queryForObject(sqlId, obj);
		return result;
	}

	public Object addEntity(String sqlId, Object obj) throws Exception {
		SqlMapClient sqlMapper = MyConn.getSqlMapper();
		return sqlMapper.insert(sqlId, obj);
	}

	public int updateEntity(String sqlId, Object obj) throws Exception {
		SqlMapClient sqlMapper = MyConn.getSqlMapper();
		return sqlMapper.update(sqlId, obj);
	}

	public List getList(String sqlId, Object obj, int i, int j)	throws Exception {
		SqlMapClient sqlMapper = MyConn.getSqlMapper();
		return sqlMapper.queryForList(sqlId, obj, i, j);
	}
}

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?