crisis111 4 lat temu
rodzic
commit
10e0441a22

+ 24 - 0
app/system/api/sync_table.go

@@ -0,0 +1,24 @@
+package api
+
+import (
+	"gfast/app/system/dao"
+	"gfast/app/system/service"
+
+	"github.com/gogf/gf/net/ghttp"
+	"github.com/gogf/gf/os/gtime"
+)
+
+type syncTable struct {
+	SystemBase
+}
+
+var SyncTable = new(syncTable)
+
+func (s *syncTable) FunSyncTable(r *ghttp.Request) {
+	var param dao.SyncSrcTableParams
+	r.Parse(&param)
+	param.CreateDate = gtime.Now()
+	param.WriteDate = gtime.Now()
+	service.SyncTable.AddSrcTable(&param)
+	s.SusJsonExit(r, "添加成功")
+}

+ 50 - 0
app/system/dao/internal/sync_src_table.go

@@ -0,0 +1,50 @@
+// ==========================================================================
+// This is auto-generated by gf cli tool. DO NOT EDIT THIS FILE MANUALLY.
+// ==========================================================================
+
+package internal
+
+import (
+	"github.com/gogf/gf/database/gdb"
+	"github.com/gogf/gf/frame/g"
+	"github.com/gogf/gf/frame/gmvc"
+)
+
+// SyncSrcTableDao is the manager for logic model data accessing
+// and custom defined data operations functions management.
+type SyncSrcTableDao struct {
+	gmvc.M                                      // M is the core and embedded struct that inherits all chaining operations from gdb.Model.
+	DB      gdb.DB                              // DB is the raw underlying database management object.
+	Table   string                              // Table is the table name of the DAO.
+	Columns syncSrcTableColumns // Columns contains all the columns of Table that for convenient usage.
+}
+
+// SyncSrcTableColumns defines and stores column names for table sync_src_table.
+type syncSrcTableColumns struct {
+	Id          string //   
+    CreateDate  string //   
+    WriteDate   string //   
+    TaskId      string //   
+    DbType      string //   
+    DbName      string //   
+    TableName   string //   
+    PkFiled     string //
+}
+
+func NewSyncSrcTableDao() *SyncSrcTableDao {
+	return &SyncSrcTableDao{
+		M:     g.DB("default").Model("sync_src_table").Safe(),
+		DB:    g.DB("default"),
+		Table: "sync_src_table",
+		Columns: syncSrcTableColumns{
+			Id:         "id",           
+            CreateDate: "create_date",  
+            WriteDate:  "write_date",   
+            TaskId:     "task_id",      
+            DbType:     "db_type",      
+            DbName:     "db_name",      
+            TableName:  "table_name",   
+            PkFiled:    "pk_filed",
+		},
+	}
+}

+ 42 - 0
app/system/dao/sync_src_table.go

@@ -0,0 +1,42 @@
+// =================================================================================
+// This is auto-generated by GoFrame CLI tool only once. Fill this file as you wish.
+// =================================================================================
+
+package dao
+
+import (
+	"gfast/app/system/dao/internal"
+
+	"github.com/gogf/gf/os/gtime"
+)
+
+// syncSrcTableDao is the manager for logic model data accessing
+// and custom defined data operations functions management. You can define
+// methods on it to extend its functionality as you wish.
+type syncSrcTableDao struct {
+	*internal.SyncSrcTableDao
+}
+
+var (
+	// SyncSrcTable is globally public accessible object for table sync_src_table operations.
+	SyncSrcTable syncSrcTableDao
+)
+
+func init() {
+	SyncSrcTable = syncSrcTableDao{
+		internal.NewSyncSrcTableDao(),
+	}
+}
+
+// Fill with you ideas below.
+
+
+type SyncSrcTableParams struct {
+	CreateDate *gtime.Time `orm:"create_date" json:"createDate"` //   
+    WriteDate  *gtime.Time `orm:"write_date"  json:"writeDate"`  //   
+    TaskId     int64       `orm:"task_id"     json:"taskId"`     //   
+    DbType     string      `orm:"db_type"     json:"dbType"`     //   
+    DbName     string      `orm:"db_name"     json:"dbName"`     //   
+    TableName  string      `orm:"table_name"  json:"tableName"`  //   
+    PkFiled    string      `orm:"pk_filed"    json:"pkFiled"`    // 
+}

+ 21 - 0
app/system/model/internal/sync_src_table.go

@@ -0,0 +1,21 @@
+// ==========================================================================
+// Code generated by GoFrame CLI tool. DO NOT EDIT.
+// ==========================================================================
+
+package internal
+
+import (
+    "github.com/gogf/gf/os/gtime"
+)
+
+// SyncSrcTable is the golang structure for table sync_src_table.
+type SyncSrcTable struct {
+    Id         int64       `orm:"id"          json:"id"`         //   
+    CreateDate *gtime.Time `orm:"create_date" json:"createDate"` //   
+    WriteDate  *gtime.Time `orm:"write_date"  json:"writeDate"`  //   
+    TaskId     int64       `orm:"task_id"     json:"taskId"`     //   
+    DbType     string      `orm:"db_type"     json:"dbType"`     //   
+    DbName     string      `orm:"db_name"     json:"dbName"`     //   
+    TableName  string      `orm:"table_name"  json:"tableName"`  //   
+    PkFiled    string      `orm:"pk_filed"    json:"pkFiled"`    //   
+}

+ 14 - 0
app/system/model/sync_src_table.go

@@ -0,0 +1,14 @@
+// =================================================================================
+// This is auto-generated by GoFrame CLI tool only once. Fill this file as you wish.
+// =================================================================================
+
+package model
+
+import (
+	"gfast/app/system/model/internal"
+)
+
+// SyncSrcTable is the golang structure for table sync_src_table.
+type SyncSrcTable internal.SyncSrcTable
+
+// Fill with you ideas below.

+ 3 - 0
app/system/router/router.go

@@ -25,6 +25,9 @@ func init() {
 			group.Middleware(middleware.Ctx, middleware.Auth)
 			//后台操作日志记录
 			group.Hook("/*", ghttp.HookAfterOutput, api.SysOperLog.OperationLog)
+
+			group.POST("/syncTable",api.SyncTable.FunSyncTable)
+
 			//后台上传
 			group.Group("/upload", func(group *ghttp.RouterGroup) {
 				//单图上传

+ 12 - 0
app/system/service/sync_table.go

@@ -0,0 +1,12 @@
+package service
+
+import "gfast/app/system/dao"
+
+type syncTable struct{}
+
+var SyncTable = new(syncTable)
+
+func (s *syncTable) AddSrcTable(params *dao.SyncSrcTableParams) (err error) {
+	_, err = dao.SyncSrcTable.Insert(params)
+	return
+}