Sfoglia il codice sorgente

传感器-摄像头

WXF 3 anni fa
parent
commit
d467e6eceb

+ 16 - 0
api-common/src/main/java/api/common/pojo/param/model/CameraParam.java

@@ -0,0 +1,16 @@
+package api.common.pojo.param.model;
+
+import lombok.Data;
+
+@Data
+public class CameraParam {
+
+    //主键id
+    private String id;
+    //车辆名称
+    private String sensorName;
+    //创建人id
+    private String createUserId;
+    //是否分享
+    private String share;
+}

+ 35 - 0
api-common/src/main/java/api/common/pojo/po/model/CameraPO.java

@@ -0,0 +1,35 @@
+package api.common.pojo.po.model;
+
+import api.common.pojo.common.CommonPO;
+import lombok.Data;
+
+import java.math.BigDecimal;
+
+@Data
+public class CameraPO extends CommonPO {
+
+    //主键id
+    private String id;
+    //传感器id
+    private String sensorId;
+    //传感器名称
+    private String sensorName;
+    //传感器描述
+    private String description;
+    //盲区距离
+    private BigDecimal nearDistance;
+    //探测距离
+    private BigDecimal farDistance;
+    //水平现场角
+    private BigDecimal fovH;
+    //垂直现场角
+    private BigDecimal fovV;
+    //分辨率
+    private String resolution;
+    //帧率
+    private BigDecimal frameRate;
+    //是否显示本车(1显示0不显示)
+    private String selfDisplay;
+    //是否分享
+    private String share;
+}

+ 34 - 0
api-common/src/main/java/api/common/pojo/vo/model/CameraVO.java

@@ -0,0 +1,34 @@
+package api.common.pojo.vo.model;
+
+import lombok.Data;
+
+import java.math.BigDecimal;
+
+@Data
+public class CameraVO {
+
+    //主键id
+    private String id;
+    //传感器id
+    private String sensorId;
+    //传感器名称
+    private String sensorName;
+    //传感器描述
+    private String description;
+    //盲区距离
+    private BigDecimal nearDistance;
+    //探测距离
+    private BigDecimal farDistance;
+    //水平现场角
+    private BigDecimal fovH;
+    //垂直现场角
+    private BigDecimal fovV;
+    //分辨率
+    private String resolution;
+    //帧率
+    private BigDecimal frameRate;
+    //是否显示本车(1显示0不显示)
+    private String selfDisplay;
+    //是否分享
+    private String share;
+}

+ 43 - 0
simulation-resource-server/src/main/java/com/css/simulation/resource/model/ctrl/CameraCtrl.java

@@ -0,0 +1,43 @@
+package com.css.simulation.resource.model.ctrl;
+
+import api.common.pojo.common.ResponseBodyVO;
+import api.common.pojo.param.model.CameraParam;
+import api.common.pojo.vo.model.CameraVO;
+import com.css.simulation.resource.model.service.CameraService;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Controller;
+import org.springframework.web.bind.annotation.RequestBody;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.ResponseBody;
+
+import java.util.List;
+
+@Controller
+@RequestMapping("/camera")
+public class CameraCtrl {
+
+    @Autowired
+    CameraService cameraService;
+
+    /**
+     * 获取列表
+     */
+    @RequestMapping("/getCameraList")
+    @ResponseBody
+    public ResponseBodyVO<List<CameraVO>> getCameraList(@RequestBody CameraParam cameraParam){
+        ResponseBodyVO<List<CameraVO>> response = new ResponseBodyVO<List<CameraVO>>(ResponseBodyVO.Response.SUCCESS);
+        response.setInfo(cameraService.getCameraList(cameraParam));
+        return response;
+    }
+
+    /**
+     * 根据id获取详情
+     */
+    @RequestMapping("/getCameraInfo")
+    @ResponseBody
+    public ResponseBodyVO<CameraVO> getCameraInfo(@RequestBody CameraParam cameraParam){
+        ResponseBodyVO<CameraVO> response = new ResponseBodyVO<CameraVO>(ResponseBodyVO.Response.SUCCESS);
+        response.setInfo(cameraService.getCameraInfo(cameraParam));
+        return response;
+    }
+}

+ 17 - 0
simulation-resource-server/src/main/java/com/css/simulation/resource/model/mapper/CameraMapper.java

@@ -0,0 +1,17 @@
+package com.css.simulation.resource.model.mapper;
+
+import api.common.pojo.param.model.CameraParam;
+import api.common.pojo.vo.model.CameraVO;
+import org.apache.ibatis.annotations.Mapper;
+import org.springframework.stereotype.Repository;
+
+import java.util.List;
+
+@Mapper
+@Repository
+public interface CameraMapper {
+
+    List<CameraVO> getCameraList(CameraParam cameraParam);
+
+    CameraVO getCameraInfo(CameraParam cameraParam);
+}

