SceneReferenceLibMapper.xml 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245
  1. <?xml version="1.0" encoding="UTF-8" ?>
  2. <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd" >
  3. <mapper namespace="com.css.simulation.resource.server.infra.db.mysql.mapper.SceneReferenceLibMapper">
  4. <insert id="saveSceneReference" parameterType="api.common.pojo.po.scene.SceneReferenceLibPO">
  5. insert into simulation.scene_reference_lib
  6. (scene_id, scene_name, main_behavior, other_behavior, weather,road_type,road_geometry_plane,road_geometry_vertical,
  7. auto_drive_function, operation_area,scene_description,label,
  8. create_user_id, create_time, modify_user_id, modify_time,
  9. is_deleted, video_preview, video_address, osgb_address, xml_address, xodr_address,
  10. json_address, max_time)
  11. values (#{sceneId,jdbcType=VARCHAR},#{sceneName,jdbcType=VARCHAR}, #{mainBehavior,jdbcType=VARCHAR}, #{otherBehavior,jdbcType=VARCHAR},
  12. #{weather,jdbcType=VARCHAR}, #{roadType,jdbcType=VARCHAR}, #{roadGeometryPlane,jdbcType=VARCHAR}, #{roadGeometryVertical,jdbcType=VARCHAR},
  13. #{autoDriveFunction,jdbcType=VARCHAR}, #{operationArea,jdbcType=VARCHAR}, #{sceneDescription,jdbcType=VARCHAR}, #{label,jdbcType=VARCHAR},
  14. #{createUserId,jdbcType=VARCHAR}, #{createTime}, #{modifyUserId,jdbcType=VARCHAR}, #{modifyTime},
  15. #{isDeleted,jdbcType=VARCHAR}, #{videoPreview,jdbcType=VARCHAR},
  16. #{videoAddress,jdbcType=VARCHAR}, #{osgbAddress,jdbcType=VARCHAR},
  17. #{xmlAddress,jdbcType=VARCHAR}, #{xodrAddress,jdbcType=VARCHAR}, #{jsonAddress,jdbcType=VARCHAR},
  18. #{maxTime,jdbcType=VARCHAR})
  19. </insert>
  20. <select id="selectAllByName" parameterType="api.common.pojo.po.scene.SceneReferenceLibPO"
  21. resultType="api.common.pojo.po.scene.SceneReferenceLibPO">
  22. select scene_id,
  23. scene_name,
  24. main_behavior,
  25. other_behavior,
  26. create_user_id,
  27. create_time,
  28. modify_user_id,
  29. modify_time,
  30. is_deleted,
  31. video_preview,
  32. video_address,
  33. osgb_address,
  34. xml_address,
  35. xodr_address,
  36. json_address,
  37. max_time
  38. from simulation.scene_reference_lib
  39. where is_deleted = '0'
  40. and scene_name = #{sceneName,jdbcType=VARCHAR}
  41. </select>
  42. <update id="updateSceneReference" parameterType="api.common.pojo.po.scene.SceneReferenceLibPO">
  43. update simulation.scene_reference_lib
  44. set scene_name=#{sceneName},
  45. main_behavior=#{mainBehavior},
  46. other_behavior=#{otherBehavior},
  47. weather=#{weather},
  48. road_type=#{roadType},
  49. road_geometry_plane=#{roadGeometryPlane},
  50. road_geometry_vertical=#{roadGeometryVertical},
  51. auto_drive_function=#{autoDriveFunction},
  52. operation_area=#{operationArea},
  53. scene_description=#{sceneDescription},
  54. label=#{label},
  55. modify_user_id=#{modifyUserId},
  56. modify_time=#{modifyTime},
  57. video_address=#{videoAddress},
  58. osgb_address=#{osgbAddress},
  59. xml_address=#{xmlAddress},
  60. xodr_address=#{xodrAddress},
  61. json_address=#{jsonAddress},
  62. video_preview=#{videoPreview},
  63. max_time=#{maxTime}
  64. where scene_id = #{sceneId,jdbcType=VARCHAR}
  65. </update>
  66. <select id="querySceneReferenceLibList" parameterType="api.common.pojo.param.scene.SceneReferenceLibParam"
  67. resultType="api.common.pojo.po.scene.SceneReferenceLibPO">
  68. SELECT
  69. scene_id,
  70. scene_name,
  71. main_behavior,
  72. other_behavior,
  73. weather,
  74. road_type,
  75. road_geometry_plane,
  76. road_geometry_vertical,
  77. auto_drive_function,
  78. operation_area,
  79. scene_description,
  80. label,
  81. create_time,
  82. modify_user_id,
  83. modify_time,
  84. video_preview,
  85. video_address,
  86. osgb_address,
  87. xml_address,
  88. xodr_address,
  89. json_address,
  90. max_time
  91. FROM simulation.scene_reference_lib
  92. <where>
  93. is_deleted = '0'
  94. <if test="ids != null and ids.length>0">
  95. and scene_id in
  96. <foreach collection="ids" item="item" index="index"
  97. separator="," open="(" close=")">
  98. #{item}
  99. </foreach>
  100. </if>
  101. <if test="names != null and names.length>0">
  102. and scene_name in
  103. <foreach collection="names" item="item" index="index"
  104. separator="," open="(" close=")">
  105. #{item}
  106. </foreach>
  107. </if>
  108. <if test="sceneName != null and sceneName != ''">
  109. AND scene_name LIKE CONCAT('%',#{sceneName,jdbcType=VARCHAR},'%')
  110. </if>
  111. <if test="sceneDescription != null and sceneDescription != ''">
  112. AND scene_description LIKE CONCAT('%',#{sceneDescription,jdbcType=VARCHAR},'%')
  113. </if>
  114. <if test="label != null and label != ''">
  115. AND label LIKE CONCAT('%',#{label,jdbcType=VARCHAR},'%')
  116. </if>
  117. <if test="mainBehavior != null and mainBehavior.size()>0">
  118. AND
  119. <foreach collection="mainBehavior" item="item" index="index"
  120. separator=" or " open="(" close=")">
  121. main_behavior LIKE CONCAT('%,',#{item},',%')
  122. OR main_behavior LIKE CONCAT('%,',#{item}) OR
  123. main_behavior LIKE CONCAT(#{item},',%') OR
  124. main_behavior=#{item}
  125. </foreach>
  126. </if>
  127. <if test="otherBehavior != null and otherBehavior.size()>0">
  128. and
  129. <foreach collection="otherBehavior" item="item" index="index"
  130. separator=" or " open="(" close=")">
  131. other_behavior LIKE CONCAT('%,',#{item},',%')
  132. OR other_behavior LIKE CONCAT('%,',#{item}) OR
  133. other_behavior LIKE CONCAT(#{item},',%') OR
  134. other_behavior=#{item}
  135. </foreach>
  136. </if>
  137. <if test="weather != null and weather.size()>0 ">
  138. AND weather IN
  139. <foreach collection="weather" item="item" index="index"
  140. separator="," open="(" close=")">
  141. #{item}
  142. </foreach>
  143. </if>
  144. <if test="roadType != null and roadType.size()>0">
  145. AND road_type IN
  146. <foreach collection="roadType" item="item" index="index"
  147. separator="," open="(" close=")">
  148. #{item}
  149. </foreach>
  150. </if>
  151. <if test="roadGeometryPlane != null and roadGeometryPlane.size()>0">
  152. AND road_geometry_plane IN
  153. <foreach collection="roadGeometryPlane" item="item" index="index"
  154. separator="," open="(" close=")">
  155. #{item}
  156. </foreach>
  157. </if>
  158. <if test="roadGeometryVertical != null and roadGeometryVertical.size()>0">
  159. AND road_geometry_vertical IN
  160. <foreach collection="roadGeometryVertical" item="item" index="index"
  161. separator="," open="(" close=")">
  162. #{item}
  163. </foreach>
  164. </if>
  165. <if test="autoDriveFunction != null and autoDriveFunction.size()>0">
  166. AND auto_drive_function IN
  167. <foreach collection="autoDriveFunction" item="item" index="index"
  168. separator="," open="(" close=")">
  169. #{item}
  170. </foreach>
  171. </if>
  172. <if test="operationArea != null and operationArea.size()>0">
  173. AND operation_area IN
  174. <foreach collection="operationArea" item="item" index="index"
  175. separator="," open="(" close=")">
  176. #{item}
  177. </foreach>
  178. </if>
  179. <if test="needComplexity != null and needComplexity != ''">
  180. and scene_id in (select scene_id from scene_complexity where is_deleted = '0'
  181. <if test="minComplexity != null and minComplexity != ''">
  182. AND complexity+0 >= #{minComplexity}
  183. </if>
  184. <if test="maxComplexity != null and maxComplexity != ''">
  185. AND complexity+0 &lt;= #{maxComplexity}
  186. </if>
  187. <if test="complexityLevels != null and complexityLevels.size()>0">
  188. AND complexity_level IN
  189. <foreach collection="complexityLevels" item="item" index="index"
  190. separator="," open="(" close=")">
  191. #{item}
  192. </foreach>
  193. </if>
  194. )
  195. </if>
  196. <if test="needRisk != null and needRisk != ''">
  197. and scene_id in (select scene_id from scene_risk where is_deleted = '0'
  198. <if test="minRisk != null and minRisk != ''">
  199. AND risk+0 >= #{minRisk}
  200. </if>
  201. <if test="maxRisk != null and maxRisk != ''">
  202. AND risk+0 &lt;= #{maxRisk}
  203. </if>
  204. <if test="riskLevels != null and riskLevels.size()>0">
  205. AND risk_level IN
  206. <foreach collection="riskLevels" item="item" index="index"
  207. separator="," open="(" close=")">
  208. #{item}
  209. </foreach>
  210. </if>
  211. )
  212. </if>
  213. </where>
  214. ORDER BY create_time,scene_name DESC
  215. </select>
  216. <select id="selectIdsByNames" resultType="java.lang.String">
  217. select scene_id
  218. from scene_reference_lib
  219. where is_deleted = '0'
  220. and scene_name in
  221. <foreach item="item" collection="list" separator="," open="(" close=")">
  222. #{item}
  223. </foreach>
  224. </select>
  225. <update id="deleteBySceneNames">
  226. update scene_reference_lib
  227. set is_deleted = '1',
  228. modify_user_id = #{modifyUserId},
  229. modify_time = #{modifyTime}
  230. where is_deleted = '0' and scene_name in
  231. <foreach item="item" collection="sceneNames" separator="," open="(" close=")">
  232. #{item}
  233. </foreach>
  234. </update>
  235. </mapper>