| | |
| | | throw new ServiceException("CaseWindupApplyService.getByCaseTaskId", e); |
| | | } |
| | | } |
| | | /** |
| | | * 根据案件ID获取最新的结案申请记录 |
| | | * @param caseId 案件ID |
| | | * @return 最新的结案申请记录,如果不存在则返回null |
| | | */ |
| | | public CaseWindupApply getByCaseId(String caseId){ |
| | | try{ |
| | | // 创建CaseWindupApply的查询条件包装器 |
| | | QueryWrapper<CaseWindupApply> caseWindupApplyQueryWrapper = new QueryWrapper<>(); |
| | | // 设置查询条件为case_task_id等于传入的caseTaskId |
| | | // 设置查询条件为case_id等于传入的caseId |
| | | caseWindupApplyQueryWrapper.eq("case_id", caseId); |
| | | // 按创建时间降序排序,确保获取最新的记录 |
| | | caseWindupApplyQueryWrapper.orderByDesc("create_time"); |
| | | // 添加LIMIT 1限制,确保只返回一条记录 |
| | | caseWindupApplyQueryWrapper.last("LIMIT 1"); |
| | | // 使用查询条件从数据库中选取一条记录 |
| | | CaseWindupApply caseWindupApply = mapper.selectOne(caseWindupApplyQueryWrapper); |
| | | |
| | |
| | | return caseWindupApply; |
| | | }catch (Exception e){ |
| | | // 记录错误日志,包括方法调用失败的信息和异常堆栈 |
| | | log.error("[CaseWindupApplyService.getByCaseTaskId]调用失败,异常信息:"+e, e); |
| | | log.error("[CaseWindupApplyService.getByCaseId]调用失败,异常信息:"+e, e); |
| | | // 抛出服务异常,包含方法名称和原始异常 |
| | | throw new ServiceException("CaseWindupApplyService.getByCaseTaskId", e); |
| | | throw new ServiceException("CaseWindupApplyService.getByCaseId", e); |
| | | } |
| | | } |
| | | /** |