+ 27 - 0
simulation-resource-server/src/main/java/com/css/simulation/resource/model/service/CameraService.java

@@ -0,0 +1,27 @@
+package com.css.simulation.resource.model.service;
+
+import api.common.pojo.param.model.CameraParam;
+import api.common.pojo.vo.model.CameraVO;
+import com.css.simulation.resource.common.utils.AuthUtil;
+import com.css.simulation.resource.model.mapper.CameraMapper;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+
+import java.util.List;
+
+@Service
+public class CameraService {
+
+    @Autowired
+    CameraMapper cameraMapper;
+
+    public List<CameraVO> getCameraList(CameraParam cameraParam) {
+        cameraParam.setCreateUserId(AuthUtil.getCurrentUserId());
+        List<CameraVO> list = cameraMapper.getCameraList(cameraParam);
+        return list;
+    }
+
+    public CameraVO getCameraInfo(CameraParam cameraParam) {
+        return cameraMapper.getCameraInfo(cameraParam);
+    }
+}

+ 58 - 0
simulation-resource-server/src/main/resources/mapper/model/CameraMapper.xml

@@ -0,0 +1,58 @@
+<?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.css.simulation.resource.model.mapper.CameraMapper" >
+
+    <resultMap id="CameraVOMap" type="api.common.pojo.vo.model.CameraVO">
+        <id column="ID" property="id" jdbcType="VARCHAR" />
+        <result column="sensor_id" property="sensorId" jdbcType="VARCHAR" />
+        <result column="sensor_name" property="sensorName" jdbcType="VARCHAR" />
+        <result column="description" property="description" jdbcType="VARCHAR" />
+        <result column="near_distance" property="nearDistance" jdbcType="DECIMAL" />
+        <result column="far_distance" property="farDistance" jdbcType="DECIMAL" />
+        <result column="fov_h" property="fovH" jdbcType="DECIMAL" />
+        <result column="fov_v" property="fovV" jdbcType="DECIMAL" />
+        <result column="resolution" property="resolution" jdbcType="VARCHAR" />
+        <result column="frame_rate" property="frameRate" jdbcType="DECIMAL" />
+        <result column="self_display" property="selfDisplay" jdbcType="VARCHAR" />
+        <result column="share" property="share" jdbcType="VARCHAR" />
+
+    </resultMap>
+
+    <select id="getCameraList" parameterType="api.common.pojo.param.model.CameraParam" resultMap="CameraVOMap">
+        select
+          id,
+          sensor_name,
+          share
+        from model_sensor_camera c
+        where c.is_deleted = '0'
+        <if test="sensorName != null and sensorName != ''">
+            and c.sensor_name like CONCAT('%',#{sensorName,jdbcType=VARCHAR},'%')
+        </if>
+        <if test="share != null and share != ''">
+            and c.create_user_id = #{createUserId,jdbcType=VARCHAR}
+            and c.share = '0'
+        </if>
+        <if test="share == null or share == ''">
+            and (c.create_user_id = #{createUserId,jdbcType=VARCHAR} or c.share = '1')
+        </if>
+        order by c.create_time desc
+    </select>
+
+    <select id="getCameraInfo" parameterType="api.common.pojo.param.model.CameraParam" resultMap="CameraVOMap">
+        select
+            id,
+            sensor_id,
+            sensor_name,
+            description,
+            near_distance,
+            far_distance,
+            fov_h,
+            fov_v,
+            resolution,
+            frame_rate,
+            self_display,
+            share
+        from model_sensor_camera c
+        where c.id = #{id,jdbcType=VARCHAR} limit 1
+    </select>
+</mapper>

+ 10 - 7
simulation-resource-server/src/main/resources/mapper/vehicle/VehicleMapper.xml → simulation-resource-server/src/main/resources/mapper/model/VehicleMapper.xml

@@ -37,13 +37,16 @@
           share
         from model_vehicle v
         where v.is_deleted = '0'
-          and v.create_user_id = #{createUserId,jdbcType=VARCHAR}
-            <if test="vehicleName != null and vehicleName != ''">
-                and v.vehicle_name like CONCAT('%',#{vehicleName,jdbcType=VARCHAR},'%')
-            </if>
-            <if test="share != null and share != ''">
-                and v.share = #{share,jdbcType=VARCHAR}
-            </if>
+        <if test="vehicleName != null and vehicleName != ''">
+            and v.vehicle_name like CONCAT('%',#{vehicleName,jdbcType=VARCHAR},'%')
+        </if>
+        <if test="share != null and share != ''">
+            and v.create_user_id = #{createUserId,jdbcType=VARCHAR}
+            and v.share = '0'
+        </if>
+        <if test="share == null or share == ''">
+            and (v.create_user_id = #{createUserId,jdbcType=VARCHAR} or v.share = '1')
+        </if>
         order by v.create_time desc
     </select>