2023-09-11
1、模糊查询
UserMapper
List<User> getUserByLike(String mohu);
UserMapper.xml
<select id="getUserByLike" resultType="com.hh.pojo.User"> select * from t_user where name like "%"#{mohu}"%" </select>
2、批量删除
UserMapper
int deleteMore(@Param("ids")String ids);
UserMapper.xml
<delete id="deleteMore"> delete from t_user where id in (${ids}) </delete>
3、按照表名查询
UserMapper
List<User> selectAll(@Param("tableName") String tableName);
UserMapper.xml
<select id="selectAll" resultType="User"> select * from ${tableName} </select>
标签:xml,String,UserMapper,tableName,查询,表名,mybatis From: https://www.cnblogs.com/isDaHua/p/17693738.html