根据parentId查询所有组织

根据parentId查询摄像头
This commit is contained in:
wuweida 2022-05-09 15:32:42 +08:00
parent 244599f817
commit 73bbd006d0
7 changed files with 34 additions and 31 deletions

View File

@ -37,7 +37,7 @@ public class Controller {
private CameraChannelMapper cameraChannelMapper; private CameraChannelMapper cameraChannelMapper;
@Autowired @Autowired
private CameraOrgenMapper cameraOrgenMapper; private CameraOrgenizationMapper cameraOrgenMapper;
@RequestMapping("all") @RequestMapping("all")
public Object 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<String> list = cameraChannelMapper.selectById(idtCameraChannel); List<CameraChannel> list = cameraChannelMapper.selectByParentId(parentId);
Result success = Result.success(list); Result success = Result.success(list);
@ -152,12 +157,12 @@ public class Controller {
* @return * @return
*/ */
@RequestMapping("selectSubOrgan") @RequestMapping("selectSubOrgan")
public Result selectSubOrgan(String parentId){ public Result selectSubOrganization(String parentId){
if (parentId == null){ if (parentId == null){
parentId = ""; parentId = "";
} }
List<CameraOrgan> organs = cameraOrgenMapper.selectSubOrgan(parentId); List<CameraOrganization> organs = cameraOrgenMapper.selectSubOrganization(parentId);
Result success = Result.success(organs); Result success = Result.success(organs);

View File

@ -5,8 +5,8 @@ import com.baomidou.mybatisplus.annotation.TableName;
import lombok.Data; import lombok.Data;
@Data @Data
@TableName("t_camera_organ") @TableName("t_camera_organization")
public class CameraOrgan { public class CameraOrganization {
@TableId @TableId
private String id; private String id;

View File

@ -16,8 +16,8 @@ public interface CameraChannelMapper extends BaseMapper<CameraChannel> {
"OR c.gps_y NOT IN('0.0','0','')) AND c.status != 0") "OR c.gps_y NOT IN('0.0','0','')) AND c.status != 0")
List<CameraChannel> selectAll(CameraChannel cameraChannel); List<CameraChannel> selectAll(CameraChannel cameraChannel);
@Select("select * from t_camera_channel where idt_camera_channel = #{idtCameraChannel}") @Select("select * from t_camera_channel where parent_id = #{parentId}")
List<String> selectById(@Param("idtCameraChannel") String idtCameraChannel); List<CameraChannel> 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 " + @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} ") "ON a.label_code = b.label_code AND b.channel_code = c.channel_code ) m where m.label_code = #{labelCode} ")

View File

@ -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<CameraOrgan> {
@Select("select * from t_camera_organ where parent_id = #{parentId}")
List<CameraOrgan> selectSubOrgan(@Param("parentId") String parentId);
}

View File

@ -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<CameraOrganization> {
@Select("select * from t_camera_organization where parent_id = #{parentId}")
List<CameraOrganization> selectSubOrganization(@Param("parentId") String parentId);
}

View File

@ -2,7 +2,6 @@ package com.hisense.monitormanage.service;
import cn.hutool.core.collection.ListUtil; import cn.hutool.core.collection.ListUtil;
import cn.hutool.crypto.SecureUtil; import cn.hutool.crypto.SecureUtil;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONArray; import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject; import com.alibaba.fastjson.JSONObject;
import com.hisense.monitormanage.entity.*; import com.hisense.monitormanage.entity.*;
@ -20,7 +19,6 @@ import org.springframework.util.Base64Utils;
import org.springframework.util.LinkedMultiValueMap; import org.springframework.util.LinkedMultiValueMap;
import org.springframework.util.MultiValueMap; import org.springframework.util.MultiValueMap;
import org.springframework.util.StringUtils; import org.springframework.util.StringUtils;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.client.HttpClientErrorException; import org.springframework.web.client.HttpClientErrorException;
import org.springframework.web.client.RestTemplate; import org.springframework.web.client.RestTemplate;
@ -57,7 +55,7 @@ public class MonitorService {
private CameraChannelMapper cameraChannelMapper; private CameraChannelMapper cameraChannelMapper;
@Autowired @Autowired
private CameraOrgenMapper cameraOrgenMapper; private CameraOrgenizationMapper cameraOrgenMapper;
@Value("${hwx.file.work-path}") @Value("${hwx.file.work-path}")
private String fileDir; private String fileDir;
@ -336,16 +334,16 @@ public class MonitorService {
Boolean isParent = (Boolean) result.get("isParent"); Boolean isParent = (Boolean) result.get("isParent");
if (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")); videoService((String) result.get("id"),path + sep + result.get("name"));
}else { }else {
if (result.get("channelId") != null){ if (result.get("channelId") != null){
CameraChannel cameraChannel = JSONObject.parseObject(JSONObject.toJSONString(result), CameraChannel.class); 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)) { if (path != null && path.startsWith(sep)) {
path = path.substring(sep.length()); path = path.substring(sep.length());

View File

@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.hisense.monitormanage.mapper.CameraOrgenMapper"> <mapper namespace="com.hisense.monitormanage.mapper.CameraOrgenizationMapper">
</mapper> </mapper>