浏览代码

Merge branch 'hotfix/v1.0.22.2' into feature/v1.0.23

* hotfix/v1.0.22.2:
  xg
  xg
  xg
  xg
  xg
  xg
  xg

# Conflicts:
#	rpc/biservice.go
#	rpc/pb/biService.pb.go
Jianghan 1 年之前
父节点
当前提交
2b1467917a

+ 6 - 6
api/biService.api

@@ -101,12 +101,12 @@ type (
 		CompanyName string `json:"companyName"`
 	}
 	ExportByDbReq {
-		Token   string `json:"token"`
-		Title   string `json:"title"`
-		Content string `json:"content"`
-		Mails   string `json:"mails"`
-		Query   string `json:"query"`
-		Stype   string `json:"stype"`
+		Token    string                   `json:"token"`
+		Title    string                   `json:"title"`
+		Content  string                   `json:"content"`
+		Mails    string                   `json:"mails"`
+		FileName string                   `json:"filename"`
+		Datas    []map[string]interface{} `json:"datas"`
 	}
 	UpFileReq {
 		AppId      string `header:"appId,default=10000"`

+ 16 - 6
api/internal/logic/sendmaillogic.go

@@ -3,6 +3,7 @@ package logic
 import (
 	"bp.jydev.jianyu360.cn/BaseService/biService/rpc/biservice"
 	"context"
+	"github.com/gogf/gf/v2/util/gconv"
 
 	"bp.jydev.jianyu360.cn/BaseService/biService/api/internal/svc"
 	"bp.jydev.jianyu360.cn/BaseService/biService/api/internal/types"
@@ -25,13 +26,22 @@ func NewSendMailLogic(ctx context.Context, svcCtx *svc.ServiceContext) *SendMail
 }
 
 func (l *SendMailLogic) SendMail(req *types.ExportByDbReq) (resp *types.BiResp, err error) {
+	logx.Info(resp)
+	datas := []*biservice.FilesData{}
+	for _, v := range req.Datas {
+		data := &biservice.FilesData{
+			SheetName: gconv.String(v["sheetName"]),
+			Sql:       gconv.String(v["sql"]),
+		}
+		datas = append(datas, data)
+	}
 	res, err := l.svcCtx.BiServiceRpc.SendMail(l.ctx, &biservice.ExportByDbReq{
-		Token:   req.Token,
-		Title:   req.Title,
-		Content: req.Content,
-		Mails:   req.Mails,
-		Query:   req.Query,
-		Stype:   req.Stype,
+		Token:    req.Token,
+		Title:    req.Title,
+		Content:  req.Content,
+		Mails:    req.Mails,
+		FileName: req.FileName,
+		Datas:    datas,
 	})
 	return &types.BiResp{Error_code: res.ErrorCode, Error_msg: res.ErrorMsg, Data: string(res.Data)}, err
 }

+ 6 - 6
api/internal/types/types.go

@@ -118,12 +118,12 @@ type GetCompanyTypeReq struct {
 }
 
 type ExportByDbReq struct {
-	Token   string `json:"token"`
-	Title   string `json:"title"`
-	Content string `json:"content"`
-	Mails   string `json:"mails"`
-	Query   string `json:"query"`
-	Stype   string `json:"stype"`
+	Token    string                   `json:"token"`
+	Title    string                   `json:"title"`
+	Content  string                   `json:"content"`
+	Mails    string                   `json:"mails"`
+	FileName string                   `json:"filename"`
+	Datas    []map[string]interface{} `json:"datas"`
 }
 
 type UpFileReq struct {

+ 7 - 2
rpc/biService.proto

@@ -191,8 +191,13 @@ message ExportByDbReq {
 	string title = 2;
 	string content = 3;
 	string mails = 4;
-	string query = 5;
-	string stype = 6;
+	string fileName = 5;
+	repeated FilesData datas = 6;
+}
+
+message FilesData {
+	string sheetName = 1;
+	string sql = 2;
 }
 
 message UpFileReq {

+ 0 - 1
rpc/biservice.go

@@ -61,7 +61,6 @@ func main() {
 		pb.RegisterBiServiceServer(grpcServer, srv)
 	})
 	defer s.Stop()
-
 	fmt.Printf("Starting rpc server at %s...\n", IC.IC.ListenOn)
 	s.Start()
 }

+ 1 - 0
rpc/biservice/biservice.go

@@ -34,6 +34,7 @@ type (
 	DrawClueReq            = pb.DrawClueReq
 	ExportByDbReq          = pb.ExportByDbReq
 	ExportReq              = pb.ExportReq
+	FilesData              = pb.FilesData
 	GetInfoIdResp          = pb.GetInfoIdResp
 	MyDataAsset            = pb.MyDataAsset
 	MyDataAssetReq         = pb.MyDataAssetReq

+ 14 - 23
rpc/internal/logic/sendmaillogic.go

@@ -3,13 +3,13 @@ package logic
 import (
 	"app.yhyue.com/moapp/jybase/common"
 	"bp.jydev.jianyu360.cn/BaseService/biService/entity"
+	"bp.jydev.jianyu360.cn/BaseService/biService/rpc/internal/svc"
+	"bp.jydev.jianyu360.cn/BaseService/biService/rpc/pb"
 	"bp.jydev.jianyu360.cn/BaseService/biService/service"
 	"context"
+	"fmt"
+	"github.com/gogf/gf/v2/util/gconv"
 	"github.com/tjfoc/gmsm/sm4"
-	"regexp"
-
-	"bp.jydev.jianyu360.cn/BaseService/biService/rpc/internal/svc"
-	"bp.jydev.jianyu360.cn/BaseService/biService/rpc/pb"
 
 	"github.com/zeromicro/go-zero/core/logx"
 )
@@ -28,38 +28,29 @@ func NewSendMailLogic(ctx context.Context, svcCtx *svc.ServiceContext) *SendMail
 	}
 }
 
