feat: 网元版本支持通过网元类型和网元ID查询
This commit is contained in:
@@ -22,6 +22,9 @@ type INeVersion interface {
|
||||
// DeleteByIds 批量删除信息
|
||||
DeleteByIds(ids []string) (int64, error)
|
||||
|
||||
// SelectByTypeAndID 通过网元类型和网元ID查询
|
||||
SelectByTypeAndID(neType, neId string) model.NeVersion
|
||||
|
||||
// CheckUniqueTypeAndID 校验网元类型和网元ID是否唯一
|
||||
CheckUniqueTypeAndID(neType, neId, id string) bool
|
||||
}
|
||||
|
||||
@@ -33,9 +33,9 @@ func (r *NeVersionImpl) SelectById(id string) model.NeVersion {
|
||||
if id == "" {
|
||||
return model.NeVersion{}
|
||||
}
|
||||
neHosts := r.neVersionRepository.SelectByIds([]string{id})
|
||||
if len(neHosts) > 0 {
|
||||
return neHosts[0]
|
||||
neVersions := r.neVersionRepository.SelectByIds([]string{id})
|
||||
if len(neVersions) > 0 {
|
||||
return neVersions[0]
|
||||
}
|
||||
return model.NeVersion{}
|
||||
}
|
||||
@@ -66,6 +66,18 @@ func (r *NeVersionImpl) DeleteByIds(ids []string) (int64, error) {
|
||||
return 0, fmt.Errorf("delete fail")
|
||||
}
|
||||
|
||||
// SelectByTypeAndID 通过网元类型和网元ID查询
|
||||
func (r *NeVersionImpl) SelectByTypeAndID(neType, neId string) model.NeVersion {
|
||||
neVersions := r.neVersionRepository.SelectList(model.NeVersion{
|
||||
NeType: neType,
|
||||
NeId: neId,
|
||||
})
|
||||
if len(neVersions) > 0 {
|
||||
return neVersions[0]
|
||||
}
|
||||
return model.NeVersion{}
|
||||
}
|
||||
|
||||
// CheckUniqueTypeAndID 校验网元类型和网元ID是否唯一
|
||||
func (r *NeVersionImpl) CheckUniqueTypeAndID(neType, neId, id string) bool {
|
||||
uniqueId := r.neVersionRepository.CheckUniqueTypeAndID(model.NeVersion{
|
||||
|
||||
Reference in New Issue
Block a user