sy-node-mysql
Advanced tools
Comparing version
@@ -201,3 +201,3 @@ const mysql = require('mysql'); | ||
* @param sql | ||
* @param opts josn -> {set[], where[], params[], gropuBy, orderBy{column, sort}, limit{offset, size}} | ||
* @param opts josn -> {set[], where[], params[], gropuBy, having[], orderBy{column, sort}, limit{offset, size}} | ||
* opts.where 查询时的where 子句, opts.set 更新时的更新选项 | ||
@@ -261,2 +261,12 @@ * @param sql | ||
sql += ' group by ' + opts.groupBy; | ||
if (opts.having && opts.having.length > 0) { | ||
sql += ' having ('; | ||
for (let i = 0; i < opts.having.length; ++i) { | ||
if (i === opts.having.length - 1) { | ||
sql += opts.having[i] + ')'; | ||
} else { | ||
sql += opts.having[i] + ') and ('; | ||
} | ||
} | ||
} | ||
} | ||
@@ -263,0 +273,0 @@ if (opts.orderBy && opts.orderBy.column) { |
{ | ||
"name": "sy-node-mysql", | ||
"version": "0.1.7", | ||
"version": "0.1.8", | ||
"engines": { | ||
@@ -5,0 +5,0 @@ "node": ">=6.0" |
12074
3.67%307
3.37%