1234567891011121314151617181920212223242526272829 |
- #include "%1.h"
- #include "MessageException.h"
- %1::%1(QObject *parent)
- : QxModelBase<%2>(parent)
- {
- }
- %1::~%1()
- {
- }
- void %1::fetchByName(const QString &name, int pageIndex)
- {
- qx::QxSqlQuery query;
- if (!name.isEmpty())
- query.where("t." + %2::column_NAME()).containsString(name).orderAsc("t." + %2::column_ID());
- query.orderAsc("t." + %2::column_ID());
- QStringList relations;
- relations << "<t>";
- this->countWithRelation(query, relations);
- this->limit(query, pageIndex);
- QSqlError error = this->qxFetchByQuery(query, relations);
- if (error.isValid())
- throw MessageException(error.text());
- }
|