【java】one record is expected, but the query result is multiple records

报错:one record is expected, but the query result is multiple records,意思是:需要一条记录,但查询结果是多条记录。这个问题很常见,但是进过排查,是用户表【手机号唯一原则】查询时候发现是时候多出来多条记录导致的

异常

测试时出现以下错误

one record is expected, but the query result is multiple records

代码

@Schema(name = "创建人")
@TableField(value = "create_by",fill = FieldFill.INSERT)
private String createBy;

查询

select phone,count(phone) as num from sys_user GROUP BY phone HAVING count(phone) > 1

你可能感兴趣的:(通用表单,java,数据库,开发语言)