【Mybatis】mapper接口中与数据库操作对应的方法参数及返回值

本文详细介绍了 Mybatis 中 mapper 接口的 CRUD 方法,包括 Insert、Update、Delete 和查询方法。每个方法的参数 parameterObject 用于提供数据库操作的数据,返回值分别对应于插入的主键、受影响的行数、查询的单个对象和对象列表。
摘要由CSDN通过智能技术生成

Insert

@param id: The name of the statement to execute.
数据库操作语句。
@param parameterObject: The parameter object is generally used to supply the input data for the INSERT values.
数据库操作对象映射的实体类,主要用于提供待插入的数据。
@return: The primary key of the newly inserted row. This might be automatically generated by the RDBMS, or selected from a sequence table or other source.
返回值为新插入的行号,即插入数据时自动生成的主键。

Update

@param parameterObject: The parameter object is generally used to supply the input data for the UPDATE values as well as the WHERE clause parameter(s).
数据库操作对象映射的实体类,主要用于提供待更新数据的位置以及更新值。
@return: The number of rows effected.
返回值为变动数据的行号,即主键。

Delete

@param parameterObject: The parameter object is generally used to supply the input data for the WHERE clause parameter(s) of the DELETE statement.
数据库操作对象映射的实体类,主要用于提供待删除数据的位置。
@return: The number of rows effected.
返回值为删除数据的行号,即主键。

queryForObject

@param parameterObject: The parameter object is generally used to supply the input data for the WHERE clause parameter(s) of the SELECT statement.
数据库操作对象映射的实体类,主要用于提供待查询的参数。
@return: The single result object populated with the result set data, or null if no result was found.
返回值为查询结果对应的主体类,且只包含一条数据。

queryForList

@param parameterObject: The parameter object is generally used to supply the input data for the WHERE clause parameter(s) of the SELECT statement.
数据库操作对象映射的实体类,主要用于提供待查询的参数。
@return: A List of result objects.
返回的是一系列符合查询条件的结果。

/*
 *  Copyright 2004 Clinton Begin
 *
 *  Licensed under the Apache License, Version 2.0 (the "License");
 *  you may not use this file except in compliance with the License.
 *  You may obtain a copy of the License at
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 *  Unless required by applicable law or agreed to in writing, software
 *  distributed under the License is distributed on an "AS IS" BASIS,
 *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 *  See the License for the specific language governing permissions and
 *  limitations under the License.
 */
package com.ibatis.sqlmap.client;
 
import com.ibatis.common.util.PaginatedList;
import com.ibatis.sqlmap.client.event.RowHandler;
import com.ibatis.sqlmap.engine.execution.BatchException;
 
import java.sql.SQLException;
import java.util.List;
import java.util.Map;
 
/**
 * This interface declares all methods involved with executing statements
 * and batches for an SQL Map.
 *
 * @see SqlMapSession
 * @see SqlMapClient
 */
public interface SqlMapExecutor {
   
 
  /**
   * Executes a mapped SQL INSERT statement.
   * Insert is a bit different from other update methods, as it
   * provides facilities for returning the primary key of the
   * newly inserted row (rather than the e
  • 0
    点赞
  • 2
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值