fix: 导出数据根据查询条件导出Execl

This commit is contained in:
TsMask
2024-08-01 15:01:33 +08:00
parent ae4f040221
commit 8eeb38c59a
10 changed files with 81 additions and 72 deletions

View File

@@ -122,16 +122,19 @@ func (s *SysLogLoginController) Unlock(c *gin.Context) {
func (s *SysLogLoginController) Export(c *gin.Context) {
language := ctx.AcceptLanguage(c)
// 查询结果,根据查询条件结果,单页最大值限制
// querys := ctx.BodyJSONMap(c)
// data := s.sysLogLoginService.SelectSysLogLoginPage(querys)
// if data["total"].(int64) == 0 {
// // 导出数据记录为空
// c.JSON(200, result.ErrMsg(i18n.TKey(language, "app.common.exportEmpty")))
// return
// }
// rows := data["rows"].([]model.SysLogLogin)
querys := ctx.BodyJSONMap(c)
querys["pageNum"] = 1
querys["pageSize"] = 10000
dataScopeSQL := ctx.LoginUserToDataScopeSQL(c, "d", "u")
data := s.sysLogLoginService.SelectSysLogLoginPage(querys, dataScopeSQL)
if parse.Number(data["total"]) == 0 {
// 导出数据记录为空
c.JSON(200, result.ErrMsg(i18n.TKey(language, "app.common.exportEmpty")))
return
}
rows := data["rows"].([]model.SysLogLogin)
rows := s.sysLogLoginService.SelectSysLogLoginList(model.SysLogLogin{})
// rows := s.sysLogLoginService.SelectSysLogLoginList(model.SysLogLogin{})
if len(rows) <= 0 {
// 导出数据记录为空
c.JSON(200, result.ErrMsg(i18n.TKey(language, "app.common.exportEmpty")))