-var reg1 = regexp.MustCompile("(?i)(insert|delete|update|master|truncate|declare|exec|alter|use)\\s")
-var reg2 = regexp.MustCompile("(?i)(select|from)\\s")
-
 func (l *SendMailLogic) SendMail(in *pb.ExportByDbReq) (*pb.BiReply, error) {
-	if in.Query == "" || in.Token == "" || in.Title == "" || in.Content == "" || in.Mails == "" {
+	if in.Token == "" || in.Title == "" || in.Content == "" || in.Mails == "" {
 		return &pb.BiReply{
 			ErrorCode: 1,
 			ErrorMsg:  "参数不能为空",
 			Data:      nil,
 		}, nil
 	}
-	if reg1.MatchString(in.Query) && !reg2.MatchString(in.Query) {
+	logx.Info("加密token:", RsaEncrypt([]byte(fmt.Sprintf("%s&%s&%s&%s", gconv.String(in.Content), gconv.String(in.Mails), gconv.String(in.FileName), gconv.String(in.Title)))))
+	if RsaEncrypt([]byte(fmt.Sprintf("%s&%s&%s&%s", gconv.String(in.Content), gconv.String(in.Mails), gconv.String(in.FileName), gconv.String(in.Title)))) != in.Token {
 		return &pb.BiReply{
 			ErrorCode: 1,
-			ErrorMsg:  "查询语句不合法",
+			ErrorMsg:  "token验证不通过",
 			Data:      nil,
 		}, nil
 	}
-	//if RsaEncrypt([]byte(fmt.Sprintf("%s&%s&%s&%s", gconv.String(in.Content), gconv.String(in.Mails), gconv.String(in.Query), gconv.String(in.Title)))) == in.Token {
-	//	return &pb.BiReply{
-	//		ErrorCode: 1,
-	//		ErrorMsg:  "token验证不通过",
-	//		Data:      nil,
-	//	}, nil
-	//}
 	res := (&service.ExportByDbReq{
-		Token:   in.Token,
-		Title:   in.Title,
-		Content: in.Content,
-		Mails:   in.Mails,
-		Query:   in.Query,
-		Stype:   in.Stype,
+		Token:    in.Token,
+		Title:    in.Title,
+		Content:  in.Content,
+		Mails:    in.Mails,
+		FileName: in.FileName,
+		Datas:    in.Datas,
 	}).ExportDataByDb()
 	return &pb.BiReply{
 		ErrorCode: 0,

+ 241 - 59
rpc/pb/biService.pb.go

@@ -1925,12 +1925,12 @@ type ExportByDbReq struct {
 	sizeCache     protoimpl.SizeCache
 	unknownFields protoimpl.UnknownFields
 
-	Token   string `protobuf:"bytes,1,opt,name=token,proto3" json:"token,omitempty"`
-	Title   string `protobuf:"bytes,2,opt,name=title,proto3" json:"title,omitempty"`
-	Content string `protobuf:"bytes,3,opt,name=content,proto3" json:"content,omitempty"`
-	Mails   string `protobuf:"bytes,4,opt,name=mails,proto3" json:"mails,omitempty"`
-	Query   string `protobuf:"bytes,5,opt,name=query,proto3" json:"query,omitempty"`
-	Stype   string `protobuf:"bytes,6,opt,name=stype,proto3" json:"stype,omitempty"`
+	Token    string       `protobuf:"bytes,1,opt,name=token,proto3" json:"token,omitempty"`
+	Title    string       `protobuf:"bytes,2,opt,name=title,proto3" json:"title,omitempty"`
+	Content  string       `protobuf:"bytes,3,opt,name=content,proto3" json:"content,omitempty"`
+	Mails    string       `protobuf:"bytes,4,opt,name=mails,proto3" json:"mails,omitempty"`
+	FileName string       `protobuf:"bytes,5,opt,name=fileName,proto3" json:"fileName,omitempty"`
+	Datas    []*FilesData `protobuf:"bytes,6,rep,name=datas,proto3" json:"datas,omitempty"`
 }
 
 func (x *ExportByDbReq) Reset() {
@@ -1993,16 +1993,71 @@ func (x *ExportByDbReq) GetMails() string {
 	return ""
 }
 
-func (x *ExportByDbReq) GetQuery() string {
+func (x *ExportByDbReq) GetFileName() string {
 	if x != nil {
-		return x.Query
+		return x.FileName
 	}
 	return ""
 }
 
-func (x *ExportByDbReq) GetStype() string {
+func (x *ExportByDbReq) GetDatas() []*FilesData {
 	if x != nil {
-		return x.Stype
+		return x.Datas
+	}
+	return nil
+}
+
+type FilesData struct {
+	state         protoimpl.MessageState
+	sizeCache     protoimpl.SizeCache
+	unknownFields protoimpl.UnknownFields
+
+	SheetName string `protobuf:"bytes,1,opt,name=sheetName,proto3" json:"sheetName,omitempty"`
+	Sql       string `protobuf:"bytes,2,opt,name=sql,proto3" json:"sql,omitempty"`
+}
+
+func (x *FilesData) Reset() {
+	*x = FilesData{}
+	if protoimpl.UnsafeEnabled {
+		mi := &file_biService_proto_msgTypes[29]
+		ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
+		ms.StoreMessageInfo(mi)
+	}
+}
+
+func (x *FilesData) String() string {
+	return protoimpl.X.MessageStringOf(x)
+}
+
+func (*FilesData) ProtoMessage() {}
+
+func (x *FilesData) ProtoReflect() protoreflect.Message {
+	mi := &file_biService_proto_msgTypes[29]
+	if protoimpl.UnsafeEnabled && x != nil {
+		ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
+		if ms.LoadMessageInfo() == nil {
+			ms.StoreMessageInfo(mi)
+		}
+		return ms
+	}
+	return mi.MessageOf(x)
+}
+
+// Deprecated: Use FilesData.ProtoReflect.Descriptor instead.
+func (*FilesData) Descriptor() ([]byte, []int) {
+	return file_biService_proto_rawDescGZIP(), []int{29}
+}
+
+func (x *FilesData) GetSheetName() string {
+	if x != nil {
+		return x.SheetName
+	}
+	return ""
+}
+
+func (x *FilesData) GetSql() string {
+	if x != nil {
+		return x.Sql
 	}
 	return ""
 }
@@ -2026,7 +2081,7 @@ type UpFileReq struct {
 func (x *UpFileReq) Reset() {
 	*x = UpFileReq{}
 	if protoimpl.UnsafeEnabled {
-		mi := &file_biService_proto_msgTypes[29]
+		mi := &file_biService_proto_msgTypes[30]
 		ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
 		ms.StoreMessageInfo(mi)
 	}
@@ -2039,7 +2094,7 @@ func (x *UpFileReq) String() string {
 func (*UpFileReq) ProtoMessage() {}
 
 func (x *UpFileReq) ProtoReflect() protoreflect.Message {
-	mi := &file_biService_proto_msgTypes[29]
+	mi := &file_biService_proto_msgTypes[30]
 	if protoimpl.UnsafeEnabled && x != nil {
 		ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
 		if ms.LoadMessageInfo() == nil {
@@ -2052,7 +2107,7 @@ func (x *UpFileReq) ProtoReflect() protoreflect.Message {
 
 // Deprecated: Use UpFileReq.ProtoReflect.Descriptor instead.
 func (*UpFileReq) Descriptor() ([]byte, []int) {
-	return file_biService_proto_rawDescGZIP(), []int{29}
+	return file_biService_proto_rawDescGZIP(), []int{30}
 }
 
 func (x *UpFileReq) GetAppId() string {
@@ -2308,6 +2363,7 @@ var file_biService_proto_rawDesc = []byte{
 	0x32, 0x14, 0x2e, 0x44, 0x69, 0x73, 0x74, 0x72, 0x69, 0x62, 0x75, 0x74, 0x65, 0x43, 0x6c, 0x75,
 	0x65, 0x53, 0x68, 0x6f, 0x77, 0x73, 0x52, 0x05, 0x64, 0x61, 0x74, 0x61, 0x73, 0x12, 0x16, 0x0a,
 	0x06, 0x49, 0x73, 0x54, 0x61, 0x73, 0x6b, 0x18, 0x05, 0x20, 0x01, 0x28, 0x03, 0x52, 0x06, 0x49,
+<<<<<<< HEAD
 	0x73, 0x54, 0x61, 0x73, 0x6b, 0x12, 0x2a, 0x0a, 0x10, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x50,
 	0x6f, 0x73, 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x49, 0x44, 0x18, 0x06, 0x20, 0x01, 0x28, 0x03, 0x52,
 	0x10, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x50, 0x6f, 0x73, 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x49,
@@ -2420,6 +2476,118 @@ var file_biService_proto_rawDesc = []byte{
 	0x12, 0x0a, 0x2e, 0x55, 0x70, 0x46, 0x69, 0x6c, 0x65, 0x52, 0x65, 0x71, 0x1a, 0x08, 0x2e, 0x42,
 	0x69, 0x52, 0x65, 0x70, 0x6c, 0x79, 0x42, 0x06, 0x5a, 0x04, 0x2e, 0x2f, 0x70, 0x62, 0x62, 0x06,
 	0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33,
+=======
+	0x73, 0x54, 0x61, 0x73, 0x6b, 0x22, 0x61, 0x0a, 0x13, 0x44, 0x69, 0x73, 0x74, 0x72, 0x69, 0x62,
+	0x75, 0x74, 0x65, 0x43, 0x6c, 0x75, 0x65, 0x53, 0x68, 0x6f, 0x77, 0x73, 0x12, 0x1e, 0x0a, 0x0a,
+	0x70, 0x6f, 0x73, 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x49, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x03,
+	0x52, 0x0a, 0x70, 0x6f, 0x73, 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x49, 0x64, 0x12, 0x2a, 0x0a, 0x10,
+	0x64, 0x69, 0x73, 0x74, 0x72, 0x69, 0x62, 0x75, 0x74, 0x65, 0x64, 0x43, 0x6f, 0x75, 0x6e, 0x74,
+	0x18, 0x02, 0x20, 0x01, 0x28, 0x03, 0x52, 0x10, 0x64, 0x69, 0x73, 0x74, 0x72, 0x69, 0x62, 0x75,
+	0x74, 0x65, 0x64, 0x43, 0x6f, 0x75, 0x6e, 0x74, 0x22, 0xba, 0x01, 0x0a, 0x14, 0x44, 0x69, 0x73,
+	0x74, 0x72, 0x69, 0x62, 0x75, 0x74, 0x65, 0x43, 0x6c, 0x75, 0x65, 0x53, 0x68, 0x6f, 0x77, 0x73,
+	0x73, 0x12, 0x1e, 0x0a, 0x0a, 0x70, 0x6f, 0x73, 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x49, 0x64, 0x18,
+	0x01, 0x20, 0x01, 0x28, 0x03, 0x52, 0x0a, 0x70, 0x6f, 0x73, 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x49,
+	0x64, 0x12, 0x22, 0x0a, 0x0c, 0x63, 0x6f, 0x6d, 0x70, 0x61, 0x6e, 0x79, 0x43, 0x6f, 0x75, 0x6e,
+	0x74, 0x18, 0x02, 0x20, 0x01, 0x28, 0x03, 0x52, 0x0c, 0x63, 0x6f, 0x6d, 0x70, 0x61, 0x6e, 0x79,
+	0x43, 0x6f, 0x75, 0x6e, 0x74, 0x12, 0x1c, 0x0a, 0x09, 0x63, 0x6c, 0x75, 0x65, 0x43, 0x6f, 0x75,
+	0x6e, 0x74, 0x18, 0x03, 0x20, 0x01, 0x28, 0x03, 0x52, 0x09, 0x63, 0x6c, 0x75, 0x65, 0x43, 0x6f,
+	0x75, 0x6e, 0x74, 0x12, 0x1a, 0x0a, 0x08, 0x6d, 0x69, 0x6e, 0x43, 0x6f, 0x75, 0x6e, 0x74, 0x18,
+	0x04, 0x20, 0x01, 0x28, 0x03, 0x52, 0x08, 0x6d, 0x69, 0x6e, 0x43, 0x6f, 0x75, 0x6e, 0x74, 0x12,
+	0x24, 0x0a, 0x0d, 0x63, 0x6f, 0x6d, 0x70, 0x61, 0x6e, 0x79, 0x43, 0x6f, 0x75, 0x6e, 0x74, 0x73,
+	0x18, 0x05, 0x20, 0x01, 0x28, 0x03, 0x52, 0x0d, 0x63, 0x6f, 0x6d, 0x70, 0x61, 0x6e, 0x79, 0x43,
+	0x6f, 0x75, 0x6e, 0x74, 0x73, 0x22, 0x7f, 0x0a, 0x16, 0x44, 0x69, 0x73, 0x74, 0x72, 0x69, 0x62,
+	0x75, 0x74, 0x65, 0x43, 0x6c, 0x75, 0x65, 0x53, 0x68, 0x6f, 0x77, 0x52, 0x65, 0x73, 0x70, 0x12,
+	0x1d, 0x0a, 0x0a, 0x65, 0x72, 0x72, 0x6f, 0x72, 0x5f, 0x63, 0x6f, 0x64, 0x65, 0x18, 0x01, 0x20,
+	0x01, 0x28, 0x03, 0x52, 0x09, 0x65, 0x72, 0x72, 0x6f, 0x72, 0x43, 0x6f, 0x64, 0x65, 0x12, 0x1b,
+	0x0a, 0x09, 0x65, 0x72, 0x72, 0x6f, 0x72, 0x5f, 0x6d, 0x73, 0x67, 0x18, 0x02, 0x20, 0x01, 0x28,
+	0x09, 0x52, 0x08, 0x65, 0x72, 0x72, 0x6f, 0x72, 0x4d, 0x73, 0x67, 0x12, 0x29, 0x0a, 0x04, 0x64,
+	0x61, 0x74, 0x61, 0x18, 0x03, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x15, 0x2e, 0x44, 0x69, 0x73, 0x74,
+	0x72, 0x69, 0x62, 0x75, 0x74, 0x65, 0x43, 0x6c, 0x75, 0x65, 0x53, 0x68, 0x6f, 0x77, 0x73, 0x73,
+	0x52, 0x04, 0x64, 0x61, 0x74, 0x61, 0x22, 0xa9, 0x01, 0x0a, 0x0d, 0x45, 0x78, 0x70, 0x6f, 0x72,
+	0x74, 0x42, 0x79, 0x44, 0x62, 0x52, 0x65, 0x71, 0x12, 0x14, 0x0a, 0x05, 0x74, 0x6f, 0x6b, 0x65,
+	0x6e, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, 0x74, 0x6f, 0x6b, 0x65, 0x6e, 0x12, 0x14,
+	0x0a, 0x05, 0x74, 0x69, 0x74, 0x6c, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, 0x74,
+	0x69, 0x74, 0x6c, 0x65, 0x12, 0x18, 0x0a, 0x07, 0x63, 0x6f, 0x6e, 0x74, 0x65, 0x6e, 0x74, 0x18,
+	0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, 0x63, 0x6f, 0x6e, 0x74, 0x65, 0x6e, 0x74, 0x12, 0x14,
+	0x0a, 0x05, 0x6d, 0x61, 0x69, 0x6c, 0x73, 0x18, 0x04, 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, 0x6d,
+	0x61, 0x69, 0x6c, 0x73, 0x12, 0x1a, 0x0a, 0x08, 0x66, 0x69, 0x6c, 0x65, 0x4e, 0x61, 0x6d, 0x65,
+	0x18, 0x05, 0x20, 0x01, 0x28, 0x09, 0x52, 0x08, 0x66, 0x69, 0x6c, 0x65, 0x4e, 0x61, 0x6d, 0x65,
+	0x12, 0x20, 0x0a, 0x05, 0x64, 0x61, 0x74, 0x61, 0x73, 0x18, 0x06, 0x20, 0x03, 0x28, 0x0b, 0x32,
+	0x0a, 0x2e, 0x46, 0x69, 0x6c, 0x65, 0x73, 0x44, 0x61, 0x74, 0x61, 0x52, 0x05, 0x64, 0x61, 0x74,
+	0x61, 0x73, 0x22, 0x3b, 0x0a, 0x09, 0x46, 0x69, 0x6c, 0x65, 0x73, 0x44, 0x61, 0x74, 0x61, 0x12,
+	0x1c, 0x0a, 0x09, 0x73, 0x68, 0x65, 0x65, 0x74, 0x4e, 0x61, 0x6d, 0x65, 0x18, 0x01, 0x20, 0x01,
+	0x28, 0x09, 0x52, 0x09, 0x73, 0x68, 0x65, 0x65, 0x74, 0x4e, 0x61, 0x6d, 0x65, 0x12, 0x10, 0x0a,
+	0x03, 0x73, 0x71, 0x6c, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x03, 0x73, 0x71, 0x6c, 0x22,
+	0xef, 0x01, 0x0a, 0x09, 0x55, 0x70, 0x46, 0x69, 0x6c, 0x65, 0x52, 0x65, 0x71, 0x12, 0x14, 0x0a,
+	0x05, 0x61, 0x70, 0x70, 0x49, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, 0x61, 0x70,
+	0x70, 0x49, 0x64, 0x12, 0x16, 0x0a, 0x06, 0x75, 0x73, 0x65, 0x72, 0x49, 0x64, 0x18, 0x02, 0x20,
+	0x01, 0x28, 0x03, 0x52, 0x06, 0x75, 0x73, 0x65, 0x72, 0x49, 0x64, 0x12, 0x1e, 0x0a, 0x0a, 0x70,
+	0x6f, 0x73, 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x49, 0x64, 0x18, 0x03, 0x20, 0x01, 0x28, 0x03, 0x52,
+	0x0a, 0x70, 0x6f, 0x73, 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x49, 0x64, 0x12, 0x1c, 0x0a, 0x09, 0x65,
+	0x6e, 0x74, 0x55, 0x73, 0x65, 0x72, 0x49, 0x64, 0x18, 0x04, 0x20, 0x01, 0x28, 0x03, 0x52, 0x09,
+	0x65, 0x6e, 0x74, 0x55, 0x73, 0x65, 0x72, 0x49, 0x64, 0x12, 0x14, 0x0a, 0x05, 0x65, 0x6e, 0x74,
+	0x49, 0x64, 0x18, 0x05, 0x20, 0x01, 0x28, 0x03, 0x52, 0x05, 0x65, 0x6e, 0x74, 0x49, 0x64, 0x12,
+	0x14, 0x0a, 0x05, 0x73, 0x74, 0x79, 0x70, 0x65, 0x18, 0x06, 0x20, 0x01, 0x28, 0x09, 0x52, 0x05,
+	0x73, 0x74, 0x79, 0x70, 0x65, 0x12, 0x12, 0x0a, 0x04, 0x66, 0x69, 0x6c, 0x65, 0x18, 0x07, 0x20,
+	0x01, 0x28, 0x0c, 0x52, 0x04, 0x66, 0x69, 0x6c, 0x65, 0x12, 0x1a, 0x0a, 0x08, 0x66, 0x69, 0x6c,
+	0x65, 0x4e, 0x61, 0x6d, 0x65, 0x18, 0x08, 0x20, 0x01, 0x28, 0x09, 0x52, 0x08, 0x66, 0x69, 0x6c,
+	0x65, 0x4e, 0x61, 0x6d, 0x65, 0x12, 0x1a, 0x0a, 0x08, 0x66, 0x69, 0x6c, 0x65, 0x53, 0x69, 0x7a,
+	0x65, 0x18, 0x09, 0x20, 0x01, 0x28, 0x09, 0x52, 0x08, 0x66, 0x69, 0x6c, 0x65, 0x53, 0x69, 0x7a,
+	0x65, 0x32, 0xbf, 0x06, 0x0a, 0x09, 0x42, 0x69, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x12,
+	0x30, 0x0a, 0x0b, 0x6d, 0x79, 0x44, 0x61, 0x74, 0x61, 0x41, 0x73, 0x73, 0x65, 0x74, 0x12, 0x0f,
+	0x2e, 0x4d, 0x79, 0x44, 0x61, 0x74, 0x61, 0x41, 0x73, 0x73, 0x65, 0x74, 0x52, 0x65, 0x71, 0x1a,
+	0x10, 0x2e, 0x4d, 0x79, 0x44, 0x61, 0x74, 0x61, 0x41, 0x73, 0x73, 0x65, 0x74, 0x52, 0x65, 0x73,
+	0x70, 0x12, 0x2d, 0x0a, 0x0a, 0x61, 0x64, 0x64, 0x50, 0x72, 0x6f, 0x6a, 0x65, 0x63, 0x74, 0x12,
+	0x0e, 0x2e, 0x41, 0x64, 0x64, 0x50, 0x72, 0x6f, 0x6a, 0x65, 0x63, 0x74, 0x52, 0x65, 0x71, 0x1a,
+	0x0f, 0x2e, 0x41, 0x64, 0x64, 0x50, 0x72, 0x6f, 0x6a, 0x65, 0x63, 0x74, 0x52, 0x65, 0x73, 0x70,
+	0x12, 0x2b, 0x0a, 0x09, 0x67, 0x65, 0x74, 0x49, 0x6e, 0x66, 0x6f, 0x49, 0x64, 0x12, 0x0e, 0x2e,
+	0x41, 0x64, 0x64, 0x50, 0x72, 0x6f, 0x6a, 0x65, 0x63, 0x74, 0x52, 0x65, 0x71, 0x1a, 0x0e, 0x2e,
+	0x47, 0x65, 0x74, 0x49, 0x6e, 0x66, 0x6f, 0x49, 0x64, 0x52, 0x65, 0x73, 0x70, 0x12, 0x29, 0x0a,
+	0x08, 0x64, 0x72, 0x61, 0x77, 0x43, 0x6c, 0x75, 0x65, 0x12, 0x0c, 0x2e, 0x44, 0x72, 0x61, 0x77,
+	0x43, 0x6c, 0x75, 0x65, 0x52, 0x65, 0x71, 0x1a, 0x0f, 0x2e, 0x41, 0x64, 0x64, 0x50, 0x72, 0x6f,
+	0x6a, 0x65, 0x63, 0x74, 0x52, 0x65, 0x73, 0x70, 0x12, 0x19, 0x0a, 0x04, 0x43, 0x61, 0x6c, 0x6c,
+	0x12, 0x08, 0x2e, 0x43, 0x61, 0x6c, 0x6c, 0x52, 0x65, 0x71, 0x1a, 0x07, 0x2e, 0x42, 0x69, 0x52,
+	0x65, 0x73, 0x70, 0x12, 0x35, 0x0a, 0x0e, 0x64, 0x69, 0x73, 0x74, 0x72, 0x69, 0x62, 0x75, 0x74,
+	0x65, 0x43, 0x6c, 0x75, 0x65, 0x12, 0x12, 0x2e, 0x44, 0x69, 0x73, 0x74, 0x72, 0x69, 0x62, 0x75,
+	0x74, 0x65, 0x43, 0x6c, 0x75, 0x65, 0x52, 0x65, 0x71, 0x1a, 0x0f, 0x2e, 0x41, 0x64, 0x64, 0x50,
+	0x72, 0x6f, 0x6a, 0x65, 0x63, 0x74, 0x52, 0x65, 0x73, 0x70, 0x12, 0x2d, 0x0a, 0x0a, 0x63, 0x6c,
+	0x75, 0x65, 0x49, 0x6d, 0x70, 0x6f, 0x72, 0x74, 0x12, 0x0e, 0x2e, 0x43, 0x6c, 0x75, 0x65, 0x49,
+	0x6d, 0x70, 0x6f, 0x72, 0x74, 0x52, 0x65, 0x71, 0x1a, 0x0f, 0x2e, 0x43, 0x6c, 0x75, 0x65, 0x49,
+	0x6d, 0x70, 0x6f, 0x72, 0x74, 0x52, 0x65, 0x73, 0x70, 0x12, 0x27, 0x0a, 0x07, 0x63, 0x6c, 0x75,
+	0x65, 0x41, 0x64, 0x64, 0x12, 0x0b, 0x2e, 0x43, 0x6c, 0x75, 0x65, 0x41, 0x64, 0x64, 0x52, 0x65,
+	0x71, 0x1a, 0x0f, 0x2e, 0x41, 0x64, 0x64, 0x50, 0x72, 0x6f, 0x6a, 0x65, 0x63, 0x74, 0x52, 0x65,
+	0x73, 0x70, 0x12, 0x2f, 0x0a, 0x0c, 0x63, 0x6c, 0x75, 0x65, 0x49, 0x6d, 0x70, 0x6f, 0x72, 0x74,
+	0x54, 0x74, 0x12, 0x0e, 0x2e, 0x43, 0x6c, 0x75, 0x65, 0x49, 0x6d, 0x70, 0x6f, 0x72, 0x74, 0x52,
+	0x65, 0x71, 0x1a, 0x0f, 0x2e, 0x43, 0x6c, 0x75, 0x65, 0x49, 0x6d, 0x70, 0x6f, 0x72, 0x74, 0x52,
+	0x65, 0x73, 0x70, 0x12, 0x27, 0x0a, 0x0a, 0x61, 0x75, 0x74, 0x6f, 0x46, 0x6f, 0x6c, 0x6c, 0x6f,
+	0x77, 0x12, 0x08, 0x2e, 0x43, 0x61, 0x6c, 0x6c, 0x52, 0x65, 0x71, 0x1a, 0x0f, 0x2e, 0x43, 0x6c,
+	0x75, 0x65, 0x49, 0x6d, 0x70, 0x6f, 0x72, 0x74, 0x52, 0x65, 0x73, 0x70, 0x12, 0x24, 0x0a, 0x09,
+	0x73, 0x71, 0x6c, 0x4d, 0x61, 0x6e, 0x61, 0x67, 0x65, 0x12, 0x0d, 0x2e, 0x53, 0x71, 0x6c, 0x4d,
+	0x61, 0x6e, 0x61, 0x67, 0x65, 0x52, 0x65, 0x71, 0x1a, 0x08, 0x2e, 0x42, 0x69, 0x52, 0x65, 0x70,
+	0x6c, 0x79, 0x12, 0x1e, 0x0a, 0x06, 0x6d, 0x79, 0x49, 0x6e, 0x66, 0x6f, 0x12, 0x0a, 0x2e, 0x4d,
+	0x79, 0x49, 0x6e, 0x66, 0x6f, 0x52, 0x65, 0x71, 0x1a, 0x08, 0x2e, 0x42, 0x69, 0x52, 0x65, 0x70,
+	0x6c, 0x79, 0x12, 0x25, 0x0a, 0x0d, 0x61, 0x6c, 0x6c, 0x49, 0x6e, 0x66, 0x6f, 0x45, 0x78, 0x70,
+	0x6f, 0x72, 0x74, 0x12, 0x0a, 0x2e, 0x45, 0x78, 0x70, 0x6f, 0x72, 0x74, 0x52, 0x65, 0x71, 0x1a,
+	0x08, 0x2e, 0x42, 0x69, 0x52, 0x65, 0x70, 0x6c, 0x79, 0x12, 0x28, 0x0a, 0x10, 0x61, 0x6c, 0x6c,
+	0x50, 0x72, 0x6f, 0x6a, 0x65, 0x63, 0x74, 0x45, 0x78, 0x70, 0x6f, 0x72, 0x74, 0x12, 0x0a, 0x2e,
+	0x45, 0x78, 0x70, 0x6f, 0x72, 0x74, 0x52, 0x65, 0x71, 0x1a, 0x08, 0x2e, 0x42, 0x69, 0x52, 0x65,
+	0x70, 0x6c, 0x79, 0x12, 0x24, 0x0a, 0x0b, 0x69, 0x6e, 0x66, 0x6f, 0x4f, 0x70, 0x65, 0x72, 0x61,
+	0x74, 0x65, 0x12, 0x0b, 0x2e, 0x4f, 0x70, 0x65, 0x72, 0x61, 0x74, 0x65, 0x52, 0x65, 0x71, 0x1a,
+	0x08, 0x2e, 0x42, 0x69, 0x52, 0x65, 0x70, 0x6c, 0x79, 0x12, 0x2b, 0x0a, 0x0e, 0x67, 0x65, 0x74,
+	0x43, 0x6f, 0x6d, 0x70, 0x61, 0x6e, 0x79, 0x54, 0x79, 0x70, 0x65, 0x12, 0x0b, 0x2e, 0x43, 0x6f,
+	0x6d, 0x70, 0x61, 0x6e, 0x79, 0x52, 0x65, 0x71, 0x1a, 0x0c, 0x2e, 0x43, 0x6f, 0x6d, 0x70, 0x61,
+	0x6e, 0x79, 0x52, 0x65, 0x73, 0x70, 0x12, 0x45, 0x0a, 0x12, 0x64, 0x69, 0x73, 0x74, 0x72, 0x69,
+	0x62, 0x75, 0x74, 0x65, 0x43, 0x6c, 0x75, 0x65, 0x53, 0x68, 0x6f, 0x77, 0x12, 0x16, 0x2e, 0x44,
+	0x69, 0x73, 0x74, 0x72, 0x69, 0x62, 0x75, 0x74, 0x65, 0x43, 0x6c, 0x75, 0x65, 0x53, 0x68, 0x6f,
+	0x77, 0x52, 0x65, 0x71, 0x1a, 0x17, 0x2e, 0x44, 0x69, 0x73, 0x74, 0x72, 0x69, 0x62, 0x75, 0x74,
+	0x65, 0x43, 0x6c, 0x75, 0x65, 0x53, 0x68, 0x6f, 0x77, 0x52, 0x65, 0x73, 0x70, 0x12, 0x24, 0x0a,
+	0x08, 0x73, 0x65, 0x6e, 0x64, 0x4d, 0x61, 0x69, 0x6c, 0x12, 0x0e, 0x2e, 0x45, 0x78, 0x70, 0x6f,
+	0x72, 0x74, 0x42, 0x79, 0x44, 0x62, 0x52, 0x65, 0x71, 0x1a, 0x08, 0x2e, 0x42, 0x69, 0x52, 0x65,
+	0x70, 0x6c, 0x79, 0x12, 0x1e, 0x0a, 0x06, 0x75, 0x70, 0x46, 0x69, 0x6c, 0x65, 0x12, 0x0a, 0x2e,
+	0x55, 0x70, 0x46, 0x69, 0x6c, 0x65, 0x52, 0x65, 0x71, 0x1a, 0x08, 0x2e, 0x42, 0x69, 0x52, 0x65,
+	0x70, 0x6c, 0x79, 0x42, 0x06, 0x5a, 0x04, 0x2e, 0x2f, 0x70, 0x62, 0x62, 0x06, 0x70, 0x72, 0x6f,
+	0x74, 0x6f, 0x33,
+>>>>>>> hotfix/v1.0.22.2
 }
 
 var (
@@ -2434,7 +2602,7 @@ func file_biService_proto_rawDescGZIP() []byte {
 	return file_biService_proto_rawDescData
 }
 
-var file_biService_proto_msgTypes = make([]protoimpl.MessageInfo, 30)
+var file_biService_proto_msgTypes = make([]protoimpl.MessageInfo, 31)
 var file_biService_proto_goTypes = []interface{}{
 	(*MyDataAssetReq)(nil),         // 0: MyDataAssetReq
 	(*MyDataAssetResp)(nil),        // 1: MyDataAssetResp
@@ -2465,7 +2633,8 @@ var file_biService_proto_goTypes = []interface{}{
 	(*DistributeClueShowss)(nil),   // 26: DistributeClueShowss
 	(*DistributeClueShowResp)(nil), // 27: DistributeClueShowResp
 	(*ExportByDbReq)(nil),          // 28: ExportByDbReq
-	(*UpFileReq)(nil),              // 29: UpFileReq
+	(*FilesData)(nil),              // 29: FilesData
+	(*UpFileReq)(nil),              // 30: UpFileReq
 }
 var file_biService_proto_depIdxs = []int32{
 	2,  // 0: MyDataAssetResp.data:type_name -> MyDataAsset
@@ -2475,49 +2644,50 @@ var file_biService_proto_depIdxs = []int32{
 	19, // 4: SqlManageReq.params:type_name -> Param
 	25, // 5: DistributeClueShowReq.datas:type_name -> DistributeClueShows
 	26, // 6: DistributeClueShowResp.data:type_name -> DistributeClueShowss
-	0,  // 7: BiService.myDataAsset:input_type -> MyDataAssetReq
-	3,  // 8: BiService.addProject:input_type -> AddProjectReq
-	3,  // 9: BiService.getInfoId:input_type -> AddProjectReq
-	7,  // 10: BiService.drawClue:input_type -> DrawClueReq
-	8,  // 11: BiService.Call:input_type -> CallReq
-	11, // 12: BiService.distributeClue:input_type -> DistributeClueReq
-	13, // 13: BiService.clueImport:input_type -> ClueImportReq
-	16, // 14: BiService.clueAdd:input_type -> ClueAddReq
-	13, // 15: BiService.clueImportTt:input_type -> ClueImportReq
-	8,  // 16: BiService.autoFollow:input_type -> CallReq
-	17, // 17: BiService.sqlManage:input_type -> SqlManageReq
-	18, // 18: BiService.myInfo:input_type -> MyInfoReq
-	20, // 19: BiService.allInfoExport:input_type -> ExportReq
-	20, // 20: BiService.allProjectExport:input_type -> ExportReq
-	21, // 21: BiService.infoOperate:input_type -> OperateReq
-	22, // 22: BiService.getCompanyType:input_type -> CompanyReq
-	24, // 23: BiService.distributeClueShow:input_type -> DistributeClueShowReq
-	28, // 24: BiService.sendMail:input_type -> ExportByDbReq
-	29, // 25: BiService.upFile:input_type -> UpFileReq
-	1,  // 26: BiService.myDataAsset:output_type -> MyDataAssetResp
-	4,  // 27: BiService.addProject:output_type -> AddProjectResp
-	6,  // 28: BiService.getInfoId:output_type -> GetInfoIdResp
-	4,  // 29: BiService.drawClue:output_type -> AddProjectResp
-	9,  // 30: BiService.Call:output_type -> BiResp
-	4,  // 31: BiService.distributeClue:output_type -> AddProjectResp
-	14, // 32: BiService.clueImport:output_type -> ClueImportResp
-	4,  // 33: BiService.clueAdd:output_type -> AddProjectResp
-	14, // 34: BiService.clueImportTt:output_type -> ClueImportResp
-	14, // 35: BiService.autoFollow:output_type -> ClueImportResp
-	10, // 36: BiService.sqlManage:output_type -> BiReply
-	10, // 37: BiService.myInfo:output_type -> BiReply
-	10, // 38: BiService.allInfoExport:output_type -> BiReply
-	10, // 39: BiService.allProjectExport:output_type -> BiReply
-	10, // 40: BiService.infoOperate:output_type -> BiReply
-	23, // 41: BiService.getCompanyType:output_type -> CompanyResp
-	27, // 42: BiService.distributeClueShow:output_type -> DistributeClueShowResp
-	10, // 43: BiService.sendMail:output_type -> BiReply
-	10, // 44: BiService.upFile:output_type -> BiReply
-	26, // [26:45] is the sub-list for method output_type
-	7,  // [7:26] is the sub-list for method input_type
-	7,  // [7:7] is the sub-list for extension type_name
-	7,  // [7:7] is the sub-list for extension extendee
-	0,  // [0:7] is the sub-list for field type_name
+	29, // 7: ExportByDbReq.datas:type_name -> FilesData
+	0,  // 8: BiService.myDataAsset:input_type -> MyDataAssetReq
+	3,  // 9: BiService.addProject:input_type -> AddProjectReq
+	3,  // 10: BiService.getInfoId:input_type -> AddProjectReq
+	7,  // 11: BiService.drawClue:input_type -> DrawClueReq
+	8,  // 12: BiService.Call:input_type -> CallReq
+	11, // 13: BiService.distributeClue:input_type -> DistributeClueReq
+	13, // 14: BiService.clueImport:input_type -> ClueImportReq
+	16, // 15: BiService.clueAdd:input_type -> ClueAddReq
+	13, // 16: BiService.clueImportTt:input_type -> ClueImportReq
+	8,  // 17: BiService.autoFollow:input_type -> CallReq
+	17, // 18: BiService.sqlManage:input_type -> SqlManageReq
+	18, // 19: BiService.myInfo:input_type -> MyInfoReq
+	20, // 20: BiService.allInfoExport:input_type -> ExportReq
+	20, // 21: BiService.allProjectExport:input_type -> ExportReq
+	21, // 22: BiService.infoOperate:input_type -> OperateReq
+	22, // 23: BiService.getCompanyType:input_type -> CompanyReq
+	24, // 24: BiService.distributeClueShow:input_type -> DistributeClueShowReq
+	28, // 25: BiService.sendMail:input_type -> ExportByDbReq
+	30, // 26: BiService.upFile:input_type -> UpFileReq
+	1,  // 27: BiService.myDataAsset:output_type -> MyDataAssetResp
+	4,  // 28: BiService.addProject:output_type -> AddProjectResp
+	6,  // 29: BiService.getInfoId:output_type -> GetInfoIdResp
+	4,  // 30: BiService.drawClue:output_type -> AddProjectResp
+	9,  // 31: BiService.Call:output_type -> BiResp
+	4,  // 32: BiService.distributeClue:output_type -> AddProjectResp
+	14, // 33: BiService.clueImport:output_type -> ClueImportResp
+	4,  // 34: BiService.clueAdd:output_type -> AddProjectResp
+	14, // 35: BiService.clueImportTt:output_type -> ClueImportResp
+	14, // 36: BiService.autoFollow:output_type -> ClueImportResp
+	10, // 37: BiService.sqlManage:output_type -> BiReply
+	10, // 38: BiService.myInfo:output_type -> BiReply
+	10, // 39: BiService.allInfoExport:output_type -> BiReply
+	10, // 40: BiService.allProjectExport:output_type -> BiReply
+	10, // 41: BiService.infoOperate:output_type -> BiReply
+	23, // 42: BiService.getCompanyType:output_type -> CompanyResp
+	27, // 43: BiService.distributeClueShow:output_type -> DistributeClueShowResp
+	10, // 44: BiService.sendMail:output_type -> BiReply
+	10, // 45: BiService.upFile:output_type -> BiReply
+	27, // [27:46] is the sub-list for method output_type
+	8,  // [8:27] is the sub-list for method input_type
+	8,  // [8:8] is the sub-list for extension type_name
+	8,  // [8:8] is the sub-list for extension extendee
+	0,  // [0:8] is the sub-list for field type_name
 }
 
 func init() { file_biService_proto_init() }
@@ -2875,6 +3045,18 @@ func file_biService_proto_init() {
 			}
 		}
 		file_biService_proto_msgTypes[29].Exporter = func(v interface{}, i int) interface{} {
+			switch v := v.(*FilesData); i {
+			case 0:
+				return &v.state
+			case 1:
+				return &v.sizeCache
+			case 2:
+				return &v.unknownFields
+			default:
+				return nil
+			}
+		}
+		file_biService_proto_msgTypes[30].Exporter = func(v interface{}, i int) interface{} {
 			switch v := v.(*UpFileReq); i {
 			case 0:
 				return &v.state
@@ -2893,7 +3075,7 @@ func file_biService_proto_init() {
 			GoPackagePath: reflect.TypeOf(x{}).PkgPath(),
 			RawDescriptor: file_biService_proto_rawDesc,
 			NumEnums:      0,
-			NumMessages:   30,
+			NumMessages:   31,
 			NumExtensions: 0,
 			NumServices:   1,
 		},

+ 82 - 35
service/exprot.go

@@ -2,6 +2,7 @@ package service
 
 import (
 	"archive/zip"
+	"bp.jydev.jianyu360.cn/BaseService/biService/rpc/pb"
 	"fmt"
 	"io"
 	"log"
@@ -31,14 +32,17 @@ type ExportReq struct {
 }
 
 type ExportByDbReq struct {
-	Token   string
-	Title   string
-	Content string
-	Mails   string
-	Query   string
-	Stype   string
+	Token    string
+	Title    string
+	Content  string
+	Mails    string
+	FileName string
+	Datas    []*pb.FilesData
 }
 
+var reg1 = regexp.MustCompile("(?i)(insert|delete|update|master|truncate|declare|exec|alter|use)\\s")
+var reg2 = regexp.MustCompile("(?i)(select|from)\\s")
+
 // 全量项目导出
 func (a *ExportReq) AllProjectExport() {
 	tableColumn := []string{}
@@ -140,7 +144,6 @@ func dataHandle(writer *excelize.StreamWriter, l *[]map[string]interface{}, a in
 
 // 入excel
 func Warehousing(writer *excelize.StreamWriter, file *excelize.File, fileCounter int, key []interface{}, path, timeStr string) (*excelize.StreamWriter, *excelize.File, string) {
-	logx.Info(fmt.Sprintf("开始第%d个文件数据", fileCounter))
 	writer.Flush()
 	folderPath := fmt.Sprintf("%s/%s", path, timeStr)
 	_, err := os.Stat(folderPath)
@@ -173,6 +176,32 @@ func InirWrite(key []interface{}) (*excelize.StreamWriter, *excelize.File) {
 	return writer, file
 }
 
+func InirWrite1(i int, sheet string, key []interface{}, file *excelize.File) (*excelize.StreamWriter, *excelize.File) {
+	//文件初始化
+	if file == nil {
+		file = excelize.NewFile()
+	}
+	if i == 1 {
+		//设置表名
+		file.SetSheetName(fmt.Sprintf("Sheet%d", i), sheet)
+		//创建流式写入
+		writer, err := file.NewStreamWriter(sheet)
+		logx.Error(err)
+		// 定义每个 Excel 文件的数据列数限制
+		writer.SetRow("A1", key)
+		return writer, file
+	} else {
+		file.NewSheet(sheet)
+		//创建流式写入
+		writer, err := file.NewStreamWriter(sheet)
+		logx.Error(err)
+		// 定义每个 Excel 文件的数据列数限制
+		writer.SetRow("A1", key)
+		return writer, file
+	}
+
+}
+
 // 发送邮箱
 func sendMail(title, target_mail string, path string) bool {
 	mailStr := "<html lang=\"en\">\n<head>\n    <meta charset=\"UTF-8\">\n    <title>铁塔全量%s数据导出</title>\n</head>\n<body>\n<div>\n    <p>铁塔全量%s数据已导出成功,导出时间:%s,请点击链接下载数据:<a href=\"%s\">%s</a></p>\n  </div>\n</body>"
@@ -256,26 +285,34 @@ func compressFiles(filePattern []string, path, timeStr string) {
 
 // 数据导出(通用)
 func (e *ExportByDbReq) ExportDataByDb() []byte {
-	key := hName(e.Query)
-	log.Println("", key)
+
+	stype := "public"
+
+	var writer *excelize.StreamWriter
+	var file *excelize.File
+
 	timeStr := time.Now().Format("20060102150405")
 	rand.Seed(time.Now().UnixNano())
 	randomInt := rand.Intn(10000) // 生成0到9999之间的随机整数
 	timeStr = fmt.Sprintf("%s%s", timeStr, gconv.String(randomInt))
-	stype := e.Stype
-	if stype == "" {
-		stype = "public"
-	}
 	path1 := fmt.Sprintf("%s/%s", ComFileDir, stype)
-	pathArr := exportA(e.Query, path1, timeStr, key)
+
+	var pathArr []string
+	for i, data := range e.Datas {
+		key := hName(data.Sql)
+		sheet := data.SheetName
+		writer, file = InirWrite1(i+1, sheet, key, file)
+
+		exportA(data.Sql, key, writer)
+	}
+	fpath := ""
+	writer, file, fpath = WarehousingA(writer, file, path1, timeStr, e.FileName)
+	pathArr = append(pathArr, fpath)
 	if len(pathArr) > 0 {
-		//folderPath := fmt.Sprintf("%s/%s", path1, timeStr)
-		//compressFiles(pathArr, folderPath, timeStr)
-		//pathstr := fmt.Sprintf("%s/%s/%s/%s.zip", ComFileUrl, stype, timeStr, timeStr)
 		var files []string
 		for _, s := range pathArr {
 			ss := strings.Split(s, "/")
-			files = append(files, fmt.Sprintf("%s/%s/%s/%s", ComFileUrl, stype, timeStr, ss[len(ss)-1]))
+			files = append(files, fmt.Sprintf("%s/%s/%s/%s.xlsx", ComFileUrl, stype, timeStr, ss[len(ss)-1]))
 		}
 		state := sendMailA(e.Title, e.Mails, e.Content, strings.Join(files, ","))
 		BiService.Insert("export_record", map[string]interface{}{
@@ -293,6 +330,9 @@ func (e *ExportByDbReq) ExportDataByDb() []byte {
 
 // 表头
 func hName(sql string) []interface{} {
+	if reg1.MatchString(sql) && !reg2.MatchString(sql) {
+		return []interface{}{}
+	}
 	var key []interface{}
 	s := strings.Split(strings.ToLower(sql), "from")
 	keystr := strings.ReplaceAll(s[0], "select", "")
@@ -307,33 +347,40 @@ func hName(sql string) []interface{} {
 			}
 		}
 	}
-	return key
+	if key != nil {
+		return key
+	} else {
+		return []interface{}{}
+	}
 }
 
 // 导出开始
-func exportA(sql, path, timeStr string, key []interface{}) []string {
-	pathArr := []string{}
-	fileCounter := 1
-	writer, file := InirWrite(key)
+func exportA(sql string, key []interface{}, writer *excelize.StreamWriter) {
 	a := 0
-	fpath := ""
 	JyBiTidb.SelectByBath(1, func(l *[]map[string]interface{}) bool {
-		if a%ExportCount == 0 && a > 0 {
-			a = 0
-			//入excel处理
-			writer, file, fpath = Warehousing(writer, file, fileCounter, key, path, timeStr)
-			fileCounter++
-			pathArr = append(pathArr, fpath)
-		}
 		dataHandle(writer, l, a+1, common.ObjArrToStringArr(key))
 		a++
 		return true
 	}, sql)
-	if a > 0 && a != ExportCount {
-		writer, file, fpath = Warehousing(writer, file, fileCounter, key, path, timeStr)
-		pathArr = append(pathArr, fpath)
+}
+
+func WarehousingA(writer *excelize.StreamWriter, file *excelize.File, path, timeStr, fileName string) (*excelize.StreamWriter, *excelize.File, string) {
+	writer.Flush()
+	folderPath := fmt.Sprintf("%s/%s", path, timeStr)
+	_, err := os.Stat(folderPath)
+	if os.IsNotExist(err) {
+		//创建文件夹
+		err := os.MkdirAll(folderPath, os.ModePerm)
+		if err != nil {
+			logx.Info("创建文件夹失败:", err)
+		}
 	}
-	return pathArr
+	f := fmt.Sprintf("%s/%s.xlsx", folderPath, fileName)
+	err = file.SaveAs(f)
+	if err != nil {
+		logx.Info(err)
+	}
+	return writer, file, fileName
 }
 
 func sendMailA(title, target_mail, content string, path string) bool {