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

@@ -319,16 +319,18 @@ func (s *SysJobController) ResetQueueJob(c *gin.Context) {
func (s *SysJobController) Export(c *gin.Context) {
language := ctx.AcceptLanguage(c)
// 查询结果,根据查询条件结果,单页最大值限制
// querys := ctx.BodyJSONMap(c)
// data := s.sysJobService.SelectJobPage(querys)
// if data["total"].(int64) == 0 {
// // 导出数据记录为空
// c.JSON(200, result.ErrMsg(i18n.TKey(language, "app.common.exportEmpty")))
// return
// }
// rows := data["rows"].([]model.SysJob)
querys := ctx.BodyJSONMap(c)
querys["pageNum"] = 1
querys["pageSize"] = 10000
data := s.sysJobService.SelectJobPage(querys)
if parse.Number(data["total"]) == 0 {
// 导出数据记录为空
c.JSON(200, result.ErrMsg(i18n.TKey(language, "app.common.exportEmpty")))
return
}
rows := data["rows"].([]model.SysJob)
rows := s.sysJobService.SelectJobList(model.SysJob{})
// rows := s.sysJobService.SelectJobList(model.SysJob{})
if len(rows) <= 0 {
// 导出数据记录为空
c.JSON(200, result.ErrMsg(i18n.TKey(language, "app.common.exportEmpty")))

View File

@@ -131,15 +131,18 @@ func (s *SysJobLogController) Clean(c *gin.Context) {
func (s *SysJobLogController) Export(c *gin.Context) {
language := ctx.AcceptLanguage(c)
// 查询结果,根据查询条件结果,单页最大值限制
// querys := ctx.BodyJSONMap(c)
// data := s.sysJobLogService.SelectJobLogPage(querys)
// if data["total"].(int64) == 0 {
// c.JSON(200, result.ErrMsg("Export data record is empty"))
// return
// }
// rows := data["rows"].([]model.SysJobLog)
querys := ctx.BodyJSONMap(c)
querys["pageNum"] = 1
querys["pageSize"] = 10000
data := s.sysJobLogService.SelectJobLogPage(querys)
if parse.Number(data["total"]) == 0 {
// 导出数据记录为空
c.JSON(200, result.ErrMsg(i18n.TKey(language, "app.common.exportEmpty")))
return
}
rows := data["rows"].([]model.SysJobLog)
rows := s.sysJobLogService.SelectJobLogList(model.SysJobLog{})
// rows := s.sysJobLogService.SelectJobLogList(model.SysJobLog{})
if len(rows) <= 0 {
// 导出数据记录为空
c.JSON(200, result.ErrMsg(i18n.TKey(language, "app.common.exportEmpty")))

View File

@@ -228,7 +228,7 @@ func (s *SysConfigController) Export(c *gin.Context) {
// 查询结果,根据查询条件结果,单页最大值限制
querys := ctx.BodyJSONMap(c)
querys["pageNum"] = 1
querys["pageSize"] = 1000
querys["pageSize"] = 10000
data := s.sysConfigService.SelectConfigPage(querys)
if parse.Number(data["total"]) == 0 {
// 导出数据记录为空

View File

@@ -241,16 +241,18 @@ func (s *SysDictDataController) DictType(c *gin.Context) {
func (s *SysDictDataController) Export(c *gin.Context) {
language := ctx.AcceptLanguage(c)
// 查询结果,根据查询条件结果,单页最大值限制
// querys := ctx.BodyJSONMap(c)
// data := s.sysDictDataService.SelectDictDataPage(querys)
// if data["total"].(int64) == 0 {
// // 导出数据记录为空
// c.JSON(200, result.ErrMsg(i18n.TKey(language, "app.common.exportEmpty")))
// return
// }
// rows := data["rows"].([]model.SysDictData)
querys := ctx.BodyJSONMap(c)
querys["pageNum"] = 1
querys["pageSize"] = 10000
data := s.sysDictDataService.SelectDictDataPage(querys)
if parse.Number(data["total"]) == 0 {
// 导出数据记录为空
c.JSON(200, result.ErrMsg(i18n.TKey(language, "app.common.exportEmpty")))
return
}
rows := data["rows"].([]model.SysDictData)
rows := s.sysDictDataService.SelectDictDataList(model.SysDictData{})
// rows := s.sysDictDataService.SelectDictDataList(model.SysDictData{})
if len(rows) <= 0 {
// 导出数据记录为空
c.JSON(200, result.ErrMsg(i18n.TKey(language, "app.common.exportEmpty")))

View File

@@ -244,16 +244,18 @@ func (s *SysDictTypeController) DictOptionselect(c *gin.Context) {
func (s *SysDictTypeController) Export(c *gin.Context) {
language := ctx.AcceptLanguage(c)
// 查询结果,根据查询条件结果,单页最大值限制
// querys := ctx.BodyJSONMap(c)
// data := s.sysDictTypeService.SelectDictTypePage(querys)
// if data["total"].(int64) == 0 {
// // 导出数据记录为空
// c.JSON(200, result.ErrMsg(i18n.TKey(language, "app.common.exportEmpty")))
// return
// }
// rows := data["rows"].([]model.SysDictType)
querys := ctx.BodyJSONMap(c)
querys["pageNum"] = 1
querys["pageSize"] = 10000
data := s.sysDictTypeService.SelectDictTypePage(querys)
if parse.Number(data["total"]) == 0 {
// 导出数据记录为空
c.JSON(200, result.ErrMsg(i18n.TKey(language, "app.common.exportEmpty")))
return
}
rows := data["rows"].([]model.SysDictType)
rows := s.sysDictTypeService.SelectDictTypeList(model.SysDictType{})
// rows := s.sysDictTypeService.SelectDictTypeList(model.SysDictType{})
if len(rows) <= 0 {
// 导出数据记录为空
c.JSON(200, result.ErrMsg(i18n.TKey(language, "app.common.exportEmpty")))

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")))

View File

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

View File

@@ -210,13 +210,11 @@ func (s *SysPostController) Remove(c *gin.Context) {
func (s *SysPostController) Export(c *gin.Context) {
language := ctx.AcceptLanguage(c)
// 查询结果,根据查询条件结果,单页最大值限制
// querys := ctx.BodyJSONMap(c)
querys := map[string]any{
"pageNum": 1,
"pageSize": 1000,
}
querys := ctx.BodyJSONMap(c)
querys["pageNum"] = 1
querys["pageSize"] = 10000
data := s.sysPostService.SelectPostPage(querys)
if data["total"].(int64) == 0 {
if parse.Number(data["total"]) == 0 {
// 导出数据记录为空
c.JSON(200, result.ErrMsg(i18n.TKey(language, "app.common.exportEmpty")))
return

View File

@@ -413,14 +413,12 @@ func (s *SysRoleController) AuthUserChecked(c *gin.Context) {
func (s *SysRoleController) Export(c *gin.Context) {
language := ctx.AcceptLanguage(c)
// 查询结果,根据查询条件结果,单页最大值限制
// querys := ctx.BodyJSONMap(c)
querys := map[string]any{
"pageNum": 1,
"pageSize": 1000,
}
querys := ctx.BodyJSONMap(c)
querys["pageNum"] = 1
querys["pageSize"] = 10000
dataScopeSQL := ctx.LoginUserToDataScopeSQL(c, "d", "")
data := s.sysRoleService.SelectRolePage(querys, dataScopeSQL)
if data["total"].(int64) == 0 {
if parse.Number(data["total"]) == 0 {
// 导出数据记录为空
c.JSON(200, result.ErrMsg(i18n.TKey(language, "app.common.exportEmpty")))
return

View File

@@ -473,14 +473,12 @@ func (s *SysUserController) Status(c *gin.Context) {
func (s *SysUserController) Export(c *gin.Context) {
language := ctx.AcceptLanguage(c)
// 查询结果,根据查询条件结果,单页最大值限制
// querys := ctx.BodyJSONMap(c)
querys := map[string]any{
"pageNum": 1,
"pageSize": 1000,
}
querys := ctx.BodyJSONMap(c)
querys["pageNum"] = 1
querys["pageSize"] = 10000
dataScopeSQL := ctx.LoginUserToDataScopeSQL(c, "d", "u")
data := s.sysUserService.SelectUserPage(querys, dataScopeSQL)
if data["total"].(int64) == 0 {
if parse.Number(data["total"]) == 0 {
// 导出数据记录为空
c.JSON(200, result.ErrMsg(i18n.TKey(language, "app.common.exportEmpty")))
return