我自己的数据对象处理类 CmsDAO

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
  */
}

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值