use of com.baomidou.samples.execution.entity.Student in project mybatis-plus-samples by baomidou.
the class ExecutionTest method test.
@Test
void test() {
studentMapper.selectList(new QueryWrapper<>());
studentMapper.deleteById(1L);
Student student = new Student();
student.setName("test_update");
studentMapper.insert(new Student(1L, "test", 12));
studentMapper.update(student, new QueryWrapper<Student>().eq("id", 1L));
try {
studentMapper.update(new Student(), new QueryWrapper<>());
} catch (MyBatisSystemException e) {
}
try {
studentMapper.delete(new QueryWrapper<>());
} catch (MyBatisSystemException e) {
System.err.println("执行了全表删除拦截,删除无效!异常:" + e.getMessage());
}
Assertions.assertTrue(CollectionUtils.isNotEmpty(studentMapper.selectList(new QueryWrapper<>())), "数据都被删掉了.(┬_┬)");
}
use of com.baomidou.samples.execution.entity.Student in project tutorials-java by Artister.
the class ExecutionTest method test.
@Test
public void test() {
studentMapper.selectList(new QueryWrapper<>());
studentMapper.deleteById(1L);
Student student = new Student();
student.setName("test_update");
studentMapper.insert(new Student(1L, "test", 12));
studentMapper.update(student, new QueryWrapper<Student>().eq("id", 1L));
try {
studentMapper.update(new Student(), new QueryWrapper<>());
} catch (MyBatisSystemException e) {
}
try {
studentMapper.delete(new QueryWrapper<>());
} catch (MyBatisSystemException e) {
}
Assert.notEmpty(studentMapper.selectList(new QueryWrapper<>()), "数据都被删掉了.(┬_┬)");
}
Aggregations