Roc пре 1 година
родитељ
комит
96ee245da0
2 измењених фајлова са 5 додато и 7 уклоњено
  1. 3 4
      models/table.go
  2. 2 3
      models/table_data.go

+ 3 - 4
models/table.go

@@ -1,7 +1,7 @@
 package models
 
 import (
-	"github.com/rdlucklib/rdluck_tools/orm"
+	"github.com/beego/beego/v2/client/orm"
 	"time"
 )
 
@@ -24,8 +24,7 @@ type TableInfo struct {
 
 // GetTableInfoByUniqueCode 根据union_code 获取表格信息
 func GetTableInfoByUniqueCode(uniqueCode string) (item *TableInfo, err error) {
-	o := orm.NewOrm()
-	o.Using("data")
+	o := orm.NewOrmUsingDB("data")
 	sql := ` SELECT * FROM table_info WHERE unique_code=? `
 	err = o.Raw(sql, uniqueCode).QueryRow(&item)
 	return
@@ -33,6 +32,6 @@ func GetTableInfoByUniqueCode(uniqueCode string) (item *TableInfo, err error) {
 
 // TableInfoDetailResp 表格详情返回
 type TableInfoDetailResp struct {
-	TableInfo   *TableInfo
+	TableInfo     *TableInfo
 	TableDataList []*TableData
 }

+ 2 - 3
models/table_data.go

@@ -1,7 +1,7 @@
 package models
 
 import (
-	"github.com/rdlucklib/rdluck_tools/orm"
+	"github.com/beego/beego/v2/client/orm"
 	"time"
 )
 
@@ -29,8 +29,7 @@ type TableData struct {
 
 // GetTableDataListByTableInfoId 根据表格id获取数据列表
 func GetTableDataListByTableInfoId(tableInfoId int) (items []*TableData, err error) {
-	o := orm.NewOrm()
-	o.Using("data")
+	o := orm.NewOrmUsingDB("data")
 	pars := make([]interface{}, 0)
 	pars = append(pars, tableInfoId)