代码拉取完成,页面将自动刷新
package datamanagelogic
import (
"context"
"gitee.com/unitedrhino/core/service/syssvr/internal/logic"
"gitee.com/unitedrhino/core/service/syssvr/internal/repo/relationDB"
"gitee.com/unitedrhino/share/ctxs"
"gitee.com/unitedrhino/core/service/syssvr/internal/svc"
"gitee.com/unitedrhino/core/service/syssvr/pb/sys"
"github.com/zeromicro/go-zero/core/logx"
)
type DataAreaIndexLogic struct {
ctx context.Context
svcCtx *svc.ServiceContext
logx.Logger
UaaDB *relationDB.DataAreaRepo
}
func NewDataAreaIndexLogic(ctx context.Context, svcCtx *svc.ServiceContext) *DataAreaIndexLogic {
return &DataAreaIndexLogic{
ctx: ctx,
svcCtx: svcCtx,
Logger: logx.WithContext(ctx),
UaaDB: relationDB.NewDataAreaRepo(ctx),
}
}
func (l *DataAreaIndexLogic) DataAreaIndex(in *sys.DataAreaIndexReq) (*sys.DataAreaIndexResp, error) {
var (
list []*sys.DataArea
total int64
err error
)
uc := ctxs.GetUserCtx(l.ctx)
if in.ProjectID != 0 {
uc.ProjectID = in.ProjectID
} else {
in.ProjectID = uc.ProjectID
}
filter := relationDB.DataAreaFilter{
Targets: []*relationDB.Target{{Type: in.TargetType, ID: in.TargetID}},
ProjectID: in.ProjectID,
}
total, err = l.UaaDB.CountByFilter(l.ctx, filter)
if err != nil {
return nil, err
}
poArr, err := l.UaaDB.FindByFilter(l.ctx, filter, logic.ToPageInfo(in.Page))
if err != nil {
return nil, err
}
list = make([]*sys.DataArea, 0, len(poArr))
for _, po := range poArr {
list = append(list, transAreaPoToPb(po))
}
return &sys.DataAreaIndexResp{List: list, Total: total}, nil
}
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。