From 1cfccb4230030f8e75f0b73d44542a4a434dde35 Mon Sep 17 00:00:00 2001 From: Bright1996 <41429222+Bright1996@users.noreply.github.com> Date: Fri, 26 Jan 2024 14:45:27 +0800 Subject: [PATCH] =?UTF-8?q?=E7=94=A8=E6=88=B7=E8=A1=8C=E4=B8=BA=E5=AE=A1?= =?UTF-8?q?=E8=AE=A1=E8=B0=83=E6=95=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/service/log_management.go | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/src/service/log_management.go b/src/service/log_management.go index 8b6013a..d3103f1 100644 --- a/src/service/log_management.go +++ b/src/service/log_management.go @@ -246,7 +246,7 @@ func (s *LogManagement) LogUserAccountAuditList(params *request.LogManagementLis Select(`u.id, u.system_account, u.phone, - u.name, + org.name, u.organization_id, u.last_access_time, case u.pwd_level when 1 then '弱' when 2 then '中' when 3 then '强' end as pwd_level, @@ -255,9 +255,10 @@ func (s *LogManagement) LogUserAccountAuditList(params *request.LogManagementLis u.created_time `) // 条件查询 + modelObj.Where("u.is_deleted = 0") if params.Search != "" { keyword := util.SpecialEscape(params.Search) - modelObj.Where("system_account like ? or phone like ? or NAME like ?", "%"+keyword+"%", "%"+keyword+"%", "%"+keyword+"%") + modelObj.Where("u.system_account like ? or u.phone like ? or org.NAME like ?", "%"+keyword+"%", "%"+keyword+"%", "%"+keyword+"%") } // 上次访问时间 if params.StartAt != "" && params.EndAt != "" { @@ -267,24 +268,24 @@ func (s *LogManagement) LogUserAccountAuditList(params *request.LogManagementLis return nil, 0, resp.DbSelectError.ErrorDetail(timeErr) } EndAt := applyEndTime.AddDate(0, 0, 1).Format(jsontime.LocalDateFormat) - modelObj.Where("last_access_time >= ? and last_access_time < ?", params.StartAt, EndAt) + modelObj.Where("u.last_access_time >= ? and u.last_access_time < ?", params.StartAt, EndAt) } // 活跃度 1: 低 2:中 3: 高 if params.Active != 0 { switch params.Active { case 1: - modelObj.Where("last_access_time <= now()-interval '1 month'") + modelObj.Where("u.last_access_time <= now()-interval '1 month'") case 2: - modelObj.Where("last_access_time < now()-interval '1 week'").And("last_access_time > now()-interval '1 month'") + modelObj.Where("u.last_access_time < now()-interval '1 week'").And("u.last_access_time > now()-interval '1 month'") case 3: - modelObj.Where("last_access_time >= now()-interval '1 week'") + modelObj.Where("u.last_access_time >= now()-interval '1 week'") } } // 密码强度 if params.PwdLevel != 0 { - modelObj.Where("pwd_level = ? ", params.PwdLevel) + modelObj.Where("u.pwd_level = ? ", params.PwdLevel) } - count, err := modelObj.OrderBy("last_access_time desc").Limit(params.GetPageSize(), params.GetOffset()).FindAndCount(&logManagementRep) + count, err := modelObj.OrderBy("u.last_access_time desc").Limit(params.GetPageSize(), params.GetOffset()).FindAndCount(&logManagementRep) if err != nil { conf.Logger.Error("查询用户账户审计列表失败", zap.Error(err)) err = resp.DbSelectError.ErrorDetail(errors.New("查询用户账户审计列表失败")) -- 2.26.0