MybatisPlus中使用主键自增策略插入数据后,如何获取到插入后的主键id值,实现编写单元测试方法/***测试插入数据获取主键*/@TestpublicvoidtestInsertReturnId(){Employeeemployee=newEmployee();employee.setName("霸道获取主键");employee.setAge(23);employee.setEmail(
MybatisPlus中使用主键自增策略插入数据后,如何获取到插入后的主键id值 实现 编写单元测试方法 /*** * 测试插入数据获取主键 */ @Test public void testInsertReturnId() { Employee employee = new Employee(); employee.setName("霸道获取主键"); employee.setAge(23); employee.setEmail("123@163.com")...
mybatis Plus的insert方法,按说插入数据后会自动返回id mapper方法: @DS("wxuser") @Mapper public interface UserInfoMapper extends BaseMapper<UserInfo> { } 业务类: @Autowired UserInfoMapper userInfoMapper; UserInfo user = new UserInfo(); user.setAddress(userInfo.getAddress()); user.setAge(userInfo...
/*** * 测试插入数据获取主键 */ @Test public void testInsertReturnId() { Employee employee = new Employee(); employee.setName("霸道获取主键"); employee.setAge(23); employee.setEmail("123@163.com"); employee.setGender(1); int result = employeeMapper.insert(employee); System.out.println...