From c17dc5484bde25d032bf58d114a4f1598a301f31 Mon Sep 17 00:00:00 2001
From: liusuyi <1951119284@qq.com>
Date: 星期三, 08 五月 2024 10:29:52 +0800
Subject: [PATCH] 增加用户预览位置接口
---
ard-work/src/main/java/com/ruoyi/device/camera/mapper/ArdCameraUserPostionMapper.java | 69 ++++++
ard-work/src/main/java/com/ruoyi/device/camera/controller/ArdCameraUserPostionController.java | 123 +++++++++++
ard-work/src/main/java/com/ruoyi/device/camera/domain/ArdCameraUserPostion.java | 104 +++++++++
ard-work/src/main/java/com/ruoyi/device/camera/service/IArdCameraUserPostionService.java | 68 ++++++
ard-work/src/main/resources/mapper/device/ArdCameraUserPostionMapper.xml | 148 +++++++++++++
ard-work/src/main/java/com/ruoyi/device/camera/service/impl/ArdCameraUserPostionServiceImpl.java | 110 ++++++++++
6 files changed, 622 insertions(+), 0 deletions(-)
diff --git a/ard-work/src/main/java/com/ruoyi/device/camera/controller/ArdCameraUserPostionController.java b/ard-work/src/main/java/com/ruoyi/device/camera/controller/ArdCameraUserPostionController.java
new file mode 100644
index 0000000..777c543
--- /dev/null
+++ b/ard-work/src/main/java/com/ruoyi/device/camera/controller/ArdCameraUserPostionController.java
@@ -0,0 +1,123 @@
+package com.ruoyi.device.camera.controller;
+
+import java.util.List;
+import javax.servlet.http.HttpServletResponse;
+
+import com.github.xiaoymin.knife4j.annotations.ApiOperationSupport;
+import com.ruoyi.common.annotation.Anonymous;
+import io.swagger.annotations.Api;
+import io.swagger.annotations.ApiOperation;
+import org.springframework.security.access.prepost.PreAuthorize;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.web.bind.annotation.GetMapping;
+import org.springframework.web.bind.annotation.PostMapping;
+import org.springframework.web.bind.annotation.PutMapping;
+import org.springframework.web.bind.annotation.DeleteMapping;
+import org.springframework.web.bind.annotation.PathVariable;
+import org.springframework.web.bind.annotation.RequestBody;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RestController;
+import com.ruoyi.common.annotation.Log;
+import com.ruoyi.common.core.controller.BaseController;
+import com.ruoyi.common.core.domain.AjaxResult;
+import com.ruoyi.common.enums.BusinessType;
+import com.ruoyi.device.camera.domain.ArdCameraUserPostion;
+import com.ruoyi.device.camera.service.IArdCameraUserPostionService;
+import com.ruoyi.common.utils.poi.ExcelUtil;
+import com.ruoyi.common.core.page.TableDataInfo;
+
+/**
+ * 鐢ㄦ埛棰勮浣嶇疆Controller
+ *
+ * @author 鍒樿嫃涔�
+ * @date 2024-05-08
+ */
+@Api(tags = "鐢ㄦ埛棰勮浣嶇疆")
+@RestController
+@RequestMapping("/camera/postion")
+public class ArdCameraUserPostionController extends BaseController
+{
+ @Autowired
+ private IArdCameraUserPostionService ardCameraUserPostionService;
+
+ /**
+ * 鏌ヨ鐢ㄦ埛棰勮浣嶇疆鍒楄〃
+ */
+ @PreAuthorize("@ss.hasPermi('camera:postion:list')")
+ @GetMapping("/list")
+ public TableDataInfo list(ArdCameraUserPostion ardCameraUserPostion)
+ {
+ startPage();
+ List<ArdCameraUserPostion> list = ardCameraUserPostionService.selectArdCameraUserPostionList(ardCameraUserPostion);
+ return getDataTable(list);
+ }
+
+ /**
+ * 瀵煎嚭鐢ㄦ埛棰勮浣嶇疆鍒楄〃
+ */
+ @PreAuthorize("@ss.hasPermi('camera:postion:export')")
+ @Log(title = "鐢ㄦ埛棰勮浣嶇疆", businessType = BusinessType.EXPORT)
+ @PostMapping("/export")
+ public void export(HttpServletResponse response, ArdCameraUserPostion ardCameraUserPostion)
+ {
+ List<ArdCameraUserPostion> list = ardCameraUserPostionService.selectArdCameraUserPostionList(ardCameraUserPostion);
+ ExcelUtil<ArdCameraUserPostion> util = new ExcelUtil<ArdCameraUserPostion>(ArdCameraUserPostion.class);
+ util.exportExcel(response, list, "鐢ㄦ埛棰勮浣嶇疆鏁版嵁");
+ }
+
+ /**
+ * 鑾峰彇鐢ㄦ埛棰勮浣嶇疆璇︾粏淇℃伅
+ */
+ @PreAuthorize("@ss.hasPermi('camera:postion:query')")
+ @GetMapping(value = "/{id}")
+ public AjaxResult getInfo(@PathVariable("id") String id)
+ {
+ return success(ardCameraUserPostionService.selectArdCameraUserPostionById(id));
+ }
+
+ /**
+ * 鑾峰彇鐢ㄦ埛棰勮鐩告満璇︾粏淇℃伅
+ */
+ @ApiOperation("鑾峰彇鐢ㄦ埛棰勮鐩告満璇︾粏淇℃伅")
+ //@PreAuthorize("@ss.hasPermi('camera:postion:query')")
+ @GetMapping(value = "/getCameraInfo/{position}")
+ public AjaxResult getCameraInfo(@PathVariable("position") String position)
+ {
+ return success(ardCameraUserPostionService.selectArdCameraUserPostionByPosition(position));
+ }
+
+ /**
+ * 鏂板鐢ㄦ埛棰勮浣嶇疆
+ */
+ @ApiOperation("鏂板鐢ㄦ埛棰勮浣嶇疆")
+ @ApiOperationSupport(includeParameters = {"ardCameraUserPostion.cameraId", "ardCameraUserPostion.chanNo","ardCameraUserPostion.position"})
+ //@PreAuthorize("@ss.hasPermi('camera:postion:add')")
+ @Log(title = "鐢ㄦ埛棰勮浣嶇疆", businessType = BusinessType.INSERT)
+ @PostMapping
+ public AjaxResult add(@RequestBody ArdCameraUserPostion ardCameraUserPostion)
+ {
+ return toAjax(ardCameraUserPostionService.insertArdCameraUserPostion(ardCameraUserPostion));
+ }
+
+ /**
+ * 淇敼鐢ㄦ埛棰勮浣嶇疆
+ */
+ @PreAuthorize("@ss.hasPermi('camera:postion:edit')")
+ @Log(title = "鐢ㄦ埛棰勮浣嶇疆", businessType = BusinessType.UPDATE)
+ @PutMapping
+ public AjaxResult edit(@RequestBody ArdCameraUserPostion ardCameraUserPostion)
+ {
+ return toAjax(ardCameraUserPostionService.updateArdCameraUserPostion(ardCameraUserPostion));
+ }
+
+ /**
+ * 鍒犻櫎鐢ㄦ埛棰勮浣嶇疆
+ */
+ @PreAuthorize("@ss.hasPermi('camera:postion:remove')")
+ @Log(title = "鐢ㄦ埛棰勮浣嶇疆", businessType = BusinessType.DELETE)
+ @DeleteMapping("/{ids}")
+ public AjaxResult remove(@PathVariable String[] ids)
+ {
+ return toAjax(ardCameraUserPostionService.deleteArdCameraUserPostionByIds(ids));
+ }
+}
diff --git a/ard-work/src/main/java/com/ruoyi/device/camera/domain/ArdCameraUserPostion.java b/ard-work/src/main/java/com/ruoyi/device/camera/domain/ArdCameraUserPostion.java
new file mode 100644
index 0000000..9de20e4
--- /dev/null
+++ b/ard-work/src/main/java/com/ruoyi/device/camera/domain/ArdCameraUserPostion.java
@@ -0,0 +1,104 @@
+package com.ruoyi.device.camera.domain;
+
+import org.apache.commons.lang3.builder.ToStringBuilder;
+import org.apache.commons.lang3.builder.ToStringStyle;
+import com.ruoyi.common.annotation.Excel;
+import com.ruoyi.common.core.domain.BaseEntity;
+
+/**
+ * 鐢ㄦ埛棰勮浣嶇疆瀵硅薄 ard_camera_user_postion
+ *
+ * @author 鍒樿嫃涔�
+ * @date 2024-05-08
+ */
+public class ArdCameraUserPostion extends BaseEntity
+{
+ private static final long serialVersionUID = 1L;
+
+ /** 涓婚敭 */
+ private String id;
+
+ /** 鐩告満ID */
+ @Excel(name = "鐩告満ID")
+ private String cameraId;
+
+ /** 閫氶亾鍙� */
+ @Excel(name = "閫氶亾鍙�")
+ private Integer chanNo;
+
+ /** 鐢ㄦ埛ID */
+ @Excel(name = "鐢ㄦ埛ID")
+ private String userId;
+
+ /** 浣嶇疆鏍囪瘑 */
+ @Excel(name = "浣嶇疆鏍囪瘑")
+ private String position;
+
+ /** 浣嶇疆鏍囪瘑 */
+ private ArdCameras ardCameras;
+
+ public ArdCameras getArdCameras() {
+ return ardCameras;
+ }
+
+ public void setArdCameras(ArdCameras ardCameras) {
+ this.ardCameras = ardCameras;
+ }
+
+ public void setId(String id)
+ {
+ this.id = id;
+ }
+
+ public String getId()
+ {
+ return id;
+ }
+ public void setCameraId(String cameraId)
+ {
+ this.cameraId = cameraId;
+ }
+
+ public String getCameraId()
+ {
+ return cameraId;
+ }
+ public void setChanNo(Integer chanNo)
+ {
+ this.chanNo = chanNo;
+ }
+
+ public Integer getChanNo()
+ {
+ return chanNo;
+ }
+ public void setUserId(String userId)
+ {
+ this.userId = userId;
+ }
+
+ public String getUserId()
+ {
+ return userId;
+ }
+ public void setPosition(String position)
+ {
+ this.position = position;
+ }
+
+ public String getPosition()
+ {
+ return position;
+ }
+
+ @Override
+ public String toString() {
+ return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
+ .append("id", getId())
+ .append("cameraId", getCameraId())
+ .append("chanNo", getChanNo())
+ .append("userId", getUserId())
+ .append("position", getPosition())
+ .toString();
+ }
+}
diff --git a/ard-work/src/main/java/com/ruoyi/device/camera/mapper/ArdCameraUserPostionMapper.java b/ard-work/src/main/java/com/ruoyi/device/camera/mapper/ArdCameraUserPostionMapper.java
new file mode 100644
index 0000000..f1fde9d
--- /dev/null
+++ b/ard-work/src/main/java/com/ruoyi/device/camera/mapper/ArdCameraUserPostionMapper.java
@@ -0,0 +1,69 @@
+package com.ruoyi.device.camera.mapper;
+
+import java.util.List;
+import com.ruoyi.device.camera.domain.ArdCameraUserPostion;
+import com.ruoyi.device.camera.domain.ArdCameras;
+
+/**
+ * 鐢ㄦ埛棰勮浣嶇疆Mapper鎺ュ彛
+ *
+ * @author 鍒樿嫃涔�
+ * @date 2024-05-08
+ */
+public interface ArdCameraUserPostionMapper
+{
+ /**
+ * 鏌ヨ鐢ㄦ埛棰勮浣嶇疆
+ *
+ * @param id 鐢ㄦ埛棰勮浣嶇疆涓婚敭
+ * @return 鐢ㄦ埛棰勮浣嶇疆
+ */
+ public ArdCameraUserPostion selectArdCameraUserPostionById(String id);
+ /**
+ * 鏌ヨ鐢ㄦ埛棰勮鐩告満淇℃伅
+ *
+ * @param ardCameraUserPostion 鐢ㄦ埛棰勮浣嶇疆涓婚敭
+ * @return 鐢ㄦ埛棰勮浣嶇疆
+ */
+ public ArdCameras selectArdCameraUserPostionByPosition(ArdCameraUserPostion ardCameraUserPostion);
+
+ /**
+ * 鏌ヨ鐢ㄦ埛棰勮浣嶇疆鍒楄〃
+ *
+ * @param ardCameraUserPostion 鐢ㄦ埛棰勮浣嶇疆
+ * @return 鐢ㄦ埛棰勮浣嶇疆闆嗗悎
+ */
+ public List<ArdCameraUserPostion> selectArdCameraUserPostionList(ArdCameraUserPostion ardCameraUserPostion);
+
+ /**
+ * 鏂板鐢ㄦ埛棰勮浣嶇疆
+ *
+ * @param ardCameraUserPostion 鐢ㄦ埛棰勮浣嶇疆
+ * @return 缁撴灉
+ */
+ public int insertArdCameraUserPostion(ArdCameraUserPostion ardCameraUserPostion);
+
+ /**
+ * 淇敼鐢ㄦ埛棰勮浣嶇疆
+ *
+ * @param ardCameraUserPostion 鐢ㄦ埛棰勮浣嶇疆
+ * @return 缁撴灉
+ */
+ public int updateArdCameraUserPostion(ArdCameraUserPostion ardCameraUserPostion);
+
+ /**
+ * 鍒犻櫎鐢ㄦ埛棰勮浣嶇疆
+ *
+ * @param id 鐢ㄦ埛棰勮浣嶇疆涓婚敭
+ * @return 缁撴灉
+ */
+ public int deleteArdCameraUserPostionById(String id);
+
+ /**
+ * 鎵归噺鍒犻櫎鐢ㄦ埛棰勮浣嶇疆
+ *
+ * @param ids 闇�瑕佸垹闄ょ殑鏁版嵁涓婚敭闆嗗悎
+ * @return 缁撴灉
+ */
+ public int deleteArdCameraUserPostionByIds(String[] ids);
+}
diff --git a/ard-work/src/main/java/com/ruoyi/device/camera/service/IArdCameraUserPostionService.java b/ard-work/src/main/java/com/ruoyi/device/camera/service/IArdCameraUserPostionService.java
new file mode 100644
index 0000000..65da311
--- /dev/null
+++ b/ard-work/src/main/java/com/ruoyi/device/camera/service/IArdCameraUserPostionService.java
@@ -0,0 +1,68 @@
+package com.ruoyi.device.camera.service;
+
+import java.util.List;
+import com.ruoyi.device.camera.domain.ArdCameraUserPostion;
+import com.ruoyi.device.camera.domain.ArdCameras;
+
+/**
+ * 鐢ㄦ埛棰勮浣嶇疆Service鎺ュ彛
+ *
+ * @author 鍒樿嫃涔�
+ * @date 2024-05-08
+ */
+public interface IArdCameraUserPostionService
+{
+ /**
+ * 鏌ヨ鐢ㄦ埛棰勮浣嶇疆
+ *
+ * @param id 鐢ㄦ埛棰勮浣嶇疆涓婚敭
+ * @return 鐢ㄦ埛棰勮浣嶇疆
+ */
+ public ArdCameraUserPostion selectArdCameraUserPostionById(String id);
+ /**
+ * 鏌ヨ鐢ㄦ埛棰勮鐩告満淇℃伅
+ *
+ * @param position 鐢ㄦ埛棰勮浣嶇疆
+ * @return 鐢ㄦ埛棰勮浣嶇疆
+ */
+ public ArdCameras selectArdCameraUserPostionByPosition(String position);
+ /**
+ * 鏌ヨ鐢ㄦ埛棰勮浣嶇疆鍒楄〃
+ *
+ * @param ardCameraUserPostion 鐢ㄦ埛棰勮浣嶇疆
+ * @return 鐢ㄦ埛棰勮浣嶇疆闆嗗悎
+ */
+ public List<ArdCameraUserPostion> selectArdCameraUserPostionList(ArdCameraUserPostion ardCameraUserPostion);
+
+ /**
+ * 鏂板鐢ㄦ埛棰勮浣嶇疆
+ *
+ * @param ardCameraUserPostion 鐢ㄦ埛棰勮浣嶇疆
+ * @return 缁撴灉
+ */
+ public int insertArdCameraUserPostion(ArdCameraUserPostion ardCameraUserPostion);
+
+ /**
+ * 淇敼鐢ㄦ埛棰勮浣嶇疆
+ *
+ * @param ardCameraUserPostion 鐢ㄦ埛棰勮浣嶇疆
+ * @return 缁撴灉
+ */
+ public int updateArdCameraUserPostion(ArdCameraUserPostion ardCameraUserPostion);
+
+ /**
+ * 鎵归噺鍒犻櫎鐢ㄦ埛棰勮浣嶇疆
+ *
+ * @param ids 闇�瑕佸垹闄ょ殑鐢ㄦ埛棰勮浣嶇疆涓婚敭闆嗗悎
+ * @return 缁撴灉
+ */
+ public int deleteArdCameraUserPostionByIds(String[] ids);
+
+ /**
+ * 鍒犻櫎鐢ㄦ埛棰勮浣嶇疆淇℃伅
+ *
+ * @param id 鐢ㄦ埛棰勮浣嶇疆涓婚敭
+ * @return 缁撴灉
+ */
+ public int deleteArdCameraUserPostionById(String id);
+}
diff --git a/ard-work/src/main/java/com/ruoyi/device/camera/service/impl/ArdCameraUserPostionServiceImpl.java b/ard-work/src/main/java/com/ruoyi/device/camera/service/impl/ArdCameraUserPostionServiceImpl.java
new file mode 100644
index 0000000..7bd810a
--- /dev/null
+++ b/ard-work/src/main/java/com/ruoyi/device/camera/service/impl/ArdCameraUserPostionServiceImpl.java
@@ -0,0 +1,110 @@
+package com.ruoyi.device.camera.service.impl;
+
+import java.util.List;
+
+import com.ruoyi.common.utils.uuid.IdUtils;
+import com.ruoyi.device.camera.domain.ArdCameras;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+
+import java.util.ArrayList;
+
+import com.ruoyi.common.utils.StringUtils;
+import com.ruoyi.common.utils.SecurityUtils;
+import com.ruoyi.device.camera.mapper.ArdCameraUserPostionMapper;
+import com.ruoyi.device.camera.domain.ArdCameraUserPostion;
+import com.ruoyi.device.camera.service.IArdCameraUserPostionService;
+
+/**
+ * 鐢ㄦ埛棰勮浣嶇疆Service涓氬姟灞傚鐞�
+ *
+ * @author 鍒樿嫃涔�
+ * @date 2024-05-08
+ */
+@Service
+public class ArdCameraUserPostionServiceImpl implements IArdCameraUserPostionService {
+ @Autowired
+ private ArdCameraUserPostionMapper ardCameraUserPostionMapper;
+
+ /**
+ * 鏌ヨ鐢ㄦ埛棰勮浣嶇疆
+ *
+ * @param id 鐢ㄦ埛棰勮浣嶇疆涓婚敭
+ * @return 鐢ㄦ埛棰勮浣嶇疆
+ */
+ @Override
+ public ArdCameraUserPostion selectArdCameraUserPostionById(String id) {
+ return ardCameraUserPostionMapper.selectArdCameraUserPostionById(id);
+ }
+
+ @Override
+ public ArdCameras selectArdCameraUserPostionByPosition(String position) {
+ ArdCameraUserPostion ardCameraUserPostion = new ArdCameraUserPostion();
+ ardCameraUserPostion.setUserId(SecurityUtils.getUserId());
+ ardCameraUserPostion.setPosition(position);
+ ArdCameras ardCameras = ardCameraUserPostionMapper.selectArdCameraUserPostionByPosition(ardCameraUserPostion);
+ return ardCameras;
+ }
+
+ /**
+ * 鏌ヨ鐢ㄦ埛棰勮浣嶇疆鍒楄〃
+ *
+ * @param ardCameraUserPostion 鐢ㄦ埛棰勮浣嶇疆
+ * @return 鐢ㄦ埛棰勮浣嶇疆
+ */
+ @Override
+ public List<ArdCameraUserPostion> selectArdCameraUserPostionList(ArdCameraUserPostion ardCameraUserPostion) {
+ return ardCameraUserPostionMapper.selectArdCameraUserPostionList(ardCameraUserPostion);
+ }
+
+ /**
+ * 鏂板鐢ㄦ埛棰勮浣嶇疆
+ *
+ * @param ardCameraUserPostion 鐢ㄦ埛棰勮浣嶇疆
+ * @return 缁撴灉
+ */
+ @Override
+ public int insertArdCameraUserPostion(ArdCameraUserPostion ardCameraUserPostion) {
+ ardCameraUserPostion.setUserId(SecurityUtils.getUserId());
+ List<ArdCameraUserPostion> ardCameraUserPostions = ardCameraUserPostionMapper.selectArdCameraUserPostionList(ardCameraUserPostion);
+ if (ardCameraUserPostions.size() > 0) {
+ return ardCameraUserPostionMapper.updateArdCameraUserPostion(ardCameraUserPostion);
+ } else {
+ ardCameraUserPostion.setId(IdUtils.simpleUUID());
+ return ardCameraUserPostionMapper.insertArdCameraUserPostion(ardCameraUserPostion);
+ }
+ }
+
+ /**
+ * 淇敼鐢ㄦ埛棰勮浣嶇疆
+ *
+ * @param ardCameraUserPostion 鐢ㄦ埛棰勮浣嶇疆
+ * @return 缁撴灉
+ */
+ @Override
+ public int updateArdCameraUserPostion(ArdCameraUserPostion ardCameraUserPostion) {
+ return ardCameraUserPostionMapper.updateArdCameraUserPostion(ardCameraUserPostion);
+ }
+
+ /**
+ * 鎵归噺鍒犻櫎鐢ㄦ埛棰勮浣嶇疆
+ *
+ * @param ids 闇�瑕佸垹闄ょ殑鐢ㄦ埛棰勮浣嶇疆涓婚敭
+ * @return 缁撴灉
+ */
+ @Override
+ public int deleteArdCameraUserPostionByIds(String[] ids) {
+ return ardCameraUserPostionMapper.deleteArdCameraUserPostionByIds(ids);
+ }
+
+ /**
+ * 鍒犻櫎鐢ㄦ埛棰勮浣嶇疆淇℃伅
+ *
+ * @param id 鐢ㄦ埛棰勮浣嶇疆涓婚敭
+ * @return 缁撴灉
+ */
+ @Override
+ public int deleteArdCameraUserPostionById(String id) {
+ return ardCameraUserPostionMapper.deleteArdCameraUserPostionById(id);
+ }
+}
diff --git a/ard-work/src/main/resources/mapper/device/ArdCameraUserPostionMapper.xml b/ard-work/src/main/resources/mapper/device/ArdCameraUserPostionMapper.xml
new file mode 100644
index 0000000..df0d743
--- /dev/null
+++ b/ard-work/src/main/resources/mapper/device/ArdCameraUserPostionMapper.xml
@@ -0,0 +1,148 @@
+<?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">
+<mapper namespace="com.ruoyi.device.camera.mapper.ArdCameraUserPostionMapper">
+
+ <resultMap type="ArdCameras" id="ArdCamerasResult">
+ <result property="id" column="id"/>
+ <result property="name" column="name"/>
+ <result property="ip" column="ip"/>
+ <result property="port" column="port"/>
+ <result property="rtspPort" column="rtsp_port"/>
+ <result property="username" column="username"/>
+ <result property="password" column="password"/>
+ <result property="gdtype" column="gdtype"/>
+ <result property="factory" column="factory"/>
+ <result property="chanNum" column="channel"/>
+ <result property="longitude" column="longitude"/>
+ <result property="latitude" column="latitude"/>
+ <result property="altitude" column="altitude"/>
+ <result property="userId" column="user_id"/>
+ <result property="deptId" column="dept_id"/>
+ <result property="camHeading" column="cam_heading"/>
+ <result property="camPitch" column="cam_pitch"/>
+ <result property="camRoll" column="cam_roll"/>
+ <result property="camNear" column="cam_near"/>
+ <result property="camFar" column="cam_far"/>
+ <result property="camAspectratio" column="cam_aspectratio"/>
+ <result property="camDepth" column="cam_depth"/>
+ <result property="camFov" column="cam_fov"/>
+ <result property="loginId" column="login_id"/>
+ <result property="operatorId" column="operator_id"/>
+ <result property="operatorExpired" column="operator_expired"/>
+ <result property="camMaxVisibleDistance" column="cam_max_visible_distance"/>
+ <result property="camAlarmGuideEnable" column="cam_alarm_guide_enable"/>
+ <result property="state" column="state"/>
+ <result property="towerId" column="tower_id"/>
+ <collection property="channelList" ofType="ArdChannel">
+ <result property="id" column="c_id"/>
+ <result property="name" column="c_name"/>
+ <result property="chanNo" column="c_chan_no"/>
+ <result property="deviceId" column="c_device_id"/>
+ </collection>
+ </resultMap>
+ <resultMap type="ArdCameraUserPostion" id="ArdCameraUserPostionResult">
+ <result property="id" column="id" />
+ <result property="cameraId" column="camera_id" />
+ <result property="chanNo" column="chan_no" />
+ <result property="userId" column="user_id" />
+ <result property="position" column="position" />
+ </resultMap>
+
+ <sql id="selectArdCameraUserPostionVo">
+ select id, camera_id, chan_no, user_id, position from ard_camera_user_postion
+ </sql>
+ <select id="selectArdCameraUserPostionList" parameterType="ArdCameraUserPostion" resultMap="ArdCameraUserPostionResult">
+ <include refid="selectArdCameraUserPostionVo"/>
+ <where>
+ <if test="userId != null and userId != ''"> and user_id = #{userId}</if>
+ <if test="position != null and position != ''"> and position = #{position}</if>
+ </where>
+ </select>
+ <select id="selectArdCameraUserPostionByPosition" parameterType="ArdCameraUserPostion" resultMap="ArdCamerasResult">
+ SELECT c.id,
+ c.name,
+ c.ip,
+ c.port,
+ c.rtsp_port,
+ c.username,
+ c.password,
+ c.gdtype,
+ c.factory,
+ c.channel,
+ c.longitude,
+ c.latitude,
+ c.altitude,
+ c.user_id,
+ c.dept_id,
+ c.login_id,
+ c.cam_heading,
+ c.cam_pitch,
+ c.cam_roll,
+ c.cam_near,
+ c.cam_far,
+ c.cam_aspectratio,
+ c.cam_depth,
+ c.cam_fov,
+ c.operator_id,
+ c.operator_expired,
+ c.cam_max_visible_distance,
+ c.cam_alarm_guide_enable,
+ c.state,
+ c.tower_id,
+ aaa.id as c_id,
+ aaa.device_id as c_device_id,
+ aaa.name as c_name,
+ aaa.chan_no as c_chan_no
+ FROM ard_camera_user_postion p
+ LEFT JOIN ard_cameras c ON c.id = p.camera_id
+ LEFT JOIN ard_channel aaa on c.id = aaa.device_id
+ where p.user_id = #{userId} and p.position = #{position}
+ </select>
+
+ <select id="selectArdCameraUserPostionById" parameterType="String" resultMap="ArdCameraUserPostionResult">
+ <include refid="selectArdCameraUserPostionVo"/>
+ where id = #{id}
+ </select>
+
+ <insert id="insertArdCameraUserPostion" parameterType="ArdCameraUserPostion">
+ insert into ard_camera_user_postion
+ <trim prefix="(" suffix=")" suffixOverrides=",">
+ <if test="id != null">id,</if>
+ <if test="cameraId != null">camera_id,</if>
+ <if test="chanNo != null">chan_no,</if>
+ <if test="userId != null">user_id,</if>
+ <if test="position != null">position,</if>
+ </trim>
+ <trim prefix="values (" suffix=")" suffixOverrides=",">
+ <if test="id != null">#{id},</if>
+ <if test="cameraId != null">#{cameraId},</if>
+ <if test="chanNo != null">#{chanNo},</if>
+ <if test="userId != null">#{userId},</if>
+ <if test="position != null">#{position},</if>
+ </trim>
+ </insert>
+
+ <update id="updateArdCameraUserPostion" parameterType="ArdCameraUserPostion">
+ update ard_camera_user_postion
+ <trim prefix="SET" suffixOverrides=",">
+ <if test="cameraId != null">camera_id = #{cameraId},</if>
+ <if test="chanNo != null">chan_no = #{chanNo},</if>
+ <if test="userId != null">user_id = #{userId},</if>
+ <if test="position != null">position = #{position},</if>
+ </trim>
+ where position = #{position} and user_id = #{userId}
+ </update>
+
+ <delete id="deleteArdCameraUserPostionById" parameterType="String">
+ delete from ard_camera_user_postion where id = #{id}
+ </delete>
+
+ <delete id="deleteArdCameraUserPostionByIds" parameterType="String">
+ delete from ard_camera_user_postion where id in
+ <foreach item="id" collection="array" open="(" separator="," close=")">
+ #{id}
+ </foreach>
+ </delete>
+</mapper>
\ No newline at end of file
--
Gitblit v1.9.3