mybatisplus使用xml
一、配置xml路径
mybatis-plus:
mapper-locations: classpath:mapper/*.xml
二、编写Mapper里面的方法
public interface UserMapper extends BaseMapper
List
List
}
三、编写sql
四、测试
@Test
void test7(){
List
users.stream().forEach(System.out::println);
}
结果:
点击查看代码
==> Preparing: select * from user WHERE name = ?
==> Parameters: Jone(String)
<== Columns: ID, NAME, AGE, EMAIL
<== Row: 1, Jone, 18, test1@baomidou.com
<== Total: 1
五、更改Mapper里面方法入参
public interface UserMapper extends BaseMapper
List
// List
List
}
测试:
@Test
void test7(){
List
users.stream().forEach(System.out::println);
}
执行结果:
点击查看代码
==> Preparing: select * from user WHERE (name = ?)
==> Parameters: Jone(String)
<== Columns: ID, NAME, AGE, EMAIL
<== Row: 1, Jone, 18, test1@baomidou.com
<== Total: 1

浙公网安备 33010602011771号