package com.jh.core.db;
import java.sql.SQLException;
import java.util.List;
import com.jh.app.util.Globle;
import com.jh.core.db.jdbc.BaseDAO;
import com.jh.core.util.JHPage;
public class CmsDAO<T> extends BaseDAO <T>{
/**
* 设定数据库
*/
final public static String DB_NAME = Globle.CMS_DB;
/**
* @param clazz
*/
@SuppressWarnings("unchecked")
public CmsDAO(Class<T> clazz) {
super(clazz);
}
@Override
public String getDBName() {
return DB_NAME;
}
/**
* 执行更新sql
*
* @param sql
* @return
* @throws SQLException
*/
public static boolean execute(String sql) throws SQLException {
return BaseDAO.execute(DB_NAME, sql);
}
public static void insertObj(String tableName, final String[] columnName,
final List obj) {
BaseDAO.insertObjList(DB_NAME, tableName, columnName, obj);
}
public static void updateObj(String tableName, final String[] columnName,
final String[] whereColumn, final List obj) {
BaseDAO.updateObj(DB_NAME, tableName, columnName, whereColumn, obj);
}
public static void updateObj(String tableName, final String[] columnName,
final String where, final List obj) {
BaseDAO.updateObj(DB_NAME, tableName, columnName, where, obj);
}
/**
* 通过sql获得对象
*
* @param sql
* @param clazz0
* @return
* @throws Exception
*/
public static Object getObj(final String sql, final Class clazz0)
throws Exception {
return BaseDAO.getObj(DB_NAME, sql, clazz0);
}
/**
* 获得对象list
*
* @param sql
* @param clazz0
* @return
* @throws Exception
*/
public static List getObjList(final String sql, final Class clazz0)
throws Exception {
return BaseDAO.getObjList(DB_NAME, sql, clazz0);
}
/**
* 获得分页对象list
*
* @param sql
* @param clazz0
* @param page
* @return
* @throws Exception
*/
public static List getObjList(final String sql, final Class clazz0,
JHPage page) throws Exception {
return BaseDAO.getObjList(DB_NAME, sql, clazz0, page);
}
/**
* 获得统计或者sql的取得的值
*
* @param sql
* @return
* @throws Exception
*/
public static Object getValue(final String sql) throws Exception {
return BaseDAO.getValue(DB_NAME, sql);
}
/**
* 插入对象方法
*
* @param tableName
* @param columnName
* @param obj
*/
public static Long insertObj(String tableName, final String[] columnName,
final Object obj) {
return BaseDAO.insertObj(DB_NAME, tableName, columnName, obj);
}
/**
* 更新对象方法
*
* @param tableName
* @param columnName
* @param whereColumn
* @param obj
*/
public static void updateObj(String tableName, final String[] columnName,
final String[] whereColumn, final Object obj) {
BaseDAO.updateObj(DB_NAME, tableName, columnName, whereColumn, obj);
}
/**
* 更新对象方法
* Time: 2006-11-25 上午09:21:19
* User: phx
* @param tableName
* @param columnName
* @param where
* @param obj
*/
public static void updateObj(String tableName, final String[] columnName,
final String where, final Object obj) {
BaseDAO.updateObj(DB_NAME, tableName, columnName, where, obj);
}
/**
* 批量执行sql update
*
* @param sqlList
* @return
* @throws SQLException
*/
static public int[] update(List sqlList) throws SQLException {
return BaseDAO.update(DB_NAME, sqlList);
}
/**
* 执行sql update
*
* @param sql
* @return
* @throws SQLException
*/
static public int update(String sql) throws SQLException {
return BaseDAO.update(DB_NAME, sql);
}
/**
* 获得指定条数的集合对象
*
* @param sql
* @param clazz0
* @param limit
* @return
* @throws Exception
*/
public static List getObjList(String sql, Class clazz0, int limit)
throws Exception {
return BaseDAO.getObjList(DB_NAME, sql, clazz0, limit);
}
/**
* 按指定sql获得对象
*
* @param sql
* @return
* @throws Exception
*/
}