|
@@ -89,6 +89,19 @@ class BaseModel {
|
|
|
return results || null;
|
|
|
}
|
|
|
|
|
|
+ async findDataByLimitPublish(conditions,limit=1,orderBy="") {
|
|
|
+ this.queryBuilder.clear()
|
|
|
+ let { sql, params } = this.queryBuilder
|
|
|
+ .select()
|
|
|
+ .from(this.tableName)
|
|
|
+ .where(conditions)
|
|
|
+ .orderByPublishAndWeight()
|
|
|
+ .limit(limit)
|
|
|
+ .getQuery();
|
|
|
+ const results = await db.query(sql, params);
|
|
|
+ return results || null;
|
|
|
+ }
|
|
|
+
|
|
|
async findAll(conditions = {}, limit = null, offset = 0, orderBy = null) {
|
|
|
this.queryBuilder.clear()
|
|
|
let builder = this.queryBuilder
|