From 128068aa9e854a574f39bc5a64352b10633a6402 Mon Sep 17 00:00:00 2001 From: huangfeng Date: Tue, 22 Apr 2025 16:11:56 +0800 Subject: [PATCH] =?UTF-8?q?perf:=20=E8=A1=A5=E4=B8=8A=E8=A7=84=E7=BA=A6?= =?UTF-8?q?=E4=BF=A1=E6=81=AF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../entity/CameraSchedule.java | 33 ++++++++++ .../entity/CameraScheduleExample.java | 60 +++++++++++++++++++ .../mappers/CameraScheduleMapper.xml | 31 +++++++--- .../timeTask/StoreCameraScheduleTask.java | 6 +- 4 files changed, 122 insertions(+), 8 deletions(-) diff --git a/xymanager_common/src/main/java/com/shxy/xymanager_common/entity/CameraSchedule.java b/xymanager_common/src/main/java/com/shxy/xymanager_common/entity/CameraSchedule.java index 214c6de..c8e6d59 100644 --- a/xymanager_common/src/main/java/com/shxy/xymanager_common/entity/CameraSchedule.java +++ b/xymanager_common/src/main/java/com/shxy/xymanager_common/entity/CameraSchedule.java @@ -28,6 +28,15 @@ public class CameraSchedule { */ private Integer channelId; + /** + * + * This field was generated by MyBatis Generator. + * This field corresponds to the database column camera_schedule.protocol + * + * @mbg.generated + */ + private Integer protocol; + /** * * This field was generated by MyBatis Generator. @@ -109,6 +118,30 @@ public class CameraSchedule { this.channelId = channelId; } + /** + * This method was generated by MyBatis Generator. + * This method returns the value of the database column camera_schedule.protocol + * + * @return the value of camera_schedule.protocol + * + * @mbg.generated + */ + public Integer getProtocol() { + return protocol; + } + + /** + * This method was generated by MyBatis Generator. + * This method sets the value of the database column camera_schedule.protocol + * + * @param protocol the value for camera_schedule.protocol + * + * @mbg.generated + */ + public void setProtocol(Integer protocol) { + this.protocol = protocol; + } + /** * This method was generated by MyBatis Generator. * This method returns the value of the database column camera_schedule.data diff --git a/xymanager_common/src/main/java/com/shxy/xymanager_common/entity/CameraScheduleExample.java b/xymanager_common/src/main/java/com/shxy/xymanager_common/entity/CameraScheduleExample.java index cc50de7..31d49e0 100644 --- a/xymanager_common/src/main/java/com/shxy/xymanager_common/entity/CameraScheduleExample.java +++ b/xymanager_common/src/main/java/com/shxy/xymanager_common/entity/CameraScheduleExample.java @@ -373,6 +373,66 @@ public class CameraScheduleExample { addCriterion("channel_id not between", value1, value2, "channelId"); return (Criteria) this; } + + public Criteria andProtocolIsNull() { + addCriterion("protocol is null"); + return (Criteria) this; + } + + public Criteria andProtocolIsNotNull() { + addCriterion("protocol is not null"); + return (Criteria) this; + } + + public Criteria andProtocolEqualTo(Integer value) { + addCriterion("protocol =", value, "protocol"); + return (Criteria) this; + } + + public Criteria andProtocolNotEqualTo(Integer value) { + addCriterion("protocol <>", value, "protocol"); + return (Criteria) this; + } + + public Criteria andProtocolGreaterThan(Integer value) { + addCriterion("protocol >", value, "protocol"); + return (Criteria) this; + } + + public Criteria andProtocolGreaterThanOrEqualTo(Integer value) { + addCriterion("protocol >=", value, "protocol"); + return (Criteria) this; + } + + public Criteria andProtocolLessThan(Integer value) { + addCriterion("protocol <", value, "protocol"); + return (Criteria) this; + } + + public Criteria andProtocolLessThanOrEqualTo(Integer value) { + addCriterion("protocol <=", value, "protocol"); + return (Criteria) this; + } + + public Criteria andProtocolIn(List values) { + addCriterion("protocol in", values, "protocol"); + return (Criteria) this; + } + + public Criteria andProtocolNotIn(List values) { + addCriterion("protocol not in", values, "protocol"); + return (Criteria) this; + } + + public Criteria andProtocolBetween(Integer value1, Integer value2) { + addCriterion("protocol between", value1, value2, "protocol"); + return (Criteria) this; + } + + public Criteria andProtocolNotBetween(Integer value1, Integer value2) { + addCriterion("protocol not between", value1, value2, "protocol"); + return (Criteria) this; + } } /** diff --git a/xymanager_dao/src/main/resources/mappers/CameraScheduleMapper.xml b/xymanager_dao/src/main/resources/mappers/CameraScheduleMapper.xml index aec22a3..68d3289 100644 --- a/xymanager_dao/src/main/resources/mappers/CameraScheduleMapper.xml +++ b/xymanager_dao/src/main/resources/mappers/CameraScheduleMapper.xml @@ -9,6 +9,7 @@ + - id, term_id, channel_id + id, term_id, channel_id, protocol update camera_schedule set term_id = #{termId,jdbcType=INTEGER}, - channel_id = #{channelId,jdbcType=INTEGER} + channel_id = #{channelId,jdbcType=INTEGER}, + protocol = #{protocol,jdbcType=INTEGER} where id = #{id,jdbcType=INTEGER} \ No newline at end of file diff --git a/xymanager_framework/src/main/java/com/shxy/xymanager_framework/timeTask/StoreCameraScheduleTask.java b/xymanager_framework/src/main/java/com/shxy/xymanager_framework/timeTask/StoreCameraScheduleTask.java index 7351343..1b82919 100644 --- a/xymanager_framework/src/main/java/com/shxy/xymanager_framework/timeTask/StoreCameraScheduleTask.java +++ b/xymanager_framework/src/main/java/com/shxy/xymanager_framework/timeTask/StoreCameraScheduleTask.java @@ -57,19 +57,23 @@ public class StoreCameraScheduleTask { Integer channel = Constants.scheduleRequestMap.get(requestid); Constants.scheduleRequestMap.remove(requestid); + Terminals term = newCacheService.getTerminal(results.getTermId()); + CameraScheduleExample example = new CameraScheduleExample(); CameraScheduleExample.Criteria criteria = example.createCriteria(); - criteria.andTermIdEqualTo(results.getTermId()); + criteria.andTermIdEqualTo(term.getId()); criteria.andChannelIdEqualTo(channel); List list = cameraScheduleMapper.selectByExample(example); if (CollectionUtils.isEmpty(list)) { CameraSchedule record = new CameraSchedule(); record.setTermId(results.getTermId()); record.setChannelId(channel); + record.setProtocol(term.getProtocol()); record.setData(results.getData()); cameraScheduleMapper.insert(record); } else { CameraSchedule record = list.get(0); + record.setProtocol(term.getProtocol()); record.setData(results.getData()); cameraScheduleMapper.updateByPrimaryKeyWithBLOBs(record); }