|
@@ -0,0 +1,204 @@
|
|
|
+<?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.ConfigMapper" >
|
|
|
+
|
|
|
+ <resultMap id="ConfigVOMap" type="api.common.pojo.vo.model.ConfigVO">
|
|
|
+ <id column="ID" property="id" jdbcType="VARCHAR" />
|
|
|
+ </resultMap>
|
|
|
+
|
|
|
+ <resultMap id="ConfigSensorVOMap" type="api.common.pojo.vo.model.ConfigSensorVO">
|
|
|
+ <id column="ID" property="id" jdbcType="VARCHAR" />
|
|
|
+ </resultMap>
|
|
|
+
|
|
|
+ <select id="getConfigPageList" parameterType="api.common.pojo.param.model.ConfigPageParam" resultMap="ConfigVOMap">
|
|
|
+ select
|
|
|
+ c.id,
|
|
|
+ c.config_code,
|
|
|
+ c.config_name,
|
|
|
+ c.description as configDescription,
|
|
|
+ v.id as vehicleId,
|
|
|
+ v.vehicle_name,
|
|
|
+ v.description as vehicleDescription,
|
|
|
+ c.share
|
|
|
+ from model_config c
|
|
|
+ LEFT JOIN model_vehicle v on c.vehicle_id = v.id
|
|
|
+ WHERE c.is_deleted = '0' and c.share = #{share,jdbcType=VARCHAR}
|
|
|
+ <if test="configId != null and configId != ''">
|
|
|
+ and c.config_id like CONCAT('%',#{configId,jdbcType=VARCHAR},'%')
|
|
|
+ </if>
|
|
|
+ <if test="configName != null and configName != ''">
|
|
|
+ and c.config_name like CONCAT('%',#{configName,jdbcType=VARCHAR},'%')
|
|
|
+ </if>
|
|
|
+ <if test="configDescription != null and configDescription != ''">
|
|
|
+ and c.description like CONCAT('%',#{configDescription,jdbcType=VARCHAR},'%')
|
|
|
+ </if>
|
|
|
+ <if test="createUserId != null and createUserId != ''">
|
|
|
+ and c.create_user_id = #{createUserId,jdbcType=VARCHAR}
|
|
|
+ </if>
|
|
|
+ order by c.create_time desc
|
|
|
+ </select>
|
|
|
+
|
|
|
+ <select id="getConfigInfo" parameterType="api.common.pojo.param.model.ConfigPageParam" resultMap="ConfigVOMap">
|
|
|
+ SELECT
|
|
|
+ c.id,
|
|
|
+ c.config_code,
|
|
|
+ c.config_name,
|
|
|
+ c.description as configDescription,
|
|
|
+ v.vehicle_name,
|
|
|
+ v.description as vehicleDescription
|
|
|
+ FROM model_config c
|
|
|
+ LEFT JOIN model_vehicle v ON v.id = c.vehicle_id
|
|
|
+ WHERE c.is_deleted = '0'
|
|
|
+ and c.id = #{id,jdbcType=VARCHAR}
|
|
|
+ </select>
|
|
|
+
|
|
|
+ <select id="getConfigSensors" parameterType="api.common.pojo.param.model.ConfigPageParam" resultMap="ConfigSensorVOMap">
|
|
|
+ <!--摄像头-->
|
|
|
+ SELECT
|
|
|
+ r.id,r.config_id,r.sensor_id,
|
|
|
+ s.sensor_name, s.description as sensorDescription,
|
|
|
+ r.sensor_type,
|
|
|
+ r.sensor_x, r.sensor_y, r.sensor_z, r.sensor_h, r.sensor_p, r.sensor_r, r.sensor_port
|
|
|
+ FROM relation_config_sensor r
|
|
|
+ INNER JOIN model_sensor_camera s ON r.sensor_id = s.id
|
|
|
+ WHERE r.config_id = #{id,jdbcType=VARCHAR}
|
|
|
+ UNION
|
|
|
+ <!--完美传感器-->
|
|
|
+ SELECT
|
|
|
+ r.id,r.config_id,r.sensor_id,
|
|
|
+ s.sensor_name, s.description as sensorDescription,
|
|
|
+ r.sensor_type,
|
|
|
+ r.sensor_x, r.sensor_y, r.sensor_z, r.sensor_h, r.sensor_p, r.sensor_r, r.sensor_port
|
|
|
+ FROM relation_config_sensor r
|
|
|
+ INNER JOIN model_sensor_ogt s ON r.sensor_id = s.id
|
|
|
+ WHERE r.config_id = #{id,jdbcType=VARCHAR}
|
|
|
+ UNION
|
|
|
+ <!--激光雷达-->
|
|
|
+ SELECT
|
|
|
+ r.id,r.config_id,r.sensor_id,
|
|
|
+ s.sensor_name, s.description as sensorDescription,
|
|
|
+ r.sensor_type,
|
|
|
+ r.sensor_x, r.sensor_y, r.sensor_z, r.sensor_h, r.sensor_p, r.sensor_r, r.sensor_port
|
|
|
+ FROM relation_config_sensor r
|
|
|
+ INNER JOIN model_sensor_lidar s ON r.sensor_id = s.id
|
|
|
+ WHERE r.config_id = #{id,jdbcType=VARCHAR}
|
|
|
+ UNION
|
|
|
+ <!--GPS-->
|
|
|
+ SELECT
|
|
|
+ r.id,r.config_id,r.sensor_id,
|
|
|
+ s.sensor_name, s.description as sensorDescription,
|
|
|
+ r.sensor_type,
|
|
|
+ r.sensor_x, r.sensor_y, r.sensor_z, r.sensor_h, r.sensor_p, r.sensor_r, r.sensor_port
|
|
|
+ FROM relation_config_sensor r
|
|
|
+ INNER JOIN model_sensor_gps s ON r.sensor_id = s.id
|
|
|
+ WHERE r.config_id = #{id,jdbcType=VARCHAR}
|
|
|
+ </select>
|
|
|
+
|
|
|
+ <select id="checkConfigName" parameterType="api.common.pojo.po.model.ConfigPO" resultMap="ConfigVOMap">
|
|
|
+ select
|
|
|
+ id
|
|
|
+ from model_config
|
|
|
+ where is_deleted = '0' and share = '0'
|
|
|
+ and config_name = #{configName,jdbcType=VARCHAR}
|
|
|
+ and create_user_id = #{createUserId,jdbcType=VARCHAR}
|
|
|
+ and id <> #{id,jdbcType=VARCHAR}
|
|
|
+ </select>
|
|
|
+
|
|
|
+ <insert id="insertConfig" parameterType="api.common.pojo.po.model.ConfigPO">
|
|
|
+ insert into model_config(
|
|
|
+ id,
|
|
|
+ config_code,
|
|
|
+ config_name,
|
|
|
+ description,
|
|
|
+ vehicle_id,
|
|
|
+ share,
|
|
|
+ create_time,
|
|
|
+ modify_time,
|
|
|
+ create_user_id,
|
|
|
+ modify_user_id,
|
|
|
+ is_deleted
|
|
|
+ )
|
|
|
+ values(
|
|
|
+ #{id,jdbcType=VARCHAR},
|
|
|
+ #{configCode,jdbcType=VARCHAR},
|
|
|
+ #{configName,jdbcType=VARCHAR},
|
|
|
+ #{description,jdbcType=VARCHAR},
|
|
|
+ #{vehicleId,jdbcType=VARCHAR},
|
|
|
+ #{share,jdbcType=VARCHAR},
|
|
|
+ #{createTime,jdbcType=TIMESTAMP},
|
|
|
+ #{modifyTime,jdbcType=TIMESTAMP},
|
|
|
+ #{createUserId,jdbcType=VARCHAR},
|
|
|
+ #{modifyUserId,jdbcType=VARCHAR},
|
|
|
+ #{isDeleted,jdbcType=VARCHAR}
|
|
|
+ )
|
|
|
+ </insert>
|
|
|
+
|
|
|
+ <update id="updateConfig" parameterType="api.common.pojo.po.model.ConfigPO">
|
|
|
+ update model_config set
|
|
|
+ config_code = #{configCode,jdbcType=VARCHAR},
|
|
|
+ config_name = #{configName,jdbcType=VARCHAR},
|
|
|
+ description = #{description,jdbcType=VARCHAR},
|
|
|
+ vehicle_id = #{vehicleId,jdbcType=VARCHAR},
|
|
|
+
|
|
|
+ modify_time = #{modifyTime,jdbcType=TIMESTAMP},
|
|
|
+ modify_user_id = #{modifyUserId,jdbcType=VARCHAR}
|
|
|
+ where id = #{id,jdbcType=VARCHAR}
|
|
|
+ </update>
|
|
|
+
|
|
|
+ <update id="delConfigSensors" parameterType="api.common.pojo.po.model.ConfigPO">
|
|
|
+ update relation_config_sensor set
|
|
|
+ modify_time = #{modifyTime,jdbcType=TIMESTAMP},
|
|
|
+ modify_user_id = #{modifyUserId,jdbcType=VARCHAR},
|
|
|
+ is_deleted = '1'
|
|
|
+ where config_id = #{id,jdbcType=VARCHAR}
|
|
|
+ </update>
|
|
|
+
|
|
|
+ <insert id="insertConfigSensors">
|
|
|
+ insert into relation_config_sensor(
|
|
|
+ id,
|
|
|
+ config_id,
|
|
|
+ sensor_id,
|
|
|
+ sensor_type,
|
|
|
+ sensor_x,
|
|
|
+ sensor_y,
|
|
|
+ sensor_z,
|
|
|
+ sensor_h,
|
|
|
+ sensor_p,
|
|
|
+ sensor_r,
|
|
|
+ sensor_port,
|
|
|
+ create_time,
|
|
|
+ modify_time,
|
|
|
+ create_user_id,
|
|
|
+ modify_user_id,
|
|
|
+ is_deleted
|
|
|
+ ) values
|
|
|
+ <foreach collection="list" item="item" separator=",">
|
|
|
+ (
|
|
|
+ #{item.id,jdbcType=VARCHAR},
|
|
|
+ #{item.configId,jdbcType=VARCHAR},
|
|
|
+ #{item.sensorId,jdbcType=VARCHAR},
|
|
|
+ #{item.sensorType,jdbcType=VARCHAR},
|
|
|
+ #{item.sensorX,jdbcType=DECIMAL},
|
|
|
+ #{item.sensorY,jdbcType=DECIMAL},
|
|
|
+ #{item.sensorZ,jdbcType=DECIMAL},
|
|
|
+ #{item.sensorH,jdbcType=DECIMAL},
|
|
|
+ #{item.sensorP,jdbcType=DECIMAL},
|
|
|
+ #{item.sensorR,jdbcType=DECIMAL},
|
|
|
+ #{item.sensorPort,jdbcType=INTEGER},
|
|
|
+ #{item.createTime,jdbcType=TIMESTAMP},
|
|
|
+ #{item.modifyTime,jdbcType=TIMESTAMP},
|
|
|
+ #{item.createUserId,jdbcType=VARCHAR},
|
|
|
+ #{item.modifyUserId,jdbcType=VARCHAR},
|
|
|
+ #{item.isDeleted,jdbcType=VARCHAR}
|
|
|
+ )
|
|
|
+ </foreach>
|
|
|
+ </insert>
|
|
|
+
|
|
|
+ <update id="delConfigById" parameterType="api.common.pojo.po.model.ConfigPO">
|
|
|
+ update model_config set
|
|
|
+ modify_time = #{modifyTime,jdbcType=TIMESTAMP},
|
|
|
+ modify_user_id = #{modifyUserId,jdbcType=VARCHAR},
|
|
|
+ is_deleted = #{isDeleted,jdbcType=VARCHAR}
|
|
|
+ where id = #{id,jdbcType=VARCHAR}
|
|
|
+ </update>
|
|
|
+</mapper>
|