mirror of
https://github.com/ebean-orm/ebean.git
synced 2026-11-20 23:05:23 +00:00
#1331 - ENH: Support Aggregation formula with findSingleAttribute() ... max, min, avg, count and count(distinct ..)
This commit is contained in:
1 parent
ec2c3b13d4
commit
3ca4efc818
23 files changed
+783
-51
No files matched your search
@@ -175,6 +175,7 @@ public class DeployBeanProperty {
|
||||
|
||||
private String aggregationPrefix;
|
||||
private String aggregation;
|
||||
private String aggregationParsed;
|
||||
|
||||
private String sqlFormulaSelect;
|
||||
private String sqlFormulaJoin;
|
||||
@@ -615,10 +616,23 @@ public class DeployBeanProperty {
|
||||
return aggregation != null;
|
||||
}
|
||||
|
||||
public String getAggregation() {
|
||||
/**
|
||||
* Get the raw/logical aggregation formula.
|
||||
*/
|
||||
public String getRawAggregation() {
|
||||
return aggregation;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the parsed aggregation formula with table alias placeholders.
|
||||
*/
|
||||
public String parseAggregation() {
|
||||
if (aggregation != null) {
|
||||
aggregationParsed = desc.parse(aggregation);
|
||||
}
|
||||
return aggregationParsed;
|
||||
}
|
||||
|
||||
public void setAggregation(String aggregation) {
|
||||
this.aggregation = aggregation;
|
||||
this.dbRead = true;
|
||||
@@ -629,9 +643,9 @@ public class DeployBeanProperty {
|
||||
/**
|
||||
* Set the path to the aggregation.
|
||||
*/
|
||||
public void setAggregationPrefix(String aggregationPrefix) {
|
||||
this.aggregationPrefix = aggregationPrefix;
|
||||
this.aggregation = aggregation.replace(aggregationPrefix, "u1");
|
||||
public void setAggregationPrefix(String prefix) {
|
||||
this.aggregationPrefix = prefix;
|
||||
this.aggregation = (prefix == null) ? aggregation : aggregation.replace(aggregationPrefix, "u1");
|
||||
}
|
||||
|
||||
public String getElPrefix() {
|
||||
@@ -644,7 +658,7 @@ public class DeployBeanProperty {
|
||||
|
||||
public String getElPlaceHolder() {
|
||||
if (aggregation != null) {
|
||||
return aggregation;
|
||||
return aggregationParsed;
|
||||
} else if (sqlFormulaSelect != null) {
|
||||
return sqlFormulaSelect;
|
||||
} else {
|
||||
|
||||
Reference in new issue
Block a user