求详解,各位大神麻烦给我解析下下面的的语句,谢谢啦,小弟感激不尽

public List getList(String startTime, String endTime, String mc, Pager pager)

{
    String where = " ";

    where = where + " and " + TypeChange.DateBetweenSql("a.riQi", startTime, endTime);
    if (!TypeChange.toNotNullDao(mc).equals(""))
    {
        where = where + " and   a.mingCheng like '%" + TypeChange.toNotNullDao(mc) + "%'";
    }

    return this.findAll(where, pager);
}


findAll:

private List<Test> findAll(String where, Pager pager)
{
    String hSql = " From  Test a where 1=1 " + where + " order by id ";
    pager.setRowCount(getAllRowCount(hSql));
    Session sess = this.getSessionFactory().openSession();
    try
    {
        Query query = sess.createQuery(hSql);
        query.setFirstResult(pager.getFirstResult());
        query.setMaxResults(pager.getPageSize());
        return query.list();
    }
    finally
    {
        sess.close();
    }
}
查看全部
baidu_29643173
baidu_29643173
2015/07/09 06:37
  • java
  • string
  • session
  • 点赞
  • 收藏
  • 回答
    私信
满意答案
查看全部

3个回复