Browse Source

feat:修改

wangchuanjin 3 năm trước cách đây
mục cha
commit
1c310ec608

+ 9 - 3
public/entity/base_ent_empower.go

@@ -21,8 +21,14 @@ type base_ent_empower struct {
 }
 
 //授权记录
-func (b *base_ent_empower) FindMyEntId(appid, function_code string, ent_id int64) *[]*base_ent_empower {
-	list := Mysql_BaseService.SelectBySql(`select * from base_ent_empower where appid=? and function_code=? and ent_id=?`, appid, function_code, ent_id)
+func (b *base_ent_empower) List(appid, function_code string, ent_id, page_num, page_size int64) *[]*base_ent_empower {
+	q := `select * from base_ent_empower where appid=? and function_code=? and ent_id=? order by id desc`
+	args := []interface{}{appid, function_code, ent_id}
+	if page_num > 0 {
+		q += ` limit ?,?`
+		args = append(args, (page_num-1)*page_size, page_size)
+	}
+	list := Mysql_BaseService.SelectBySql(q, args...)
 	return JsonUnmarshal(list, &[]*base_ent_empower{}).(*[]*base_ent_empower)
 }
 
@@ -33,7 +39,7 @@ func (b *base_ent_empower) Count(appid, function_code string, ent_id int64) int6
 
 //是否授权
 func (b *base_ent_empower) HasEmpower(appid, function_code string, ent_id, ent_user_id int64) bool {
-	empower := b.FindMyEntId(appid, function_code, ent_id)
+	empower := b.List(appid, function_code, ent_id, 0, 0)
 	if empower != nil {
 		if len(*empower) == 1 && (*empower)[0].Ent_user_id == 0 {
 			return true

+ 32 - 0
public/service/power.go

@@ -2,6 +2,7 @@ package service
 
 import (
 	. "bp.jydev.jianyu360.cn/BaseService/resourceCenter/public/entity"
+	"bp.jydev.jianyu360.cn/BaseService/resourceCenter/rpc/pb"
 )
 
 /*
@@ -70,3 +71,34 @@ func CancelEmpower(appid, function_code string, ent_id int64, ent_user_id []int6
 	}
 	return 0
 }
+
+/*
+ * 授权列表
+ * @param appid
+ * @param function_code 功能代码
+ * @param ent_id 企业id
+ * @param page_num 开始页码,小于1的话,返回所有数据,不进行分页
+ * @param page_size 每页大小
+ * @return 总条数,只有第一页的时候才返回, 如果企业下所有人都有权限返回-1
+ * @return 列表,如果企业下所有人都有权限,返回空数组
+ */
+func EmpowerList(appid, function_code string, ent_id, page_num, page_size int64) (int64, []*pb.Empower) {
+	var count int64
+	result := []*pb.Empower{}
+	list := Base_ent_empower.List(appid, function_code, ent_id, page_num, page_size)
+	if list != nil {
+		if len(*list) == 1 && (*list)[0].Ent_user_id == 0 {
+			count = -1
+		} else {
+			for _, v := range *list {
+				result = append(result, &pb.Empower{
+					EntUserId: v.Ent_user_id,
+				})
+			}
+			if page_num == 1 {
+				count = Base_ent_empower.Count(appid, function_code, ent_id)
+			}
+		}
+	}
+	return count, result
+}

+ 6 - 1
public/service/power_test.go

@@ -20,7 +20,7 @@ func init() {
 }
 
 func TestHasPowers(t *testing.T) {
-	t.Log("我的权益", HasPowers("10000", 0, 14184, 4271))
+	t.Log(HasPowers("10000", 0, 14184, 4271))
 }
 
 func TestReEmpower(t *testing.T) {
@@ -31,3 +31,8 @@ func TestReEmpower(t *testing.T) {
 func TestCancelEmpower(t *testing.T) {
 	assert.Equal(t, int64(1), CancelEmpower("10000", "znsj_kf_use", 14184, []int64{4271, 123}))
 }
+
+func TestEmpowerList(t *testing.T) {
+	count, list := EmpowerList("10000", "znsj_kf_use", 14184, 2, 1)
+	t.Log(count, list)
+}

+ 43 - 0
rpc/internal/logic/empowerlistlogic.go

@@ -0,0 +1,43 @@
+package logic
+
+import (
+	"context"
+	"fmt"
+
+	. "bp.jydev.jianyu360.cn/BaseService/resourceCenter/public/service"
+	"bp.jydev.jianyu360.cn/BaseService/resourceCenter/rpc/internal/svc"
+	"bp.jydev.jianyu360.cn/BaseService/resourceCenter/rpc/pb"
+
+	"github.com/zeromicro/go-zero/core/logx"
+)
+
+type EmpowerListLogic struct {
+	ctx    context.Context
+	svcCtx *svc.ServiceContext
+	logx.Logger
+}
+
+func NewEmpowerListLogic(ctx context.Context, svcCtx *svc.ServiceContext) *EmpowerListLogic {
+	return &EmpowerListLogic{
+		ctx:    ctx,
+		svcCtx: svcCtx,
+		Logger: logx.WithContext(ctx),
+	}
+}
+
+// 授权列表
+func (l *EmpowerListLogic) EmpowerList(in *pb.EmpowerListReq) (*pb.EmpowerListResp, error) {
+	resp := &pb.EmpowerListResp{}
+	if in.Appid == "" {
+		l.Error(fmt.Sprintf("%+v", in), "无效的参数appid")
+		return resp, nil
+	} else if in.FunctionCode == "" {
+		l.Error(fmt.Sprintf("%+v", in), "无效的参数function_code")
+		return resp, nil
+	} else if in.EntId == 0 {
+		l.Error(fmt.Sprintf("%+v", in), "无效的参数ent_id")
+		return resp, nil
+	}
+	resp.Count, resp.List = EmpowerList(in.Appid, in.FunctionCode, in.EntId, in.PageNum, in.PageSize)
+	return resp, nil
+}

+ 6 - 0
rpc/internal/server/resourceserver.go

@@ -51,3 +51,9 @@ func (s *ResourceServer) CancelEmpower(ctx context.Context, in *pb.EmpowerReq) (
 	l := logic.NewCancelEmpowerLogic(ctx, s.svcCtx)
 	return l.CancelEmpower(in)
 }
+
+// 授权列表
+func (s *ResourceServer) EmpowerList(ctx context.Context, in *pb.EmpowerListReq) (*pb.EmpowerListResp, error) {
+	l := logic.NewEmpowerListLogic(ctx, s.svcCtx)
+	return l.EmpowerList(in)
+}

+ 334 - 90
rpc/pb/resource.pb.go

@@ -20,6 +20,53 @@ const (
 	_ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20)
 )
 
+type Empower struct {
+	state         protoimpl.MessageState
+	sizeCache     protoimpl.SizeCache
+	unknownFields protoimpl.UnknownFields
+
+	EntUserId int64 `protobuf:"varint,1,opt,name=ent_user_id,json=entUserId,proto3" json:"ent_user_id,omitempty"` //企业用户id
+}
+
+func (x *Empower) Reset() {
+	*x = Empower{}
+	if protoimpl.UnsafeEnabled {
+		mi := &file_resource_proto_msgTypes[0]
+		ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
+		ms.StoreMessageInfo(mi)
+	}
+}
+
+func (x *Empower) String() string {
+	return protoimpl.X.MessageStringOf(x)
+}
+
+func (*Empower) ProtoMessage() {}
+
+func (x *Empower) ProtoReflect() protoreflect.Message {
+	mi := &file_resource_proto_msgTypes[0]
+	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 Empower.ProtoReflect.Descriptor instead.
+func (*Empower) Descriptor() ([]byte, []int) {
+	return file_resource_proto_rawDescGZIP(), []int{0}
+}
+
+func (x *Empower) GetEntUserId() int64 {
+	if x != nil {
+		return x.EntUserId
+	}
+	return 0
+}
+
 type PowerReq struct {
 	state         protoimpl.MessageState
 	sizeCache     protoimpl.SizeCache
@@ -37,7 +84,7 @@ type PowerReq struct {
 func (x *PowerReq) Reset() {
 	*x = PowerReq{}
 	if protoimpl.UnsafeEnabled {
-		mi := &file_resource_proto_msgTypes[0]
+		mi := &file_resource_proto_msgTypes[1]
 		ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
 		ms.StoreMessageInfo(mi)
 	}
@@ -50,7 +97,7 @@ func (x *PowerReq) String() string {
 func (*PowerReq) ProtoMessage() {}
 
 func (x *PowerReq) ProtoReflect() protoreflect.Message {
-	mi := &file_resource_proto_msgTypes[0]
+	mi := &file_resource_proto_msgTypes[1]
 	if protoimpl.UnsafeEnabled && x != nil {
 		ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
 		if ms.LoadMessageInfo() == nil {
@@ -63,7 +110,7 @@ func (x *PowerReq) ProtoReflect() protoreflect.Message {
 
 // Deprecated: Use PowerReq.ProtoReflect.Descriptor instead.
 func (*PowerReq) Descriptor() ([]byte, []int) {
-	return file_resource_proto_rawDescGZIP(), []int{0}
+	return file_resource_proto_rawDescGZIP(), []int{1}
 }
 
 func (x *PowerReq) GetAppid() string {
@@ -130,7 +177,7 @@ type CheckPowerReq struct {
 func (x *CheckPowerReq) Reset() {
 	*x = CheckPowerReq{}
 	if protoimpl.UnsafeEnabled {
-		mi := &file_resource_proto_msgTypes[1]
+		mi := &file_resource_proto_msgTypes[2]
 		ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
 		ms.StoreMessageInfo(mi)
 	}
@@ -143,7 +190,7 @@ func (x *CheckPowerReq) String() string {
 func (*CheckPowerReq) ProtoMessage() {}
 
 func (x *CheckPowerReq) ProtoReflect() protoreflect.Message {
-	mi := &file_resource_proto_msgTypes[1]
+	mi := &file_resource_proto_msgTypes[2]
 	if protoimpl.UnsafeEnabled && x != nil {
 		ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
 		if ms.LoadMessageInfo() == nil {
@@ -156,7 +203,7 @@ func (x *CheckPowerReq) ProtoReflect() protoreflect.Message {
 
 // Deprecated: Use CheckPowerReq.ProtoReflect.Descriptor instead.
 func (*CheckPowerReq) Descriptor() ([]byte, []int) {
-	return file_resource_proto_rawDescGZIP(), []int{1}
+	return file_resource_proto_rawDescGZIP(), []int{2}
 }
 
 func (x *CheckPowerReq) GetAppid() string {
@@ -210,7 +257,7 @@ type DeductionReq struct {
 func (x *DeductionReq) Reset() {
 	*x = DeductionReq{}
 	if protoimpl.UnsafeEnabled {
-		mi := &file_resource_proto_msgTypes[2]
+		mi := &file_resource_proto_msgTypes[3]
 		ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
 		ms.StoreMessageInfo(mi)
 	}
@@ -223,7 +270,7 @@ func (x *DeductionReq) String() string {
 func (*DeductionReq) ProtoMessage() {}
 
 func (x *DeductionReq) ProtoReflect() protoreflect.Message {
-	mi := &file_resource_proto_msgTypes[2]
+	mi := &file_resource_proto_msgTypes[3]
 	if protoimpl.UnsafeEnabled && x != nil {
 		ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
 		if ms.LoadMessageInfo() == nil {
@@ -236,7 +283,7 @@ func (x *DeductionReq) ProtoReflect() protoreflect.Message {
 
 // Deprecated: Use DeductionReq.ProtoReflect.Descriptor instead.
 func (*DeductionReq) Descriptor() ([]byte, []int) {
-	return file_resource_proto_rawDescGZIP(), []int{2}
+	return file_resource_proto_rawDescGZIP(), []int{3}
 }
 
 func (x *DeductionReq) GetAppid() string {
@@ -295,7 +342,7 @@ type EmpowerReq struct {
 func (x *EmpowerReq) Reset() {
 	*x = EmpowerReq{}
 	if protoimpl.UnsafeEnabled {
-		mi := &file_resource_proto_msgTypes[3]
+		mi := &file_resource_proto_msgTypes[4]
 		ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
 		ms.StoreMessageInfo(mi)
 	}
@@ -308,7 +355,7 @@ func (x *EmpowerReq) String() string {
 func (*EmpowerReq) ProtoMessage() {}
 
 func (x *EmpowerReq) ProtoReflect() protoreflect.Message {
-	mi := &file_resource_proto_msgTypes[3]
+	mi := &file_resource_proto_msgTypes[4]
 	if protoimpl.UnsafeEnabled && x != nil {
 		ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
 		if ms.LoadMessageInfo() == nil {
@@ -321,7 +368,7 @@ func (x *EmpowerReq) ProtoReflect() protoreflect.Message {
 
 // Deprecated: Use EmpowerReq.ProtoReflect.Descriptor instead.
 func (*EmpowerReq) Descriptor() ([]byte, []int) {
-	return file_resource_proto_rawDescGZIP(), []int{3}
+	return file_resource_proto_rawDescGZIP(), []int{4}
 }
 
 func (x *EmpowerReq) GetAppid() string {
@@ -352,6 +399,140 @@ func (x *EmpowerReq) GetEntUserId() []int64 {
 	return nil
 }
 
+type EmpowerListReq struct {
+	state         protoimpl.MessageState
+	sizeCache     protoimpl.SizeCache
+	unknownFields protoimpl.UnknownFields
+
+	Appid        string `protobuf:"bytes,1,opt,name=appid,proto3" json:"appid,omitempty"`
+	FunctionCode string `protobuf:"bytes,2,opt,name=function_code,json=functionCode,proto3" json:"function_code,omitempty"` //功能代码
+	EntId        int64  `protobuf:"varint,3,opt,name=ent_id,json=entId,proto3" json:"ent_id,omitempty"`                     //企业id
+	PageNum      int64  `protobuf:"varint,4,opt,name=page_num,json=pageNum,proto3" json:"page_num,omitempty"`               //开始页码,小于1的话,返回所有数据,不进行分页
+	PageSize     int64  `protobuf:"varint,5,opt,name=page_size,json=pageSize,proto3" json:"page_size,omitempty"`            //每页大小
+}
+
+func (x *EmpowerListReq) Reset() {
+	*x = EmpowerListReq{}
+	if protoimpl.UnsafeEnabled {
+		mi := &file_resource_proto_msgTypes[5]
+		ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
+		ms.StoreMessageInfo(mi)
+	}
+}
+
+func (x *EmpowerListReq) String() string {
+	return protoimpl.X.MessageStringOf(x)
+}
+
+func (*EmpowerListReq) ProtoMessage() {}
+
+func (x *EmpowerListReq) ProtoReflect() protoreflect.Message {
+	mi := &file_resource_proto_msgTypes[5]
+	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 EmpowerListReq.ProtoReflect.Descriptor instead.
+func (*EmpowerListReq) Descriptor() ([]byte, []int) {
+	return file_resource_proto_rawDescGZIP(), []int{5}
+}
+
+func (x *EmpowerListReq) GetAppid() string {
+	if x != nil {
+		return x.Appid
+	}
+	return ""
+}
+
+func (x *EmpowerListReq) GetFunctionCode() string {
+	if x != nil {
+		return x.FunctionCode
+	}
+	return ""
+}
+
+func (x *EmpowerListReq) GetEntId() int64 {
+	if x != nil {
+		return x.EntId
+	}
+	return 0
+}
+
+func (x *EmpowerListReq) GetPageNum() int64 {
+	if x != nil {
+		return x.PageNum
+	}
+	return 0
+}
+
+func (x *EmpowerListReq) GetPageSize() int64 {
+	if x != nil {
+		return x.PageSize
+	}
+	return 0
+}
+
+type EmpowerListResp struct {
+	state         protoimpl.MessageState
+	sizeCache     protoimpl.SizeCache
+	unknownFields protoimpl.UnknownFields
+
+	Count int64      `protobuf:"varint,1,opt,name=count,proto3" json:"count,omitempty"` //总条数,只有第一页的时候才返回, 如果企业下所有人都有权限返回-1
+	List  []*Empower `protobuf:"bytes,2,rep,name=list,proto3" json:"list,omitempty"`    //企业用户id,如果企业下所有人都有权限,返回空数组
+}
+
+func (x *EmpowerListResp) Reset() {
+	*x = EmpowerListResp{}
+	if protoimpl.UnsafeEnabled {
+		mi := &file_resource_proto_msgTypes[6]
+		ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
+		ms.StoreMessageInfo(mi)
+	}
+}
+
+func (x *EmpowerListResp) String() string {
+	return protoimpl.X.MessageStringOf(x)
+}
+
+func (*EmpowerListResp) ProtoMessage() {}
+
+func (x *EmpowerListResp) ProtoReflect() protoreflect.Message {
+	mi := &file_resource_proto_msgTypes[6]
+	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 EmpowerListResp.ProtoReflect.Descriptor instead.
+func (*EmpowerListResp) Descriptor() ([]byte, []int) {
+	return file_resource_proto_rawDescGZIP(), []int{6}
+}
+
+func (x *EmpowerListResp) GetCount() int64 {
+	if x != nil {
+		return x.Count
+	}
+	return 0
+}
+
+func (x *EmpowerListResp) GetList() []*Empower {
+	if x != nil {
+		return x.List
+	}
+	return nil
+}
+
 type Resp struct {
 	state         protoimpl.MessageState
 	sizeCache     protoimpl.SizeCache
@@ -363,7 +544,7 @@ type Resp struct {
 func (x *Resp) Reset() {
 	*x = Resp{}
 	if protoimpl.UnsafeEnabled {
-		mi := &file_resource_proto_msgTypes[4]
+		mi := &file_resource_proto_msgTypes[7]
 		ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
 		ms.StoreMessageInfo(mi)
 	}
@@ -376,7 +557,7 @@ func (x *Resp) String() string {
 func (*Resp) ProtoMessage() {}
 
 func (x *Resp) ProtoReflect() protoreflect.Message {
-	mi := &file_resource_proto_msgTypes[4]
+	mi := &file_resource_proto_msgTypes[7]
 	if protoimpl.UnsafeEnabled && x != nil {
 		ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
 		if ms.LoadMessageInfo() == nil {
@@ -389,7 +570,7 @@ func (x *Resp) ProtoReflect() protoreflect.Message {
 
 // Deprecated: Use Resp.ProtoReflect.Descriptor instead.
 func (*Resp) Descriptor() ([]byte, []int) {
-	return file_resource_proto_rawDescGZIP(), []int{4}
+	return file_resource_proto_rawDescGZIP(), []int{7}
 }
 
 func (x *Resp) GetStatus() int64 {
@@ -403,61 +584,82 @@ var File_resource_proto protoreflect.FileDescriptor
 
 var file_resource_proto_rawDesc = []byte{
 	0x0a, 0x0e, 0x72, 0x65, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f,
-	0x22, 0xc0, 0x01, 0x0a, 0x08, 0x50, 0x6f, 0x77, 0x65, 0x72, 0x52, 0x65, 0x71, 0x12, 0x14, 0x0a,
+	0x22, 0x29, 0x0a, 0x07, 0x45, 0x6d, 0x70, 0x6f, 0x77, 0x65, 0x72, 0x12, 0x1e, 0x0a, 0x0b, 0x65,
+	0x6e, 0x74, 0x5f, 0x75, 0x73, 0x65, 0x72, 0x5f, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x03,
+	0x52, 0x09, 0x65, 0x6e, 0x74, 0x55, 0x73, 0x65, 0x72, 0x49, 0x64, 0x22, 0xc0, 0x01, 0x0a, 0x08,
+	0x50, 0x6f, 0x77, 0x65, 0x72, 0x52, 0x65, 0x71, 0x12, 0x14, 0x0a, 0x05, 0x61, 0x70, 0x70, 0x69,
+	0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, 0x61, 0x70, 0x70, 0x69, 0x64, 0x12, 0x1d,
+	0x0a, 0x0a, 0x67, 0x6f, 0x6f, 0x64, 0x73, 0x5f, 0x63, 0x6f, 0x64, 0x65, 0x18, 0x02, 0x20, 0x01,
+	0x28, 0x09, 0x52, 0x09, 0x67, 0x6f, 0x6f, 0x64, 0x73, 0x43, 0x6f, 0x64, 0x65, 0x12, 0x22, 0x0a,
+	0x0d, 0x67, 0x6f, 0x6f, 0x64, 0x73, 0x5f, 0x73, 0x70, 0x65, 0x63, 0x5f, 0x69, 0x64, 0x18, 0x03,
+	0x20, 0x01, 0x28, 0x03, 0x52, 0x0b, 0x67, 0x6f, 0x6f, 0x64, 0x73, 0x53, 0x70, 0x65, 0x63, 0x49,
+	0x64, 0x12, 0x15, 0x0a, 0x06, 0x65, 0x6e, 0x74, 0x5f, 0x69, 0x64, 0x18, 0x04, 0x20, 0x01, 0x28,
+	0x03, 0x52, 0x05, 0x65, 0x6e, 0x74, 0x49, 0x64, 0x12, 0x17, 0x0a, 0x07, 0x75, 0x73, 0x65, 0x72,
+	0x5f, 0x69, 0x64, 0x18, 0x05, 0x20, 0x01, 0x28, 0x03, 0x52, 0x06, 0x75, 0x73, 0x65, 0x72, 0x49,
+	0x64, 0x12, 0x17, 0x0a, 0x07, 0x62, 0x75, 0x79, 0x5f, 0x6e, 0x75, 0x6d, 0x18, 0x06, 0x20, 0x01,
+	0x28, 0x03, 0x52, 0x06, 0x62, 0x75, 0x79, 0x4e, 0x75, 0x6d, 0x12, 0x12, 0x0a, 0x04, 0x74, 0x79,
+	0x70, 0x65, 0x18, 0x07, 0x20, 0x01, 0x28, 0x03, 0x52, 0x04, 0x74, 0x79, 0x70, 0x65, 0x22, 0x9a,
+	0x01, 0x0a, 0x0d, 0x43, 0x68, 0x65, 0x63, 0x6b, 0x50, 0x6f, 0x77, 0x65, 0x72, 0x52, 0x65, 0x71,
+	0x12, 0x14, 0x0a, 0x05, 0x61, 0x70, 0x70, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52,
+	0x05, 0x61, 0x70, 0x70, 0x69, 0x64, 0x12, 0x23, 0x0a, 0x0d, 0x66, 0x75, 0x6e, 0x63, 0x74, 0x69,
+	0x6f, 0x6e, 0x5f, 0x63, 0x6f, 0x64, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0c, 0x66,
+	0x75, 0x6e, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x43, 0x6f, 0x64, 0x65, 0x12, 0x17, 0x0a, 0x07, 0x75,
+	0x73, 0x65, 0x72, 0x5f, 0x69, 0x64, 0x18, 0x03, 0x20, 0x01, 0x28, 0x03, 0x52, 0x06, 0x75, 0x73,
+	0x65, 0x72, 0x49, 0x64, 0x12, 0x15, 0x0a, 0x06, 0x65, 0x6e, 0x74, 0x5f, 0x69, 0x64, 0x18, 0x04,
+	0x20, 0x01, 0x28, 0x03, 0x52, 0x05, 0x65, 0x6e, 0x74, 0x49, 0x64, 0x12, 0x1e, 0x0a, 0x0b, 0x65,
+	0x6e, 0x74, 0x5f, 0x75, 0x73, 0x65, 0x72, 0x5f, 0x69, 0x64, 0x18, 0x05, 0x20, 0x01, 0x28, 0x03,
+	0x52, 0x09, 0x65, 0x6e, 0x74, 0x55, 0x73, 0x65, 0x72, 0x49, 0x64, 0x22, 0xa1, 0x01, 0x0a, 0x0c,
+	0x44, 0x65, 0x64, 0x75, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x65, 0x71, 0x12, 0x14, 0x0a, 0x05,
+	0x61, 0x70, 0x70, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, 0x61, 0x70, 0x70,
+	0x69, 0x64, 0x12, 0x23, 0x0a, 0x0d, 0x66, 0x75, 0x6e, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x5f, 0x63,
+	0x6f, 0x64, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0c, 0x66, 0x75, 0x6e, 0x63, 0x74,
+	0x69, 0x6f, 0x6e, 0x43, 0x6f, 0x64, 0x65, 0x12, 0x15, 0x0a, 0x06, 0x65, 0x6e, 0x74, 0x5f, 0x69,
+	0x64, 0x18, 0x03, 0x20, 0x01, 0x28, 0x03, 0x52, 0x05, 0x65, 0x6e, 0x74, 0x49, 0x64, 0x12, 0x17,
+	0x0a, 0x07, 0x75, 0x73, 0x65, 0x72, 0x5f, 0x69, 0x64, 0x18, 0x04, 0x20, 0x01, 0x28, 0x03, 0x52,
+	0x06, 0x75, 0x73, 0x65, 0x72, 0x49, 0x64, 0x12, 0x14, 0x0a, 0x05, 0x63, 0x6f, 0x75, 0x6e, 0x74,
+	0x18, 0x05, 0x20, 0x01, 0x28, 0x03, 0x52, 0x05, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x12, 0x10, 0x0a,
+	0x03, 0x69, 0x64, 0x73, 0x18, 0x06, 0x20, 0x03, 0x28, 0x09, 0x52, 0x03, 0x69, 0x64, 0x73, 0x22,
+	0x7e, 0x0a, 0x0a, 0x45, 0x6d, 0x70, 0x6f, 0x77, 0x65, 0x72, 0x52, 0x65, 0x71, 0x12, 0x14, 0x0a,
 	0x05, 0x61, 0x70, 0x70, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, 0x61, 0x70,
-	0x70, 0x69, 0x64, 0x12, 0x1d, 0x0a, 0x0a, 0x67, 0x6f, 0x6f, 0x64, 0x73, 0x5f, 0x63, 0x6f, 0x64,
-	0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x09, 0x67, 0x6f, 0x6f, 0x64, 0x73, 0x43, 0x6f,
-	0x64, 0x65, 0x12, 0x22, 0x0a, 0x0d, 0x67, 0x6f, 0x6f, 0x64, 0x73, 0x5f, 0x73, 0x70, 0x65, 0x63,
-	0x5f, 0x69, 0x64, 0x18, 0x03, 0x20, 0x01, 0x28, 0x03, 0x52, 0x0b, 0x67, 0x6f, 0x6f, 0x64, 0x73,
-	0x53, 0x70, 0x65, 0x63, 0x49, 0x64, 0x12, 0x15, 0x0a, 0x06, 0x65, 0x6e, 0x74, 0x5f, 0x69, 0x64,
-	0x18, 0x04, 0x20, 0x01, 0x28, 0x03, 0x52, 0x05, 0x65, 0x6e, 0x74, 0x49, 0x64, 0x12, 0x17, 0x0a,
-	0x07, 0x75, 0x73, 0x65, 0x72, 0x5f, 0x69, 0x64, 0x18, 0x05, 0x20, 0x01, 0x28, 0x03, 0x52, 0x06,
-	0x75, 0x73, 0x65, 0x72, 0x49, 0x64, 0x12, 0x17, 0x0a, 0x07, 0x62, 0x75, 0x79, 0x5f, 0x6e, 0x75,
-	0x6d, 0x18, 0x06, 0x20, 0x01, 0x28, 0x03, 0x52, 0x06, 0x62, 0x75, 0x79, 0x4e, 0x75, 0x6d, 0x12,
-	0x12, 0x0a, 0x04, 0x74, 0x79, 0x70, 0x65, 0x18, 0x07, 0x20, 0x01, 0x28, 0x03, 0x52, 0x04, 0x74,
-	0x79, 0x70, 0x65, 0x22, 0x9a, 0x01, 0x0a, 0x0d, 0x43, 0x68, 0x65, 0x63, 0x6b, 0x50, 0x6f, 0x77,
-	0x65, 0x72, 0x52, 0x65, 0x71, 0x12, 0x14, 0x0a, 0x05, 0x61, 0x70, 0x70, 0x69, 0x64, 0x18, 0x01,
-	0x20, 0x01, 0x28, 0x09, 0x52, 0x05, 0x61, 0x70, 0x70, 0x69, 0x64, 0x12, 0x23, 0x0a, 0x0d, 0x66,
-	0x75, 0x6e, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x5f, 0x63, 0x6f, 0x64, 0x65, 0x18, 0x02, 0x20, 0x01,
-	0x28, 0x09, 0x52, 0x0c, 0x66, 0x75, 0x6e, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x43, 0x6f, 0x64, 0x65,
-	0x12, 0x17, 0x0a, 0x07, 0x75, 0x73, 0x65, 0x72, 0x5f, 0x69, 0x64, 0x18, 0x03, 0x20, 0x01, 0x28,
-	0x03, 0x52, 0x06, 0x75, 0x73, 0x65, 0x72, 0x49, 0x64, 0x12, 0x15, 0x0a, 0x06, 0x65, 0x6e, 0x74,
-	0x5f, 0x69, 0x64, 0x18, 0x04, 0x20, 0x01, 0x28, 0x03, 0x52, 0x05, 0x65, 0x6e, 0x74, 0x49, 0x64,
-	0x12, 0x1e, 0x0a, 0x0b, 0x65, 0x6e, 0x74, 0x5f, 0x75, 0x73, 0x65, 0x72, 0x5f, 0x69, 0x64, 0x18,
-	0x05, 0x20, 0x01, 0x28, 0x03, 0x52, 0x09, 0x65, 0x6e, 0x74, 0x55, 0x73, 0x65, 0x72, 0x49, 0x64,
-	0x22, 0xa1, 0x01, 0x0a, 0x0c, 0x44, 0x65, 0x64, 0x75, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x65,
-	0x71, 0x12, 0x14, 0x0a, 0x05, 0x61, 0x70, 0x70, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09,
-	0x52, 0x05, 0x61, 0x70, 0x70, 0x69, 0x64, 0x12, 0x23, 0x0a, 0x0d, 0x66, 0x75, 0x6e, 0x63, 0x74,
-	0x69, 0x6f, 0x6e, 0x5f, 0x63, 0x6f, 0x64, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0c,
-	0x66, 0x75, 0x6e, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x43, 0x6f, 0x64, 0x65, 0x12, 0x15, 0x0a, 0x06,
-	0x65, 0x6e, 0x74, 0x5f, 0x69, 0x64, 0x18, 0x03, 0x20, 0x01, 0x28, 0x03, 0x52, 0x05, 0x65, 0x6e,
-	0x74, 0x49, 0x64, 0x12, 0x17, 0x0a, 0x07, 0x75, 0x73, 0x65, 0x72, 0x5f, 0x69, 0x64, 0x18, 0x04,
-	0x20, 0x01, 0x28, 0x03, 0x52, 0x06, 0x75, 0x73, 0x65, 0x72, 0x49, 0x64, 0x12, 0x14, 0x0a, 0x05,
-	0x63, 0x6f, 0x75, 0x6e, 0x74, 0x18, 0x05, 0x20, 0x01, 0x28, 0x03, 0x52, 0x05, 0x63, 0x6f, 0x75,
-	0x6e, 0x74, 0x12, 0x10, 0x0a, 0x03, 0x69, 0x64, 0x73, 0x18, 0x06, 0x20, 0x03, 0x28, 0x09, 0x52,
-	0x03, 0x69, 0x64, 0x73, 0x22, 0x7e, 0x0a, 0x0a, 0x45, 0x6d, 0x70, 0x6f, 0x77, 0x65, 0x72, 0x52,
+	0x70, 0x69, 0x64, 0x12, 0x23, 0x0a, 0x0d, 0x66, 0x75, 0x6e, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x5f,
+	0x63, 0x6f, 0x64, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0c, 0x66, 0x75, 0x6e, 0x63,
+	0x74, 0x69, 0x6f, 0x6e, 0x43, 0x6f, 0x64, 0x65, 0x12, 0x15, 0x0a, 0x06, 0x65, 0x6e, 0x74, 0x5f,
+	0x69, 0x64, 0x18, 0x03, 0x20, 0x01, 0x28, 0x03, 0x52, 0x05, 0x65, 0x6e, 0x74, 0x49, 0x64, 0x12,
+	0x1e, 0x0a, 0x0b, 0x65, 0x6e, 0x74, 0x5f, 0x75, 0x73, 0x65, 0x72, 0x5f, 0x69, 0x64, 0x18, 0x04,
+	0x20, 0x03, 0x28, 0x03, 0x52, 0x09, 0x65, 0x6e, 0x74, 0x55, 0x73, 0x65, 0x72, 0x49, 0x64, 0x22,
+	0x9a, 0x01, 0x0a, 0x0e, 0x45, 0x6d, 0x70, 0x6f, 0x77, 0x65, 0x72, 0x4c, 0x69, 0x73, 0x74, 0x52,
 	0x65, 0x71, 0x12, 0x14, 0x0a, 0x05, 0x61, 0x70, 0x70, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28,
 	0x09, 0x52, 0x05, 0x61, 0x70, 0x70, 0x69, 0x64, 0x12, 0x23, 0x0a, 0x0d, 0x66, 0x75, 0x6e, 0x63,
 	0x74, 0x69, 0x6f, 0x6e, 0x5f, 0x63, 0x6f, 0x64, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52,
 	0x0c, 0x66, 0x75, 0x6e, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x43, 0x6f, 0x64, 0x65, 0x12, 0x15, 0x0a,
 	0x06, 0x65, 0x6e, 0x74, 0x5f, 0x69, 0x64, 0x18, 0x03, 0x20, 0x01, 0x28, 0x03, 0x52, 0x05, 0x65,
-	0x6e, 0x74, 0x49, 0x64, 0x12, 0x1e, 0x0a, 0x0b, 0x65, 0x6e, 0x74, 0x5f, 0x75, 0x73, 0x65, 0x72,
-	0x5f, 0x69, 0x64, 0x18, 0x04, 0x20, 0x03, 0x28, 0x03, 0x52, 0x09, 0x65, 0x6e, 0x74, 0x55, 0x73,
-	0x65, 0x72, 0x49, 0x64, 0x22, 0x1e, 0x0a, 0x04, 0x52, 0x65, 0x73, 0x70, 0x12, 0x16, 0x0a, 0x06,
-	0x73, 0x74, 0x61, 0x74, 0x75, 0x73, 0x18, 0x01, 0x20, 0x01, 0x28, 0x03, 0x52, 0x06, 0x73, 0x74,
-	0x61, 0x74, 0x75, 0x73, 0x32, 0xb9, 0x01, 0x0a, 0x08, 0x52, 0x65, 0x73, 0x6f, 0x75, 0x72, 0x63,
-	0x65, 0x12, 0x1f, 0x0a, 0x0b, 0x50, 0x6f, 0x77, 0x65, 0x72, 0x48, 0x61, 0x6e, 0x64, 0x6c, 0x65,
-	0x12, 0x09, 0x2e, 0x50, 0x6f, 0x77, 0x65, 0x72, 0x52, 0x65, 0x71, 0x1a, 0x05, 0x2e, 0x52, 0x65,
-	0x73, 0x70, 0x12, 0x23, 0x0a, 0x0a, 0x43, 0x68, 0x65, 0x63, 0x6b, 0x50, 0x6f, 0x77, 0x65, 0x72,
-	0x12, 0x0e, 0x2e, 0x43, 0x68, 0x65, 0x63, 0x6b, 0x50, 0x6f, 0x77, 0x65, 0x72, 0x52, 0x65, 0x71,
-	0x1a, 0x05, 0x2e, 0x52, 0x65, 0x73, 0x70, 0x12, 0x21, 0x0a, 0x09, 0x44, 0x65, 0x64, 0x75, 0x63,
-	0x74, 0x69, 0x6f, 0x6e, 0x12, 0x0d, 0x2e, 0x44, 0x65, 0x64, 0x75, 0x63, 0x74, 0x69, 0x6f, 0x6e,
-	0x52, 0x65, 0x71, 0x1a, 0x05, 0x2e, 0x52, 0x65, 0x73, 0x70, 0x12, 0x1f, 0x0a, 0x09, 0x52, 0x65,
-	0x45, 0x6d, 0x70, 0x6f, 0x77, 0x65, 0x72, 0x12, 0x0b, 0x2e, 0x45, 0x6d, 0x70, 0x6f, 0x77, 0x65,
-	0x72, 0x52, 0x65, 0x71, 0x1a, 0x05, 0x2e, 0x52, 0x65, 0x73, 0x70, 0x12, 0x23, 0x0a, 0x0d, 0x43,
-	0x61, 0x6e, 0x63, 0x65, 0x6c, 0x45, 0x6d, 0x70, 0x6f, 0x77, 0x65, 0x72, 0x12, 0x0b, 0x2e, 0x45,
-	0x6d, 0x70, 0x6f, 0x77, 0x65, 0x72, 0x52, 0x65, 0x71, 0x1a, 0x05, 0x2e, 0x52, 0x65, 0x73, 0x70,
-	0x42, 0x06, 0x5a, 0x04, 0x2e, 0x2f, 0x70, 0x62, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33,
+	0x6e, 0x74, 0x49, 0x64, 0x12, 0x19, 0x0a, 0x08, 0x70, 0x61, 0x67, 0x65, 0x5f, 0x6e, 0x75, 0x6d,
+	0x18, 0x04, 0x20, 0x01, 0x28, 0x03, 0x52, 0x07, 0x70, 0x61, 0x67, 0x65, 0x4e, 0x75, 0x6d, 0x12,
+	0x1b, 0x0a, 0x09, 0x70, 0x61, 0x67, 0x65, 0x5f, 0x73, 0x69, 0x7a, 0x65, 0x18, 0x05, 0x20, 0x01,
+	0x28, 0x03, 0x52, 0x08, 0x70, 0x61, 0x67, 0x65, 0x53, 0x69, 0x7a, 0x65, 0x22, 0x45, 0x0a, 0x0f,
+	0x45, 0x6d, 0x70, 0x6f, 0x77, 0x65, 0x72, 0x4c, 0x69, 0x73, 0x74, 0x52, 0x65, 0x73, 0x70, 0x12,
+	0x14, 0x0a, 0x05, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x18, 0x01, 0x20, 0x01, 0x28, 0x03, 0x52, 0x05,
+	0x63, 0x6f, 0x75, 0x6e, 0x74, 0x12, 0x1c, 0x0a, 0x04, 0x6c, 0x69, 0x73, 0x74, 0x18, 0x02, 0x20,
+	0x03, 0x28, 0x0b, 0x32, 0x08, 0x2e, 0x45, 0x6d, 0x70, 0x6f, 0x77, 0x65, 0x72, 0x52, 0x04, 0x6c,
+	0x69, 0x73, 0x74, 0x22, 0x1e, 0x0a, 0x04, 0x52, 0x65, 0x73, 0x70, 0x12, 0x16, 0x0a, 0x06, 0x73,
+	0x74, 0x61, 0x74, 0x75, 0x73, 0x18, 0x01, 0x20, 0x01, 0x28, 0x03, 0x52, 0x06, 0x73, 0x74, 0x61,
+	0x74, 0x75, 0x73, 0x32, 0xeb, 0x01, 0x0a, 0x08, 0x52, 0x65, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65,
+	0x12, 0x1f, 0x0a, 0x0b, 0x50, 0x6f, 0x77, 0x65, 0x72, 0x48, 0x61, 0x6e, 0x64, 0x6c, 0x65, 0x12,
+	0x09, 0x2e, 0x50, 0x6f, 0x77, 0x65, 0x72, 0x52, 0x65, 0x71, 0x1a, 0x05, 0x2e, 0x52, 0x65, 0x73,
+	0x70, 0x12, 0x23, 0x0a, 0x0a, 0x43, 0x68, 0x65, 0x63, 0x6b, 0x50, 0x6f, 0x77, 0x65, 0x72, 0x12,
+	0x0e, 0x2e, 0x43, 0x68, 0x65, 0x63, 0x6b, 0x50, 0x6f, 0x77, 0x65, 0x72, 0x52, 0x65, 0x71, 0x1a,
+	0x05, 0x2e, 0x52, 0x65, 0x73, 0x70, 0x12, 0x21, 0x0a, 0x09, 0x44, 0x65, 0x64, 0x75, 0x63, 0x74,
+	0x69, 0x6f, 0x6e, 0x12, 0x0d, 0x2e, 0x44, 0x65, 0x64, 0x75, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x52,
+	0x65, 0x71, 0x1a, 0x05, 0x2e, 0x52, 0x65, 0x73, 0x70, 0x12, 0x1f, 0x0a, 0x09, 0x52, 0x65, 0x45,
+	0x6d, 0x70, 0x6f, 0x77, 0x65, 0x72, 0x12, 0x0b, 0x2e, 0x45, 0x6d, 0x70, 0x6f, 0x77, 0x65, 0x72,
+	0x52, 0x65, 0x71, 0x1a, 0x05, 0x2e, 0x52, 0x65, 0x73, 0x70, 0x12, 0x23, 0x0a, 0x0d, 0x43, 0x61,
+	0x6e, 0x63, 0x65, 0x6c, 0x45, 0x6d, 0x70, 0x6f, 0x77, 0x65, 0x72, 0x12, 0x0b, 0x2e, 0x45, 0x6d,
+	0x70, 0x6f, 0x77, 0x65, 0x72, 0x52, 0x65, 0x71, 0x1a, 0x05, 0x2e, 0x52, 0x65, 0x73, 0x70, 0x12,
+	0x30, 0x0a, 0x0b, 0x45, 0x6d, 0x70, 0x6f, 0x77, 0x65, 0x72, 0x4c, 0x69, 0x73, 0x74, 0x12, 0x0f,
+	0x2e, 0x45, 0x6d, 0x70, 0x6f, 0x77, 0x65, 0x72, 0x4c, 0x69, 0x73, 0x74, 0x52, 0x65, 0x71, 0x1a,
+	0x10, 0x2e, 0x45, 0x6d, 0x70, 0x6f, 0x77, 0x65, 0x72, 0x4c, 0x69, 0x73, 0x74, 0x52, 0x65, 0x73,
+	0x70, 0x42, 0x06, 0x5a, 0x04, 0x2e, 0x2f, 0x70, 0x62, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f,
+	0x33,
 }
 
 var (
@@ -472,30 +674,36 @@ func file_resource_proto_rawDescGZIP() []byte {
 	return file_resource_proto_rawDescData
 }
 
-var file_resource_proto_msgTypes = make([]protoimpl.MessageInfo, 5)
+var file_resource_proto_msgTypes = make([]protoimpl.MessageInfo, 8)
 var file_resource_proto_goTypes = []interface{}{
-	(*PowerReq)(nil),      // 0: PowerReq
-	(*CheckPowerReq)(nil), // 1: CheckPowerReq
-	(*DeductionReq)(nil),  // 2: DeductionReq
-	(*EmpowerReq)(nil),    // 3: EmpowerReq
-	(*Resp)(nil),          // 4: Resp
+	(*Empower)(nil),         // 0: Empower
+	(*PowerReq)(nil),        // 1: PowerReq
+	(*CheckPowerReq)(nil),   // 2: CheckPowerReq
+	(*DeductionReq)(nil),    // 3: DeductionReq
+	(*EmpowerReq)(nil),      // 4: EmpowerReq
+	(*EmpowerListReq)(nil),  // 5: EmpowerListReq
+	(*EmpowerListResp)(nil), // 6: EmpowerListResp
+	(*Resp)(nil),            // 7: Resp
 }
 var file_resource_proto_depIdxs = []int32{
-	0, // 0: Resource.PowerHandle:input_type -> PowerReq
-	1, // 1: Resource.CheckPower:input_type -> CheckPowerReq
-	2, // 2: Resource.Deduction:input_type -> DeductionReq
-	3, // 3: Resource.ReEmpower:input_type -> EmpowerReq
-	3, // 4: Resource.CancelEmpower:input_type -> EmpowerReq
-	4, // 5: Resource.PowerHandle:output_type -> Resp
-	4, // 6: Resource.CheckPower:output_type -> Resp
-	4, // 7: Resource.Deduction:output_type -> Resp
-	4, // 8: Resource.ReEmpower:output_type -> Resp
-	4, // 9: Resource.CancelEmpower:output_type -> Resp
-	5, // [5:10] is the sub-list for method output_type
-	0, // [0:5] is the sub-list for method input_type
-	0, // [0:0] is the sub-list for extension type_name
-	0, // [0:0] is the sub-list for extension extendee
-	0, // [0:0] is the sub-list for field type_name
+	0, // 0: EmpowerListResp.list:type_name -> Empower
+	1, // 1: Resource.PowerHandle:input_type -> PowerReq
+	2, // 2: Resource.CheckPower:input_type -> CheckPowerReq
+	3, // 3: Resource.Deduction:input_type -> DeductionReq
+	4, // 4: Resource.ReEmpower:input_type -> EmpowerReq
+	4, // 5: Resource.CancelEmpower:input_type -> EmpowerReq
+	5, // 6: Resource.EmpowerList:input_type -> EmpowerListReq
+	7, // 7: Resource.PowerHandle:output_type -> Resp
+	7, // 8: Resource.CheckPower:output_type -> Resp
+	7, // 9: Resource.Deduction:output_type -> Resp
+	7, // 10: Resource.ReEmpower:output_type -> Resp
+	7, // 11: Resource.CancelEmpower:output_type -> Resp
+	6, // 12: Resource.EmpowerList:output_type -> EmpowerListResp
+	7, // [7:13] is the sub-list for method output_type
+	1, // [1:7] is the sub-list for method input_type
+	1, // [1:1] is the sub-list for extension type_name
+	1, // [1:1] is the sub-list for extension extendee
+	0, // [0:1] is the sub-list for field type_name
 }
 
 func init() { file_resource_proto_init() }
@@ -505,7 +713,7 @@ func file_resource_proto_init() {
 	}
 	if !protoimpl.UnsafeEnabled {
 		file_resource_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} {
-			switch v := v.(*PowerReq); i {
+			switch v := v.(*Empower); i {
 			case 0:
 				return &v.state
 			case 1:
@@ -517,7 +725,7 @@ func file_resource_proto_init() {
 			}
 		}
 		file_resource_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} {
-			switch v := v.(*CheckPowerReq); i {
+			switch v := v.(*PowerReq); i {
 			case 0:
 				return &v.state
 			case 1:
@@ -529,7 +737,7 @@ func file_resource_proto_init() {
 			}
 		}
 		file_resource_proto_msgTypes[2].Exporter = func(v interface{}, i int) interface{} {
-			switch v := v.(*DeductionReq); i {
+			switch v := v.(*CheckPowerReq); i {
 			case 0:
 				return &v.state
 			case 1:
@@ -541,7 +749,7 @@ func file_resource_proto_init() {
 			}
 		}
 		file_resource_proto_msgTypes[3].Exporter = func(v interface{}, i int) interface{} {
-			switch v := v.(*EmpowerReq); i {
+			switch v := v.(*DeductionReq); i {
 			case 0:
 				return &v.state
 			case 1:
@@ -553,6 +761,42 @@ func file_resource_proto_init() {
 			}
 		}
 		file_resource_proto_msgTypes[4].Exporter = func(v interface{}, i int) interface{} {
+			switch v := v.(*EmpowerReq); i {
+			case 0:
+				return &v.state
+			case 1:
+				return &v.sizeCache
+			case 2:
+				return &v.unknownFields
+			default:
+				return nil
+			}
+		}
+		file_resource_proto_msgTypes[5].Exporter = func(v interface{}, i int) interface{} {
+			switch v := v.(*EmpowerListReq); i {
+			case 0:
+				return &v.state
+			case 1:
+				return &v.sizeCache
+			case 2:
+				return &v.unknownFields
+			default:
+				return nil
+			}
+		}
+		file_resource_proto_msgTypes[6].Exporter = func(v interface{}, i int) interface{} {
+			switch v := v.(*EmpowerListResp); i {
+			case 0:
+				return &v.state
+			case 1:
+				return &v.sizeCache
+			case 2:
+				return &v.unknownFields
+			default:
+				return nil
+			}
+		}
+		file_resource_proto_msgTypes[7].Exporter = func(v interface{}, i int) interface{} {
 			switch v := v.(*Resp); i {
 			case 0:
 				return &v.state
@@ -571,7 +815,7 @@ func file_resource_proto_init() {
 			GoPackagePath: reflect.TypeOf(x{}).PkgPath(),
 			RawDescriptor: file_resource_proto_rawDesc,
 			NumEnums:      0,
-			NumMessages:   5,
+			NumMessages:   8,
 			NumExtensions: 0,
 			NumServices:   1,
 		},

+ 38 - 0
rpc/pb/resource_grpc.pb.go

@@ -32,6 +32,8 @@ type ResourceClient interface {
 	ReEmpower(ctx context.Context, in *EmpowerReq, opts ...grpc.CallOption) (*Resp, error)
 	//取消授权
 	CancelEmpower(ctx context.Context, in *EmpowerReq, opts ...grpc.CallOption) (*Resp, error)
+	//授权列表
+	EmpowerList(ctx context.Context, in *EmpowerListReq, opts ...grpc.CallOption) (*EmpowerListResp, error)
 }
 
 type resourceClient struct {
@@ -87,6 +89,15 @@ func (c *resourceClient) CancelEmpower(ctx context.Context, in *EmpowerReq, opts
 	return out, nil
 }
 
+func (c *resourceClient) EmpowerList(ctx context.Context, in *EmpowerListReq, opts ...grpc.CallOption) (*EmpowerListResp, error) {
+	out := new(EmpowerListResp)
+	err := c.cc.Invoke(ctx, "/Resource/EmpowerList", in, out, opts...)
+	if err != nil {
+		return nil, err
+	}
+	return out, nil
+}
+
 // ResourceServer is the server API for Resource service.
 // All implementations must embed UnimplementedResourceServer
 // for forward compatibility
@@ -101,6 +112,8 @@ type ResourceServer interface {
 	ReEmpower(context.Context, *EmpowerReq) (*Resp, error)
 	//取消授权
 	CancelEmpower(context.Context, *EmpowerReq) (*Resp, error)
+	//授权列表
+	EmpowerList(context.Context, *EmpowerListReq) (*EmpowerListResp, error)
 	mustEmbedUnimplementedResourceServer()
 }
 
@@ -123,6 +136,9 @@ func (UnimplementedResourceServer) ReEmpower(context.Context, *EmpowerReq) (*Res
 func (UnimplementedResourceServer) CancelEmpower(context.Context, *EmpowerReq) (*Resp, error) {
 	return nil, status.Errorf(codes.Unimplemented, "method CancelEmpower not implemented")
 }
+func (UnimplementedResourceServer) EmpowerList(context.Context, *EmpowerListReq) (*EmpowerListResp, error) {
+	return nil, status.Errorf(codes.Unimplemented, "method EmpowerList not implemented")
+}
 func (UnimplementedResourceServer) mustEmbedUnimplementedResourceServer() {}
 
 // UnsafeResourceServer may be embedded to opt out of forward compatibility for this service.
@@ -226,6 +242,24 @@ func _Resource_CancelEmpower_Handler(srv interface{}, ctx context.Context, dec f
 	return interceptor(ctx, in, info, handler)
 }
 
+func _Resource_EmpowerList_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
+	in := new(EmpowerListReq)
+	if err := dec(in); err != nil {
+		return nil, err
+	}
+	if interceptor == nil {
+		return srv.(ResourceServer).EmpowerList(ctx, in)
+	}
+	info := &grpc.UnaryServerInfo{
+		Server:     srv,
+		FullMethod: "/Resource/EmpowerList",
+	}
+	handler := func(ctx context.Context, req interface{}) (interface{}, error) {
+		return srv.(ResourceServer).EmpowerList(ctx, req.(*EmpowerListReq))
+	}
+	return interceptor(ctx, in, info, handler)
+}
+
 // Resource_ServiceDesc is the grpc.ServiceDesc for Resource service.
 // It's only intended for direct use with grpc.RegisterService,
 // and not to be introspected or modified (even as a copy)
@@ -253,6 +287,10 @@ var Resource_ServiceDesc = grpc.ServiceDesc{
 			MethodName: "CancelEmpower",
 			Handler:    _Resource_CancelEmpower_Handler,
 		},
+		{
+			MethodName: "EmpowerList",
+			Handler:    _Resource_EmpowerList_Handler,
+		},
 	},
 	Streams:  []grpc.StreamDesc{},
 	Metadata: "resource.proto",

+ 19 - 0
rpc/resource.proto

@@ -2,6 +2,10 @@ syntax = "proto3";
 
 option go_package="./pb";
 
+message Empower {
+  int64 ent_user_id = 1; //企业用户id
+}
+
 message PowerReq {
   string appid = 1;
   string goods_code = 2; 	//商品代码
@@ -36,6 +40,19 @@ message EmpowerReq {
   repeated int64 ent_user_id = 4; //企业用户id
 }
 
+message EmpowerListReq {
+  string appid = 1;
+  string function_code = 2; //功能代码
+  int64 ent_id = 3;         //企业id
+  int64 page_num = 4;       //开始页码,小于1的话,返回所有数据,不进行分页
+  int64 page_size = 5;      //每页大小
+}
+
+message EmpowerListResp {
+  int64 count = 1;            //总条数,只有第一页的时候才返回, 如果企业下所有人都有权限返回-1
+  repeated Empower list = 2;  //列表,如果企业下所有人都有权限,返回空数组
+}
+
 message Resp {
   int64 status = 1;        //0:失败 1:成功 -1:不在有效期内 -2:数量不足 -3:没有授权
 }
@@ -51,4 +68,6 @@ service Resource {
   rpc ReEmpower(EmpowerReq) returns(Resp);
   //取消授权
   rpc CancelEmpower(EmpowerReq) returns(Resp);
+  //授权列表
+  rpc EmpowerList(EmpowerListReq) returns(EmpowerListResp);
 }

+ 16 - 5
rpc/resource/resource.go

@@ -13,11 +13,14 @@ import (
 )
 
 type (
-	CheckPowerReq = pb.CheckPowerReq
-	DeductionReq  = pb.DeductionReq
-	EmpowerReq    = pb.EmpowerReq
-	PowerReq      = pb.PowerReq
-	Resp          = pb.Resp
+	CheckPowerReq   = pb.CheckPowerReq
+	DeductionReq    = pb.DeductionReq
+	Empower         = pb.Empower
+	EmpowerListReq  = pb.EmpowerListReq
+	EmpowerListResp = pb.EmpowerListResp
+	EmpowerReq      = pb.EmpowerReq
+	PowerReq        = pb.PowerReq
+	Resp            = pb.Resp
 
 	Resource interface {
 		// 开通或者取消用户/企业权益
@@ -30,6 +33,8 @@ type (
 		ReEmpower(ctx context.Context, in *EmpowerReq, opts ...grpc.CallOption) (*Resp, error)
 		// 取消授权
 		CancelEmpower(ctx context.Context, in *EmpowerReq, opts ...grpc.CallOption) (*Resp, error)
+		// 授权列表
+		EmpowerList(ctx context.Context, in *EmpowerListReq, opts ...grpc.CallOption) (*EmpowerListResp, error)
 	}
 
 	defaultResource struct {
@@ -72,3 +77,9 @@ func (m *defaultResource) CancelEmpower(ctx context.Context, in *EmpowerReq, opt
 	client := pb.NewResourceClient(m.cli.Conn())
 	return client.CancelEmpower(ctx, in, opts...)
 }
+
+// 授权列表
+func (m *defaultResource) EmpowerList(ctx context.Context, in *EmpowerListReq, opts ...grpc.CallOption) (*EmpowerListResp, error) {
+	client := pb.NewResourceClient(m.cli.Conn())
+	return client.EmpowerList(ctx, in, opts...)
+}