feat: 更新多个模块以支持新的数据结构和日志格式

This commit is contained in:
TsMask
2025-02-20 10:08:27 +08:00
parent 045a2b6b01
commit f3c33b31ac
272 changed files with 13246 additions and 15885 deletions

View File

@@ -23,22 +23,22 @@ type NeLicense struct {
neLicenseRepository *repository.NeLicense // 网元授权激活信息表
}
// SelectNeHostPage 分页查询列表数据
func (r *NeLicense) SelectPage(query map[string]any) map[string]any {
return r.neLicenseRepository.SelectPage(query)
// FindByPage 分页查询列表数据
func (r *NeLicense) FindByPage(query map[string]string) ([]model.NeLicense, int64) {
return r.neLicenseRepository.SelectByPage(query)
}
// SelectConfigList 查询列表
func (r *NeLicense) SelectList(neLicense model.NeLicense) []model.NeLicense {
return r.neLicenseRepository.SelectList(neLicense)
// Find 查询列表
func (r *NeLicense) Find(neLicense model.NeLicense) []model.NeLicense {
return r.neLicenseRepository.Select(neLicense)
}
// SelectByIds 通过ID查询
func (r *NeLicense) SelectById(id string) model.NeLicense {
if id == "" {
// FindById 通过ID查询
func (r *NeLicense) FindById(id int64) model.NeLicense {
if id <= 0 {
return model.NeLicense{}
}
neLicenses := r.neLicenseRepository.SelectByIds([]string{id})
neLicenses := r.neLicenseRepository.SelectByIds([]int64{id})
if len(neLicenses) > 0 {
return neLicenses[0]
}
@@ -46,7 +46,7 @@ func (r *NeLicense) SelectById(id string) model.NeLicense {
}
// Insert 新增信息
func (r *NeLicense) Insert(neLicense model.NeLicense) string {
func (r *NeLicense) Insert(neLicense model.NeLicense) int64 {
return r.neLicenseRepository.Insert(neLicense)
}
@@ -56,7 +56,7 @@ func (r *NeLicense) Update(neLicense model.NeLicense) int64 {
}
// DeleteByIds 批量删除信息
func (r *NeLicense) DeleteByIds(ids []string) (int64, error) {
func (r *NeLicense) DeleteByIds(ids []int64) (int64, error) {
// 检查是否存在
rowIds := r.neLicenseRepository.SelectByIds(ids)
if len(rowIds) <= 0 {
@@ -71,9 +71,9 @@ func (r *NeLicense) DeleteByIds(ids []string) (int64, error) {
return 0, fmt.Errorf("delete fail")
}
// SelectByTypeAndID 通过网元类型和网元ID查询
func (r *NeLicense) SelectByTypeAndID(neType, neId string) model.NeLicense {
neLicenses := r.neLicenseRepository.SelectList(model.NeLicense{
// FindByTypeAndID 通过网元类型和网元ID查询
func (r *NeLicense) FindByTypeAndID(neType, neId string) model.NeLicense {
neLicenses := r.neLicenseRepository.Select(model.NeLicense{
NeType: neType,
NeId: neId,
})
@@ -83,9 +83,9 @@ func (r *NeLicense) SelectByTypeAndID(neType, neId string) model.NeLicense {
return model.NeLicense{}
}
// SelectByNeTypeAndNeID 通过ne_type和ne_id查询信息
func (r *NeLicense) SelectByNeTypeAndNeID(neType, neId string) model.NeLicense {
neLicenses := r.neLicenseRepository.SelectList(model.NeLicense{
// FindByNeTypeAndNeID 通过ne_type和ne_id查询信息
func (r *NeLicense) FindByNeTypeAndNeID(neType, neId string) model.NeLicense {
neLicenses := r.neLicenseRepository.Select(model.NeLicense{
NeType: neType,
NeId: neId,
})
@@ -142,7 +142,7 @@ func (r *NeLicense) ReadLicenseInfo(neLicense model.NeLicense) (string, string)
// UploadLicense 授权文件上传到网元主机
func (r *NeLicense) UploadLicense(neLicense model.NeLicense) error {
// 检查文件是否存在
omcLicensePath := file.ParseUploadFilePath(neLicense.LicensePath)
omcLicensePath := file.ParseUploadFileAbsPath(neLicense.LicensePath)
if _, err := os.Stat(omcLicensePath); err != nil {
return fmt.Errorf("file read failure")
}