参照使用手册:
public TimesInfo queryTimesInfo(int beginIndex, int endIndex, String codeNum, String cnd1, String cnd2) {
Sql sql = Sqls.fetchEntity("call ticket_times_info(@begin_index,@end_index,@code_num,@cnd1,@cnd2)");
sql.setEntity(dao.getEntity(TimesInfo.class));
sql.params().set("begin_index", beginIndex);
sql.params().set("end_index", endIndex);
sql.params().set("code_num", codeNum);
sql.params().set("cnd1", cnd1);
sql.params().set("cnd2", cnd2);
dao.execute(sql);
TimesInfo timesInfolist = sql.getObject(TimesInfo.class);
return timesInfolist;
}
实体类:
package com.dodoke.bean;
import org.nutz.dao.entity.annotation.Column;
public class TimesInfo {
@Column(hump = true)
private Integer codeNum;
@Column(hump = true)
private Integer allShowTimes;
@Column(hump = true)
private Integer nonShowTimes;
@Column(hump = true)
private Integer timesSum;
public Integer getCodeNum() {
return codeNum;
}
public void setCodeNum(Integer codeNum) {
this.codeNum = codeNum;
}
public Integer getAllShowTimes() {
return allShowTimes;
}
public void setAllShowTimes(Integer allShowTimes) {
this.allShowTimes = allShowTimes;
}
public Integer getNonShowTimes() {
return nonShowTimes;
}
public void setNonShowTimes(Integer nonShowTimes) {
this.nonShowTimes = nonShowTimes;
}
public Integer getTimesSum() {
return timesSum;
}
public void setTimesSum(Integer timesSum) {
this.timesSum = timesSum;
}
}
页面显示Json数据:
[
{
"codeNum": 5,
"allShowTimes": 7,
"nonShowTimes": 0,
"timesSum": 7
}
]
但是在navicat查询窗口中直接跑:
call ticket_times_info(0,20,'5','n5=1','!(n5=1)')
结果是:
|code_num|all_show_times|non_show_times|times_sum|
|5| 11 |9 |20|