//第一课 删除冲突的依赖
//在此处添加exclusion标签
//想要删除的依赖
<artifactId>junit-jupiter-params</artifactId>
<groupId>org.junit.jupiter</groupId>
</exclusion>
</exclusions>
//想要再加回来,在下面继续添加标签
//第二课 可以删除参数的类型,可填可不填,返回值类型必须填(在.xml中)
//删除后
//回到测试类,输出
@Test
public void test() throws IOException {
Employee emp = new Employee(null, "张三", 1000.0, true);
boolean ret = employeeMapper.save(emp);
System.out.println(emp);
if (ret) {
System.out.println("保存成功");
} else {
System.out.println("保存失败");
}
}
//输出成功 Employee(id=18, name=张三, sal=1000.0, sex=true)
//第三课 当传两个对象时
@Test
public void test3() throws IOException {
Employee emp = new Employee(3L,"maomaochong", null, false);
Employee employee = employeeMapper.queryById(emp);
System.out.println(employee);
//第四课 引用参数数据时的形式
{} 15 'abc' 根据类型添加'' 安全
${} 15 abc 原文显示 不安全
selectfrom user where username=#{username} maomao
selectfrom user where username='maomao'
selectfrom user where username=${username}
selectfrom user where username=maomamo
//要想传sql语句的一部分,用$
要是传值本身,用#
浙公网安备 33010602011771号