本文整理汇总了Java中com.alibaba.druid.sql.ast.SQLOrderingSpecification.ASC属性的典型用法代码示例。如果您正苦于以下问题:Java SQLOrderingSpecification.ASC属性的具体用法?Java SQLOrderingSpecification.ASC怎么用?Java SQLOrderingSpecification.ASC使用的例子?那么恭喜您, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在类com.alibaba.druid.sql.ast.SQLOrderingSpecification
的用法示例。
在下文中一共展示了SQLOrderingSpecification.ASC属性的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: buildOrderByCols
protected LinkedHashMap<String, Integer> buildOrderByCols(List<SQLSelectOrderByItem> orderByItems,Map<String, String> aliaColumns) {
LinkedHashMap<String, Integer> map = new LinkedHashMap<String, Integer>();
for(int i= 0; i < orderByItems.size(); i++) {
SQLOrderingSpecification type = orderByItems.get(i).getType();
//orderColumn只记录字段名称,因为返回的结果集是不带表名的。
SQLExpr expr = orderByItems.get(i).getExpr();
String col;
if (expr instanceof SQLName) {
col = ((SQLName)expr).getSimpleName();
}
else {
col =expr.toString();
}
if(type == null) {
type = SQLOrderingSpecification.ASC;
}
col=getAliaColumn(aliaColumns,col);//此步骤得到的col必须是不带.的,有别名的用别名,无别名的用字段名
map.put(col, type == SQLOrderingSpecification.ASC ? OrderCol.COL_ORDER_TYPE_ASC : OrderCol.COL_ORDER_TYPE_DESC);
}
return map;
}
示例2: reverseAppendTo
private void reverseAppendTo(SQLSelectOrderByItem order, SQLServerOutputVisitor visitor, String tmpTableAlias, List<SQLSelectItem> items) {
SQLExpr expression=order.getExpr();
if(expression instanceof SQLPropertyExpr){
SQLPropertyExpr c=(SQLPropertyExpr)expression;
if(items!=null){
fixWithSelects(c,items);
}
if(c.getOwner()!=null){
c.setOwner(new SQLIdentifierExpr(tmpTableAlias));
}
}
expression.accept(visitor);
if(order.getType()==SQLOrderingSpecification.ASC || order.getType()==null){
try {
visitor.getAppender().append(" DESC");
} catch (IOException e) {
e.printStackTrace();
}
}
}
示例3: orderBy
public PlanNode orderBy(Item c, SQLOrderingSpecification sortOrder) {
if (sortOrder == null) {
sortOrder = SQLOrderingSpecification.ASC;
}
Order order = new Order(c, sortOrder);
if (!this.orderBys.contains(order)) {
this.orderBys.add(order);
}
return this;
}
示例4: makeOrder
/**
* make order by from distinct
*
* @param selects
* @return
*/
public static List<Order> makeOrder(List<Item> selects) {
List<Order> orders = new ArrayList<>();
for (Item sel : selects) {
Order order = new Order(sel, SQLOrderingSpecification.ASC);
orders.add(order);
}
return orders;
}
示例5: buildOrderbyType
public static OrderbyType buildOrderbyType(SQLOrderingSpecification type){
if (SQLOrderingSpecification.ASC == type){
return OrderbyType.ASC;
}
if (SQLOrderingSpecification.DESC == type){
return OrderbyType.DESC;
}
return OrderbyType.ASC;
}
示例6: Order
public Order(Item item) {
this(item, SQLOrderingSpecification.ASC);
}