diff --git a/configmanage/server/internal/configinfo.go b/configmanage/server/internal/configinfo.go index f8fba6951c4c49e527f169110c146463a42ff32b..e26b2a458aebbd0ae8fb98ac45699aaa7d3ce757 100644 --- a/configmanage/server/internal/configinfo.go +++ b/configmanage/server/internal/configinfo.go @@ -27,7 +27,7 @@ func (cm *ConfigInfo) Add() error { func GetInfoByUUID(uuid string) (ConfigInfo, error) { var ci ConfigInfo - err := db.MySQL().Model(&ConfigInfo{}).Where("uuid=?", uuid).Find(&ci).Error + err := db.MySQL().Model(&ConfigInfo{}).Where("uuid=?", uuid).First(&ci).Error return ci, err } diff --git a/configmanage/server/internal/dnsfile.go b/configmanage/server/internal/dnsfile.go index a9d4ccd1050add568d63c8c89bd6e2a9ecfec692..755cdfca6c12781de45cd6ea733e0b63feaad2d2 100644 --- a/configmanage/server/internal/dnsfile.go +++ b/configmanage/server/internal/dnsfile.go @@ -52,15 +52,15 @@ func (df *DNSFile) Add() error { func GetDNSFileByInfoUUID(uuid string, isindex interface{}) (DNSFile, error) { var file DNSFile if isindex != nil { - err := db.MySQL().Model(&DNSFile{}).Where("config_info_uuid=? && is_index = ?", uuid, isindex).Find(&file).Error + err := db.MySQL().Model(&DNSFile{}).Where("config_info_uuid=? && is_index = ?", uuid, isindex).First(&file).Error return file, err } - err := db.MySQL().Model(&DNSFile{}).Where("config_info_uuid=?", uuid).Find(&file).Error + err := db.MySQL().Model(&DNSFile{}).Where("config_info_uuid=?", uuid).First(&file).Error return file, err } func GetDNSFileByUUID(uuid string) (DNSFile, error) { var file DNSFile - err := db.MySQL().Model(&DNSFile{}).Where("uuid=?", uuid).Find(&file).Error + err := db.MySQL().Model(&DNSFile{}).Where("uuid=?", uuid).First(&file).Error return file, err } diff --git a/configmanage/server/internal/hostfile.go b/configmanage/server/internal/hostfile.go index b37b3408671c1ae87e7a007b17f480983781dbd1..d06b670be7e078ea06c8a1b569bca00409f6104e 100644 --- a/configmanage/server/internal/hostfile.go +++ b/configmanage/server/internal/hostfile.go @@ -53,16 +53,16 @@ func (hf *HostFile) Add() error { func GetHostFileByInfoUUID(uuid string, isindex interface{}) (HostFile, error) { var file HostFile if isindex != nil { - err := db.MySQL().Model(&HostFile{}).Where("config_info_uuid=? && is_index = ?", uuid, isindex).Find(&file).Error + err := db.MySQL().Model(&HostFile{}).Where("config_info_uuid=? && is_index = ?", uuid, isindex).First(&file).Error return file, err } - err := db.MySQL().Model(&HostFile{}).Where("config_info_uuid=?", uuid).Find(&file).Error + err := db.MySQL().Model(&HostFile{}).Where("config_info_uuid=?", uuid).First(&file).Error return file, err } func GetHostFileByUUID(uuid string) (HostFile, error) { var file HostFile - err := db.MySQL().Model(&HostFile{}).Where("uuid=?", uuid).Find(&file).Error + err := db.MySQL().Model(&HostFile{}).Where("uuid=?", uuid).First(&file).Error return file, err } diff --git a/configmanage/server/internal/repofile.go b/configmanage/server/internal/repofile.go index 872962b4a6976b08d04ad9cffebbe7eb52fff75c..a4e7d07eabfffb8d7fbd8735f100195d886bc155 100644 --- a/configmanage/server/internal/repofile.go +++ b/configmanage/server/internal/repofile.go @@ -29,16 +29,16 @@ func (rf *RepoFile) Add() error { func GetRepoFileByInfoUUID(uuid string, isindex interface{}) (RepoFile, error) { var file RepoFile if isindex != nil { - err := db.MySQL().Model(&RepoFile{}).Where("config_info_uuid=? && is_index = ?", uuid, isindex).Find(&file).Error + err := db.MySQL().Model(&RepoFile{}).Where("config_info_uuid=? && is_index = ?", uuid, isindex).First(&file).Error return file, err } - err := db.MySQL().Model(&RepoFile{}).Where("config_info_uuid=?", uuid).Find(&file).Error + err := db.MySQL().Model(&RepoFile{}).Where("config_info_uuid=?", uuid).First(&file).Error return file, err } func GetRepoFileByUUID(uuid string) (RepoFile, error) { var file RepoFile - err := db.MySQL().Model(&RepoFile{}).Where("uuid=?", uuid).Find(&file).Error + err := db.MySQL().Model(&RepoFile{}).Where("uuid=?", uuid).First(&file).Error return file, err } diff --git a/configmanage/server/internal/ssh.go b/configmanage/server/internal/ssh.go index b206c01e520311b7b4eb38b2ee3fa780c1992428..1a80f7fb761900e3e5d61592f733ff139caf1ca3 100644 --- a/configmanage/server/internal/ssh.go +++ b/configmanage/server/internal/ssh.go @@ -29,10 +29,10 @@ func (sf *SSHFile) Add() error { func GetSSHFileByInfoUUID(uuid string, isindex interface{}) (SSHFile, error) { var file SSHFile if isindex != nil { - err := db.MySQL().Model(&SSHFile{}).Where("config_info_uuid=? && is_index = ?", uuid, isindex).Find(&file).Error + err := db.MySQL().Model(&SSHFile{}).Where("config_info_uuid=? && is_index = ?", uuid, isindex).First(&file).Error return file, err } - err := db.MySQL().Model(&SSHFile{}).Where("config_info_uuid=?", uuid).Find(&file).Error + err := db.MySQL().Model(&SSHFile{}).Where("config_info_uuid=?", uuid).First(&file).Error return file, err } diff --git a/configmanage/server/internal/sshd.go b/configmanage/server/internal/sshd.go index 47ea0c7f0c402e5955c1b59a11ef5e77b8b963c4..942788a293db6c9d535ce54e5009b59c35514cf4 100644 --- a/configmanage/server/internal/sshd.go +++ b/configmanage/server/internal/sshd.go @@ -28,16 +28,16 @@ func (sdf *SSHDFile) Add() error { func GetSSHDFileByInfoUUID(uuid string, isindex interface{}) (SSHDFile, error) { var file SSHDFile if isindex != nil { - err := db.MySQL().Model(&SSHDFile{}).Where("config_info_uuid=? && is_index = ?", uuid, isindex).Find(&file).Error + err := db.MySQL().Model(&SSHDFile{}).Where("config_info_uuid=? && is_index = ?", uuid, isindex).First(&file).Error return file, err } - err := db.MySQL().Model(&SSHDFile{}).Where("config_info_uuid=?", uuid).Find(&file).Error + err := db.MySQL().Model(&SSHDFile{}).Where("config_info_uuid=?", uuid).First(&file).Error return file, err } func GetSSHDFileByUUID(uuid string) (SSHDFile, error) { var file SSHDFile - err := db.MySQL().Model(&SSHDFile{}).Where("uuid=?", uuid).Find(&file).Error + err := db.MySQL().Model(&SSHDFile{}).Where("uuid=?", uuid).First(&file).Error return file, err } diff --git a/configmanage/server/internal/sysctl.go b/configmanage/server/internal/sysctl.go index 943b8cf7ade48800722d2f8993f335a00118487a..9eb2511a0626b8484757534ed259ffc41a704b46 100644 --- a/configmanage/server/internal/sysctl.go +++ b/configmanage/server/internal/sysctl.go @@ -29,16 +29,16 @@ func (sysf *SysctlFile) Add() error { func GetSysctlFileByInfoUUID(uuid string, isindex interface{}) (SysctlFile, error) { var file SysctlFile if isindex != nil { - err := db.MySQL().Model(&SysctlFile{}).Where("config_info_uuid=? && is_index = ?", uuid, isindex).Find(&file).Error + err := db.MySQL().Model(&SysctlFile{}).Where("config_info_uuid=? && is_index = ?", uuid, isindex).First(&file).Error return file, err } - err := db.MySQL().Model(&SysctlFile{}).Where("config_info_uuid=?", uuid).Find(&file).Error + err := db.MySQL().Model(&SysctlFile{}).Where("config_info_uuid=?", uuid).First(&file).Error return file, err } func GetSysctlFileByUUID(uuid string) (SysctlFile, error) { var file SysctlFile - err := db.MySQL().Model(&SysctlFile{}).Where("uuid=?", uuid).Find(&file).Error + err := db.MySQL().Model(&SysctlFile{}).Where("uuid=?", uuid).First(&file).Error return file, err }