2 个回答
 /**
   * Execute an insert statement.
   * @param statement Unique identifier matching the statement to execute.
   * @return int The number of rows affected by the insert.
   */
  int insert(String statement);

上面是SqlSession中的insert方法, 注释中已经很清楚的说到int是insert影响的行数。

返回的是修改记录的条数,如果是插入一条记录应该返回1,通过判断是不是大于0知道插入是否成功?

推荐问题