use of org.dbflute.cbean.coption.DerivedReferrerOption in project dbflute-core by dbflute.
the class HpQDRFunction method min.
/**
* An overload method for min(). So refer to the method's java-doc about basic info.
* <pre>
* cb.query().derivedPurchaseList().<span style="color: #CC4747">min</span>(<span style="color: #553000">purchaseCB</span> <span style="color: #90226C; font-weight: bold"><span style="font-size: 120%">-</span>></span> {
* <span style="color: #553000">purchaseCB</span>.specify().<span style="color: #994747">columnPurchasePrice</span>(); <span style="color: #3F7E5E">// *Point</span>
* <span style="color: #553000">purchaseCB</span>.query().setPaymentCompleteFlg_Equal_True();
* }).<span style="color: #994747">greaterEqual</span>(123, <span style="color: #553000">op</span> <span style="color: #90226C; font-weight: bold"><span style="font-size: 120%">-</span>></span> <span style="color: #553000">op</span>.<span style="color: #CC4747">coalesce</span>(0));
* </pre>
* @param derivedCBLambda The callback for sub-query of referrer. (NotNull)
* @param opLambda The callback for option of DerivedReferrer. For example, you can use a coalesce function. (NotNull)
* @return The parameter for comparing with scalar. (NotNull)
*/
public HpQDRParameter<CB, Object> min(SubQuery<CB> derivedCBLambda, FunctionFilterOptionCall<DerivedReferrerOption> opLambda) {
assertDerivedReferrerOption(opLambda);
final DerivedReferrerOption option = createDerivedReferrerOption();
opLambda.callback(option);
return doMin(derivedCBLambda, option);
}
use of org.dbflute.cbean.coption.DerivedReferrerOption in project dbflute-core by dbflute.
the class HpQDRFunction method sum.
/**
* An overload method for sum(). So refer to the method's java-doc about basic info.
* <pre>
* cb.query().derivedPurchaseList().<span style="color: #CC4747">sum</span>(<span style="color: #553000">purchaseCB</span> <span style="color: #90226C; font-weight: bold"><span style="font-size: 120%">-</span>></span> {
* <span style="color: #553000">purchaseCB</span>.specify().<span style="color: #994747">columnPurchasePrice</span>(); <span style="color: #3F7E5E">// *Point</span>
* <span style="color: #553000">purchaseCB</span>.query().setPaymentCompleteFlg_Equal_True();
* }).<span style="color: #994747">greaterEqual</span>(123, <span style="color: #553000">op</span> <span style="color: #90226C; font-weight: bold"><span style="font-size: 120%">-</span>></span> <span style="color: #553000">op</span>.<span style="color: #CC4747">coalesce</span>(0));
* </pre>
* @param derivedCBLambda The callback for sub-query of referrer. (NotNull)
* @param opLambda The callback for option of DerivedReferrer. For example, you can use a coalesce function. (NotNull)
* @return The parameter for comparing with scalar. (NotNull)
*/
public HpQDRParameter<CB, Number> sum(SubQuery<CB> derivedCBLambda, FunctionFilterOptionCall<DerivedReferrerOption> opLambda) {
assertDerivedReferrerOption(opLambda);
final DerivedReferrerOption option = createDerivedReferrerOption();
opLambda.callback(option);
return doSum(derivedCBLambda, option);
}
use of org.dbflute.cbean.coption.DerivedReferrerOption in project dbflute-core by dbflute.
the class HpQDRFunction method countDistinct.
/**
* An overload method for countDistinct(). So refer to the method's java-doc about basic info.
* <pre>
* cb.query().derivedPurchaseList().<span style="color: #CC4747">countDistinct</span>(<span style="color: #553000">purchaseCB</span> <span style="color: #90226C; font-weight: bold"><span style="font-size: 120%">-</span>></span> {
* <span style="color: #553000">purchaseCB</span>.specify().<span style="color: #994747">columnPurchasePrice</span>(); <span style="color: #3F7E5E">// *Point</span>
* <span style="color: #553000">purchaseCB</span>.query().setPaymentCompleteFlg_Equal_True();
* }).<span style="color: #994747">greaterEqual</span>(123, <span style="color: #553000">op</span> <span style="color: #90226C; font-weight: bold"><span style="font-size: 120%">-</span>></span> <span style="color: #553000">op</span>.<span style="color: #CC4747">coalesce</span>(0));
* </pre>
* @param derivedCBLambda The callback for sub-query of referrer. (NotNull)
* @param opLambda The callback for option of DerivedReferrer. For example, you can use a coalesce function. (NotNull)
* @return The parameter for comparing with scalar. (NotNull)
*/
public HpQDRParameter<CB, Integer> countDistinct(SubQuery<CB> derivedCBLambda, FunctionFilterOptionCall<DerivedReferrerOption> opLambda) {
assertDerivedReferrerOption(opLambda);
final DerivedReferrerOption option = createDerivedReferrerOption();
opLambda.callback(option);
return doCountDistinct(derivedCBLambda, option);
}
use of org.dbflute.cbean.coption.DerivedReferrerOption in project dbflute-core by dbflute.
the class HpQDRFunction method avg.
/**
* An overload method for avg(). So refer to the method's java-doc about basic info.
* <pre>
* cb.query().derivedPurchaseList().<span style="color: #CC4747">avg</span>(<span style="color: #553000">purchaseCB</span> <span style="color: #90226C; font-weight: bold"><span style="font-size: 120%">-</span>></span> {
* <span style="color: #553000">purchaseCB</span>.specify().<span style="color: #994747">columnPurchasePrice</span>(); <span style="color: #3F7E5E">// *Point</span>
* <span style="color: #553000">purchaseCB</span>.query().setPaymentCompleteFlg_Equal_True();
* }).<span style="color: #994747">greaterEqual</span>(123, <span style="color: #553000">op</span> <span style="color: #90226C; font-weight: bold"><span style="font-size: 120%">-</span>></span> <span style="color: #553000">op</span>.<span style="color: #CC4747">coalesce</span>(0));
* </pre>
* @param derivedCBLambda The callback for sub-query of referrer. (NotNull)
* @param opLambda The callback for option of DerivedReferrer. For example, you can use a coalesce function. (NotNull)
* @return The parameter for comparing with scalar. (NotNull)
*/
public HpQDRParameter<CB, Number> avg(SubQuery<CB> derivedCBLambda, FunctionFilterOptionCall<DerivedReferrerOption> opLambda) {
assertDerivedReferrerOption(opLambda);
final DerivedReferrerOption option = createDerivedReferrerOption();
opLambda.callback(option);
return doAvg(derivedCBLambda, option);
}
use of org.dbflute.cbean.coption.DerivedReferrerOption in project dbflute-core by dbflute.
the class AbstractConditionQuery method doRegisterSpecifyDerivedReferrer.
protected void doRegisterSpecifyDerivedReferrer(String function, final ConditionQuery subQuery, String columnDbName, String relatedColumnDbName, String propertyName, String referrerPropertyName, String aliasName, DerivedReferrerOption option) {
assertFunctionNotNull("SpecifyDerivedReferrer", columnDbName, function);
assertSubQueryNotNull("SpecifyDerivedReferrer", columnDbName, subQuery);
option.xacceptBaseCB(xgetBaseCB());
if (isDerivedReferrerSelectAllPossible(subQuery, option)) {
createCBExThrower().throwSpecifyDerivedReferrerSelectAllPossibleException(function, subQuery, aliasName);
}
final SubQueryPath subQueryPath = new SubQueryPath(xgetLocation(propertyName));
final GeneralColumnRealNameProvider localRealNameProvider = new GeneralColumnRealNameProvider();
final int subQueryLevel = subQuery.xgetSqlClause().getSubQueryLevel();
final SqlClause subQueryClause = subQuery.xgetSqlClause();
final String subQueryIdentity = propertyName + "[" + subQueryLevel + "]";
final ColumnSqlNameProvider subQuerySqlNameProvider = dbName -> subQuery.toColumnSqlName(dbName);
final DBMeta subQueryDBMeta = findDBMeta(subQuery.asTableDbName());
final GearedCipherManager cipherManager = xgetSqlClause().getGearedCipherManager();
final String mainSubQueryIdentity = propertyName + "[" + subQueryLevel + ":subquerymain]";
final SpecifyDerivedReferrer derivedReferrer = option.createSpecifyDerivedReferrer(subQueryPath, localRealNameProvider, subQuerySqlNameProvider, subQueryLevel, subQueryClause, subQueryIdentity, subQueryDBMeta, cipherManager, mainSubQueryIdentity, aliasName);
xregisterParameterOption(option);
final String correlatedFixedCondition = xbuildReferrerCorrelatedFixedCondition(subQuery, referrerPropertyName);
final String clause = derivedReferrer.buildDerivedReferrer(function, columnDbName, relatedColumnDbName, correlatedFixedCondition, option);
final HpDerivingSubQueryInfo subQueryInfo = xcreateDerivingSubQueryInfo(function, aliasName, clause, derivedReferrer);
xgetSqlClause().specifyDerivingSubQuery(subQueryInfo);
}
Aggregations