public ResultIPageTalentSeaServiceApplyVO queryApplyListRequestBodyrequired = false TalentSeaServiceApplyVO applyVO HttpServletRequest req applyVO = applyVO == null new
可以在查询时按照申请时间排序,然后使用SQL的DISTINCT关键字过滤掉重复的申请数据,只保留最新的一条申请数据。具体代码如下:
queryWrapper.orderByDesc("apply_time"); // 按照申请时间倒序排序
queryWrapper.groupBy("talent_user_id", "seaservice_id"); // 根据用户和服务项目分组
queryWrapper.select("id", "talent_user_id", "seaservice_id", "company_name", "apply_status", "pay_amount", "apply_time"); // 只查询需要的字段
IPage
需要注意的是,使用DISTINCT关键字可能会影响查询性能,如果数据量较大,可能会导致查询速度变慢。可以根据实际情况进行调整。
原文地址: https://www.cveoy.top/t/topic/fzcv 著作权归作者所有。请勿转载和采集!