SQL语句获取数据库中的表主键,自增列,所有列 获取表主键 1:SELECT TABLE_NAME,COLUMN_NAME FROM INFORMATION_SCHEMA.KEY_COLUMN_USAGEWHERE TABLE_NAME<>'dtproperties' 2:EXEC sp_pkeys @table_name='表名' 3: select o.name as 表名,c.name as 字段名,k.colid as 字段序号,k.keyno as 索引顺序,t.name as
获取自增主键的值:mysql支持自增主键,自增主键值的获取,mybatis也是利用statement.getGenreatedKeys():useGeneratedKeys="true":使用自增主键获取主键值策略keyProperty:指定对应的主键属性,也就是mybatis获取到主键值以后,将这个值封装给javaBean的哪个属性 1.接口定义 package com.mybatis.dao; import com.mybatis.bean.Employee; public int
一.mybatis的增删改查 1.修改hotelMapper接口 package com.pjf.mybatis.dao; import com.pjf.mybatis.po.Hotel; public interface HotelMapper { public Hotel getHotel(Integer i); public void updateHotel(Hotel hotel); public void insertHotel(Hotel hotel); public void de