大佬,正解。附件说明,在new的时候,还都是null。只有save后,userId拿到了一个随机递增的id。
this.save(user);————implementation:
public boolean save(T entity) {
return this.retBool(this.baseMapper.insert(entity));
}
protected boolean retBool(Integer result) {
return SqlHelper.retBool(result);
}
this.baseMapper.insert(entity) ————implementation:
public interface BaseMapper<T> {
int insert(T entity);
直接执行sql语句,userId是固定的加一递增。用this.save(user);是随机的递增。是在哪里设置的?
【 在 realdonald 的大作中提到: 】
: save的时候数据库生成的然后orm取回来赋值的吧
:

--
FROM 120.242.253.*