feat: 网元软件包查询支持通过文件版本和路径查询
This commit is contained in:
@@ -125,6 +125,10 @@ func (r *NeSoftwareImpl) SelectList(neSoftware model.NeSoftware) []model.NeSoftw
|
||||
conditions = append(conditions, "ne_type = ?")
|
||||
params = append(params, neSoftware.NeType)
|
||||
}
|
||||
if neSoftware.Path != "" {
|
||||
conditions = append(conditions, "path = ?")
|
||||
params = append(params, neSoftware.Path)
|
||||
}
|
||||
if neSoftware.Version != "" {
|
||||
conditions = append(conditions, "version = ?")
|
||||
params = append(params, neSoftware.Version)
|
||||
|
||||
@@ -22,6 +22,9 @@ type INeSoftware interface {
|
||||
// DeleteByIds 批量删除信息
|
||||
DeleteByIds(ids []string) (int64, error)
|
||||
|
||||
// SelectByVersionAndPath 通过文件版本和路径查询
|
||||
SelectByVersionAndPath(version, path string) model.NeSoftware
|
||||
|
||||
// CheckUniqueTypeAndFileNameAndVersion 校验网元类型和文件名版本是否唯一
|
||||
CheckUniqueTypeAndFileNameAndVersion(neType, fileName, version, id string) bool
|
||||
|
||||
|
||||
@@ -66,6 +66,18 @@ func (r *NeSoftwareImpl) DeleteByIds(ids []string) (int64, error) {
|
||||
return 0, fmt.Errorf("delete fail")
|
||||
}
|
||||
|
||||
// SelectByVersionAndPath 通过文件版本和路径查询
|
||||
func (r *NeSoftwareImpl) SelectByVersionAndPath(version, path string) model.NeSoftware {
|
||||
neSoftwares := r.neSoftwareRepository.SelectList(model.NeSoftware{
|
||||
Version: version,
|
||||
Path: path,
|
||||
})
|
||||
if len(neSoftwares) > 0 {
|
||||
return neSoftwares[0]
|
||||
}
|
||||
return model.NeSoftware{}
|
||||
}
|
||||
|
||||
// CheckUniqueTypeAndFileNameAndVersion 校验网元类型和文件名版本是否唯一
|
||||
func (r *NeSoftwareImpl) CheckUniqueTypeAndFileNameAndVersion(neType, fileName, version, id string) bool {
|
||||
uniqueId := r.neSoftwareRepository.CheckUniqueTypeAndFileNameAndVersion(model.NeSoftware{
|
||||
|
||||
Reference in New Issue
Block a user