mybatis 使用(6)基于注解的单表的CURD

package com.mybatis.mapper;

import java.util.List;

import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;

import com.mybatis.pojo.UserInfo;

public interface UserInfoMapper {
	@Select("select * from user_info where id=#{id}")
	public UserInfo findUserInfoById(int id);

	@Select("select * from user_info where userName like CONCAT(CONCAT('%',#{userName}),'%')")
	public List<UserInfo> findUserInfoByUserName(String userName);

	@Insert("insert into user_info(userName,password) values(#{userName},#{password})")
	public int addUserInfo(UserInfo ui);

	@Update("update user_info set userName=#{userName},password=#{password} where id=#{id}")
	public int updateUserInfo(UserInfo ui);

	@Delete("delete from user_info where id=#{id}")
	public int deleteUserInfo(int id);

}
发布了245 篇原创文章 · 获赞 1 · 访问量 9554

猜你喜欢

转载自blog.csdn.net/qq_37769323/article/details/104320544