From 289c08dc0ee2754faad956e038be36915ce64565 Mon Sep 17 00:00:00 2001 From: weizhihong Date: Tue, 21 Nov 2023 10:27:12 +0800 Subject: [PATCH] =?UTF-8?q?=E3=80=90=E8=8D=89=E7=A8=BF=E6=9B=B4=E6=96=B0?= =?UTF-8?q?=E6=97=B6=E9=97=B4=E5=80=92=E5=8F=99=E6=8E=92=E5=88=97=E3=80=91?= =?UTF-8?q?=E3=80=90=E7=94=B5=E6=9C=BA=E8=BD=AC=E9=80=9F=E4=BF=A1=E6=81=AF?= =?UTF-8?q?=E6=8A=A5=E9=94=99=E5=A4=84=E7=90=86=E3=80=91?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- service/drafting.go | 4 ++-- third_party/electrical_machinery/electrical_machinery.go | 3 +++ 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/service/drafting.go b/service/drafting.go index f811272..ab1b933 100644 --- a/service/drafting.go +++ b/service/drafting.go @@ -16,7 +16,7 @@ func PageDraftingQuery(query *dto.PageDraftingReqDto) *dto.PageDto { if query.Name != "" { dq = dq.Where(d.Name.Like(fmt.Sprintf("%%%s%%", query.Name))) } - records, total, err := dq.Debug().Omit(d.Proto).FindByPage(query.Offset(), query.Size) + records, total, err := dq.Debug().Omit(d.Proto).Order(d.UpdateAt.Desc()).FindByPage(query.Offset(), query.Size) if err != nil { panic(dto.ErrorDto{Code: dto.QueryDBError, Message: err.Error()}) } @@ -29,7 +29,7 @@ func ListDraftingQuery(query *dto.ListDraftingReqDto) []*model.Drafting { if query.Type != 0 { dq = dq.Where(d.Type.Eq(query.Type)) } - records, err := dq.Debug().Omit(d.Proto).Find() + records, err := dq.Debug().Omit(d.Proto).Order(d.UpdateAt.Desc()).Find() if err != nil { panic(dto.ErrorDto{Code: dto.QueryDBError, Message: err.Error()}) } diff --git a/third_party/electrical_machinery/electrical_machinery.go b/third_party/electrical_machinery/electrical_machinery.go index e72684f..e43eb3b 100644 --- a/third_party/electrical_machinery/electrical_machinery.go +++ b/third_party/electrical_machinery/electrical_machinery.go @@ -54,6 +54,9 @@ func (s *electricalMachineryImpl) Stop() { } func (s *electricalMachineryImpl) SendElectricMachineryMessage(info *message.ElectricMachinery) { + if s.electricalMachineryUdpClient == nil { + return + } s.electricalMachineryUdpClient.Send(info.Encode()) }