Skip to content

Commit

Permalink
修改参数配置查询方式
Browse files Browse the repository at this point in the history
  • Loading branch information
singledemon committed Sep 24, 2023
1 parent 2d28ac3 commit ebaa007
Showing 1 changed file with 3 additions and 4 deletions.
7 changes: 3 additions & 4 deletions internal/logic/common/config_data.go
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand Down Expand Up @@ -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, "校验失败")
Expand Down

0 comments on commit ebaa007

Please sign in to comment.