Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
30 changes: 15 additions & 15 deletions Interfaces/AAA/Accounting_Defs.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@ namespace tblAccountUnitsI18NBase {
namespace Fields {
TARGOMAN_CREATE_CONSTEXPR(pid);
TARGOMAN_CREATE_CONSTEXPR(language);
TARGOMAN_CREATE_CONSTEXPR(untName);
TARGOMAN_CREATE_CONSTEXPR(untNameI18N);
} //namespace Fields
}

Expand Down Expand Up @@ -151,8 +151,8 @@ namespace tblAccountProductsI18NBase {
namespace Fields {
TARGOMAN_CREATE_CONSTEXPR(pid);
TARGOMAN_CREATE_CONSTEXPR(language);
TARGOMAN_CREATE_CONSTEXPR(prdName);
TARGOMAN_CREATE_CONSTEXPR(prdDesc);
TARGOMAN_CREATE_CONSTEXPR(prdNameI18N);
TARGOMAN_CREATE_CONSTEXPR(prdDescI18N);
} //namespace Fields
}

Expand Down Expand Up @@ -196,8 +196,8 @@ namespace tblAccountSaleablesI18NBase {
namespace Fields {
TARGOMAN_CREATE_CONSTEXPR(pid);
TARGOMAN_CREATE_CONSTEXPR(language);
TARGOMAN_CREATE_CONSTEXPR(slbName);
TARGOMAN_CREATE_CONSTEXPR(slbDesc);
TARGOMAN_CREATE_CONSTEXPR(slbNameI18N);
TARGOMAN_CREATE_CONSTEXPR(slbDescI18N);
} //namespace Fields
}

Expand Down Expand Up @@ -346,7 +346,7 @@ namespace tblAccountUnitsI18NBase {
//ColName Type Validation Default UpBy Sort Filter Self Virt PK
{ Fields::pid, S(quint16), QFV, QRequired, UPNone, true, true, false, false, true },
{ Fields::language, S(QString), QFV, QRequired, UPNone, true, true, false, false, true },
{ Fields::untName, S(QString), QFV, QRequired, UPOwner },
{ Fields::untNameI18N, S(QString), QFV, QRequired, UPOwner },
};

