You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
73 lines
3.0 KiB
73 lines
3.0 KiB
package customerForm
|
|
|
|
import (
|
|
"appPlatform/overall"
|
|
"strings"
|
|
)
|
|
|
|
/*
|
|
*
|
|
@ 作者: 秦东
|
|
@ 时间: 2024-03-06 13:23:03
|
|
@ 功能: 自定义表单分组
|
|
*/
|
|
type DiaoBanSetup struct {
|
|
Id int64 `json:"id" gorm:"primaryKey;column:id;type:int(5) unsigned;not null;comment:Id;index"`
|
|
Appid int64 `json:"appid" gorm:"column:appid;type:bigint(20) unsigned;default:0;not null;comment:归属哪个app"`
|
|
Source string `json:"source" gorm:"column:source;type:varchar(255) unsigned;default:'';not null;comment:是否引用数据源(yes ; no)"`
|
|
Ip string `json:"ip" gorm:"column:ip;type:varchar(255) unsigned;default:'';not null;comment:数据源地址"`
|
|
DataBaseName string `json:"dataBaseName" gorm:"column:dataBaseName;type:varchar(255) unsigned;default:'';not null;comment:是否引用数据源(yes ; no)"`
|
|
SqlType string `json:"sqlType" gorm:"column:sqlType;type:varchar(255) unsigned;default:'';not null;comment:数据库类型"`
|
|
Port int64 `json:"port" gorm:"column:port;type:int(7) unsigned;default:50;not null;comment:端口"`
|
|
TableKey string `json:"tableKey" gorm:"column:tableKey;type:varchar(255);default:'';comment:数据表标识"`
|
|
TableNames string `json:"tableName" gorm:"column:tableName;type:varchar(255);default:'';comment:数据表名称"`
|
|
UserName string `json:"userName" gorm:"column:userName;type:varchar(255);default:'';comment:数据库用户名"`
|
|
Pwd string `json:"pwd" gorm:"column:pwd;type:varchar(255);default:'';comment:数据库密码"`
|
|
Time int64 `json:"time" gorm:"column:time;type:bigint(20) unsigned;default:0;not null;comment:创建时间"`
|
|
SourceId string `json:"sourceId" gorm:"column:sourceId;type:varchar(255);default:'';comment:所愿"`
|
|
}
|
|
|
|
func (DiaoBanSetup *DiaoBanSetup) TableName() string {
|
|
return "diaoBanSetup"
|
|
}
|
|
|
|
// 编辑内容
|
|
func (cont *DiaoBanSetup) EiteCont(whereMap interface{}, saveData interface{}) (err error) {
|
|
err = overall.CONSTANT_DB_AppPlatform.Model(&cont).Where(whereMap).Updates(saveData).Error
|
|
return
|
|
}
|
|
|
|
// 获取内容
|
|
func (cont *DiaoBanSetup) GetCont(whereMap interface{}, field ...string) (err error) {
|
|
gormDb := overall.CONSTANT_DB_AppPlatform.Model(&cont)
|
|
if len(field) > 0 {
|
|
fieldStr := strings.Join(field, ",")
|
|
gormDb = gormDb.Select(fieldStr)
|
|
}
|
|
gormDb = gormDb.Where(whereMap)
|
|
err = gormDb.First(&cont).Error
|
|
return
|
|
}
|
|
|
|
// 根据条件获取总数
|
|
func (cont *DiaoBanSetup) CountCont(whereMap interface{}) (countId int64) {
|
|
overall.CONSTANT_DB_AppPlatform.Model(&cont).Where(whereMap).Count(&countId)
|
|
return
|
|
}
|
|
|
|
// 读取全部信息
|
|
func (cont *DiaoBanSetup) ContMap(whereMap interface{}, field ...string) (countAry []DiaoBanSetup, err error) {
|
|
gormDb := overall.CONSTANT_DB_AppPlatform.Model(&cont)
|
|
if len(field) > 0 {
|
|
fieldStr := strings.Join(field, ",")
|
|
gormDb = gormDb.Select(fieldStr)
|
|
}
|
|
err = gormDb.Where(whereMap).Find(&countAry).Error
|
|
return
|
|
}
|
|
|
|
// 删除内容
|
|
func (cont *DiaoBanSetup) DelCont(whereMap interface{}) (err error) {
|
|
err = overall.CONSTANT_DB_AppPlatform.Where(whereMap).Delete(&cont).Error
|
|
return
|
|
}
|
|
|