UserMapper接口 package com.sdcet.mapper; import com.sdcet.entity.User; import org.apache.ibatis.annotations.*; import java.util.List; @Mapper public interface UserMapper { @Select("SELECT `name`FROM user WHERE id=#{id}") String selectNameById(Long id); @Select("SELECT*FROM user WHERE id =#{id}") User selectUserById(Long id); @Select("SELECT id,`name`,sex,password,phone_num,create_time,update_time FROM user WHERE`name`=#{name}") List<User> selectUserByName(String name); @Insert("INSERT INTO user (name, sex, password, phone_num, create_time, update_time) VALUES (#{name}, #{sex}, #{password}, #{phoneNum}, #{createTime}, #{updateTime})") int save(User user); @Update("update user SET name=#{name},password=#{password},phone_num=#{phoneNum},sex=#{sex},update_time=#{updateTime} WHERE id=#{id}") int update(User user); @Delete("DELETE FROM user WHERE id=#{id}") int delete(Long id); }
2021-05-24
最新推荐文章于 2022-01-26 22:26:06 发布
![](https://img-home.csdnimg.cn/images/20240711042549.png)