dao 获取表最大排序实现

public Long getMaxOrder(Long parentId) {
Query query = this.getSession().createSQLQuery(
"select max(ORDERID) from tbl_type where PARENTID =:parentId");
query.setLong("parentId", parentId);
List<Object> list = query.list();
Long order = 0l;
if (list != null && list.size() > 0) {
if (list.get(0)!=null) {
order = Long.parseLong(list.get(0).toString());
}
}
if (order != null && order > 0) {
return order + 1;
} else {
return 1l;
}
}
上一篇:Android-LoaderManager异步加载数据库数据


下一篇:linux下高可用LVS搭建及配置方法