ABP项目备忘(报错及配置)

1.注入报错

Castle.MicroKernel.Handlers.HandlerException: Can't create component 'PaymentCore.Users.PayApiAppService' as it has dependencies to be satisfied.

'PaymentCore.Users.PayApiAppService' is waiting for the following dependencies:
- Service 'PaymentCore.Payment.WXPayApi.NativePay' which was not registered.
- Service 'PaymentCore.Payment.AliPayApi.QRCode' which was not registered.
- Service 'PaymentCore.Payment.AliPayApi.PayDataHandle' which was not registered.
- Service 'Alipay.AopSdk.AspnetCore.AlipayService' which was not registered.

解决办法:

注入的方法实现接口 ITransientDependency

2.多表查询

var query = _goodsRepository.GetAll()
                                          .Join(
                                                  _devicegoodsRepository.GetAll().Where(p => p.DeviceNo == input.deviceNo),
                                          top => top.Code,
                                          art => art.GoodsNo,
                                          (top, art) => new GoodsDto
                                          {
                                             GoodsNo= top.Code,
                                             GoodsName=top.Name,
                                             Description=top.Description,
                                             Unit=top.Unit,
                                             Price=art.Price,
                                             ProductId=top.ProductId,
                                             LastModificationTime = art.LastModificationTime,
                                             GoodsQty=1//设置默认数量
                                          });
            var list = await query
                   .PageBy(input)
                   .ToListAsync();

3.code first 命令

add-migration <name>;

update-database;

4.前端要能访问接口

①实现接口里面定义

②方法后面要加Async

③方法名不能有Post

5.外部引用的接口eg:AlipayService   注入方法

 [Abp.Modules.DependsOn(typeof(AlipayService))]

6.abp权限菜单管理备忘

(1) 菜单需要在前端routes.ts中配置,配置完后,①到系统菜单界面配置菜单②角色界面勾选添加权限菜单(对应BasRoleMenu表)

(2)admin没有tenantId的是宿主,也就是总管理员可以添加租户的,在添加租户的时候会默认添加一个admin租户角色,同时会添加除了tanant页面之外的所有菜单权限

(3)租户下面的admin不能看到租户界面

7.GroupBy使用示例

var list = _goodsRepository.GetAll()
                    .Where(x => x.TenantId == tenantId)
                    .Join(_deviceRepository.GetAll()
                        .Where(x => x.TenantId == tenantId),
                        f => 1,
                        s => 1,
                        (f, s) => new PriceDto {
                            goodsNo = f.Code,
                            goodsName = f.Name,
                            deviceNo = s.Code,
                            deviceName=s.Name
                        }).ToList();
                var query = list.GroupBy(x => new { x.goodsNo,x.goodsName }).ToList();
                goodsList= query.Select(x => new GoodsDeviceTreeDto
                {
                    value = x.Key.goodsNo,
                    label = x.Key.goodsName,
                    children = x.Select(y => new GoodsDeviceTreeDto
                    {
                        value = y.deviceNo,
                        label = y.deviceName
                    }).ToList()
                }).ToList();

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值