fix: 网元版本函数优化

This commit is contained in:
TsMask
2024-04-11 17:12:37 +08:00
parent ebd02cb3e9
commit ca0f047f22
4 changed files with 8 additions and 8 deletions

View File

@@ -11,7 +11,7 @@ type NeVersion struct {
PrePath string `json:"prePath" gorm:"pre_path"` // 上一版本软件包
NewVersion string `json:"newVersion" gorm:"new_version"` // 下一版本
NewPath string `json:"newPath" gorm:"new_path"` // 下一版本软件包
Status string `json:"status" gorm:"status"` // 当前状态 (Uploaded下一版本上传 Inactive下一版本待激活 Active当前已激活)
Status string `json:"status" gorm:"status"` // 当前状态 1当前版本 2上一版本 3有新版本 (Uploaded下一版本上传 Inactive下一版本待激活 Active当前已激活)
CreateBy string `json:"createBy" gorm:"column:create_by"` // 创建者
CreateTime int64 `json:"createTime" gorm:"column:create_time"` // 创建时间
UpdateBy string `json:"updateBy" gorm:"column:update_by"` // 更新者

View File

@@ -76,8 +76,8 @@ func (r *NeVersionImpl) SelectPage(query map[string]any) map[string]any {
conditions = append(conditions, "version like concat(?, '%')")
params = append(params, strings.Trim(v.(string), " "))
}
if v, ok := query["filePath"]; ok && v != "" {
conditions = append(conditions, "file_path like concat(?, '%')")
if v, ok := query["path"]; ok && v != "" {
conditions = append(conditions, "path like concat(?, '%')")
params = append(params, strings.Trim(v.(string), " "))
}
@@ -108,7 +108,7 @@ func (r *NeVersionImpl) SelectPage(query map[string]any) map[string]any {
// 分页
pageNum, pageSize := repo.PageNumSize(query["pageNum"], query["pageSize"])
pageSql := " limit ?,? "
pageSql := " order by update_time desc limit ?,? "
params = append(params, pageNum*pageSize)
params = append(params, pageSize)

View File

@@ -22,8 +22,8 @@ type INeVersion interface {
// DeleteByIds 批量删除信息
DeleteByIds(ids []string) (int64, error)
// SelectByTypeAndID 通过网元类型和网元ID查询
SelectByTypeAndID(neType, neId string) model.NeVersion
// SelectByNeTypeAndNeID 通过网元类型和网元ID查询
SelectByNeTypeAndNeID(neType, neId string) model.NeVersion
// CheckUniqueTypeAndID 校验网元类型和网元ID是否唯一
CheckUniqueTypeAndID(neType, neId, id string) bool

View File

@@ -66,8 +66,8 @@ 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 {
// SelectByNeTypeAndNeID 通过网元类型和网元ID查询
func (r *NeVersionImpl) SelectByNeTypeAndNeID(neType, neId string) model.NeVersion {
neVersions := r.neVersionRepository.SelectList(model.NeVersion{
NeType: neType,
NeId: neId,