Bladeren bron

修改数据库为dm

hongze 1 maand geleden
bovenliggende
commit
8c37b00c93
2 gewijzigde bestanden met toevoegingen van 13 en 13 verwijderingen
  1. 2 2
      models/data_manage/manual.go
  2. 11 11
      models/data_manage/manual_classify.go

+ 2 - 2
models/data_manage/manual.go

@@ -27,7 +27,7 @@ func GetManualClassifyEdbInfoCount() (items []*ManualClassifyEdbInfoCount, err e
 			INNER JOIN edbinfo AS b ON a.classify_id=b.classify_id
 			WHERE a.is_show=1
 			GROUP BY a.classify_id `
-	err = global.DmSQL["data"].Raw(sql).Find(&items).Error
+	err = global.DmSQL["edb"].Raw(sql).Find(&items).Error
 	return
 }
 
@@ -42,6 +42,6 @@ func GetManualEdbInfoCountByClassifyId(classifyId int) (total int, err error) {
 	sql := ` SELECT COUNT(1) AS total FROM edbdata_classify AS a
 			INNER JOIN edbinfo AS b ON a.classify_id=b.classify_id
 			WHERE a.is_show=1 AND b.classify_id = ?`
-	err = global.DmSQL["data"].Raw(sql, classifyId).Scan(&total).Error
+	err = global.DmSQL["edb"].Raw(sql, classifyId).Scan(&total).Error
 	return
 }

+ 11 - 11
models/data_manage/manual_classify.go

@@ -27,7 +27,7 @@ type EdbdataClassifyList struct {
 func AddEdbdataClassify(item *EdbdataClassify) (lastId int64, err error) {
 	//o := orm.NewOrmUsingDB("edb")
 	//lastId, err = o.Insert(item)
-	err = global.DmSQL["data"].Create(item).Error
+	err = global.DmSQL["edb"].Create(item).Error
 	return
 }
 
@@ -49,7 +49,7 @@ func GetManualClassifyAll(adminId int) (items []*ManualClassifyList, err error)
 	//}
 
 	sql := ` SELECT classify_id,classify_name,parent_id FROM edbdata_classify WHERE parent_id=0 AND is_show=1 ORDER BY sort ASC ,classify_id ASC `
-	err = global.DmSQL["data"].Raw(sql).Find(&newItems).Error
+	err = global.DmSQL["edb"].Raw(sql).Find(&newItems).Error
 	if err != nil {
 		return
 	}
@@ -66,7 +66,7 @@ func GetManualClassifyAll(adminId int) (items []*ManualClassifyList, err error)
 		//}
 
 		childSql = "SELECT classify_id,classify_name,parent_id FROM edbdata_classify WHERE parent_id=? AND is_show=1 ORDER BY sort ASC ,classify_id ASC "
-		err = global.DmSQL["data"].Raw(childSql, parentId).Find(&childItems).Error
+		err = global.DmSQL["edb"].Raw(childSql, parentId).Find(&childItems).Error
 		if err != nil {
 			return
 		}
@@ -116,7 +116,7 @@ func GetManualClassifyAllV2() (items []*ManualClassifyList, err error) {
 	//}
 
 	sql := ` SELECT classify_id,classify_name,parent_id FROM edbdata_classify WHERE parent_id=0 AND is_show=1 ORDER BY sort ASC ,classify_id ASC `
-	err = global.DmSQL["data"].Raw(sql).Find(&newItems).Error
+	err = global.DmSQL["edb"].Raw(sql).Find(&newItems).Error
 	if err != nil {
 		return
 	}
@@ -132,7 +132,7 @@ func GetManualClassifyAllV2() (items []*ManualClassifyList, err error) {
 		//}
 
 		childSql = "SELECT classify_id,classify_name,parent_id FROM edbdata_classify WHERE parent_id=? AND is_show=1 ORDER BY sort ASC ,classify_id ASC "
-		err = global.DmSQL["data"].Raw(childSql, parentId).Find(&childItems).Error
+		err = global.DmSQL["edb"].Raw(childSql, parentId).Find(&childItems).Error
 		if err != nil {
 			return
 		}
@@ -163,7 +163,7 @@ func GetManualClassifyByClassifyName(classifyName string) (item *EdbdataClassify
 	//err = o.Raw(sql, classifyName).QueryRow(&item)
 
 	sql := `SELECT * FROM edbdata_classify WHERE classify_name=? `
-	err = global.DmSQL["data"].Raw(sql, classifyName).First(&item).Error
+	err = global.DmSQL["edb"].Raw(sql, classifyName).First(&item).Error
 	return
 }
 
@@ -173,7 +173,7 @@ func ModifyManualClassifyIsShow(isShow, classifyId, parentId int) (err error) {
 	//_, err = o.Raw(sql, isShow, parentId, classifyId).Exec()
 
 	sql := `UPDATE edbdata_classify SET is_show=?,parent_id=? WHERE classify_id=? `
-	err = global.DmSQL["data"].Exec(sql, isShow, parentId, classifyId).Error
+	err = global.DmSQL["edb"].Exec(sql, isShow, parentId, classifyId).Error
 	return
 }
 
@@ -194,7 +194,7 @@ func GetManualClassifyById(classifyId int) (item *EdbdataClassify, err error) {
 	//err = o.Raw(sql, classifyId).QueryRow(&item)
 
 	sql := ` SELECT * FROM edbdata_classify WHERE classify_id=? `
-	err = global.DmSQL["data"].Raw(sql, classifyId).First(&item).Error
+	err = global.DmSQL["edb"].Raw(sql, classifyId).First(&item).Error
 	return
 }
 
@@ -220,7 +220,7 @@ func ModifyManualClassifyName(classifyName string, classifyId, parentId int) (er
 	sql := `UPDATE edbdata_classify SET ` + updateStr + ` WHERE classify_id=? `
 
 	pars = append(pars, classifyId)
-	err = global.DmSQL["data"].Exec(sql, pars).Error
+	err = global.DmSQL["edb"].Exec(sql, pars).Error
 	return
 }
 
@@ -238,7 +238,7 @@ func GetManualClassifyAllByCondition(condition string) (items []*EdbdataClassify
 		sql += condition
 	}
 	sql += `  ORDER BY sort ASC `
-	err = global.DmSQL["data"].Raw(sql).Find(&items).Error
+	err = global.DmSQL["edb"].Raw(sql).Find(&items).Error
 	return
 }
 
@@ -249,6 +249,6 @@ func GetChildManualClassifyCount(parentId int) (count int, err error) {
 	//err = o.Raw(sql, parentId).QueryRow(&count)
 
 	sql := `SELECT COUNT(1) AS count FROM edbdata_classify WHERE parent_id=? AND is_show = 1`
-	err = global.DmSQL["data"].Raw(sql, parentId).Scan(&count).Error
+	err = global.DmSQL["edb"].Raw(sql, parentId).Scan(&count).Error
 	return
 }