All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.rt.orm.Dao Maven / Gradle / Ivy

There is a newer version: 1.1.17
Show newest version
package com.rt.orm;

import com.json.JSONArray;
import com.json.JSONObject;
import com.rt.logic.beans.LogicBean;

import java.io.Serializable;

/**
 * dao service interface
 *
 * @author msc
 */
public interface Dao {

    /**
     * batch update
     *
     * @param entityArray entityArray
     * @return LogicBean
     * @throws Exception Exception
     */
    LogicBean batchUpdate(JSONArray entityArray) throws Exception;

    /**
     * batch update
     *
     * @param entityArray     entityArray
     * @param throwsException default false
     * @return LogicBean
     * @throws Exception Exception
     */
    LogicBean batchUpdate(JSONArray entityArray, boolean throwsException) throws Exception;

    /**
     * 保存
     *
     * @param tableName is tableName
     * @param entity    is entity
     * @return LogicBean
     * @throws Exception exception
     */
    LogicBean saveEntity(String tableName, JSONObject entity) throws Exception;

    /**
     * insert
     *
     * @param tableName tableName
     * @param entity    entity
     * @return LogicBean
     * @throws Exception Exception
     */
    LogicBean insertEntity(String tableName, JSONObject entity) throws Exception;

    /**
     * update
     *
     * @param tableName tableName
     * @param entity    entity
     * @return LogicBean
     * @throws Exception Exception
     */
    LogicBean updateEntity(String tableName, JSONObject entity) throws Exception;

    /**
     * delete
     *
     * @param tableName is tableName
     * @param id        pk value
     * @return LogicBean
     * @throws Exception exception
     */
    LogicBean deleteEntity(String tableName, Serializable id) throws Exception;

    /**
     * 获得BaseEntity
     *
     * @param tableName is tableName
     * @param id        pk value
     * @return LogicBean
     * @throws Exception exception
     */
    LogicBean getEntity(String tableName, Serializable id) throws Exception;

    /**
     * 直接执行sql如:insert/update/delete
     *
     * @param sql sql
     * @return LogicBean
     * @throws Exception Exception
     */
    LogicBean updateSQL(String sql) throws Exception;

    /**
     * 直接执行sql如:insert/update/delete
     *
     * @param sql   sql
     * @param param param
     * @return LogicBean
     * @throws Exception Exception
     */
    LogicBean updateSQL(String sql, JSONObject param) throws Exception;

    /**
     * 批量直接执行sql如:insert/update/delete
     *
     * @param sqlMap key=sql value=param
     * @return LogicBean
     * @throws Exception Exception
     */
    LogicBean batchUpdateSQL(JSONObject sqlMap) throws Exception;

    /**
     * 批量直接执行sql如:insert/update/delete
     *
     * @param sqlMap          key=sql value=param
     * @param throwsException default false
     * @return LogicBean
     * @throws Exception Exception
     */
    LogicBean batchUpdateSQL(JSONObject sqlMap, boolean throwsException) throws Exception;

    /**
     * sql查询
     *
     * @param sql query sql
     * @return LogicBean
     * @throws Exception exception
     */
    LogicBean query(String sql) throws Exception;

    /**
     * sql查询
     *
     * @param sql   search query
     * @param param search query param
     * @return List
     * @throws Exception exception
     */
    LogicBean query(String sql, JSONObject param)
            throws Exception;

    /**
     * sql查询
     *
     * @param sql      search query
     * @param param    search query param
     * @param startRow page param
     * @param maxRow   page param
     * @return List
     * @throws Exception exception
     */
    LogicBean query(String sql, JSONObject param, long startRow, long maxRow)
            throws Exception;

}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy