update
This commit is contained in:
1 parent
315475c38f
commit
119facec02
15 files changed
+64
-105
No files matched your search
@@ -2,13 +2,11 @@ package tools
|
||||
|
||||
import (
|
||||
"errors"
|
||||
"go-admin/config"
|
||||
orm "go-admin/database"
|
||||
)
|
||||
|
||||
type DBColumns struct {
|
||||
//select COLUMN_NAME,COLUMN_DEFAULT,IS_NULLABLE,DATA_TYPE,CHARACTER_MAXIMUM_LENGTH,CHARACTER_SET_NAME,COLUMN_TYPE,COLUMN_KEY,EXTRA,COLUMN_COMMENT
|
||||
//from information_schema.`COLUMNS` where table_schema='test1db' and TABLE_NAME='sys_config'
|
||||
|
||||
TableSchema string `gorm:"column:TABLE_SCHEMA" json:"tableSchema"`
|
||||
TableName string `gorm:"column:TABLE_NAME" json:"tableName"`
|
||||
ColumnName string `gorm:"column:COLUMN_NAME" json:"columnName"`
|
||||
@@ -27,7 +25,7 @@ func (e *DBColumns) GetPage(pageSize int, pageIndex int) ([]DBColumns, int32, er
|
||||
var doc []DBColumns
|
||||
|
||||
table := orm.Eloquent.Select("*").Table("information_schema.`COLUMNS`")
|
||||
table = table.Where("table_schema='test1db'")
|
||||
table = table.Where("table_schema= ? ", config.DatabaseConfig.Database)
|
||||
|
||||
if e.TableName != "" {
|
||||
return nil, 0, errors.New("table name cannot be empty!")
|
||||
@@ -48,7 +46,7 @@ func (e *DBColumns) GetList() ([]DBColumns, error) {
|
||||
var doc []DBColumns
|
||||
|
||||
table := orm.Eloquent.Select("*").Table("information_schema.columns")
|
||||
table = table.Where("table_schema='test1db'")
|
||||
table = table.Where("table_schema= ? ", config.DatabaseConfig.Database)
|
||||
|
||||
if e.TableName == "" {
|
||||
return nil, errors.New("table name cannot be empty!")
|
||||
|
||||
@@ -2,6 +2,7 @@ package tools
|
||||
|
||||
import (
|
||||
"errors"
|
||||
"go-admin/config"
|
||||
orm "go-admin/database"
|
||||
)
|
||||
|
||||
@@ -19,7 +20,7 @@ func (e *DBTables) GetPage(pageSize int, pageIndex int) ([]DBTables, int32, erro
|
||||
var doc []DBTables
|
||||
|
||||
table := orm.Eloquent.Select("*").Table("information_schema.tables")
|
||||
table = table.Where("table_schema='test1db'")
|
||||
table = table.Where("table_schema= ? ", config.DatabaseConfig.Database)
|
||||
|
||||
if e.TableName != "" {
|
||||
table = table.Where("TABLE_NAME = ?", e.TableName)
|
||||
@@ -38,7 +39,7 @@ func (e *DBTables) Get() (DBTables, error) {
|
||||
var doc DBTables
|
||||
|
||||
table := orm.Eloquent.Select("*").Table("information_schema.tables")
|
||||
table = table.Where("table_schema='test1db'")
|
||||
table = table.Where("table_schema= ? ", config.DatabaseConfig.Database)
|
||||
if e.TableName == "" {
|
||||
return doc, errors.New("table name cannot be empty!")
|
||||
}
|
||||
|
||||
@@ -26,6 +26,8 @@ type SysTables struct {
|
||||
//功能作者
|
||||
FunctionAuthor string `gorm:"column:function_author" json:"functionAuthor"`
|
||||
PkColumn string `gorm:"column:pk_column" json:"pkColumn"`
|
||||
PkGoField string `gorm:"column:pk_go_field" json:"pkGoField"`
|
||||
PkJsonField string `gorm:"column:pk_json_field" json:"pkJsonField"`
|
||||
Options string `gorm:"column:options" json:"options"`
|
||||
TreeCode string `gorm:"column:tree_code" json:"treeCode"`
|
||||
TreeParentCode string `gorm:"column:tree_parent_code" json:"treeParentCode"`
|
||||
@@ -33,7 +35,8 @@ type SysTables struct {
|
||||
Tree bool `gorm:"column:tree" json:"tree"`
|
||||
Crud bool `gorm:"column:crud" json:"crud"`
|
||||
Remark string `gorm:"column:remark" json:"remark"`
|
||||
IsLogicalDelete bool `gorm:"column:is_logical_delete" json:"isLogicalDelete"`
|
||||
IsLogicalDelete string `gorm:"column:is_logical_delete" json:"isLogicalDelete"`
|
||||
LogicalDelete bool `gorm:"column:logical_delete" json:"logicalDelete"`
|
||||
LogicalDeleteColumn string `gorm:"column:logical_delete_column" json:"logicalDeleteColumn"`
|
||||
CreateBy string `gorm:"column:create_by" json:"createBy"`
|
||||
CreateTime string `gorm:"column:create_time" json:"createTime"`
|
||||
@@ -101,6 +104,7 @@ func (e *SysTables) Get() (SysTables, error) {
|
||||
func (e *SysTables) Create() (SysTables, error) {
|
||||
var doc SysTables
|
||||
e.CreateTime = utils.GetCurrntTime()
|
||||
e.UpdateTime = utils.GetCurrntTime()
|
||||
result := orm.Eloquent.Table("sys_tables").Create(&e)
|
||||
if result.Error != nil {
|
||||
err := result.Error
|
||||
|
||||
Reference in new issue
Block a user