ring() { StrBuilder builder = new StrBuilder(); if (ListUtils.notEmpty(orderList)) { String orders = ListUtils.list2String(orderList); builder.append(ORDER_BY_WITH_BLANK).append(orders); } return builder.toString(); } }
package cn.fansunion.hibernate.sql.entity;
import java.util.ArrayList;
import java.util.List;
import cn.fansunion.hibernate.sql.ConstantBase;
import cn.fansunion.hibernate.util.EmptyUtils;
import cn.fansunion.hibernate.util.ListUtils;
/**
* 分组语句,如"group by id,name"。
*
* @author LeiWen@FansUnion.cn
*/
public class GroupBy extends ConstantBase {
/**
* 分组的字段名称构成的集合,暂时不支持having子句
*/
private List
group;
public GroupBy() {
group = new ArrayList
(); } public List
getGroup() { return group; } /** * 转化为字符串 */ public String toString() { if (EmptyUtils.notEmpty(group)) { String groupStr = ListUtils.list2String(group); return GROUP_BY_WITH_BLANK + groupStr; } return EMPTY; } public void addGroup(String g) { this.group.add(g); } }
原文链接:http://blog.fansunion.cn/articles/3616(小雷博客-blog.fansunion.cn)