xxdezh il y a 7 mois
Parent
commit
316c50d0ea

+ 26 - 5
src/main/java/com/sqx/modules/interviewRecord/service/impl/InterviewRecordServiceImpl.java

@@ -241,16 +241,37 @@ public class InterviewRecordServiceImpl extends ServiceImpl<InterviewRecordDao,
     }
 
 
-    @Override
     public Result isSendView(Long postPushId, Long userId) {
-        List<InterviewRecord> records = baseMapper.selectList(new QueryWrapper<InterviewRecord>().eq("user_id", userId).eq("post_push_id", postPushId).in("status", 1, 2));
-        if (!records.isEmpty()) {
-            return Result.success().put("data", false);
+        // 构建查询条件:用户ID、岗位推送ID、状态为待接受或已同意
+        QueryWrapper<InterviewRecord> queryWrapper = new QueryWrapper<>();
+        queryWrapper.eq("user_id", userId)
+                .eq("post_push_id", postPushId)
+                .in("status", 1, 2); // 1待接受、2已同意
+
+        // 查询单条记录(因为 user_id + post_push_id + status 理论上唯一)
+        InterviewRecord record = baseMapper.selectOne(queryWrapper);
+
+        if (record != null) {
+            // 存在记录:返回 record_id
+            return Result.success().put("data", record.getRecordId());
+
         } else {
-            return Result.success().put("data", true);
+            // 不存在记录:返回 null 或约定值
+            return Result.success().put("data", null);
         }
     }
 
+
+//    @Override
+//    public Result isSendView(Long postPushId, Long userId) {
+//        List<InterviewRecord> records = baseMapper.selectList(new QueryWrapper<InterviewRecord>().eq("user_id", userId).eq("post_push_id", postPushId).in("status", 1, 2));
+//        if (!records.isEmpty()) {
+//            return Result.success().put("data", false);
+//        } else {
+//            return Result.success().put("data", true);
+//        }
+//    }
+
     @Override
     public List<Object> selectInterviewList(Long userId) {
         return baseMapper.selectInterviewList(userId);