Browse Source

Merge branch 'master' of https://git.i2edu.net/i2/i2-bill-erp

2637309949 4 years ago
parent
commit
235f0307d2

+ 21 - 17
internal/logic/get_erp_active_logic.go

@@ -2,6 +2,7 @@ package logic
 
 import (
 	"context"
+	"git.i2edu.net/i2/i2-bill-erp/utils"
 
 	"git.i2edu.net/i2/i2-bill-erp/internal/svc"
 	"git.i2edu.net/i2/i2-bill-erp/transform"
@@ -29,29 +30,32 @@ func (l *GetErpActiveLogic) GetErpActive(in *transform.GetErpActiveReq) (*transf
 		MaName   string `json:"ma_name"`
 		ActiveId int64  `json:"active_id"`
 	}
-	acts := new([]*Active)
+	//acts := new([]*Active)
 	actives := new([]*transform.Active)
-	sql := `
-		select
-    		act.id active_id,act.ma_name
-		from
-    		mkt_activity act
-		left join
-    		mkt_activities_school act_sch
-		on
-    		act.id = act_sch.ma_id
-		where
-    		act.del_flag = 0
-    		and act_sch.school_id = ?  `
-	err := l.svcCtx.DB.SQL(sql, in.SchId).Find(acts)
+	var parmas = make(map[string]interface{})
+	parmas["school_id"] = in.SchId
+	//sql := `
+	//	select
+	//		act.id active_id,act.ma_name
+	//	from
+	//		mkt_activity act
+	//	left join
+	//		mkt_activities_school act_sch
+	//	on
+	//		act.id = act_sch.ma_id
+	//	where
+	//		act.del_flag = 0
+	//		and act_sch.school_id = ?  `
+	result, err := utils.AllSearch(l.svcCtx.DB, "mkt_activity", "all", "mkt_activity", parmas)
+	//err := l.svcCtx.DB.SQL(sql, in.SchId).Find(acts)
 	if err != nil {
 		logx.Error(err.Error())
 		return nil, err
 	}
-	for _, act := range *acts {
+	for _, act := range result {
 		active := new(transform.Active)
-		active.MaName = act.MaName
-		active.ActiveId = act.ActiveId
+		active.MaName = act["ma_name"].(string)
+		active.ActiveId = act["active_id"].(int64)
 		*actives = append(*actives, active)
 	}
 	return &transform.GetErpActiveRes{Active: *actives}, nil

+ 24 - 21
internal/logic/get_erp_organ_sch_per_by_user_id_logic.go

@@ -4,6 +4,7 @@ import (
 	"context"
 	"git.i2edu.net/i2/i2-bill-erp/internal/svc"
 	"git.i2edu.net/i2/i2-bill-erp/transform"
+	"git.i2edu.net/i2/i2-bill-erp/utils"
 
 	"git.i2edu.net/i2/go-zero/core/logx"
 )
@@ -30,33 +31,35 @@ func (l *GetErpOrganSchPerByUserIdLogic) GetErpOrganSchPerByUserId(in *transform
 		OrganId int64  `json:"organ_id"`
 		Id      int64  `json:"id"`
 	}
-	sch := new([]*Sch)
 	schools := new([]*transform.OrganSchool)
-	sql := `
-		SELECT
-    		sch.name,sch.organ_id,sch.id
-		FROM
-    		base_organ_school sch
-		INNER JOIN
-    		base_user_organ_school user_sch
-		ON
-    		sch.id= user_sch.os_id
-		WHERE
-    		sch.del_flag = 0
-    		and user_sch.del_flag = 0
-		    and onoff =98
-    		and user_sch.user_id = ?
-	`
-	err := l.svcCtx.DB.SQL(sql, in.UserId).Find(sch)
+	//sql := `
+	//	SELECT
+	//		sch.name,sch.organ_id,sch.id
+	//	FROM
+	//		base_organ_school sch
+	//	INNER JOIN
+	//		base_user_organ_school user_sch
+	//	ON
+	//		sch.id= user_sch.os_id
+	//	WHERE
+	//		sch.del_flag = 0
+	//		and user_sch.del_flag = 0
+	//	    and onoff =98
+	//		and user_sch.user_id = ?
+	//`
+	var params = make(map[string]interface{})
+	params["user_id"] = in.UserId
+	res, err := utils.AllSearch(l.svcCtx.DB, "base_organ_school", "all", "base_organ_school", params)
+	//err := l.svcCtx.DB.SQL(sql, in.UserId).Find(sch)
 	if err != nil {
 		logx.Error(err.Error())
 		return nil, err
 	}
-	for _, s := range *sch {
+	for _, s := range res {
 		school := new(transform.OrganSchool)
-		school.Id = s.Id
-		school.Name = s.Name
-		school.OrganId = s.OrganId
+		school.Id = s["id"].(int64)
+		school.Name = s["name"].(string)
+		school.OrganId = s["organ_id"].(int64)
 		*schools = append(*schools, school)
 	}
 	return &transform.GetErpOrganSchPerByUserIdRes{School: *schools}, nil

+ 36 - 0
internal/logic/get_erp_organ_sch_tree_logic.go

@@ -0,0 +1,36 @@
+package logic
+
+import (
+	"context"
+	"git.i2edu.net/i2/i2-bill-erp/utils"
+
+	"git.i2edu.net/i2/i2-bill-erp/internal/svc"
+	"git.i2edu.net/i2/i2-bill-erp/transform"
+
+	"github.com/tal-tech/go-zero/core/logx"
+)
+
+type GetErpOrganSchTreeLogic struct {
+	ctx    context.Context
+	svcCtx *svc.ServiceContext
+	logx.Logger
+}
+
+func NewGetErpOrganSchTreeLogic(ctx context.Context, svcCtx *svc.ServiceContext) *GetErpOrganSchTreeLogic {
+	return &GetErpOrganSchTreeLogic{
+		ctx:    ctx,
+		svcCtx: svcCtx,
+		Logger: logx.WithContext(ctx),
+	}
+}
+
+// 获取erp 省、城、校区
+func (l *GetErpOrganSchTreeLogic) GetErpOrganSchTree(in *transform.Empty) (*transform.TreeNodes, error) {
+	// todo: add your logic here and delete this line
+	res, err := utils.TreeSearch(l.svcCtx.DB, "base_organ_school", "tree", "", nil)
+
+	if err != nil {
+		return nil, err
+	}
+	return &transform.TreeNodes{Nodes: res}, err
+}

+ 15 - 6
internal/logic/get_erp_role_logic.go

@@ -3,7 +3,7 @@ package logic
 import (
 	"context"
 	"errors"
-
+	"fmt"
 	"git.i2edu.net/i2/i2-bill-erp/internal/svc"
 	"git.i2edu.net/i2/i2-bill-erp/transform"
 
@@ -27,8 +27,8 @@ func NewGetErpRoleLogic(ctx context.Context, svcCtx *svc.ServiceContext) *GetErp
 // 获取 erp 用户角色
 func (l *GetErpRoleLogic) GetErpRole(in *transform.GetErpRoleReq) (*transform.GetErpRoleRes, error) {
 	// todo: add your logic here and delete this line
-	if in.Mobile == "" {
-		return nil, errors.New("mobile is empty")
+	if in.Mobile == "" && in.UserId == "" {
+		return nil, errors.New("mobile and user_id is empty")
 	}
 	sql := `select  
 			sys_user.id user_id,GROUP_CONCAT(sys_role.code)  role
@@ -38,13 +38,22 @@ func (l *GetErpRoleLogic) GetErpRole(in *transform.GetErpRoleReq) (*transform.Ge
 			sys_user_role on sys_user.id=sys_user_role.user_id  
 		  LEFT JOIN  sys_role on sys_user_role.role_id= sys_role.id   
 		  where 
-			 sys_user.mobile = ? GROUP BY sys_user.mobile`
-	result, err := l.svcCtx.DB.SQL(sql, in.Mobile).Query().List()
+			sys_user_role.del_flag =0 and sys_user.status = 0 %s  GROUP BY sys_user.mobile`
+	var args string
+	if in.Mobile != "" {
+		args = in.Mobile
+		sql = fmt.Sprintf(sql, " and sys_user.mobile = ? ")
+	}
+	if in.UserId != "" {
+		args = in.UserId
+		sql = fmt.Sprintf(sql, " and sys_user.id = ? ")
+	}
+	result, err := l.svcCtx.DB.SQL(sql, args).Query().List()
 	if err != nil {
 		return nil, err
 	}
 	if len(result) == 0 {
-		return nil, nil
+		return &transform.GetErpRoleRes{}, nil
 	}
 	user_id, _ := result[0]["user_id"].(string)
 	role, _ := result[0]["role"].(string)

+ 6 - 0
internal/server/transform_server.go

@@ -98,3 +98,9 @@ func (s *TransformServer) GetErpActive(ctx context.Context, in *transform.GetErp
 	l := logic.NewGetErpActiveLogic(ctx, s.svcCtx)
 	return l.GetErpActive(in)
 }
+
+// 获取erp 省、城、校区
+func (s *TransformServer) GetErpOrganSchTree(ctx context.Context, in *transform.Empty) (*transform.TreeNodes, error) {
+	l := logic.NewGetErpOrganSchTreeLogic(ctx, s.svcCtx)
+	return l.GetErpOrganSchTree(in)
+}

+ 13 - 0
sqlconfig/mkt_activity/mkt_activity_all_select.tpl

@@ -0,0 +1,13 @@
+select
+    act.id active_id,act.ma_name
+from
+    mkt_activity act
+left join
+    mkt_activities_school act_sch
+on
+    act.id = act_sch.ma_id
+where
+    {{if .school_id }}
+        act.del_flag = 0
+        and  act_sch.school_id = '{{.school_id}}'
+    {{end}}

+ 0 - 13
sqlconfig/mkt_activity_all.tpl

@@ -1,13 +0,0 @@
-select
-    *
-from
-    mkt_activity act
-left join
-    mkt_activities_school act_sch
-on
-    act.id = act_sch.ma_id
-where
-    act.del_flag = 0
-    {{if ne .school_id ""}}
-    act_sch.school_id = '{{.school_id}}'
-    {{end}}

+ 5 - 4
sqlconfig/base_organ_school_permission_select.tpl → sqlconfig/organ_school/base_organ_school_all_select.tpl

@@ -1,7 +1,8 @@
 SELECT
-    *
+    sch.name,sch.organ_id,sch.id
 FROM
     base_organ_school sch
+{{if .user_id }}
 INNER JOIN
     base_user_organ_school user_sch
 ON
@@ -9,6 +10,6 @@ ON
 WHERE
     sch.del_flag = 0
     and user_sch.del_flag = 0
-    {{if ne .user_id ""}}
-    and user_sch.user_id = '{{.user_id}}'
-    {{end}}
+    and onoff =98
+    and user_sch.user_id = {{.user_id}}
+{{end}}

+ 30 - 0
sqlconfig/organ_school/base_organ_school_tree.tpl

@@ -0,0 +1,30 @@
+SELECT * FROM (
+    SELECT
+        id,
+        name,
+        organ_id + 20000 parent
+    FROM
+        base_organ_school
+WHERE
+        del_flag = 0 and onoff != 99
+UNION
+    SELECT
+        DISTINCT base_organ.id  + 20000 id,
+    name,
+        CASE WHEN base_organ.parent != 0 THEN base_organ.parent + 20000 END parent
+    FROM
+        base_organ
+JOIN (
+    SELECT
+        organ_id,
+        parent,
+        base_organ.inheritance
+    FROM
+        base_organ_school, base_organ
+    WHERE
+        base_organ_school.del_flag = 0
+) base_organ_school ON base_organ.id IN (base_organ_school.organ_id, base_organ_school.parent) OR base_organ_school.inheritance like concat('%|', base_organ.id, '|%')
+WHERE
+    del_flag = 0
+)os_tree
+ORDER BY parent,id

+ 2 - 0
transform.proto

@@ -193,4 +193,6 @@ service Transform {
   rpc GetErpSchool(Empty)  returns(GetErpSchoolRes);
   //获取 erp 活动
   rpc GetErpActive(GetErpActiveReq) returns(GetErpActiveRes);
+  //获取erp 省、城、校区
+  rpc GetErpOrganSchTree(Empty) returns(TreeNodes);
 }

+ 118 - 80
transform/transform.pb.go

@@ -1618,86 +1618,86 @@ func init() {
 func init() { proto.RegisterFile("transform.proto", fileDescriptor_cb4a498eeb2ba07d) }
 
 var fileDescriptor_cb4a498eeb2ba07d = []byte{
-	// 1255 bytes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79, 0x03, 0xcd, 0x0e, 0x93, 0xc5, 0x73,
-	0x6f, 0x75, 0xf6, 0x48, 0x9e, 0xf4, 0x30, 0x31, 0xd5, 0x77, 0x00, 0x3a, 0x4c, 0x9a, 0x79, 0x48,
-	0x9e, 0xcf, 0x9a, 0x91, 0xb7, 0xde, 0x4c, 0x36, 0x6e, 0x84, 0xe6, 0x39, 0x17, 0x32, 0x5f, 0x49,
-	0x13, 0xe0, 0x5b, 0x4b, 0xd8, 0x9b, 0xcd, 0xc7, 0x11, 0x6d, 0xba, 0xa4, 0x80, 0xe0, 0xf9, 0xd4,
-	0x4d, 0xb1, 0x3e, 0x3d, 0x32, 0x0d, 0x00, 0x39, 0x83, 0x67, 0x1d, 0x26, 0x27, 0xab, 0x8d, 0xac,
-	0x3d, 0x50, 0x88, 0xb7, 0xde, 0x43, 0x52, 0x41, 0x0e, 0xc1, 0xd3, 0xe9, 0x9c, 0xdc, 0xc8, 0x53,
-	0x26, 0x7f, 0xe6, 0xd9, 0xcd, 0x21, 0x93, 0x41, 0x14, 0xff, 0xab, 0xaf, 0x3a, 0x80, 0x17, 0x73,
-	0xa7, 0x20, 0xf9, 0xde, 0x32, 0x79, 0x68, 0xc8, 0x7a, 0x8f, 0x54, 0xc4, 0x0a, 0x80, 0x62, 0xde,
-	0x93, 0xd6, 0x94, 0x99, 0x59, 0x03, 0xde, 0x3c, 0x09, 0x7e, 0x85, 0xa6, 0x3d, 0x18, 0x67, 0x5c,
-	0xd4, 0x9b, 0xb2, 0x2d, 0x66, 0xe8, 0xdb, 0xdc, 0xda, 0x4c, 0xac, 0x69, 0xdd, 0xf1, 0xb0, 0xf4,
-	0xe6, 0xcb, 0xc4, 0xfb, 0x8a, 0xfa, 0xbd, 0x7c, 0xf9, 0x4f, 0x00, 0x00, 0x00, 0xff, 0xff, 0x2f,
-	0xf8, 0xc5, 0xaf, 0x71, 0x0e, 0x00, 0x00,
+	// 1262 bytes of a gzipped FileDescriptorProto
+	0x1f, 0x8b, 0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 0xec, 0x91, 0x3c, 0xe9, 0x61, 0x62, 0xaa, 0xef, 0x00, 0x74, 0x98, 0x34, 0xf3,
+	0x90, 0x3c, 0x9f, 0x35, 0x23, 0x6f, 0xbd, 0x99, 0x6c, 0xdc, 0x08, 0xcd, 0x73, 0x2e, 0x64, 0xbe,
+	0x92, 0x26, 0xc0, 0xb7, 0x96, 0xb0, 0x37, 0x9b, 0x8f, 0x23, 0xda, 0x74, 0x49, 0x01, 0xc1, 0xf3,
+	0xa9, 0x9b, 0x62, 0x7d, 0x7a, 0x64, 0x1a, 0x00, 0x72, 0x06, 0xcf, 0x3a, 0x4c, 0x4e, 0x56, 0x1b,
+	0x59, 0x7b, 0xa0, 0x10, 0x6f, 0xbd, 0x87, 0xa4, 0x82, 0x1c, 0x82, 0xa7, 0xd3, 0x39, 0xb9, 0x91,
+	0xa7, 0x4c, 0xfe, 0xcc, 0xb3, 0x9b, 0x43, 0x26, 0x83, 0x28, 0xfe, 0xac, 0xaf, 0x3a, 0x80, 0x17,
+	0x73, 0xa7, 0x20, 0xf9, 0xde, 0x32, 0x79, 0x68, 0xc8, 0x7a, 0x8f, 0x54, 0xc4, 0x0a, 0x80, 0x62,
+	0xde, 0x93, 0xd6, 0x94, 0x99, 0x59, 0x03, 0xde, 0x3c, 0x09, 0x7e, 0x85, 0xa6, 0x3d, 0x18, 0x67,
+	0x5c, 0xd4, 0x9b, 0xb2, 0x2d, 0x66, 0xe8, 0xdb, 0xdc, 0xda, 0x4c, 0xac, 0x69, 0xdd, 0xf1, 0xb0,
+	0xf4, 0xe6, 0xcb, 0x30, 0x0b, 0x32, 0x79, 0xcf, 0xcf, 0x01, 0xfd, 0x7d, 0x45, 0xfd, 0x9c, 0xbe,
+	0xfc, 0x27, 0x00, 0x00, 0xff, 0xff, 0x7b, 0x28, 0xd9, 0x8c, 0xaf, 0x0e, 0x00, 0x00,
 }
 
 // Reference imports to suppress errors if they are not otherwise used.
@@ -1734,6 +1734,8 @@ type TransformClient interface {
 	GetErpSchool(ctx context.Context, in *Empty, opts ...grpc.CallOption) (*GetErpSchoolRes, error)
 	//获取 erp 活动
 	GetErpActive(ctx context.Context, in *GetErpActiveReq, opts ...grpc.CallOption) (*GetErpActiveRes, error)
+	//获取erp 省、城、校区
+	GetErpOrganSchTree(ctx context.Context, in *Empty, opts ...grpc.CallOption) (*TreeNodes, error)
 }
 
 type transformClient struct {
@@ -1870,6 +1872,15 @@ func (c *transformClient) GetErpActive(ctx context.Context, in *GetErpActiveReq,
 	return out, nil
 }
 
+func (c *transformClient) GetErpOrganSchTree(ctx context.Context, in *Empty, opts ...grpc.CallOption) (*TreeNodes, error) {
+	out := new(TreeNodes)
+	err := c.cc.Invoke(ctx, "/transform.Transform/GetErpOrganSchTree", in, out, opts...)
+	if err != nil {
+		return nil, err
+	}
+	return out, nil
+}
+
 // TransformServer is the server API for Transform service.
 type TransformServer interface {
 	GetUser(context.Context, *UserRequest) (*UserResponse, error)
@@ -1894,6 +1905,8 @@ type TransformServer interface {
 	GetErpSchool(context.Context, *Empty) (*GetErpSchoolRes, error)
 	//获取 erp 活动
 	GetErpActive(context.Context, *GetErpActiveReq) (*GetErpActiveRes, error)
+	//获取erp 省、城、校区
+	GetErpOrganSchTree(context.Context, *Empty) (*TreeNodes, error)
 }
 
 // UnimplementedTransformServer can be embedded to have forward compatible implementations.
@@ -1942,6 +1955,9 @@ func (*UnimplementedTransformServer) GetErpSchool(ctx context.Context, req *Empt
 func (*UnimplementedTransformServer) GetErpActive(ctx context.Context, req *GetErpActiveReq) (*GetErpActiveRes, error) {
 	return nil, status.Errorf(codes.Unimplemented, "method GetErpActive not implemented")
 }
+func (*UnimplementedTransformServer) GetErpOrganSchTree(ctx context.Context, req *Empty) (*TreeNodes, error) {
+	return nil, status.Errorf(codes.Unimplemented, "method GetErpOrganSchTree not implemented")
+}
 
 func RegisterTransformServer(s *grpc.Server, srv TransformServer) {
 	s.RegisterService(&_Transform_serviceDesc, srv)
@@ -2199,6 +2215,24 @@ func _Transform_GetErpActive_Handler(srv interface{}, ctx context.Context, dec f
 	return interceptor(ctx, in, info, handler)
 }
 
+func _Transform_GetErpOrganSchTree_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
+	in := new(Empty)
+	if err := dec(in); err != nil {
+		return nil, err
+	}
+	if interceptor == nil {
+		return srv.(TransformServer).GetErpOrganSchTree(ctx, in)
+	}
+	info := &grpc.UnaryServerInfo{
+		Server:     srv,
+		FullMethod: "/transform.Transform/GetErpOrganSchTree",
+	}
+	handler := func(ctx context.Context, req interface{}) (interface{}, error) {
+		return srv.(TransformServer).GetErpOrganSchTree(ctx, req.(*Empty))
+	}
+	return interceptor(ctx, in, info, handler)
+}
+
 var _Transform_serviceDesc = grpc.ServiceDesc{
 	ServiceName: "transform.Transform",
 	HandlerType: (*TransformServer)(nil),
@@ -2259,6 +2293,10 @@ var _Transform_serviceDesc = grpc.ServiceDesc{
 			MethodName: "GetErpActive",
 			Handler:    _Transform_GetErpActive_Handler,
 		},
+		{
+			MethodName: "GetErpOrganSchTree",
+			Handler:    _Transform_GetErpOrganSchTree_Handler,
+		},
 	},
 	Streams:  []grpc.StreamDesc{},
 	Metadata: "transform.proto",

+ 34 - 26
transformclient/transform.go

@@ -14,39 +14,39 @@ import (
 )
 
 type (
-	GetErpOrganSchPerByUserIdRes = transform.GetErpOrganSchPerByUserIdRes
-	Active                       = transform.Active
+	GetErpActiveRes              = transform.GetErpActiveRes
+	UserResponse                 = transform.UserResponse
+	BytesResp                    = transform.BytesResp
+	GetErpSchoolRes              = transform.GetErpSchoolRes
+	OptionsetRes                 = transform.OptionsetRes
+	DataPermissionReq            = transform.DataPermissionReq
+	CityIdsReq                   = transform.CityIdsReq
+	OrganSchool                  = transform.OrganSchool
+	GetErpActiveReq              = transform.GetErpActiveReq
+	DataPermissionRes            = transform.DataPermissionRes
+	Empty                        = transform.Empty
+	TreeNodes                    = transform.TreeNodes
 	Options                      = transform.Options
-	ExcelLogRes                  = transform.ExcelLogRes
-	SchoolIdsReq                 = transform.SchoolIdsReq
+	CityIdsRes                   = transform.CityIdsRes
+	TreeNode                     = transform.TreeNode
+	OptionsetReq                 = transform.OptionsetReq
 	ListOfInt                    = transform.ListOfInt
-	TokenRequest                 = transform.TokenRequest
+	Tag                          = transform.Tag
+	ExcelLogReq                  = transform.ExcelLogReq
+	Active                       = transform.Active
 	TokenResponse                = transform.TokenResponse
-	OptionsetRes                 = transform.OptionsetRes
+	ResponseByte                 = transform.ResponseByte
 	SchoolIdsRes                 = transform.SchoolIdsRes
-	BytesResp                    = transform.BytesResp
-	Empty                        = transform.Empty
-	TreeNode                     = transform.TreeNode
-	BytesReq                     = transform.BytesReq
-	GetErpActiveReq              = transform.GetErpActiveReq
+	GetErpOrganSchPerByUserIdReq = transform.GetErpOrganSchPerByUserIdReq
 	OptionCode                   = transform.OptionCode
-	CityIdsRes                   = transform.CityIdsRes
-	CityIdsReq                   = transform.CityIdsReq
+	SchoolIdsReq                 = transform.SchoolIdsReq
+	GetErpRoleReq                = transform.GetErpRoleReq
+	BytesReq                     = transform.BytesReq
 	GetErpRoleRes                = transform.GetErpRoleRes
-	GetErpSchoolRes              = transform.GetErpSchoolRes
-	DataPermissionReq            = transform.DataPermissionReq
-	UserResponse                 = transform.UserResponse
-	Tag                          = transform.Tag
+	GetErpOrganSchPerByUserIdRes = transform.GetErpOrganSchPerByUserIdRes
 	UserRequest                  = transform.UserRequest
-	ResponseByte                 = transform.ResponseByte
-	GetErpRoleReq                = transform.GetErpRoleReq
-	GetErpOrganSchPerByUserIdReq = transform.GetErpOrganSchPerByUserIdReq
-	OrganSchool                  = transform.OrganSchool
-	GetErpActiveRes              = transform.GetErpActiveRes
-	OptionsetReq                 = transform.OptionsetReq
-	ExcelLogReq                  = transform.ExcelLogReq
-	TreeNodes                    = transform.TreeNodes
-	DataPermissionRes            = transform.DataPermissionRes
+	TokenRequest                 = transform.TokenRequest
+	ExcelLogRes                  = transform.ExcelLogRes
 
 	Transform interface {
 		GetUser(ctx context.Context, in *UserRequest) (*UserResponse, error)
@@ -71,6 +71,8 @@ type (
 		GetErpSchool(ctx context.Context, in *Empty) (*GetErpSchoolRes, error)
 		// 获取 erp 活动
 		GetErpActive(ctx context.Context, in *GetErpActiveReq) (*GetErpActiveRes, error)
+		// 获取erp 省、城、校区
+		GetErpOrganSchTree(ctx context.Context, in *Empty) (*TreeNodes, error)
 	}
 
 	defaultTransform struct {
@@ -161,3 +163,9 @@ func (m *defaultTransform) GetErpActive(ctx context.Context, in *GetErpActiveReq
 	client := transform.NewTransformClient(m.cli.Conn())
 	return client.GetErpActive(ctx, in)
 }
+
+// 获取erp 省、城、校区
+func (m *defaultTransform) GetErpOrganSchTree(ctx context.Context, in *Empty) (*TreeNodes, error) {
+	client := transform.NewTransformClient(m.cli.Conn())
+	return client.GetErpOrganSchTree(ctx, in)
+}

+ 39 - 0
utils/build_tree.go

@@ -2,9 +2,37 @@ package utils
 
 import (
 	"container/list"
+	"fmt"
+
 	"git.i2edu.net/i2/i2-bill-erp/transform"
+
+	"github.com/xormplus/xorm"
 )
 
+func TreeSearch(engine *xorm.Engine, controllername string, apiname string, tableName string, paramMap map[string]interface{}) ([]*transform.TreeNode, error) {
+	stplkey := fmt.Sprintf("%s_%s.tpl", controllername, apiname)
+	result, err := engine.SqlTemplateClient(stplkey, &paramMap).Query().List()
+	if err != nil {
+		fmt.Println(err)
+		return nil, err
+	}
+
+	var nodes = new([]*transform.TreeNode)
+
+	if err != nil {
+		return nil, err
+	}
+	for _, n := range result {
+		fmt.Printf("++++++++%T\n", n["parent"])
+		node := new(transform.TreeNode)
+		node.Id = n["id"].(int64)
+		node.Parent, _ = n["parent"].(int64)
+		node.Text = n["name"].(string)
+		*nodes = append(*nodes, node)
+	}
+	return BuildTree(nodes)
+}
+
 func BuildTree(nodes *[]*transform.TreeNode) ([]*transform.TreeNode, error) {
 	originNodeList := list.New()
 	treeNodeList := list.New()
@@ -39,3 +67,14 @@ func BuildTree(nodes *[]*transform.TreeNode) ([]*transform.TreeNode, error) {
 	}
 	return rootArr, nil
 }
+
+func SqlTemplateSearch(engine *xorm.Engine, controllername string, apiname string, tableName string, paramMap map[string]interface{}) ([]map[string]interface{}, error) {
+	stplkey := fmt.Sprintf("%s_%s.tpl", controllername, apiname)
+	result, err := engine.SqlTemplateClient(stplkey, &paramMap).Query().List()
+	if err != nil {
+		fmt.Println(err)
+		return nil, err
+	}
+	return result, nil
+
+}

+ 16 - 0
utils/page_utils.go

@@ -0,0 +1,16 @@
+package utils
+
+import (
+	"fmt"
+	"github.com/xormplus/xorm"
+)
+
+func AllSearch(db *xorm.Engine, controllername string, apiname string, tableName string, params map[string]interface{}) ([]map[string]interface{}, error) {
+	stplkey := fmt.Sprintf("%s_%s_select.tpl", controllername, apiname)
+	result, err := db.SqlTemplateClient(stplkey, &params).Query().List()
+	if err != nil {
+		fmt.Println(err)
+		return nil, err
+	}
+	return result, nil
+}