异常截图:
异常代码:
public Integer AppointmentNum(int type,Integer accountId,Integer appletsAccountId){
StringBuilder builder = new StringBuilder("select count(*) from fwzl_appointment");
if (type==0){
builder.append("where to_days(createTime) = to_days(now())");
}else if(type==1){
builder.append("where to_days(cancel_time) = to_days(now())");
}
if(accountId!=null){
builder.append("and accountId = ?");
return Db.queryInt(builder.toString(),accountId);
}
if(appletsAccountId!=null){
builder.append("and applets_account_id = ?");
}
return Db.queryInt(builder.toString(),appletsAccountId);
}
正确代码:
/**
* 某人当天(取消)预约次数
* @param type 0-预约 1-取消预约
* @return
*/
public Integer AppointmentNum(int type,Integer accountId,Integer appletsAccountId){
StringBuilder builder = new StringBuilder("select count(*) from fwzl_appointment");
if (type==0){
builder.append(" where to_days(createTime) = to_days(now())");
}else if(type==1){
builder.append(" where to_days(cancel_time) = to_days(now())");
}
if(accountId!=null){
builder.append(" and accountId = ?");
return Db.queryInt(builder.toString(),accountId);
}
if(appletsAccountId!=null){
builder.append(" and applets_account_id = ?");
}
return Db.queryInt(builder.toString(),appletsAccountId);
}
加空格:
细节决定成败!!!😝