From 73bbd006d0e11348e5afe8f53fc981241730e306 Mon Sep 17 00:00:00 2001 From: wuweida <2918581207@qq.com> Date: Mon, 9 May 2022 15:32:42 +0800 Subject: [PATCH] =?UTF-8?q?=E6=A0=B9=E6=8D=AEparentId=E6=9F=A5=E8=AF=A2?= =?UTF-8?q?=E6=89=80=E6=9C=89=E7=BB=84=E7=BB=87=20=E6=A0=B9=E6=8D=AEparent?= =?UTF-8?q?Id=E6=9F=A5=E8=AF=A2=E6=91=84=E5=83=8F=E5=A4=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../monitormanage/controller/Controller.java | 17 +++++++++++------ ...CameraOrgan.java => CameraOrganization.java} | 4 ++-- .../mapper/CameraChannelMapper.java | 4 ++-- .../monitormanage/mapper/CameraOrgenMapper.java | 14 -------------- .../mapper/CameraOrgenizationMapper.java | 14 ++++++++++++++ .../monitormanage/service/MonitorService.java | 10 ++++------ ...nMapper.xml => CameraOrganizationMapper.xml} | 2 +- 7 files changed, 34 insertions(+), 31 deletions(-) rename src/main/java/com/hisense/monitormanage/entity/{CameraOrgan.java => CameraOrganization.java} (82%) delete mode 100644 src/main/java/com/hisense/monitormanage/mapper/CameraOrgenMapper.java create mode 100644 src/main/java/com/hisense/monitormanage/mapper/CameraOrgenizationMapper.java rename src/main/resources/mapper/{CameraOrganMapper.xml => CameraOrganizationMapper.xml} (62%) diff --git a/src/main/java/com/hisense/monitormanage/controller/Controller.java b/src/main/java/com/hisense/monitormanage/controller/Controller.java index 1cda68a..0cc966a 100644 --- a/src/main/java/com/hisense/monitormanage/controller/Controller.java +++ b/src/main/java/com/hisense/monitormanage/controller/Controller.java @@ -37,7 +37,7 @@ public class Controller { private CameraChannelMapper cameraChannelMapper; @Autowired - private CameraOrgenMapper cameraOrgenMapper; + private CameraOrgenizationMapper cameraOrgenMapper; @RequestMapping("all") public Object all(){ @@ -106,10 +106,15 @@ public class Controller { } - @RequestMapping("selectById") - public Result selectById(String idtCameraChannel){ + /** + * 根据parentId查询摄像头 + * @param parentId + * @return + */ + @RequestMapping("selectByParentId") + public Result selectByParentId(String parentId){ - List list = cameraChannelMapper.selectById(idtCameraChannel); + List list = cameraChannelMapper.selectByParentId(parentId); Result success = Result.success(list); @@ -152,12 +157,12 @@ public class Controller { * @return */ @RequestMapping("selectSubOrgan") - public Result selectSubOrgan(String parentId){ + public Result selectSubOrganization(String parentId){ if (parentId == null){ parentId = ""; } - List organs = cameraOrgenMapper.selectSubOrgan(parentId); + List organs = cameraOrgenMapper.selectSubOrganization(parentId); Result success = Result.success(organs); diff --git a/src/main/java/com/hisense/monitormanage/entity/CameraOrgan.java b/src/main/java/com/hisense/monitormanage/entity/CameraOrganization.java similarity index 82% rename from src/main/java/com/hisense/monitormanage/entity/CameraOrgan.java rename to src/main/java/com/hisense/monitormanage/entity/CameraOrganization.java index 5aa716a..5a85729 100644 --- a/src/main/java/com/hisense/monitormanage/entity/CameraOrgan.java +++ b/src/main/java/com/hisense/monitormanage/entity/CameraOrganization.java @@ -5,8 +5,8 @@ import com.baomidou.mybatisplus.annotation.TableName; import lombok.Data; @Data -@TableName("t_camera_organ") -public class CameraOrgan { +@TableName("t_camera_organization") +public class CameraOrganization { @TableId private String id; diff --git a/src/main/java/com/hisense/monitormanage/mapper/CameraChannelMapper.java b/src/main/java/com/hisense/monitormanage/mapper/CameraChannelMapper.java index 486fc49..8a15a49 100644 --- a/src/main/java/com/hisense/monitormanage/mapper/CameraChannelMapper.java +++ b/src/main/java/com/hisense/monitormanage/mapper/CameraChannelMapper.java @@ -16,8 +16,8 @@ public interface CameraChannelMapper extends BaseMapper { "OR c.gps_y NOT IN('0.0','0','')) AND c.status != 0") List selectAll(CameraChannel cameraChannel); - @Select("select * from t_camera_channel where idt_camera_channel = #{idtCameraChannel}") - List selectById(@Param("idtCameraChannel") String idtCameraChannel); + @Select("select * from t_camera_channel where parent_id = #{parentId}") + List selectByParentId(@Param("parentId") String parentId); @Select("select * from (select a.*,c.* from t_channel_mtm_label b JOIN t_label a JOIN t_camera_channel c " + "ON a.label_code = b.label_code AND b.channel_code = c.channel_code ) m where m.label_code = #{labelCode} ") diff --git a/src/main/java/com/hisense/monitormanage/mapper/CameraOrgenMapper.java b/src/main/java/com/hisense/monitormanage/mapper/CameraOrgenMapper.java deleted file mode 100644 index 84761c2..0000000 --- a/src/main/java/com/hisense/monitormanage/mapper/CameraOrgenMapper.java +++ /dev/null @@ -1,14 +0,0 @@ -package com.hisense.monitormanage.mapper; - -import com.baomidou.mybatisplus.core.mapper.BaseMapper; -import com.hisense.monitormanage.entity.CameraOrgan; -import org.apache.ibatis.annotations.Param; -import org.apache.ibatis.annotations.Select; - -import java.util.List; - -public interface CameraOrgenMapper extends BaseMapper { - - @Select("select * from t_camera_organ where parent_id = #{parentId}") - List selectSubOrgan(@Param("parentId") String parentId); -} diff --git a/src/main/java/com/hisense/monitormanage/mapper/CameraOrgenizationMapper.java b/src/main/java/com/hisense/monitormanage/mapper/CameraOrgenizationMapper.java new file mode 100644 index 0000000..fe82262 --- /dev/null +++ b/src/main/java/com/hisense/monitormanage/mapper/CameraOrgenizationMapper.java @@ -0,0 +1,14 @@ +package com.hisense.monitormanage.mapper; + +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import com.hisense.monitormanage.entity.CameraOrganization; +import org.apache.ibatis.annotations.Param; +import org.apache.ibatis.annotations.Select; + +import java.util.List; + +public interface CameraOrgenizationMapper extends BaseMapper { + + @Select("select * from t_camera_organization where parent_id = #{parentId}") + List selectSubOrganization(@Param("parentId") String parentId); +} diff --git a/src/main/java/com/hisense/monitormanage/service/MonitorService.java b/src/main/java/com/hisense/monitormanage/service/MonitorService.java index ba4a044..1c61709 100644 --- a/src/main/java/com/hisense/monitormanage/service/MonitorService.java +++ b/src/main/java/com/hisense/monitormanage/service/MonitorService.java @@ -2,7 +2,6 @@ package com.hisense.monitormanage.service; import cn.hutool.core.collection.ListUtil; import cn.hutool.crypto.SecureUtil; -import com.alibaba.fastjson.JSON; import com.alibaba.fastjson.JSONArray; import com.alibaba.fastjson.JSONObject; import com.hisense.monitormanage.entity.*; @@ -20,7 +19,6 @@ import org.springframework.util.Base64Utils; import org.springframework.util.LinkedMultiValueMap; import org.springframework.util.MultiValueMap; import org.springframework.util.StringUtils; -import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.client.HttpClientErrorException; import org.springframework.web.client.RestTemplate; @@ -57,7 +55,7 @@ public class MonitorService { private CameraChannelMapper cameraChannelMapper; @Autowired - private CameraOrgenMapper cameraOrgenMapper; + private CameraOrgenizationMapper cameraOrgenMapper; @Value("${hwx.file.work-path}") private String fileDir; @@ -336,16 +334,16 @@ public class MonitorService { Boolean isParent = (Boolean) result.get("isParent"); if (isParent){ - CameraOrgan cameraOrgan = JSONObject.parseObject(JSONObject.toJSONString(result), CameraOrgan.class); + CameraOrganization cameraOrganization = JSONObject.parseObject(JSONObject.toJSONString(result), CameraOrganization.class); - cameraOrgenMapper.insert(cameraOrgan); + cameraOrgenMapper.insert(cameraOrganization); videoService((String) result.get("id"),path + sep + result.get("name")); }else { if (result.get("channelId") != null){ CameraChannel cameraChannel = JSONObject.parseObject(JSONObject.toJSONString(result), CameraChannel.class); - String id = (String)result.get("parentId"); + String id = (String)result.get("orgCode"); if (path != null && path.startsWith(sep)) { path = path.substring(sep.length()); diff --git a/src/main/resources/mapper/CameraOrganMapper.xml b/src/main/resources/mapper/CameraOrganizationMapper.xml similarity index 62% rename from src/main/resources/mapper/CameraOrganMapper.xml rename to src/main/resources/mapper/CameraOrganizationMapper.xml index 88e2420..568a0b2 100644 --- a/src/main/resources/mapper/CameraOrganMapper.xml +++ b/src/main/resources/mapper/CameraOrganizationMapper.xml @@ -1,5 +1,5 @@ - + \ No newline at end of file