2
This commit is contained in:
@@ -87,7 +87,7 @@ type Querier interface {
|
||||
ListSysUser(ctx context.Context) ([]*SysUser, error)
|
||||
ListSysUserByIds(ctx context.Context, dollar_1 []int32) ([]*SysUser, error)
|
||||
ListSysUserCondition(ctx context.Context, arg *ListSysUserConditionParams) ([]*ListSysUserConditionRow, error)
|
||||
ListSysUserLoginLogCondition(ctx context.Context, arg *ListSysUserLoginLogConditionParams) ([]*SysUserLoginLog, error)
|
||||
ListSysUserLoginLogCondition(ctx context.Context, arg *ListSysUserLoginLogConditionParams) ([]*ListSysUserLoginLogConditionRow, error)
|
||||
RecursiveSysMenus(ctx context.Context) ([]*RecursiveSysMenusRow, error)
|
||||
RecursiveSysMenusByRoleID(ctx context.Context, roleID int32) ([]*RecursiveSysMenusByRoleIDRow, error)
|
||||
StatisticsExpense(ctx context.Context) ([]*StatisticsExpenseRow, error)
|
||||
|
||||
@@ -85,8 +85,21 @@ func (q *Queries) CreateSysUserLoginLog(ctx context.Context, arg *CreateSysUserL
|
||||
}
|
||||
|
||||
const listSysUserLoginLogCondition = `-- name: ListSysUserLoginLogCondition :many
|
||||
SELECT id, created_at, email, username, user_uuid, is_success, message, referer_url, url, os, ip, browser FROM sys_user_login_log
|
||||
WHERE created_at BETWEEN $1 AND $2
|
||||
SELECT
|
||||
id,
|
||||
created_at,
|
||||
email,
|
||||
COALESCE((SELECT username FROM sys_user WHERE email = sys_user_login_log.email LIMIT 1), '') AS username,
|
||||
user_uuid,
|
||||
is_success,
|
||||
message,
|
||||
referer_url,
|
||||
url,
|
||||
os,
|
||||
ip,
|
||||
browser
|
||||
FROM sys_user_login_log
|
||||
WHERE sys_user_login_log.created_at BETWEEN $1 AND $2
|
||||
AND ($3::text = '' OR email ILIKE '%' || $3 || '%')
|
||||
AND ($4::text = '' OR username ILIKE '%' || $4 || '%')
|
||||
ORDER BY created_at DESC
|
||||
@@ -103,7 +116,22 @@ type ListSysUserLoginLogConditionParams struct {
|
||||
Size int32 `json:"size"`
|
||||
}
|
||||
|
||||
func (q *Queries) ListSysUserLoginLogCondition(ctx context.Context, arg *ListSysUserLoginLogConditionParams) ([]*SysUserLoginLog, error) {
|
||||
type ListSysUserLoginLogConditionRow struct {
|
||||
ID int64 `json:"id"`
|
||||
CreatedAt time.Time `json:"created_at"`
|
||||
Email string `json:"email"`
|
||||
Username interface{} `json:"username"`
|
||||
UserUuid uuid.UUID `json:"user_uuid"`
|
||||
IsSuccess bool `json:"is_success"`
|
||||
Message string `json:"message"`
|
||||
RefererUrl string `json:"referer_url"`
|
||||
Url string `json:"url"`
|
||||
Os string `json:"os"`
|
||||
Ip string `json:"ip"`
|
||||
Browser string `json:"browser"`
|
||||
}
|
||||
|
||||
func (q *Queries) ListSysUserLoginLogCondition(ctx context.Context, arg *ListSysUserLoginLogConditionParams) ([]*ListSysUserLoginLogConditionRow, error) {
|
||||
rows, err := q.db.Query(ctx, listSysUserLoginLogCondition,
|
||||
arg.StartAt,
|
||||
arg.EndAt,
|
||||
@@ -116,9 +144,9 @@ func (q *Queries) ListSysUserLoginLogCondition(ctx context.Context, arg *ListSys
|
||||
return nil, err
|
||||
}
|
||||
defer rows.Close()
|
||||
items := []*SysUserLoginLog{}
|
||||
items := []*ListSysUserLoginLogConditionRow{}
|
||||
for rows.Next() {
|
||||
var i SysUserLoginLog
|
||||
var i ListSysUserLoginLogConditionRow
|
||||
if err := rows.Scan(
|
||||
&i.ID,
|
||||
&i.CreatedAt,
|
||||
|
||||
Reference in New Issue
Block a user