Browse Source

分类树查询修复

kobe6258 4 weeks ago
parent
commit
195c5670c7
2 changed files with 12 additions and 2 deletions
  1. 4 2
      controllers/oilchem_data.go
  2. 8 0
      models/data_manage/base_from_oilchem.go

+ 4 - 2
controllers/oilchem_data.go

@@ -669,12 +669,14 @@ func (this *TradeCommonController) ExportoilchemList() {
 	}
 	if req.IsSelectedAll {
 		if len(req.IndexCode) > 0 {
-			condition += ` AND index_code NOT IN (` + utils.GetOrmInReplace(len(req.IndexCode)) + `)`
+			//condition += ` AND index_code NOT IN (` + utils.GetOrmInReplace(len(req.IndexCode)) + `)`
+			condition += ` AND index_code NOT IN ?`
 			pars = append(pars, req.IndexCode)
 		}
 	} else {
 		if len(req.IndexCode) > 0 {
-			condition += ` AND index_code IN (` + utils.GetOrmInReplace(len(req.IndexCode)) + `)`
+			//condition += ` AND index_code IN (` + utils.GetOrmInReplace(len(req.IndexCode)) + `)`
+			condition += ` AND index_code IN ?`
 			pars = append(pars, req.IndexCode)
 		}
 	}

+ 8 - 0
models/data_manage/base_from_oilchem.go

@@ -346,5 +346,13 @@ func GetOilchemDataDataTimeByIndexId(indexIdList []int) (items []string, err err
 	o := global.DbMap[utils.DbNameIndex]
 	sql := ` SELECT DISTINCT data_time FROM base_from_oilchem_data WHERE base_from_oilchem_index_id IN (` + utils.GetOrmInReplace(len(indexIdList)) + `) ORDER BY data_time DESC`
 	err = o.Raw(sql, indexIdList).Find(&items).Error
+	if err != nil {
+		return
+	}
+	if utils.NeedDateOrTimeFormat(utils.DbDriverName) {
+		for i := 0; i < len(items); i++ {
+			items[i] = utils.GormDateStrToDateStr(items[i])
+		}
+	}
 	return
 }