From 63860e1e82a20e46c29c5d53cda0afbe954b77ca Mon Sep 17 00:00:00 2001 From: yangping Date: Thu, 9 Dec 2021 16:25:50 +0800 Subject: [PATCH] =?UTF-8?q?fixed(*):=20=20err=20=20=E6=B2=A1=E6=9C=89?= =?UTF-8?q?=E6=AD=A3=E7=A1=AE=E8=BF=94=E5=9B=9E=20optimize(sys=5Fdept.go):?= =?UTF-8?q?=20=20nil=20=E6=B1=82=20len=20=E4=B8=BA=200=20=E4=B8=8D?= =?UTF-8?q?=E9=9C=80=E5=81=9A=E9=9D=9E=E7=A9=BA=E5=88=A4=E6=96=AD=20optimi?= =?UTF-8?q?ze(tools=5Fgen=5Ftable.go):=20=E5=8C=85=E5=88=86=E7=B1=BB?= =?UTF-8?q?=E6=95=B4=E7=90=86=EF=BC=8C=E4=BB=A3=E7=A0=81=E6=B8=85=E6=99=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/system/service/sys_dept.go | 2 +- app/system/service/sys_dict_type.go | 3 ++- app/system/service/tools_gen_table.go | 7 ++++--- 3 files changed, 7 insertions(+), 5 deletions(-) diff --git a/app/system/service/sys_dept.go b/app/system/service/sys_dept.go index 61ba8a2..e697bf9 100644 --- a/app/system/service/sys_dept.go +++ b/app/system/service/sys_dept.go @@ -68,7 +68,7 @@ func (s *dept) GetDeptListTree(pid int64, list []*model.SysDept) []*dao.SysDeptT SysDept: v, } child := s.GetDeptListTree(v.DeptId, list) - if child != nil && len(child) > 0 { + if len(child) > 0 { t.Children = child } tree = append(tree, t) diff --git a/app/system/service/sys_dict_type.go b/app/system/service/sys_dict_type.go index b8fdcdb..8835dc6 100644 --- a/app/system/service/sys_dict_type.go +++ b/app/system/service/sys_dict_type.go @@ -7,6 +7,7 @@ import ( comService "gfast/app/common/service" "gfast/app/system/dao" "gfast/app/system/model" + "github.com/gogf/gf/container/garray" "github.com/gogf/gf/database/gdb" "github.com/gogf/gf/errors/gerror" @@ -101,7 +102,7 @@ func (s *sysDictType) Edit(ctx context.Context, req *model.SysDictTypeEditReq) e //修改字段数据的类型 _, err = dao.SysDictData.TX(tx).Data(g.Map{dao.SysDictData.Columns.DictType: req.DictType}). Where(dao.SysDictData.Columns.DictType, dt.DictType).Update() - return nil + return err }) if err != nil { g.Log().Debug(err) diff --git a/app/system/service/tools_gen_table.go b/app/system/service/tools_gen_table.go index bc871a0..2c7a13d 100644 --- a/app/system/service/tools_gen_table.go +++ b/app/system/service/tools_gen_table.go @@ -17,6 +17,10 @@ import ( comService "gfast/app/common/service" "gfast/app/system/dao" "gfast/app/system/model" + "io" + "os" + "strings" + "github.com/gogf/gf/database/gdb" "github.com/gogf/gf/encoding/gjson" "github.com/gogf/gf/errors/gerror" @@ -27,9 +31,6 @@ import ( "github.com/gogf/gf/text/gregex" "github.com/gogf/gf/text/gstr" "github.com/gogf/gf/util/gconv" - "io" - "os" - "strings" ) type toolsGenTable struct{}