feat: 网元版本支持通过网元类型和网元ID查询
This commit is contained in:
@@ -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