diff --git a/.gitignore b/.gitignore index ce4b72605887be32510101a99e78836512888c78..90e15af88b04a4333d4b95af010656830565ff4f 100644 --- a/.gitignore +++ b/.gitignore @@ -5,7 +5,6 @@ target # Log file *.log - # BlueJ files *.ctxt diff --git a/src/main/java/com/snhanyue/course/mapper/database/UsersMapper.java b/src/main/java/com/snhanyue/course/mapper/database/UsersMapper.java index 2702d50233a4f95a6057cc013bb3c6d1b5078e5e..5997afa0a816c4947ff56b5a189f393ec748526b 100644 --- a/src/main/java/com/snhanyue/course/mapper/database/UsersMapper.java +++ b/src/main/java/com/snhanyue/course/mapper/database/UsersMapper.java @@ -2,6 +2,7 @@ package com.snhanyue.course.mapper.database; import com.snhanyue.course.entity.Users; import com.snhanyue.course.vo.UsersVo; +import org.apache.ibatis.annotations.Param; import org.springframework.stereotype.Repository; @@ -18,8 +19,24 @@ public interface UsersMapper { */ int insert(Users users); - //查询方法 + /** + * 查询数据 + * @param username用户名 + * @return 查询的数据 + */ UsersVo getByName(String username); + /** + * + * @param id 主键编号 + * @return 受影响行数 + */ + int Update(@Param("id") int id, @Param("username")String username); + /** + * 删除数据 + * @param id 主键id + * @return受影响行数 + */ + int deleteUsers(int id); } diff --git a/src/main/resources/mybatis/mapper/UsersMapper.xml b/src/main/resources/mybatis/mapper/UsersMapper.xml index 4f65982087aa31437159752fda406c39d84fa01e..a51553254208814306265742c63c1ed6bc46fa66 100644 --- a/src/main/resources/mybatis/mapper/UsersMapper.xml +++ b/src/main/resources/mybatis/mapper/UsersMapper.xml @@ -13,6 +13,17 @@ ) + + delete from users where id=#{id} + + + + update users + set username=#{username} + where id = #{id} + + +