From 49438f83efb7c0d3d978b42962c312870d4fca02 Mon Sep 17 00:00:00 2001 From: louwenzhi Date: Thu, 23 Dec 2021 19:07:18 +0800 Subject: [PATCH] =?UTF-8?q?=E5=A4=9A=E7=89=88=E6=9C=AC=E6=AF=94=E8=BE=83?= =?UTF-8?q?=E6=8E=92=E5=BA=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- dao/ap/implments/CustDemandVerDetail.dao.impl.go | 2 +- models/ap/ap.go | 3 +-- .../implments/CustDemandVerHead.service.impl.go | 15 +++------------ 3 files changed, 5 insertions(+), 15 deletions(-) diff --git a/dao/ap/implments/CustDemandVerDetail.dao.impl.go b/dao/ap/implments/CustDemandVerDetail.dao.impl.go index 98ad122..9a60873 100644 --- a/dao/ap/implments/CustDemandVerDetail.dao.impl.go +++ b/dao/ap/implments/CustDemandVerDetail.dao.impl.go @@ -350,7 +350,7 @@ func (impl *CustDemandVerDetailDAOImplement) SelectWeeks(customerId string, vers if !utils.ValueIsEmpty(nowDate) { session = session.And("DemandDate >= ? ", nowDate) } - session = session.Asc("DemandWeek") + session = session.Asc("DemandYear","DemandWeek") data := make([]model.CustDemandVerDetail, 0) err := session.Find(&data) if err != nil { diff --git a/models/ap/ap.go b/models/ap/ap.go index 09b5f70..e61ff50 100644 --- a/models/ap/ap.go +++ b/models/ap/ap.go @@ -2,7 +2,6 @@ package ap import ( "leit.com/LAPP_CHEERSSON_BACKEND/grmi" - "leit.com/LAPP_CHEERSSON_BACKEND/utils" ) // ResourceSpecialDayInsert 资源特殊工作日前端传入结构体 @@ -123,7 +122,7 @@ func (item CustomerDetailItem) Compare(iData interface{}) int { if !ok { return -2 } - if utils.ValueToInt(item.VersionId, 0) > utils.ValueToInt(data.VersionId, 0) { + if item.PlanReleaseTime > data.PlanReleaseTime { return 1 } else { return -1 diff --git a/services/ap/implments/CustDemandVerHead.service.impl.go b/services/ap/implments/CustDemandVerHead.service.impl.go index c467a22..23491ae 100644 --- a/services/ap/implments/CustDemandVerHead.service.impl.go +++ b/services/ap/implments/CustDemandVerHead.service.impl.go @@ -1787,7 +1787,7 @@ func (impl *CustDemandVerHeadServiceImplement) CompareVersion(user *global.User, } items := make([]map[string]int, 0) //排序 - sort.Strings(allWeeks) + //sort.Strings(allWeeks) for _, vvv := range allWeeks { item := make(map[string]int) key := vvv @@ -1800,19 +1800,10 @@ func (impl *CustDemandVerHeadServiceImplement) CompareVersion(user *global.User, items = append(items, item) } one.Item = items + one.SortKeys = allWeeks data = append(data, one) } - //排序 - li := make([]model.ICompare, 0, len(data)) - for _, value := range data { - li = append(li, value) - } - li = model.BubbleSort(li) - result := make([]model.CustomerDetailItem, 0, len(li)) - for _, data := range li { - result = append(result, data.(model.CustomerDetailItem)) - } - return result, nil + return data, nil } /******************************************************************************