feat 导出查询去除最大记录数限制,查询分页检查
This commit is contained in:
@@ -29,20 +29,10 @@ func (r SysLogLogin) SelectByPage(query map[string]string, dataScopeSQL string)
|
||||
tx = tx.Where("status_flag = ?", v)
|
||||
}
|
||||
if v, ok := query["beginTime"]; ok && v != "" {
|
||||
if len(v) == 10 {
|
||||
v = fmt.Sprintf("%s000", v)
|
||||
tx = tx.Where("login_time >= ?", v)
|
||||
} else if len(v) == 13 {
|
||||
tx = tx.Where("login_time >= ?", v)
|
||||
}
|
||||
tx = tx.Where("login_time >= ?", v)
|
||||
}
|
||||
if v, ok := query["endTime"]; ok && v != "" {
|
||||
if len(v) == 10 {
|
||||
v = fmt.Sprintf("%s999", v)
|
||||
tx = tx.Where("login_time <= ?", v)
|
||||
} else if len(v) == 13 {
|
||||
tx = tx.Where("login_time <= ?", v)
|
||||
}
|
||||
tx = tx.Where("login_time <= ?", v)
|
||||
}
|
||||
if dataScopeSQL != "" {
|
||||
dataScopeSQL = fmt.Sprintf("select distinct user_name from sys_user where %s", dataScopeSQL)
|
||||
@@ -59,8 +49,11 @@ func (r SysLogLogin) SelectByPage(query map[string]string, dataScopeSQL string)
|
||||
}
|
||||
|
||||
// 查询数据分页
|
||||
pageNum, pageSize := db.PageNumSize(query["pageNum"], query["pageSize"])
|
||||
tx = tx.Limit(pageSize).Offset(pageSize * pageNum)
|
||||
if query["pageNum"] != "" && query["pageSize"] != "" {
|
||||
pageNum, pageSize := db.PageNumSize(query["pageNum"], query["pageSize"])
|
||||
tx = tx.Limit(pageSize).Offset(pageSize * pageNum)
|
||||
}
|
||||
|
||||
err := tx.Order("id desc").Find(&rows).Error
|
||||
if err != nil {
|
||||
logger.Errorf("query find err => %v", err.Error())
|
||||
|
||||
@@ -35,20 +35,10 @@ func (r SysLogOperate) SelectByPage(query map[string]string, dataScopeSQL string
|
||||
tx = tx.Where("status_flag = ?", v)
|
||||
}
|
||||
if v, ok := query["beginTime"]; ok && v != "" {
|
||||
if len(v) == 10 {
|
||||
v = fmt.Sprintf("%s000", v)
|
||||
tx = tx.Where("opera_time >= ?", v)
|
||||
} else if len(v) == 13 {
|
||||
tx = tx.Where("opera_time >= ?", v)
|
||||
}
|
||||
tx = tx.Where("opera_time <= ?", v)
|
||||
}
|
||||
if v, ok := query["endTime"]; ok && v != "" {
|
||||
if len(v) == 10 {
|
||||
v = fmt.Sprintf("%s999", v)
|
||||
tx = tx.Where("opera_time <= ?", v)
|
||||
} else if len(v) == 13 {
|
||||
tx = tx.Where("opera_time <= ?", v)
|
||||
}
|
||||
tx = tx.Where("opera_time <= ?", v)
|
||||
}
|
||||
if dataScopeSQL != "" {
|
||||
dataScopeSQL = fmt.Sprintf("select distinct user_name from sys_user where %s", dataScopeSQL)
|
||||
@@ -65,8 +55,11 @@ func (r SysLogOperate) SelectByPage(query map[string]string, dataScopeSQL string
|
||||
}
|
||||
|
||||
// 查询数据分页
|
||||
pageNum, pageSize := db.PageNumSize(query["pageNum"], query["pageSize"])
|
||||
tx = tx.Limit(pageSize).Offset(pageSize * pageNum)
|
||||
if query["pageNum"] != "" && query["pageSize"] != "" {
|
||||
pageNum, pageSize := db.PageNumSize(query["pageNum"], query["pageSize"])
|
||||
tx = tx.Limit(pageSize).Offset(pageSize * pageNum)
|
||||
}
|
||||
|
||||
err := tx.Order("id desc").Find(&rows).Error
|
||||
if err != nil {
|
||||
logger.Errorf("query find err => %v", err.Error())
|
||||
|
||||
Reference in New Issue
Block a user