注解开发完成增删改
* (在完成简单功能时)使用注解开发会比配置文件开发更加方便
- 查询:@Select
- 添加:@Insert
- 修改:@Update
- 删除:@Delete
// 注解开发
@Select("select * from tb_user where id = #{id}")
User selectById(int id);
注解添加
/**
* 注解开发
* 添加用户
*/
@Insert("insert into tb_user (username, password, gender, addr) VALUES (#{username},#{password},#{gender},#{addr})")
int insert(User user);
User user = new User();
user.setUsername("zhaoliu");
user.setPassword("456");
user.setGender("女");
user.setAddr("杭州");
int count = userMapper.insert(user);
标签:int,开发,user,MyBatis,注解,id,User From: https://www.cnblogs.com/1873cy/p/16736516.html