mybatisPlus

1 查询数据库不存在的对象,返回值

/**
     * 查询数据库不存在的对象
     */
    @Test
    public void selectSome2() {
        ArrayList<Integer> list = new ArrayList<>();
        list.add(666);
        List<Person> people = personMapper.selectBatchIds(list);
        System.out.println(people); // []
        System.out.println(people.size());  // 0
    }

    
    @Test
    public void selectOneNotExist() {
        Person people = personMapper.selectById(666);
        // 查询不存在的,会返回null
        System.out.println(people);  // null
        System.out.println(ObjectUtil.isNull(people));  // true
    }

2-mybatis中数据库和Java实体类映射封装

as别名
符合驼峰,好像自动映射
自己写resultmap
posted @ 2021-12-12 09:31  姚狗蛋  阅读(16)  评论(0编辑  收藏  举报