fix: 网元版本函数优化
This commit is contained in:
@@ -11,7 +11,7 @@ type NeVersion struct {
|
|||||||
PrePath string `json:"prePath" gorm:"pre_path"` // 上一版本软件包
|
PrePath string `json:"prePath" gorm:"pre_path"` // 上一版本软件包
|
||||||
NewVersion string `json:"newVersion" gorm:"new_version"` // 下一版本
|
NewVersion string `json:"newVersion" gorm:"new_version"` // 下一版本
|
||||||
NewPath string `json:"newPath" gorm:"new_path"` // 下一版本软件包
|
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"` // 创建者
|
CreateBy string `json:"createBy" gorm:"column:create_by"` // 创建者
|
||||||
CreateTime int64 `json:"createTime" gorm:"column:create_time"` // 创建时间
|
CreateTime int64 `json:"createTime" gorm:"column:create_time"` // 创建时间
|
||||||
UpdateBy string `json:"updateBy" gorm:"column:update_by"` // 更新者
|
UpdateBy string `json:"updateBy" gorm:"column:update_by"` // 更新者
|
||||||
|
|||||||
@@ -76,8 +76,8 @@ func (r *NeVersionImpl) SelectPage(query map[string]any) map[string]any {
|
|||||||
conditions = append(conditions, "version like concat(?, '%')")
|
conditions = append(conditions, "version like concat(?, '%')")
|
||||||
params = append(params, strings.Trim(v.(string), " "))
|
params = append(params, strings.Trim(v.(string), " "))
|
||||||
}
|
}
|
||||||
if v, ok := query["filePath"]; ok && v != "" {
|
if v, ok := query["path"]; ok && v != "" {
|
||||||
conditions = append(conditions, "file_path like concat(?, '%')")
|
conditions = append(conditions, "path like concat(?, '%')")
|
||||||
params = append(params, strings.Trim(v.(string), " "))
|
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"])
|
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, pageNum*pageSize)
|
||||||
params = append(params, pageSize)
|
params = append(params, pageSize)
|
||||||
|
|
||||||
|
|||||||
@@ -22,8 +22,8 @@ type INeVersion interface {
|
|||||||
// DeleteByIds 批量删除信息
|
// DeleteByIds 批量删除信息
|
||||||
DeleteByIds(ids []string) (int64, error)
|
DeleteByIds(ids []string) (int64, error)
|
||||||
|
|
||||||
// SelectByTypeAndID 通过网元类型和网元ID查询
|
// SelectByNeTypeAndNeID 通过网元类型和网元ID查询
|
||||||
SelectByTypeAndID(neType, neId string) model.NeVersion
|
SelectByNeTypeAndNeID(neType, neId string) model.NeVersion
|
||||||
|
|
||||||
// CheckUniqueTypeAndID 校验网元类型和网元ID是否唯一
|
// CheckUniqueTypeAndID 校验网元类型和网元ID是否唯一
|
||||||
CheckUniqueTypeAndID(neType, neId, id string) bool
|
CheckUniqueTypeAndID(neType, neId, id string) bool
|
||||||
|
|||||||
@@ -66,8 +66,8 @@ func (r *NeVersionImpl) DeleteByIds(ids []string) (int64, error) {
|
|||||||
return 0, fmt.Errorf("delete fail")
|
return 0, fmt.Errorf("delete fail")
|
||||||
}
|
}
|
||||||
|
|
||||||
// SelectByTypeAndID 通过网元类型和网元ID查询
|
// SelectByNeTypeAndNeID 通过网元类型和网元ID查询
|
||||||
func (r *NeVersionImpl) SelectByTypeAndID(neType, neId string) model.NeVersion {
|
func (r *NeVersionImpl) SelectByNeTypeAndNeID(neType, neId string) model.NeVersion {
|
||||||
neVersions := r.neVersionRepository.SelectList(model.NeVersion{
|
neVersions := r.neVersionRepository.SelectList(model.NeVersion{
|
||||||
NeType: neType,
|
NeType: neType,
|
||||||
NeId: neId,
|
NeId: neId,
|
||||||
|
|||||||
Reference in New Issue
Block a user