如下代码:
Clients m = .getModel(Clients.)(m.dao().findFirst(getPara()) !=){ jsonResult()} (m.save()){ jsonResult()}{ jsonResult()}
会报错,java.lang.RuntimeException: dao 只允许调用查询方法。难道是 m.dao() 调用后,m 与 m.dao()就指向了同一个对象么?
Clients m = this.getModel(Clients.class,"",true);
if(m.dao().findFirst("select * from clients where username = ?",getPara("username")) !=null){
jsonResult(false,"用户名已经存在, 请更换");
return;
}
if(m.save()){
jsonResult(true);
}else{
jsonResult(false,"注册失败!");
}