1.insert:
    insert方法插入数据时,底层做非空判断,如果哪个成员变量的值为空就不会放到sql语句中。

    • 数据库中的字段:

    image.jpeg

    • 插入是的字段,没有插入email

    image.jpeg

    • 日志中sql语句中也没有email

    image.jpeg

    image.png

    1. package com.wzy.text;
    2. import com.wzy.mapper.EmployeeMapper;
    3. import com.wzy.pojo.EmployeeBean;
    4. import org.junit.Test;
    5. import org.springframework.context.ApplicationContext;
    6. import org.springframework.context.support.ClassPathXmlApplicationContext;
    7. import javax.sql.DataSource;
    8. import java.sql.Connection;
    9. import java.sql.SQLException;
    10. public class TestS {
    11. ApplicationContext applicationContext =
    12. new ClassPathXmlApplicationContext("applicationContext.xml");
    13. EmployeeMapper employeeMapper =
    14. applicationContext.getBean("employeeMapper",EmployeeMapper.class);
    15. EmployeeBean employeeBean = new EmployeeBean(null,"MP1","55522qqw@163.com",1,25);
    16. @Test
    17. public void test1() throws SQLException {
    18. Integer insert = employeeMapper.insert(employeeBean);
    19. System.out.println(insert);
    20. }
    21. }


    2.insertAllColumn
    同样没有传入email
    image.jpeg
    image.jpeg