fix: 系统数据导出格式优化
This commit is contained in:
Binary file not shown.
@@ -653,5 +653,8 @@ INSERT INTO `sys_dict_data` VALUES (2126, 2126, 'ne_license_status.1', '有效',
|
||||
INSERT INTO `sys_dict_data` VALUES (2127, 2127, 'menu.dashboard.mocn', 'MOCN', 'i18n_zh', '', '', '1', 'supervisor', 1705550000000, '', 0, '');
|
||||
INSERT INTO `sys_dict_data` VALUES (2128, 2128, 'menu.monitor.cdr', '话单', 'i18n_zh', '', '', '1', 'supervisor', 1705550000000, '', 0, '');
|
||||
INSERT INTO `sys_dict_data` VALUES (2129, 2129, 'menu.monitor.event', '事件', 'i18n_zh', '', '', '1', 'supervisor', 1705550000000, '', 0, '');
|
||||
INSERT INTO `sys_dict_data` VALUES (2130, 2130, 'post.export.time', '创建时间', 'i18n_zh', '', '', '1', 'supervisor', 1705550000000, '', 0, '');
|
||||
INSERT INTO `sys_dict_data` VALUES (2131, 2131, 'role.export.time', '创建时间', 'i18n_zh', '', '', '1', 'supervisor', 1705550000000, '', 0, '');
|
||||
|
||||
|
||||
SET FOREIGN_KEY_CHECKS = 1;
|
||||
|
||||
@@ -653,5 +653,7 @@ INSERT INTO `sys_dict_data` VALUES (4126, 4126, 'ne_license_status.1', 'Valid',
|
||||
INSERT INTO `sys_dict_data` VALUES (4127, 4127, 'menu.dashboard.mocn', 'MOCN', 'i18n_en', '', '', '1', 'supervisor', 1705550000000, '', 0, '');
|
||||
INSERT INTO `sys_dict_data` VALUES (4128, 4128, 'menu.monitor.cdr', 'CDR', 'i18n_en', '', '', '1', 'supervisor', 1705550000000, '', 0, '');
|
||||
INSERT INTO `sys_dict_data` VALUES (4129, 4129, 'menu.monitor.event', 'Event', 'i18n_en', '', '', '1', 'supervisor', 1705550000000, '', 0, '');
|
||||
INSERT INTO `sys_dict_data` VALUES (4130, 4130, 'post.export.time', 'Creation Time', 'i18n_en', '', '', '1', 'supervisor', 1705550000000, '', 0, '');
|
||||
INSERT INTO `sys_dict_data` VALUES (4131, 4131, 'role.export.time', 'Creation Time', 'i18n_en', '', '', '1', 'supervisor', 1705550000000, '', 0, '');
|
||||
|
||||
SET FOREIGN_KEY_CHECKS = 1;
|
||||
|
||||
@@ -650,5 +650,7 @@ REPLACE INTO `sys_dict_data` VALUES (2126, 2126, 'ne_license_status.1', '有效'
|
||||
REPLACE INTO `sys_dict_data` VALUES (2127, 2127, 'menu.dashboard.mocn', 'MOCN', 'i18n_zh', '', '', '1', 'supervisor', 1705550000000, '', 0, '');
|
||||
REPLACE INTO `sys_dict_data` VALUES (2128, 2128, 'menu.monitor.cdr', '话单', 'i18n_zh', '', '', '1', 'supervisor', 1705550000000, '', 0, '');
|
||||
REPLACE INTO `sys_dict_data` VALUES (2129, 2129, 'menu.monitor.event', '事件', 'i18n_zh', '', '', '1', 'supervisor', 1705550000000, '', 0, '');
|
||||
REPLACE INTO `sys_dict_data` VALUES (2130, 2130, 'post.export.time', '创建时间', 'i18n_zh', '', '', '1', 'supervisor', 1705550000000, '', 0, '');
|
||||
REPLACE INTO `sys_dict_data` VALUES (2131, 2131, 'role.export.time', '创建时间', 'i18n_zh', '', '', '1', 'supervisor', 1705550000000, '', 0, '');
|
||||
|
||||
SET FOREIGN_KEY_CHECKS = 1;
|
||||
|
||||
@@ -651,5 +651,7 @@ REPLACE INTO `sys_dict_data` VALUES (4126, 4126, 'ne_license_status.1', 'Valid',
|
||||
REPLACE INTO `sys_dict_data` VALUES (4127, 4127, 'menu.dashboard.mocn', 'MOCN', 'i18n_en', '', '', '1', 'supervisor', 1705550000000, '', 0, '');
|
||||
REPLACE INTO `sys_dict_data` VALUES (4128, 4128, 'menu.monitor.cdr', 'CDR', 'i18n_en', '', '', '1', 'supervisor', 1705550000000, '', 0, '');
|
||||
REPLACE INTO `sys_dict_data` VALUES (4129, 4129, 'menu.monitor.event', 'Event', 'i18n_en', '', '', '1', 'supervisor', 1705550000000, '', 0, '');
|
||||
REPLACE INTO `sys_dict_data` VALUES (4130, 4130, 'post.export.time', 'Creation Time', 'i18n_en', '', '', '1', 'supervisor', 1705550000000, '', 0, '');
|
||||
REPLACE INTO `sys_dict_data` VALUES (4131, 4131, 'role.export.time', 'Creation Time', 'i18n_en', '', '', '1', 'supervisor', 1705550000000, '', 0, '');
|
||||
|
||||
SET FOREIGN_KEY_CHECKS = 1;
|
||||
|
||||
@@ -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