LambdaQueryWrapper和QueryWrapper使用的优缺点

LambdaQueryWrapper

 MatchUserEntity matchUserEntity = matchUserService.getOne(new LambdaQueryWrapper<MatchUserEntity>()
                .eq(MatchUserEntity::getUserId, gameUserId)
                .eq(MatchUserEntity::getMatchId, gameEntity.getMatchId())
                .eq(MatchUserEntity::getDelFlag, "1"));

QueryWrapper

List<UserBillEntity>  olds = this.list(new QueryWrapper<UserBillEntity>().eq("main_id",mainId).eq("bill_status",BillStatusEnum.BILL_STATUS_THREE.getKey()));

LambdaQueryWrapper的好处是写实体属性,而不是数据库字段,这样就不用担心数据库字段改了需要修改java中的代码(只需要修改xml文件就行了)


版权声明:本文为qq_25983579原创文章,遵循CC 4.0 BY-SA版权协议,转载请附上原文出处链接和本声明。