BdDevcTrailUwbMapper.xml 5.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132
  1. <?xml version="1.0" encoding="UTF-8" ?>
  2. <!DOCTYPE mapper
  3. PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
  4. "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
  5. <mapper namespace="com.ruoyi.bd.mapper.BdDevcTrailUwbMapper">
  6. <resultMap type="BdDevcTrailUwb" id="BdDevcTrailUwbResult">
  7. <result property="id" column="id" />
  8. <result property="devcKey" column="devc_key" />
  9. <result property="lat" column="lat" />
  10. <result property="lng" column="lng" />
  11. <result property="dt" column="dt" />
  12. <result property="stepIndex" column="step_index" />
  13. <result property="tp" column="tp" />
  14. <result property="roomIndex" column="room_index" />
  15. <result property="updateTime" column="update_time" />
  16. <result property="createTime" column="create_time" />
  17. <result property="createBy" column="create_by" />
  18. <result property="updateBy" column="update_by" />
  19. </resultMap>
  20. <sql id="selectBdDevcTrailUwbVo">
  21. select id, devc_key, lat, lng, dt, step_index, tp, room_index, update_time, create_time, create_by, update_by from bd_devc_trail_uwb
  22. </sql>
  23. <select id="selectBdDevcTrailUwbList" parameterType="BdDevcTrailUwb" resultMap="BdDevcTrailUwbResult">
  24. <include refid="selectBdDevcTrailUwbVo"/>
  25. <where>
  26. <if test="devcKey != null and devcKey != ''"> and devc_key = #{devcKey}</if>
  27. <if test="dt != null and dt != ''"> and dt = #{dt}</if>
  28. </where>
  29. </select>
  30. <select id="selectBdDevcTrailUwbById" parameterType="Long" resultMap="BdDevcTrailUwbResult">
  31. <include refid="selectBdDevcTrailUwbVo"/>
  32. where id = #{id}
  33. </select>
  34. <insert id="insertBdDevcTrailUwb" parameterType="BdDevcTrailUwb" useGeneratedKeys="true" keyProperty="id">
  35. insert into bd_devc_trail_uwb
  36. <trim prefix="(" suffix=")" suffixOverrides=",">
  37. <if test="devcKey != null">devc_key,</if>
  38. <if test="lat != null">lat,</if>
  39. <if test="lng != null">lng,</if>
  40. <if test="dt != null">dt,</if>
  41. <if test="stepIndex != null">step_index,</if>
  42. <if test="tp != null">tp,</if>
  43. <if test="roomIndex != null">room_index,</if>
  44. <if test="updateTime != null">update_time,</if>
  45. <if test="createTime != null">create_time,</if>
  46. <if test="createBy != null">create_by,</if>
  47. <if test="updateBy != null">update_by,</if>
  48. </trim>
  49. <trim prefix="values (" suffix=")" suffixOverrides=",">
  50. <if test="devcKey != null">#{devcKey},</if>
  51. <if test="lat != null">#{lat},</if>
  52. <if test="lng != null">#{lng},</if>
  53. <if test="dt != null">#{dt},</if>
  54. <if test="stepIndex != null">#{stepIndex},</if>
  55. <if test="tp != null">#{tp},</if>
  56. <if test="roomIndex != null">#{roomIndex},</if>
  57. <if test="updateTime != null">#{updateTime},</if>
  58. <if test="createTime != null">#{createTime},</if>
  59. <if test="createBy != null">#{createBy},</if>
  60. <if test="updateBy != null">#{updateBy},</if>
  61. </trim>
  62. </insert>
  63. <update id="updateBdDevcTrailUwb" parameterType="BdDevcTrailUwb">
  64. update bd_devc_trail_uwb
  65. <trim prefix="SET" suffixOverrides=",">
  66. <if test="devcKey != null">devc_key = #{devcKey},</if>
  67. <if test="lat != null">lat = #{lat},</if>
  68. <if test="lng != null">lng = #{lng},</if>
  69. <if test="dt != null">dt = #{dt},</if>
  70. <if test="stepIndex != null">step_index = #{stepIndex},</if>
  71. <if test="tp != null">tp = #{tp},</if>
  72. <if test="roomIndex != null">room_index = #{roomIndex},</if>
  73. <if test="updateTime != null">update_time = #{updateTime},</if>
  74. <if test="createTime != null">create_time = #{createTime},</if>
  75. <if test="createBy != null">create_by = #{createBy},</if>
  76. <if test="updateBy != null">update_by = #{updateBy},</if>
  77. </trim>
  78. where id = #{id}
  79. </update>
  80. <delete id="deleteBdDevcTrailUwbById" parameterType="Long">
  81. delete from bd_devc_trail_uwb where id = #{id}
  82. </delete>
  83. <delete id="deleteBdDevcTrailUwbByIds" parameterType="String">
  84. delete from bd_devc_trail_uwb where id in
  85. <foreach item="id" collection="array" open="(" separator="," close=")">
  86. #{id}
  87. </foreach>
  88. </delete>
  89. <insert id="saveObjTail" parameterType="String">
  90. SET SESSION group_concat_max_len = 1024000;
  91. INSERT INTO bd_devc_trail (devc_key, dt, poly, update_time, create_time)
  92. SELECT devc_key, dt, poly, NOW(), NOW()
  93. FROM (SELECT devc_key,
  94. dt,
  95. concat(
  96. '[',
  97. GROUP_CONCAT(
  98. CONCAT(
  99. '[',
  100. lng,
  101. ',',
  102. lat,
  103. ',',
  104. COALESCE(altitude, '-1'),
  105. ',',
  106. step_index,
  107. ',',
  108. COALESCE(room_index, '-1'),
  109. ']'
  110. ) ORDER BY
  111. step_index SEPARATOR ','
  112. ),
  113. ']'
  114. ) AS poly
  115. FROM bd_devc_trail_uwb
  116. WHERE dt = #{dt}
  117. GROUP BY devc_key,
  118. dt) res ON DUPLICATE KEY
  119. UPDATE poly =
  120. VALUES (poly), update_time =
  121. VALUES (update_time);
  122. </insert>
  123. </mapper>