作者 tangxuhui

添加 选择列导出

  1 +package query
  2 +
  3 +type ExcelDataFieldsQuery struct {
  4 + //操作人
  5 + // 业务编码
  6 + Code string `form:"code"`
  7 +}
@@ -7,6 +7,7 @@ import ( @@ -7,6 +7,7 @@ import (
7 "github.com/linmadan/egglib-go/core/application" 7 "github.com/linmadan/egglib-go/core/application"
8 "github.com/linmadan/egglib-go/utils/excel" 8 "github.com/linmadan/egglib-go/utils/excel"
9 "gitlab.fjmaimaimai.com/allied-creation/allied-creation-gateway/pkg/application/web/excelData/command" 9 "gitlab.fjmaimaimai.com/allied-creation/allied-creation-gateway/pkg/application/web/excelData/command"
  10 + "gitlab.fjmaimaimai.com/allied-creation/allied-creation-gateway/pkg/application/web/excelData/query"
10 "gitlab.fjmaimaimai.com/allied-creation/allied-creation-gateway/pkg/domain" 11 "gitlab.fjmaimaimai.com/allied-creation/allied-creation-gateway/pkg/domain"
11 "gitlab.fjmaimaimai.com/allied-creation/allied-creation-gateway/pkg/infrastructure/domainService" 12 "gitlab.fjmaimaimai.com/allied-creation/allied-creation-gateway/pkg/infrastructure/domainService"
12 "gitlab.fjmaimaimai.com/allied-creation/allied-creation-gateway/pkg/infrastructure/service_gateway/allied_creation_user" 13 "gitlab.fjmaimaimai.com/allied-creation/allied-creation-gateway/pkg/infrastructure/service_gateway/allied_creation_user"
@@ -217,9 +218,9 @@ func (srv ExcelDataService) FileImportTemplate(importDataCommand *command.Import @@ -217,9 +218,9 @@ func (srv ExcelDataService) FileImportTemplate(importDataCommand *command.Import
217 }, nil 218 }, nil
218 } 219 }
219 220
220 -func (srv ExcelDataService) GetExcelDataFields(code string) (interface{}, error) { 221 +func (srv ExcelDataService) GetExcelDataFields(param *query.ExcelDataFieldsQuery) (interface{}, error) {
221 dataFileds := []DataFieldOptions{} 222 dataFileds := []DataFieldOptions{}
222 - switch code { 223 + switch param.Code {
223 case domain.ExportCompanyUser: 224 case domain.ExportCompanyUser:
224 dataFileds = (ExportCompanyUserData{}).AllFields() 225 dataFileds = (ExportCompanyUserData{}).AllFields()
225 case domain.ExportCooperationUser: 226 case domain.ExportCooperationUser:
@@ -291,5 +291,8 @@ func (controller *ExcelDataController) ExportCooperationUser() { @@ -291,5 +291,8 @@ func (controller *ExcelDataController) ExportCooperationUser() {
291 291
292 //GetExcelDataFields 获取导出excel数据的可选字段 292 //GetExcelDataFields 获取导出excel数据的可选字段
293 func (controller *ExcelDataController) GetExcelDataFields() { 293 func (controller *ExcelDataController) GetExcelDataFields() {
294 - 294 + code := controller.GetString(":code")
  295 + var excelService = service.NewExcelDataService(nil)
  296 + data, _ := excelService.GetExcelDataFields(&query.ExcelDataFieldsQuery{Code: code})
  297 + controller.Response(data, nil)
295 } 298 }
@@ -15,4 +15,7 @@ func init() { @@ -15,4 +15,7 @@ func init() {
15 web.Router("/v1/web/file-import", &web_client.ExcelDataController{}, "Post:FileImport") 15 web.Router("/v1/web/file-import", &web_client.ExcelDataController{}, "Post:FileImport")
16 web.Router("/v1/web/file-export", &web_client.ExcelDataController{}, "Post:FileExport") 16 web.Router("/v1/web/file-export", &web_client.ExcelDataController{}, "Post:FileExport")
17 web.Router("/v1/web/file-import-template/:code", &web_client.ExcelDataController{}, "Get:FileImportTemplate") 17 web.Router("/v1/web/file-import-template/:code", &web_client.ExcelDataController{}, "Get:FileImportTemplate")
  18 +
  19 + web.Router("/v1/web/file-export/fields/:code", &web_client.ExcelDataController{}, "Get:GetExcelDataFields")
  20 +
18 } 21 }