下面是内存溢出 jb51.cc 通过网络收集整理的代码片段。
内存溢出小编现在分享给大家,也给大家做个参考。
public String findArticle(TArticle article,Integer pageNo,Integer pageSize,String sortname,String sortOrder,Integer num) { StringBuffer sql = new StringBuffer( "select top 5 a.ID,a.Title,a.cate_one,m.parent_ID,a.cate_two,m.name as cate_two_name," + "a.content,a.rank,a.check_status,a.check_time,a.creator,a.create_time,a.updator,a.update_time " + "from t_article a left join t_menu m on a.cate_two = m.ID"); if (!CommonUtils.isNullOrLessthanOne(pageNo) && !CommonUtils.isNullOrLessthanOne(pageSize)) { int start = (pageNo-1)*pageSize; int limit = pageSize; String tablename = "t_article a left join t_menu m on a.cate_two = m.ID"; String fIElds = "a.ID,a.update_time"; StringBuffer filter = new StringBuffer("1 = 1"); if(article != null){ if (StringUtils.hasLength(article.getTitle())) filter.append(" and a.Title like '%").append(article.getTitle()) .append("%'"); if (article.getCateOne() != null && article.getCateOne() != 0) filter.append(" and a.cate_one=").append(article.getCateOne()); if (article.getCateTwo() != null && article.getCateTwo() != 0) filter.append(" and a.cate_two=").append(article.getCateTwo()); if (article.getCreator() != null) filter.append(" and a.creator=").append(article.getCreator()); if (article.getCheckStatus() != null){ if(article.getCheckStatus() == -1) filter.append(" and a.check_status in (0,1,2)"); else{ filter.append(" and a.check_status=").append( article.getCheckStatus()); } } } StringBuffer orderBy = new StringBuffer(""); if (StringUtils.hasLength(sortname) && StringUtils.hasLength(sortOrder)) { orderBy.append("a.").append(this.getColumnPropertyMap().get(sortname)) .append(" ").append(sortOrder); } sql = sqlString.getPaginationsql(start,limit,tablename,fIElds,filter.toString(),orderBy.toString()); }else{ if (article != null) { sql.append(" where 1=1 "); if (StringUtils.hasLength(article.getTitle())) sql.append(" and a.Title like '%").append(article.getTitle()) .append("%'"); if (article.getCateOne() != null) sql.append(" and a.cate_one=").append(article.getCateOne()); if (article.getCateTwo() != null) sql.append(" and a.cate_two=").append(article.getCateTwo()); if (article.getCreator() != null) sql.append(" and a.creator=").append(article.getCreator()); if (article.getCheckStatus() != null) sql.append(" and a.check_status=").append( article.getCheckStatus()); } if (StringUtils.hasLength(sortname) && StringUtils.hasLength(sortOrder)) { sql.append(" order by rank desc,") .append(this.getColumnPropertyMap().get(sortname)) .append(" ").append(sortOrder); } } return sql; }
以上是内存溢出(jb51.cc)为你收集整理的全部代码内容,希望文章能够帮你解决所遇到的程序开发问题。
如果觉得内存溢出网站内容还不错,欢迎将内存溢出网站推荐给程序员好友。
总结以上是内存溢出为你收集整理的SqlServer分页工具类全部内容,希望文章能够帮你解决SqlServer分页工具类所遇到的程序开发问题。
如果觉得内存溢出网站内容还不错,欢迎将内存溢出网站推荐给程序员好友。
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)