|
@@ -46,11 +46,21 @@ module.exports = (sequelize, DataTypes) => {
|
|
|
//var idList = await this.findAll(condition);//获得idList
|
|
|
//var yearList= await this.findAll(condition);//获得yearList
|
|
|
//console.log(logType+'d'+dataId);
|
|
|
+
|
|
|
var list=[];
|
|
|
- await this.sequelize.query('select CONVERT(GROUP_CONCAT(id) USING utf8) as id,date_format(createDate,"%Y") as year FROM operate_log where ' +
|
|
|
- 'logType='+logType+' and dataId='+dataId+' GROUP BY Year(createDate) ').spread((results, metadata) => {
|
|
|
- list=results;
|
|
|
- });
|
|
|
+ var sqlQuery = 'select CONVERT(GROUP_CONCAT(id) USING utf8) as id,date_format(createDate,"%Y") as year FROM operate_log where ' +
|
|
|
+ 'logType=? and dataId=? GROUP BY Year(createDate) ';
|
|
|
+ sequelize.query(sqlQuery,
|
|
|
+ { replacements: [logType,dataId], type: sequelize.QueryTypes.SELECT }
|
|
|
+ ).then(function(projects) {
|
|
|
+ list=projects;
|
|
|
+ })
|
|
|
+
|
|
|
+// var list=[];
|
|
|
+// await this.sequelize.query('select CONVERT(GROUP_CONCAT(id) USING utf8) as id,date_format(createDate,"%Y") as year FROM operate_log where ' +
|
|
|
+// 'logType='+logType+' and dataId='+dataId+' GROUP BY Year(createDate) ').spread((results, metadata) => {
|
|
|
+// list=results;
|
|
|
+// });
|
|
|
|
|
|
var sqlArray=[];
|
|
|
list.forEach(function(v,i){
|