inline const QList<stuRelation> Relations(Q_DECL_UNUSED const QString& _schema) {
Expand All @@ -361,7 +361,7 @@ namespace tblAccountUnitsI18NBase {
#define SF_tblAccountUnitsI18NBase_DTO \
SF_quint16 (pid), \
SF_QString (language), \
SF_QString (untName)
SF_QString (untNameI18N)

TAPI_DEFINE_STRUCT(DTO,
SF_tblAccountUnitsI18NBase_DTO
Expand Down Expand Up @@ -464,8 +464,8 @@ namespace tblAccountProductsI18NBase {
//ColName Type Validation Default UpBy Sort Filter Self Virt PK
{ Fields::pid, S(quint32), QFV, QRequired, UPNone, true, true, false, false, true },
{ Fields::language, S(QString), QFV, QRequired, UPNone, true, true, false, false, true },
{ Fields::prdName, S(QString), QFV, QRequired, UPOwner },
{ Fields::prdDesc, S(QString), QFV, QNull, UPOwner },
{ Fields::prdNameI18N, S(QString), QFV, QRequired, UPOwner },
{ Fields::prdDescI18N, S(QString), QFV, QNull, UPOwner },
};

inline const QList<stuRelation> Relations(Q_DECL_UNUSED const QString& _schema) {
Expand All @@ -480,8 +480,8 @@ namespace tblAccountProductsI18NBase {
#define SF_tblAccountProductsI18NBase_DTO \
SF_quint32 (pid), \
SF_QString (language), \
SF_QString (prdName), \
SF_QString (prdDesc)
SF_QString (prdNameI18N), \
SF_QString (prdDescI18N)

TAPI_DEFINE_STRUCT(DTO,
SF_tblAccountProductsI18NBase_DTO
Expand Down Expand Up @@ -585,8 +585,8 @@ namespace tblAccountSaleablesI18NBase {
//ColName Type Validation Default UpBy Sort Filter Self Virt PK
{ Fields::pid, S(quint32), QFV, QRequired, UPNone, true, true, false, false, true },
{ Fields::language, S(QString), QFV, QRequired, UPNone, true, true, false, false, true },
{ Fields::slbName, S(QString), QFV, QRequired, UPOwner },
{ Fields::slbDesc, S(QString), QFV, QNull, UPOwner },
{ Fields::slbNameI18N, S(QString), QFV, QRequired, UPOwner },
{ Fields::slbDescI18N, S(QString), QFV, QNull, UPOwner },
};

inline const QList<stuRelation> Relations(Q_DECL_UNUSED const QString& _schema) {
Expand All @@ -603,8 +603,8 @@ namespace tblAccountSaleablesI18NBase {
#define SF_tblAccountSaleablesI18NBase_DTO \
SF_quint32 (pid), \
SF_QString (language), \
SF_QString (slbName), \
SF_QString (slbDesc)
SF_QString (slbNameI18N), \
SF_QString (slbDescI18N)

TAPI_DEFINE_STRUCT(DTO,
SF_tblAccountSaleablesI18NBase_DTO
Expand Down
149 changes: 114 additions & 35 deletions Interfaces/AAA/Accounting_Interfaces.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -133,11 +133,16 @@ intfAccountUnits::intfAccountUnits(
tblAccountUnitsBase::Private::Indexes + _exclusiveIndexes
) { ; }

ORMSelectQuery intfAccountUnits::makeSelectQuery(INTFAPICALLBOOM_IMPL &APICALLBOOM_PARAM, const QString &_alias, Q_DECL_UNUSED bool _isRoot) {
ORMSelectQuery intfAccountUnits::makeSelectQuery(INTFAPICALLBOOM_IMPL &APICALLBOOM_PARAM, const QString &_alias, Q_DECL_UNUSED bool _translate, Q_DECL_UNUSED bool _isRoot) {

intfAccountUnitsI18N::myInstance->prepareFiltersList();

return intfSQLBasedModule::makeSelectQuery(APICALLBOOM_PARAM, _alias)
.addCols(this->selectableColumnNames())
ORMSelectQuery Query = intfSQLBasedModule::makeSelectQuery(APICALLBOOM_PARAM, _alias, _translate)
.addCols(this->selectableColumnNames())
;

if (_translate) {
Query
.removeCols({
tblAccountUnitsBase::Fields::untName
})
Expand All @@ -150,12 +155,31 @@ ORMSelectQuery intfAccountUnits::makeSelectQuery(INTFAPICALLBOOM_IMPL &APICALLBO
}
)
.addCol(enuConditionalAggregation::IF,
{ "lng_tblAccountUnits", tblAccountUnitsI18NBase::Fields::untName, enuConditionOperator::Null },
{ "lng_tblAccountUnits", tblAccountUnitsI18NBase::Fields::untNameI18N, enuConditionOperator::Null },
DBExpression::VALUE(R(_alias.isEmpty() ? tblAccountUnitsBase::Name : _alias, tblAccountUnitsBase::Fields::untName)),
DBExpression::VALUE(R("lng_tblAccountUnits", tblAccountUnitsI18NBase::Fields::untName)),
DBExpression::VALUE(R("lng_tblAccountUnits", tblAccountUnitsI18NBase::Fields::untNameI18N)),
tblAccountUnitsBase::Fields::untName
)
;
;
} else {
Query
.nestedLeftJoin(intfAccountUnitsI18N::myInstance->makeSelectQuery(APICALLBOOM_PARAM)
.addCol(tblAccountUnitsI18NBase::Fields::pid)
.addCol(DBExpression::VALUE(QString("CONCAT('[', GROUP_CONCAT(JSON_OBJECT(`language`, %1)), ']')")
.arg(tblAccountUnitsI18NBase::Fields::untNameI18N)),
tblAccountUnitsI18NBase::Fields::untNameI18N)
.groupBy(tblAccountUnitsI18NBase::Fields::pid)
, "lng_tblAccountUnits"
, { "lng_tblAccountUnits", tblAccountUnitsI18NBase::Fields::pid,
enuConditionOperator::Equal,
tblAccountUnitsBase::Name, tblAccountUnitsBase::Fields::untID
}
)
.addCol(R("lng_tblAccountUnits", tblAccountUnitsI18NBase::Fields::untNameI18N), tblAccountUnitsBase::Fields::untNameI18N)
;
}

return Query;
}

QVariant IMPL_ANONYMOUSE_ORMGET(intfAccountUnits) {
Expand Down Expand Up @@ -217,11 +241,24 @@ intfAccountProducts::intfAccountProducts(
tblAccountProductsBase::Private::Indexes + _exclusiveIndexes
) { ; }

ORMSelectQuery intfAccountProducts::makeSelectQuery(INTFAPICALLBOOM_IMPL &APICALLBOOM_PARAM, const QString &_alias, Q_DECL_UNUSED bool _isRoot) {
ORMSelectQuery intfAccountProducts::makeSelectQuery(INTFAPICALLBOOM_IMPL &APICALLBOOM_PARAM, const QString &_alias, Q_DECL_UNUSED bool _translate, Q_DECL_UNUSED bool _isRoot) {
intfAccountProductsI18N::myInstance->prepareFiltersList();

return intfSQLBasedModule::makeSelectQuery(APICALLBOOM_PARAM, _alias)
.addCols(this->selectableColumnNames())
ORMSelectQuery Query = intfSQLBasedModule::makeSelectQuery(APICALLBOOM_PARAM, _alias, _translate)
.addCols(this->selectableColumnNames())
.inlineInnerJoin(tblAccountUnitsBase::Name/*, tblAccountUnitsBase::Name*/, clsCondition(
tblAccountUnitsBase::Name,
tblAccountUnitsBase::Fields::untID,
enuConditionOperator::Equal,
tblAccountProductsBase::Name,
tblAccountProductsBase::Fields::prd_untID
))
// .innerJoinWith(tblAccountProductsBase::Relation::Unit)
// .addCol(tblAccountUnitsBase::Fields::untName)
;

if (_translate) {
Query
.removeCols({
tblAccountProductsBase::Fields::prdName,
tblAccountProductsBase::Fields::prdDesc,
Expand All @@ -235,27 +272,41 @@ ORMSelectQuery intfAccountProducts::makeSelectQuery(INTFAPICALLBOOM_IMPL &APICAL
}
)
.addCol(enuConditionalAggregation::IF,
{ "lng_tblAccountProducts", tblAccountProductsI18NBase::Fields::prdName, enuConditionOperator::Null },
{ "lng_tblAccountProducts", tblAccountProductsI18NBase::Fields::prdNameI18N, enuConditionOperator::Null },
DBExpression::VALUE(R(_alias.isEmpty() ? tblAccountProductsBase::Name : _alias, tblAccountProductsBase::Fields::prdName)),
DBExpression::VALUE(R("lng_tblAccountProducts", tblAccountProductsI18NBase::Fields::prdName)),
DBExpression::VALUE(R("lng_tblAccountProducts", tblAccountProductsI18NBase::Fields::prdNameI18N)),
tblAccountProductsBase::Fields::prdName
)
.addCol(enuConditionalAggregation::IF,
{ "lng_tblAccountProducts", tblAccountProductsI18NBase::Fields::prdDesc, enuConditionOperator::Null },
{ "lng_tblAccountProducts", tblAccountProductsI18NBase::Fields::prdDescI18N, enuConditionOperator::Null },
DBExpression::VALUE(R(_alias.isEmpty() ? tblAccountProductsBase::Name : _alias, tblAccountProductsBase::Fields::prdDesc)),
DBExpression::VALUE(R("lng_tblAccountProducts", tblAccountProductsI18NBase::Fields::prdDesc)),
DBExpression::VALUE(R("lng_tblAccountProducts", tblAccountProductsI18NBase::Fields::prdDescI18N)),
tblAccountProductsBase::Fields::prdDesc
)
.inlineInnerJoin(tblAccountUnitsBase::Name/*, tblAccountUnitsBase::Name*/, clsCondition(
tblAccountUnitsBase::Name,
tblAccountUnitsBase::Fields::untID,
enuConditionOperator::Equal,
tblAccountProductsBase::Name,
tblAccountProductsBase::Fields::prd_untID
))
// .innerJoinWith(tblAccountProductsBase::Relation::Unit)
// .addCol(tblAccountUnitsBase::Fields::untName)
;
;
} else {
Query
.nestedLeftJoin(intfAccountProductsI18N::myInstance->makeSelectQuery(APICALLBOOM_PARAM)
.addCol(tblAccountProductsI18NBase::Fields::pid)
.addCol(DBExpression::VALUE(QString("CONCAT('[', GROUP_CONCAT(JSON_OBJECT(`language`, %1)), ']')")
.arg(tblAccountProductsI18NBase::Fields::prdNameI18N)),
tblAccountProductsI18NBase::Fields::prdNameI18N)
.addCol(DBExpression::VALUE(QString("CONCAT('[', GROUP_CONCAT(JSON_OBJECT(`language`, %1)), ']')")
.arg(tblAccountProductsI18NBase::Fields::prdDescI18N)),
tblAccountProductsI18NBase::Fields::prdDescI18N)
.groupBy(tblAccountProductsI18NBase::Fields::pid)
, "lng_tblAccountProducts"
, { "lng_tblAccountProducts", tblAccountProductsI18NBase::Fields::pid,
enuConditionOperator::Equal,
tblAccountProductsBase::Name, tblAccountProductsBase::Fields::prdID
}
)
.addCol(R("lng_tblAccountProducts", tblAccountProductsI18NBase::Fields::prdNameI18N), tblAccountProductsBase::Fields::prdNameI18N)
.addCol(R("lng_tblAccountProducts", tblAccountProductsI18NBase::Fields::prdDescI18N), tblAccountProductsBase::Fields::prdDescI18N)
;
}

return Query;
}

QVariant IMPL_ANONYMOUSE_ORMGET(intfAccountProducts) {
Expand Down Expand Up @@ -320,11 +371,15 @@ intfAccountSaleables::intfAccountSaleables(
tblAccountSaleablesBase::Private::Indexes + _exclusiveIndexes
) { ; }

ORMSelectQuery intfAccountSaleables::makeSelectQuery(INTFAPICALLBOOM_IMPL &APICALLBOOM_PARAM, const QString &_alias, Q_DECL_UNUSED bool _isRoot) {
ORMSelectQuery intfAccountSaleables::makeSelectQuery(INTFAPICALLBOOM_IMPL &APICALLBOOM_PARAM, const QString &_alias, Q_DECL_UNUSED bool _translate, Q_DECL_UNUSED bool _isRoot) {
intfAccountSaleablesI18N::myInstance->prepareFiltersList();

return intfSQLBasedModule::makeSelectQuery(APICALLBOOM_PARAM, _alias)
.addCols(this->selectableColumnNames())
ORMSelectQuery Query = intfSQLBasedModule::makeSelectQuery(APICALLBOOM_PARAM, _alias, _translate)
.addCols(this->selectableColumnNames())
;

if (_translate) {
Query
.removeCols({
tblAccountSaleablesBase::Fields::slbName,
tblAccountSaleablesBase::Fields::slbDesc,
Expand All @@ -338,18 +393,41 @@ ORMSelectQuery intfAccountSaleables::makeSelectQuery(INTFAPICALLBOOM_IMPL &APICA
}
)
.addCol(enuConditionalAggregation::IF,
{ "lng_tblAccountSaleables", tblAccountSaleablesI18NBase::Fields::slbName, enuConditionOperator::Null },
{ "lng_tblAccountSaleables", tblAccountSaleablesI18NBase::Fields::slbNameI18N, enuConditionOperator::Null },
DBExpression::VALUE(R(_alias.isEmpty() ? tblAccountSaleablesBase::Name : _alias, tblAccountSaleablesBase::Fields::slbName)),
DBExpression::VALUE(R("lng_tblAccountSaleables", tblAccountSaleablesI18NBase::Fields::slbName)),
DBExpression::VALUE(R("lng_tblAccountSaleables", tblAccountSaleablesI18NBase::Fields::slbNameI18N)),
tblAccountSaleablesBase::Fields::slbName
)
.addCol(enuConditionalAggregation::IF,
{ "lng_tblAccountSaleables", tblAccountSaleablesI18NBase::Fields::slbDesc, enuConditionOperator::Null },
{ "lng_tblAccountSaleables", tblAccountSaleablesI18NBase::Fields::slbDescI18N, enuConditionOperator::Null },
DBExpression::VALUE(R(_alias.isEmpty() ? tblAccountSaleablesBase::Name : _alias, tblAccountSaleablesBase::Fields::slbDesc)),
DBExpression::VALUE(R("lng_tblAccountSaleables", tblAccountSaleablesI18NBase::Fields::slbDesc)),
DBExpression::VALUE(R("lng_tblAccountSaleables", tblAccountSaleablesI18NBase::Fields::slbDescI18N)),
tblAccountSaleablesBase::Fields::slbDesc
)
;
;
} else {
Query
.nestedLeftJoin(intfAccountSaleablesI18N::myInstance->makeSelectQuery(APICALLBOOM_PARAM)
.addCol(tblAccountSaleablesI18NBase::Fields::pid)
.addCol(DBExpression::VALUE(QString("CONCAT('[', GROUP_CONCAT(JSON_OBJECT(`language`, %1)), ']')")
.arg(tblAccountSaleablesI18NBase::Fields::slbNameI18N)),
tblAccountSaleablesI18NBase::Fields::slbNameI18N)
.addCol(DBExpression::VALUE(QString("CONCAT('[', GROUP_CONCAT(JSON_OBJECT(`language`, %1)), ']')")
.arg(tblAccountSaleablesI18NBase::Fields::slbDescI18N)),
tblAccountSaleablesI18NBase::Fields::slbDescI18N)
.groupBy(tblAccountSaleablesI18NBase::Fields::pid)
, "lng_tblAccountSaleables"
, { "lng_tblAccountSaleables", tblAccountSaleablesI18NBase::Fields::pid,
enuConditionOperator::Equal,
tblAccountSaleablesBase::Name, tblAccountSaleablesBase::Fields::slbID
}
)
.addCol(R("lng_tblAccountSaleables", tblAccountSaleablesI18NBase::Fields::slbNameI18N), tblAccountSaleablesBase::Fields::slbNameI18N)
.addCol(R("lng_tblAccountSaleables", tblAccountSaleablesI18NBase::Fields::slbDescI18N), tblAccountSaleablesBase::Fields::slbDescI18N)
;
}

return Query;
}

QVariant IMPL_ANONYMOUSE_ORMGET(intfAccountSaleables) {
Expand Down Expand Up @@ -510,8 +588,9 @@ GROUP BY uasufl_uasID
) tmpProvidedFiles
ON tmpProvidedFiles.uasufl_uasID = uas.uasID
*/
ORMSelectQuery intfAccountUserAssets::makeSelectQuery(INTFAPICALLBOOM_IMPL &APICALLBOOM_PARAM, const QString &_alias, Q_DECL_UNUSED bool _isRoot) {
ORMSelectQuery Query = intfSQLBasedModule::makeSelectQuery(APICALLBOOM_PARAM, _alias);
ORMSelectQuery intfAccountUserAssets::makeSelectQuery(INTFAPICALLBOOM_IMPL &APICALLBOOM_PARAM, const QString &_alias, Q_DECL_UNUSED bool _translate, Q_DECL_UNUSED bool _isRoot) {

ORMSelectQuery Query = intfSQLBasedModule::makeSelectQuery(APICALLBOOM_PARAM, _alias, _translate);

if (_isRoot) {
Query.addCols(this->selectableColumnNames())
Expand All @@ -524,7 +603,7 @@ ORMSelectQuery intfAccountUserAssets::makeSelectQuery(INTFAPICALLBOOM_IMPL &APIC
// ) tmpNeededFiles
// ON tmpNeededFiles.slf_slbID = tblAccountUserAssets.uas_slbID

.nestedLeftJoin(intfAccountSaleablesFiles::myInstance->makeSelectQuery(APICALLBOOM_PARAM, "", false)
.nestedLeftJoin(intfAccountSaleablesFiles::myInstance->makeSelectQuery(APICALLBOOM_PARAM, "", true, false)
.addCol(tblAccountSaleablesFilesBase::Fields::slf_slbID, tblAccountSaleablesFilesBase::Fields::slf_slbID)
.addCol(enuAggregation::SUM, tblAccountSaleablesFilesBase::Fields::slfMinCount, "MandatoryFilesCount")
.where({ tblAccountSaleablesFilesBase::Fields::slfMinCount, enuConditionOperator::Greater, 0 })
Expand Down Expand Up @@ -559,7 +638,7 @@ ORMSelectQuery intfAccountUserAssets::makeSelectQuery(INTFAPICALLBOOM_IMPL &APIC
// ON tmpProvidedFiles.uasufl_uasID = tblAccountUserAssets.uasID

.nestedLeftJoin(ORMSelectQuery(APICALLBOOM_PARAM,
intfAccountUserAssetsFiles::myInstance->makeSelectQuery(APICALLBOOM_PARAM, "", false)
intfAccountUserAssetsFiles::myInstance->makeSelectQuery(APICALLBOOM_PARAM, "", true, false)
.addCol(tblAccountUserAssetsFilesBase::Fields::uasufl_uasID)
.addCol(tblAccountUserAssetsFilesBase::Fields::uasufl_slfID)
.addCol(tblAccountSaleablesFilesBase::Fields::slfMinCount)
Expand Down
Loading