From ebaa007092659f161f312634fd43ed848f111f2b Mon Sep 17 00:00:00 2001 From: maqinglin Date: Sun, 24 Sep 2023 18:54:55 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E5=8F=82=E6=95=B0=E9=85=8D?= =?UTF-8?q?=E7=BD=AE=E6=9F=A5=E8=AF=A2=E6=96=B9=E5=BC=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- internal/logic/common/config_data.go | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/internal/logic/common/config_data.go b/internal/logic/common/config_data.go index 7da4778..d7860bd 100644 --- a/internal/logic/common/config_data.go +++ b/internal/logic/common/config_data.go @@ -44,8 +44,7 @@ func (s *sConfigData) List(ctx context.Context, input *model.ConfigDoInput) (tot m = m.Where(dao.SysConfig.Columns().ModuleClassify, input.ModuleClassify) } if len(input.DateRange) > 0 { - m = m.WhereGTE(dao.SysConfig.Columns().CreatedAt, input.DateRange[0]). - WhereLTE(dao.SysConfig.Columns().CreatedAt, input.DateRange[1]) + m = m.WhereBetween(dao.SysConfig.Columns().CreatedAt, input.DateRange[0], input.DateRange[1]) } } total, err = m.Count() @@ -85,9 +84,9 @@ func (s *sConfigData) Add(ctx context.Context, input *model.AddConfigInput, user func (s *sConfigData) CheckConfigKeyUnique(ctx context.Context, configKey string, configId ...int) (err error) { err = g.Try(ctx, func(ctx context.Context) { data := (*entity.SysConfig)(nil) - m := dao.SysConfig.Ctx(ctx).Fields(dao.SysConfig.Columns().ConfigId).Where(dao.SysConfig.Columns().ConfigKey, configKey) + m := dao.SysConfig.Ctx(ctx).Fields(dao.SysConfig.Columns().ConfigId).Where(dao.SysConfig.Columns().ConfigKey, configKey).Unscoped() if len(configId) > 0 { - m = m.Where(dao.SysConfig.Columns().ConfigId+" != ?", configId[0]) + m = m.WhereNot(dao.SysConfig.Columns().ConfigId, configId[0]) } err = m.Scan(&data) liberr.ErrIsNil(ctx, err, "校验失败")