diff --git a/springboot-mybatis-crud/src/main/java/com/inmind/mapper/EmpMapper.java b/springboot-mybatis-crud/src/main/java/com/inmind/mapper/EmpMapper.java index 2c1efd5..c25c349 100644 --- a/springboot-mybatis-crud/src/main/java/com/inmind/mapper/EmpMapper.java +++ b/springboot-mybatis-crud/src/main/java/com/inmind/mapper/EmpMapper.java @@ -6,7 +6,8 @@ import org.apache.ibatis.annotations.Mapper; @Mapper public interface EmpMapper { //定义方法 - @Delete("delete from emp where id = #{id};") + @Delete("delete from emp where id = #{id};")//#{}预编译的方式 +// @Delete("delete from emp where id = ${id};")//${}拼接的方式,有sql注入问题 int delete(Integer id);//想返回删除数据的个数 // void delete(Integer id);//不想获得删除数据的个数 } diff --git a/springboot-mybatis-crud/src/main/resources/application.properties b/springboot-mybatis-crud/src/main/resources/application.properties index c92c824..9737b62 100644 --- a/springboot-mybatis-crud/src/main/resources/application.properties +++ b/springboot-mybatis-crud/src/main/resources/application.properties @@ -3,4 +3,6 @@ spring.application.name=springboot-mybatis-crud spring.datasource.url= jdbc:mysql://localhost:3306/mybatis spring.datasource.username= root spring.datasource.password= 1234 -spring.datasource.driver-class-name= com.mysql.cj.jdbc.Driver \ No newline at end of file +spring.datasource.driver-class-name= com.mysql.cj.jdbc.Driver + +mybatis.configuration.log-impl=org.apache.ibatis.logging.stdout.StdOutImpl \ No newline at end of file