Merge remote-tracking branch 'origin/main' into lichang
This commit is contained in:
@@ -17,6 +17,8 @@ const (
|
||||
YYYYMMDDHHMMSS = "20060102150405"
|
||||
// 年-月-日 时:分:秒 列如:2022-12-30 01:01:59
|
||||
YYYY_MM_DD_HH_MM_SS = "2006-01-02 15:04:05"
|
||||
// 年-月-日T时:分:秒Z时区 列如:2022-12-30T01:01:59+08:00
|
||||
YYYY_MM_DDTHH_MM_SSZ = time.RFC3339
|
||||
)
|
||||
|
||||
// 格式时间字符串
|
||||
|
||||
@@ -179,7 +179,7 @@ func (s *SysLogLoginController) Export(c *gin.Context) {
|
||||
"E" + idx: row.OS,
|
||||
"F" + idx: row.Browser,
|
||||
"G" + idx: statusValue,
|
||||
"H" + idx: date.ParseDateToStr(row.LoginTime, date.YYYY_MM_DD_HH_MM_SS),
|
||||
"H" + idx: date.ParseDateToStr(row.LoginTime, date.YYYY_MM_DDTHH_MM_SSZ),
|
||||
"I" + idx: row.Msg,
|
||||
})
|
||||
}
|
||||
|
||||
@@ -190,7 +190,7 @@ func (s *SysLogOperateController) Export(c *gin.Context) {
|
||||
"E" + idx: row.RequestMethod,
|
||||
"F" + idx: row.OperIP,
|
||||
"G" + idx: statusValue,
|
||||
"H" + idx: date.ParseDateToStr(row.OperTime, date.YYYY_MM_DD_HH_MM_SS),
|
||||
"H" + idx: date.ParseDateToStr(row.OperTime, date.YYYY_MM_DDTHH_MM_SSZ),
|
||||
"I" + idx: row.CostTime,
|
||||
})
|
||||
}
|
||||
|
||||
@@ -8,6 +8,7 @@ import (
|
||||
|
||||
"be.ems/src/framework/i18n"
|
||||
"be.ems/src/framework/utils/ctx"
|
||||
"be.ems/src/framework/utils/date"
|
||||
"be.ems/src/framework/utils/file"
|
||||
"be.ems/src/framework/utils/parse"
|
||||
"be.ems/src/framework/vo/result"
|
||||
@@ -210,20 +211,17 @@ func (s *SysPostController) Export(c *gin.Context) {
|
||||
language := ctx.AcceptLanguage(c)
|
||||
// 查询结果,根据查询条件结果,单页最大值限制
|
||||
// querys := ctx.BodyJSONMap(c)
|
||||
// data := s.sysPostService.SelectPostPage(querys)
|
||||
// if data["total"].(int64) == 0 {
|
||||
// // 导出数据记录为空
|
||||
// c.JSON(200, result.ErrMsg(i18n.TKey(language, "app.common.exportEmpty")))
|
||||
// return
|
||||
// }
|
||||
// rows := data["rows"].([]model.SysPost)
|
||||
|
||||
rows := s.sysPostService.SelectPostList(model.SysPost{})
|
||||
if len(rows) <= 0 {
|
||||
querys := map[string]any{
|
||||
"pageNum": 1,
|
||||
"pageSize": 1000,
|
||||
}
|
||||
data := s.sysPostService.SelectPostPage(querys)
|
||||
if data["total"].(int64) == 0 {
|
||||
// 导出数据记录为空
|
||||
c.JSON(200, result.ErrMsg(i18n.TKey(language, "app.common.exportEmpty")))
|
||||
return
|
||||
}
|
||||
rows := data["rows"].([]model.SysPost)
|
||||
|
||||
// 闭包函数处理多语言
|
||||
converI18n := func(language string, arr *[]model.SysPost) {
|
||||
@@ -243,6 +241,7 @@ func (s *SysPostController) Export(c *gin.Context) {
|
||||
"C1": i18n.TKey(language, "post.export.code"),
|
||||
"D1": i18n.TKey(language, "post.export.sort"),
|
||||
"E1": i18n.TKey(language, "post.export.status"),
|
||||
"F1": i18n.TKey(language, "post.export.time"),
|
||||
}
|
||||
// 从第二行开始的数据
|
||||
dataCells := make([]map[string]any, 0)
|
||||
@@ -258,6 +257,7 @@ func (s *SysPostController) Export(c *gin.Context) {
|
||||
"C" + idx: row.PostCode,
|
||||
"D" + idx: row.PostSort,
|
||||
"E" + idx: statusValue,
|
||||
"F" + idx: date.ParseDateToStr(row.CreateTime, date.YYYY_MM_DDTHH_MM_SSZ),
|
||||
})
|
||||
}
|
||||
|
||||
|
||||
@@ -9,6 +9,7 @@ import (
|
||||
"be.ems/src/framework/constants/admin"
|
||||
"be.ems/src/framework/i18n"
|
||||
"be.ems/src/framework/utils/ctx"
|
||||
"be.ems/src/framework/utils/date"
|
||||
"be.ems/src/framework/utils/file"
|
||||
"be.ems/src/framework/utils/parse"
|
||||
"be.ems/src/framework/vo/result"
|
||||
@@ -413,21 +414,18 @@ func (s *SysRoleController) Export(c *gin.Context) {
|
||||
language := ctx.AcceptLanguage(c)
|
||||
// 查询结果,根据查询条件结果,单页最大值限制
|
||||
// querys := ctx.BodyJSONMap(c)
|
||||
querys := map[string]any{
|
||||
"pageNum": 1,
|
||||
"pageSize": 1000,
|
||||
}
|
||||
dataScopeSQL := ctx.LoginUserToDataScopeSQL(c, "d", "")
|
||||
// data := s.sysRoleService.SelectRolePage(querys, dataScopeSQL)
|
||||
// if data["total"].(int64) == 0 {
|
||||
// // 导出数据记录为空
|
||||
// c.JSON(200, result.ErrMsg(i18n.TKey(language, "app.common.exportEmpty")))
|
||||
// return
|
||||
// }
|
||||
// rows := data["rows"].([]model.SysRole)
|
||||
|
||||
rows := s.sysRoleService.SelectRoleList(model.SysRole{}, dataScopeSQL)
|
||||
if len(rows) <= 0 {
|
||||
data := s.sysRoleService.SelectRolePage(querys, dataScopeSQL)
|
||||
if data["total"].(int64) == 0 {
|
||||
// 导出数据记录为空
|
||||
c.JSON(200, result.ErrMsg(i18n.TKey(language, "app.common.exportEmpty")))
|
||||
return
|
||||
}
|
||||
rows := data["rows"].([]model.SysRole)
|
||||
|
||||
// 闭包函数处理多语言
|
||||
converI18n := func(language string, arr *[]model.SysRole) {
|
||||
@@ -447,6 +445,7 @@ func (s *SysRoleController) Export(c *gin.Context) {
|
||||
"C1": i18n.TKey(language, "role.export.key"),
|
||||
"D1": i18n.TKey(language, "role.export.sort"),
|
||||
"E1": i18n.TKey(language, "role.export.status"),
|
||||
"F1": i18n.TKey(language, "role.export.time"),
|
||||
// "F1": i18n.TKey(language, "role.export.dataScope"),
|
||||
}
|
||||
// 读取系统角色数据范围字典数据
|
||||
@@ -474,6 +473,7 @@ func (s *SysRoleController) Export(c *gin.Context) {
|
||||
"C" + idx: row.RoleKey,
|
||||
"D" + idx: row.RoleSort,
|
||||
"E" + idx: statusValue,
|
||||
"F" + idx: date.ParseDateToStr(row.CreateTime, date.YYYY_MM_DDTHH_MM_SSZ),
|
||||
// "F" + idx: dataScope,
|
||||
})
|
||||
}
|
||||
|
||||
@@ -474,21 +474,18 @@ func (s *SysUserController) Export(c *gin.Context) {
|
||||
language := ctx.AcceptLanguage(c)
|
||||
// 查询结果,根据查询条件结果,单页最大值限制
|
||||
// querys := ctx.BodyJSONMap(c)
|
||||
querys := map[string]any{
|
||||
"pageNum": 1,
|
||||
"pageSize": 1000,
|
||||
}
|
||||
dataScopeSQL := ctx.LoginUserToDataScopeSQL(c, "d", "u")
|
||||
// data := s.sysUserService.SelectUserPage(querys, dataScopeSQL)
|
||||
// if data["total"].(int64) == 0 {
|
||||
// // 导出数据记录为空
|
||||
// c.JSON(200, result.ErrMsg(i18n.TKey(language, "app.common.exportEmpty")))
|
||||
// return
|
||||
// }
|
||||
// rows := data["rows"].([]model.SysUser)
|
||||
|
||||
rows := s.sysUserService.SelectUserList(model.SysUser{}, dataScopeSQL)
|
||||
if len(rows) <= 0 {
|
||||
data := s.sysUserService.SelectUserPage(querys, dataScopeSQL)
|
||||
if data["total"].(int64) == 0 {
|
||||
// 导出数据记录为空
|
||||
c.JSON(200, result.ErrMsg(i18n.TKey(language, "app.common.exportEmpty")))
|
||||
return
|
||||
}
|
||||
rows := data["rows"].([]model.SysUser)
|
||||
|
||||
// 闭包函数处理多语言
|
||||
converI18n := func(language string, arr *[]model.SysUser) {
|
||||
@@ -543,9 +540,7 @@ func (s *SysUserController) Export(c *gin.Context) {
|
||||
// 用户角色, 默认导出首个
|
||||
userRole := ""
|
||||
if len(row.Roles) > 0 {
|
||||
roleID := row.Roles[0].RoleID
|
||||
roleName := i18n.TKey(language, row.Roles[0].RoleName)
|
||||
userRole = fmt.Sprintf("%s-%s", roleID, roleName)
|
||||
userRole = i18n.TKey(language, row.Roles[0].RoleName)
|
||||
}
|
||||
dataCells = append(dataCells, map[string]any{
|
||||
"A" + idx: row.UserID,
|
||||
|
||||
Reference in New Issue
Block a user