当前位置: 首页 > wzjs >正文

网站即时到账要怎么做建筑设计就业方向及前景

网站即时到账要怎么做,建筑设计就业方向及前景,咸宁手机网站建设,网站模板是什么背景:2个表,是一对多的关系,一个实时视频帧可以出现多个检测结果 要求,可以根据,ids,起始时间,识别出的鸟的种类,来进行删除。 出现的问题, 一致性没有实现&#xff1a…

背景:2个表,是一对多的关系,一个实时视频帧可以出现多个检测结果

要求,可以根据,ids,起始时间,识别出的鸟的种类,来进行删除。

出现的问题,

一致性没有实现

1.比如起始时间符合,但没判断type是否符合就进行了删除

原因:2个字段在不同的表,判断出问题

2.识别结果表中有剩余识别结果,但视频帧中仍然进行了删除

原因;是一对多关系,必须要

筛选出真正需要删除的 DetectionResult ID (即没有被其他 BirdAndconfidence 关联的)

api接口:

封装Bo:

public class DeleteCondition {private List<Integer> ids; // 根据 ID 列表删除@DateTimeFormat(iso = DateTimeFormat.ISO.DATE)private LocalDate startDate; // 删除起始日期@DateTimeFormat(iso = DateTimeFormat.ISO.DATE)private LocalDate endDate; // 删除结束日期 (如果只删除一天,则 startDate 和 endDate 相同)private List<String> birdTypes; // 根据鸟的类型列表删除}

controller层:

@DeleteMapping("/deleteBirds")
public ResponseEntity<?> deleteBirds(@RequestBody DeleteCondition condition) {log.info("删除鸟类检测结果,参数:condition={}", condition);try {boolean isSuccess = birdSelectService.deleteBirdsByCondition(condition);if (isSuccess) {log.info("根据条件 {} 删除鸟类检测结果成功", condition);return ResponseEntity.ok("删除成功");} else {log.info("没有找到符合条件 {} 的鸟类检测结果,无需删除", condition);return ResponseEntity.ok("没有找到符合条件的鸟类检测结果,无需删除");}} catch (IllegalArgumentException e) {log.error("参数校验失败", e);return ResponseEntity.badRequest().body(e.getMessage()); // 400 Bad Request} catch (Exception e) {log.error("删除鸟类检测结果失败", e);return ResponseEntity.internalServerError().body("删除失败,请稍后重试"); // 500 Internal Server Error}
}

service层:

// 1. 参数校验
validateDeleteCondition(condition);// 2. 构建 BirdAndconfidence 的 QueryWrapper
QueryWrapper<BirdAndconfidence> birdQueryWrapper = new QueryWrapper<>();if (!CollectionUtils.isEmpty(condition.getIds())) {birdQueryWrapper.in("detection_results_id", condition.getIds()); // 根据 detection_results_id 删除
}

构建查询条件1:先 取出condition.getIds(),让删除结果要满足输入的ids

if (condition.getStartDate() != null) {// 根据日期范围查询 DetectionResultQueryWrapper<DetectionResult> detectionResultQueryWrapper = new QueryWrapper<>();if (condition.getEndDate() != null) {detectionResultQueryWrapper.ge("creat_time", condition.getStartDate().atStartOfDay()); // 大于等于起始日期detectionResultQueryWrapper.le("creat_time", condition.getEndDate().atTime(23, 59, 59)); // 小于等于结束日期} else {detectionResultQueryWrapper.eq("creat_time", condition.getStartDate().atStartOfDay()); // 等于指定日期}List<DetectionResult> detectionResults = detectionResultMapper.selectList(detectionResultQueryWrapper);if (!CollectionUtils.isEmpty(detectionResults)) {List<Integer> detectionResultIds = detectionResults.stream().map(DetectionResult::getId).collect(Collectors.toList());birdQueryWrapper.in("detection_results_id", detectionResultIds);} else {log.info("在指定日期范围内没有找到任何鸟类检测结果");return false; // 没有找到任何鸟类检测结果}
}

构建查询条件2:查询出满足输入日期需求的ids,然后继续构建进来

if (!CollectionUtils.isEmpty(condition.getBirdTypes())) {birdQueryWrapper.in("bird_type", condition.getBirdTypes()); // 根据鸟的类型删除
}// 3. 查询需要删除的 BirdAndconfidence 记录
List<BirdAndconfidence> birdAndConfidenceList = birdAndconfidenceMapper.selectList(birdQueryWrapper);

构建查询条件3: 查询出满足输入种类需求的ids,然后继续构建进来

int deletedCount = birdAndconfidenceMapper.delete(birdQueryWrapper);
log.info("成功逻辑删除 {} 条 BirdAndconfidence 记录", deletedCount);执行删除 BirdAndconfidence 操作

 

// 5. 找出所有需要删除的 DetectionResult ID
List<Integer> detectionResultIdsToDelete = birdAndConfidenceList.stream().map(BirdAndconfidence::getDetectionResultsId).distinct().collect(Collectors.toList());// 6. 筛选出真正需要删除的 DetectionResult ID (即没有被其他 BirdAndconfidence 关联的)
List<Integer> trulyDetectionResultIdsToDelete = detectionResultIdsToDelete.stream().filter(detectionResultId -> {QueryWrapper<BirdAndconfidence> countQueryWrapper = new QueryWrapper<>();countQueryWrapper.eq("detection_results_id", detectionResultId);int count = Math.toIntExact(birdAndconfidenceMapper.selectCount(countQueryWrapper));return count == 0; // 如果没有 BirdAndconfidence 引用这个 DetectionResult,则删除
}).collect(Collectors.toList());
// 7. 删除 DetectionResult 记录 (只删除没有被其他 BirdAndconfidence 关联的 DetectionResult 记录)
if (!CollectionUtils.isEmpty(trulyDetectionResultIdsToDelete)) {int detectionResultDeletedCount = detectionResultMapper.deleteBatchIds(trulyDetectionResultIdsToDelete);log.info("成功逻辑删除 {} 条 DetectionResult 记录", detectionResultDeletedCount);
}

 先找出所有要删除的id,只有在检测结果表中的detection_results_id为0了,才删除对应的视频帧


文章转载自:

http://uFKqJZEU.kshzr.cn
http://h4y7zRc9.kshzr.cn
http://wDKo6CE6.kshzr.cn
http://ieLJy5vd.kshzr.cn
http://hJoqmEif.kshzr.cn
http://1bIpPic1.kshzr.cn
http://4kGE6nte.kshzr.cn
http://YbHJPfJ9.kshzr.cn
http://gr0rrrXO.kshzr.cn
http://fOYz8KLY.kshzr.cn
http://bjZFKeGr.kshzr.cn
http://sHZxYZvV.kshzr.cn
http://LkIpF9GA.kshzr.cn
http://XMaGZouB.kshzr.cn
http://3gaKbFGt.kshzr.cn
http://zYMGx3eg.kshzr.cn
http://S5MMJcaR.kshzr.cn
http://bo30URC9.kshzr.cn
http://mEYtcZwW.kshzr.cn
http://srjve5QB.kshzr.cn
http://XaY4onqC.kshzr.cn
http://VgmhfiJr.kshzr.cn
http://18sXFnJF.kshzr.cn
http://Bm3lbfgz.kshzr.cn
http://R9iSOxcr.kshzr.cn
http://n4NlnnbW.kshzr.cn
http://tjqCScsO.kshzr.cn
http://CIn2OMqn.kshzr.cn
http://N8OEempL.kshzr.cn
http://s9VZObUg.kshzr.cn
http://www.dtcms.com/wzjs/747206.html

相关文章:

  • 常用网站开发模式抖音小程序推广码怎么获得
  • 我想投诉做软件的网站哪个网站做视频有钱挣
  • 东莞土木建筑学会网站网站买空间
  • 固安做网站北京装饰装修公司
  • 中国联通网站备案管理系统邯郸营销网站建设公司
  • 重庆网站建设近重庆零臻科技wordpress短代码引入小工具
  • 美容院网站制作网站站长
  • 网站建设与维护相关知识设计必知的设计网站 039
  • 做展厅的网站seo怎么做网站内容
  • 深圳模板建站多少钱艺术网站建设公司
  • 网站建设与管理专业电子上网站开发
  • wordpress 多个站点广东微信网站制作价格
  • 网站登录页面怎么做安化网站建设
  • 东莞哪些网络公司做网站比较好网站主色调简介
  • 网站 wap 插件个人网站免费推广
  • 左右左布局网站建设拉销智能模板建站系统
  • 站长收录查询网页制作模板素材免费
  • 重庆网站建设子沃科技熊掌号dw做的网站如何上传图片
  • 广州科 外贸网站建设亚马逊的免费网站
  • 南宁论坛建站模板宁夏建设工程造价信息网
  • 做网站虚拟主机推荐做论坛网站时应该注意什么
  • 哪里做网站优化品牌注册名字大全
  • 网站维护哪些wordpress登录跳转
  • 苏州网络网站建设怎么制作视频网站
  • 校园网站建设途径destoon 网站后台显示不出模板
  • 保山市城市建设网站dw怎么把设计网页显示出来
  • 饿了么网站做要多少钱德州做网站
  • 建设网站定位分析辽宁专业网站建设大全
  • 如何进入公司网站后台wordpress 单栏
  • 朋友圈网站广告怎么做小程序开发专业定制