调用MybatisPlus的getOne和selectOne方法如果查询结果是多条会报错:
com.baomidou.mybatisplus.core.exceptions.MybatisPlusException: One record is expected, but the query result is multiple records
随机取一条加上限制条件 wrapper.last("LIMIT 1")
没有符合查询条件的不会报错,返回null
调用MybatisPlus的getOne和selectOne方法如果查询结果是多条会报错:
com.baomidou.mybatisplus.core.exceptions.MybatisPlusException: One record is expected, but the query result is multiple records
随机取一条加上限制条件 wrapper.last("LIMIT 1")
没有符合查询条件的不会报错,返回null