为了账号安全,请及时绑定邮箱和手机立即绑定

HQL语句报错,但好像没错,求大神指点?

HQL语句报错,但好像没错,求大神指点?

鹰击长空007 2016-11-10 18:31:09
    StringBuffer sb = new StringBuffer();        String sql ="select count(*) from Major m where 1=1 ";        if(majorname != null && !"".equals(majorname)){            sb.append(" and m.majorname like ");            sb.append("%"+ majorname +"%");        }                if(traininglevel != null && !"".equals(traininglevel)){            sb.append(" and m.traininglevel= ");            sb.append(traininglevel);        }                if(version !=null && !"".equals(version)) {            sb.append(" and m.version= ");            sb.append(version);        }                String hql1 = sql + sb.toString();        int tatolSize = majorService.getTatolSize(hql1);                StringBuffer hql = new StringBuffer();        hql.append(" from Major m INNer Join Traininglevel t ");        hql.append(" ON m.traininglevel=t.id where 1=1 ");        hql.append(sb);        hql.append(" ORDER BY m.id ASC ");        hql.append(" limit ");        int index = (currentPage - 1) * pageSize ;        hql.append(index+",");        hql.append(pageSize);                List<Major> list = majorService.findByCondition(hql.toString());        PageBean<Major> pb = new PageBean<Major>();        pb.setCurrentPage(currentPage);        pb.setTatolSize(tatolSize);        pb.setPageData(list);        // 封装当前页; 如果没有搜索到值,即总记录数为0,当前页也是0        if (tatolSize == 0){            pb.setCurrentPage(0);                }else{            pb.setCurrentPage(currentPage);                }         return pb;
查看完整描述

1 回答

  • 1 回答
  • 0 关注
  • 1141 浏览

添加回答

举报

0/150
提交
取消
意见反馈 帮助中心 APP下载
官方微信