From 4bc39717f80af51e3d670a9d0ae5110a2a113578 Mon Sep 17 00:00:00 2001 From: xiangpei <xiangpei@timesnew.cn> Date: 星期五, 12 四月 2024 16:16:22 +0800 Subject: [PATCH] 运维阈值修改接口。删除新增、删除接口 --- ycl-server/src/main/java/com/ycl/platform/service/impl/YwThresholdServiceImpl.java | 42 +++++++++++++++++++++++++++++++++++++++++- 1 files changed, 41 insertions(+), 1 deletions(-) diff --git a/ycl-server/src/main/java/com/ycl/platform/service/impl/YwThresholdServiceImpl.java b/ycl-server/src/main/java/com/ycl/platform/service/impl/YwThresholdServiceImpl.java index 0cbf737..c3b29f3 100644 --- a/ycl-server/src/main/java/com/ycl/platform/service/impl/YwThresholdServiceImpl.java +++ b/ycl-server/src/main/java/com/ycl/platform/service/impl/YwThresholdServiceImpl.java @@ -1,13 +1,20 @@ package com.ycl.platform.service.impl; +import com.alibaba.fastjson2.JSON; +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; import com.ycl.platform.domain.entity.YwThreshold; +import com.ycl.platform.domain.form.CarThresholdForm; +import com.ycl.platform.domain.form.FaceThresholdForm; +import com.ycl.platform.domain.form.VideoThresholdForm; import com.ycl.platform.mapper.YwThresholdMapper; import com.ycl.platform.service.IYwThresholdService; import com.ycl.utils.DateUtils; +import org.springframework.beans.BeanUtils; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import java.util.List; +import java.util.Objects; /** * 杩愮淮闃堝�糞ervice涓氬姟灞傚鐞� @@ -16,7 +23,7 @@ * @date 2024-03-25 */ @Service -public class YwThresholdServiceImpl implements IYwThresholdService { +public class YwThresholdServiceImpl extends ServiceImpl<YwThresholdMapper, YwThreshold> implements IYwThresholdService { @Autowired private YwThresholdMapper ywThresholdMapper; @@ -87,4 +94,37 @@ public int deleteYwThresholdById(Integer id) { return ywThresholdMapper.deleteYwThresholdById(id); } + + @Override + public int editFace(FaceThresholdForm form) { + YwThreshold ywThreshold = baseMapper.selectById(form.getId()); + if (Objects.isNull(ywThreshold)) { + throw new RuntimeException("鏁版嵁涓嶅瓨鍦�"); + } + BeanUtils.copyProperties(form, ywThreshold); + ywThreshold.setIndicator(JSON.toJSONString(form)); + return baseMapper.updateById(ywThreshold); + } + + @Override + public int editCar(CarThresholdForm form) { + YwThreshold ywThreshold = baseMapper.selectById(form.getId()); + if (Objects.isNull(ywThreshold)) { + throw new RuntimeException("鏁版嵁涓嶅瓨鍦�"); + } + BeanUtils.copyProperties(form, ywThreshold); + ywThreshold.setIndicator(JSON.toJSONString(form)); + return baseMapper.updateById(ywThreshold); + } + + @Override + public int editVideo(VideoThresholdForm form) { + YwThreshold ywThreshold = baseMapper.selectById(form.getId()); + if (Objects.isNull(ywThreshold)) { + throw new RuntimeException("鏁版嵁涓嶅瓨鍦�"); + } + BeanUtils.copyProperties(form, ywThreshold); + ywThreshold.setIndicator(JSON.toJSONString(form)); + return baseMapper.updateById(ywThreshold); + } } -- Gitblit v1.8.0