通过[index]和.eq(index)获取的对象有什么区别

本文阐述了通过不同方式获取DOM元素的区别:使用[index]获取的是原生JS DOM对象,适用于原生JS方法;而使用.eq(index)获取的是JQuery对象,适用于JQuery方法。理解这些差异有助于开发者更高效地进行前端开发。

通过[index]获取的是原生的dom对象,是js原生调用方法(*是不能用在Jquery中调用*)

通过.eq(index)获取的是Jquery对象,是Jquery调用方法(*也不可在原生js中调用*)


分清js原生和Jquery就行了




private List<Tuple> fetchToBeProcessedAlertRecord(AlertRecord data, int offset, int pageSize) { // 子查询实体 QTbAlertRecord latest = new QTbAlertRecord("sub"); // 构建子查询:获取每组最新时间的记录 JPAQuery<Tuple> subQuery = jpaQueryFactory .select(latest.deviceId, latest.name, latest.level, latest.ruleId, latest.tagName, latest.alertTime.max().as("alertTime")) .from(latest) .where(latest.processed.eq(0)) .groupBy(latest.deviceId, latest.name, latest.level, latest.ruleId, latest.tagName); return jpaQueryFactory.select(tbAlertRecord,tbDeviceGroup.name,tbDeviceInfo.deviceName,tbRuleInfo.name) .from(tbAlertRecord) // 将子查询结果当作临时表 // 核心修复:内连接子查询,通过on条件匹配分组字段最新时间 .innerJoin(tbAlertRecord) .on( // 匹配所有分组字段(与子查询groupBy保持一致) tbAlertRecord.deviceId.eq(latest.deviceId), tbAlertRecord.name.eq(latest.name), tbAlertRecord.level.eq(latest.level), tbAlertRecord.ruleId.eq(latest.ruleId), tbAlertRecord.tagName.eq(latest.tagName), // 匹配子查询中的最大时间(确保是每组最新记录) tbAlertRecord.alertTime.eq(latest.alertTime.max()) ) .leftJoin(tbDeviceInfo).on(tbAlertRecord.deviceId.eq(tbDeviceInfo.id)) .leftJoin(tbRuleInfo).on(tbAlertRecord.ruleId.eq(tbRuleInfo.id)) .leftJoin(tbDeviceGroupMapping).on(tbAlertRecord.deviceId.eq(tbDeviceGroupMapping.deviceId)) .leftJoin(tbDeviceGroup).on(tbDeviceGroupMapping.groupId.eq(tbDeviceGroup.id)) .where(buildPredicateSafe(data)) .orderBy(tbAlertRecord.alertTime.desc()) .limit(pageSize).offset(offset).fetch(); } 加子查询原生sql 组合
最新发布
08-26
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值