SceneAccidentMapper.xml 22 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471
  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.scene.mapper.SceneAccidentMapper">
  4. <insert id="saveSceneAccident" parameterType="api.common.pojo.po.scene.SceneAccidentPO">
  5. insert into simulation.scene_accident
  6. (accident_id,scene_name,self_driving,target_driving,
  7. self_reaction,conflict_behavior,conflict_type,
  8. scence_resume,scene_time,scene_weather,
  9. create_user_id,create_time,modify_user_id,modify_time,
  10. is_deleted,share,video_preview,video_address,osgb_address,xml_address,xodr_address,
  11. json_address,max_time)
  12. values (#{accidentId,jdbcType=VARCHAR},#{sceneName,jdbcType=VARCHAR},#{selfDriving,jdbcType=VARCHAR}, #{targetDriving,jdbcType=VARCHAR},
  13. #{selfReaction,jdbcType=VARCHAR}, #{conflictBehavior,jdbcType=VARCHAR},#{conflictType,jdbcType=VARCHAR},
  14. #{scenceResume,jdbcType=VARCHAR}, #{sceneTime,jdbcType=VARCHAR},#{sceneWeather,jdbcType=VARCHAR},
  15. #{createUserId,jdbcType=VARCHAR},#{createTime},#{modifyUserId,jdbcType=VARCHAR},#{modifyTime},
  16. #{isDeleted,jdbcType=VARCHAR}, #{share,jdbcType=VARCHAR},#{videoPreview,jdbcType=VARCHAR},#{videoAddress,jdbcType=VARCHAR},#{osgbAddress,jdbcType=VARCHAR},
  17. #{xmlAddress,jdbcType=VARCHAR}, #{xodrAddress,jdbcType=VARCHAR},#{jsonAddress,jdbcType=VARCHAR},#{maxTime,jdbcType=VARCHAR})
  18. </insert>
  19. <insert id="saveSceneAccidentList" parameterType="java.util.List">
  20. insert into simulation.scene_accident
  21. (accident_id,scene_name,self_driving,target_driving,
  22. self_reaction,conflict_behavior,conflict_type,
  23. scence_resume,scene_time,scene_weather,
  24. create_user_id,create_time,modify_user_id,modify_time,
  25. is_deleted,share,video_preview,video_address,osgb_address,xml_address,xodr_address,
  26. json_address,max_time)
  27. values
  28. <foreach collection="list" index="index" item="item" separator=",">
  29. (#{item.accidentId,jdbcType=VARCHAR},#{item.sceneName,jdbcType=VARCHAR},#{item.selfDriving,jdbcType=VARCHAR}, #{item.targetDriving,jdbcType=VARCHAR},
  30. #{item.selfReaction,jdbcType=VARCHAR}, #{item.conflictBehavior,jdbcType=VARCHAR},#{item.conflictType,jdbcType=VARCHAR},
  31. #{item.scenceResume,jdbcType=VARCHAR}, #{item.sceneTime,jdbcType=VARCHAR},#{item.sceneWeather,jdbcType=VARCHAR},
  32. #{item.createUserId,jdbcType=VARCHAR},#{item.createTime},#{item.modifyUserId,jdbcType=VARCHAR},#{item.modifyTime},
  33. #{item.isDeleted,jdbcType=VARCHAR}, #{item.share,jdbcType=VARCHAR},#{item.videoPreview,jdbcType=VARCHAR},#{item.videoAddress,jdbcType=VARCHAR},#{item.osgbAddress,jdbcType=VARCHAR},
  34. #{item.xmlAddress,jdbcType=VARCHAR}, #{item.xodrAddress,jdbcType=VARCHAR},#{item.jsonAddress,jdbcType=VARCHAR},#{item.maxTime,jdbcType=VARCHAR})
  35. </foreach>
  36. </insert>
  37. <select id="querySceneAccidentList" parameterType="api.common.pojo.param.scene.SceneAccidentParam"
  38. resultType="api.common.pojo.po.scene.SceneAccidentPO">
  39. select
  40. accident_id,scene_name,self_driving,target_driving,
  41. self_reaction,conflict_behavior,conflict_type,
  42. scence_resume,scene_time,scene_weather,
  43. create_user_id,create_time,modify_user_id,modify_time,
  44. is_deleted,share,video_address,video_preview,osgb_address,xml_address,xodr_address,
  45. json_address,max_time
  46. from(
  47. select
  48. accident_id,scene_name,self_driving,target_driving,
  49. self_reaction,conflict_behavior,conflict_type,
  50. scence_resume,scene_time,scene_weather,
  51. create_user_id,create_time,modify_user_id,modify_time,
  52. is_deleted,share,video_address,video_preview,osgb_address,xml_address,xodr_address,
  53. json_address,max_time
  54. from simulation.scene_accident
  55. <where>
  56. <if test="sceneName != null and sceneName != ''">
  57. and scene_name like CONCAT('%',#{sceneName,jdbcType=VARCHAR},'%')
  58. </if>
  59. <if test="selfDriving != null and selfDriving.size()>0 ">
  60. and self_driving in
  61. <foreach collection="selfDriving" item="item" index="index"
  62. separator="," open="(" close=")">
  63. #{item}
  64. </foreach>
  65. </if>
  66. <if test="targetDriving != null and targetDriving.size()>0">
  67. and target_driving in
  68. <foreach collection="targetDriving" item="item" index="index"
  69. separator="," open="(" close=")">
  70. #{item}
  71. </foreach>
  72. </if>
  73. <if test="selfReaction != null and selfReaction.size()>0">
  74. and self_reaction in
  75. <foreach collection="selfReaction" item="item" index="index"
  76. separator="," open="(" close=")">
  77. #{item}
  78. </foreach>
  79. </if>
  80. <if test="conflictBehavior != null and conflictBehavior.size()>0">
  81. and conflict_behavior in
  82. <foreach collection="conflictBehavior" item="item" index="index"
  83. separator="," open="(" close=")">
  84. #{item}
  85. </foreach>
  86. </if>
  87. <if test="conflictType != null and conflictType.size()>0">
  88. and conflict_type in
  89. <foreach collection="conflictType" item="item" index="index"
  90. separator="," open="(" close=")">
  91. #{item}
  92. </foreach>
  93. </if>
  94. <if test="ids != null and ids.length>0">
  95. and accident_id in
  96. <foreach collection="ids" item="item" index="index"
  97. separator="," open="(" close=")">
  98. #{item}
  99. </foreach>
  100. </if>
  101. </where>
  102. <if test="bq != null and bq.equals(1)">
  103. union
  104. select
  105. accident_id,scene_name,self_driving,target_driving,
  106. self_reaction,conflict_behavior,conflict_type,
  107. scence_resume,scene_time,scene_weather,
  108. create_user_id,create_time,modify_user_id,modify_time,
  109. is_deleted,share,video_address,video_preview,osgb_address,xml_address,xodr_address,
  110. json_address,max_time
  111. from simulation.scene_accident
  112. <where>
  113. <if test="rearEndCollision != null and rearEndCollision!=''">
  114. or conflict_behavior =#{rearEndCollision}
  115. </if>
  116. <if test="cutIn != null and cutIn!=''">
  117. or target_driving =#{cutIn}
  118. </if>
  119. <if test="driveCurve != null and driveCurve!=''">
  120. or target_driving =#{driveCurve}
  121. </if>
  122. <if test="carConflict != null and carConflict!=''">
  123. or conflict_type =#{carConflict}
  124. </if>
  125. </where>
  126. </if>
  127. ) a where
  128. a.is_deleted = '0'
  129. <if test="AllIds != null and AllIds.size()>0">
  130. and a.accident_id in
  131. <foreach collection="AllIds" item="item" index="index"
  132. separator="," open="(" close=")">
  133. #{item}
  134. </foreach>
  135. </if>
  136. order by a.modify_time desc
  137. </select>
  138. <select id="querySceneAccidentListByBq" parameterType="api.common.pojo.param.scene.SceneAccidentParam"
  139. resultType="api.common.pojo.po.scene.SceneAccidentPO">
  140. select
  141. accident_id,scene_name,self_driving,target_driving,
  142. self_reaction,conflict_behavior,conflict_type,
  143. scence_resume,scene_time,scene_weather,
  144. create_user_id,create_time,modify_user_id,modify_time,
  145. is_deleted,share,video_address,video_preview,osgb_address,xml_address,xodr_address,
  146. json_address,max_time
  147. from( select
  148. accident_id,scene_name,self_driving,target_driving,
  149. self_reaction,conflict_behavior,conflict_type,
  150. scence_resume,scene_time,scene_weather,
  151. create_user_id,create_time,modify_user_id,modify_time,
  152. is_deleted,share,video_address,video_preview,osgb_address,xml_address,xodr_address,
  153. json_address,max_time
  154. from simulation.scene_accident
  155. <where>
  156. <if test="rearEndCollision != null and rearEndCollision!=''">
  157. conflict_behavior =#{rearEndCollision}
  158. </if>
  159. <if test="cutIn != null and cutIn!=''">
  160. or target_driving =#{cutIn}
  161. </if>
  162. <if test="driveCurve != null and driveCurve!=''">
  163. or target_driving =#{driveCurve}
  164. </if>
  165. <if test="carConflict != null and carConflict!=''">
  166. or conflict_type =#{carConflict}
  167. </if>
  168. </where>
  169. ) a where a.is_deleted = '0'
  170. <if test="AllIds != null and AllIds.size()>0">
  171. and a.accident_id in
  172. <foreach collection="AllIds" item="item" index="index"
  173. separator="," open="(" close=")">
  174. #{item}
  175. </foreach>
  176. </if>
  177. order by a.modify_time desc
  178. </select>
  179. <select id="querySceneAccidentListByXlk" parameterType="api.common.pojo.param.scene.SceneAccidentParam"
  180. resultType="api.common.pojo.po.scene.SceneAccidentPO">
  181. select
  182. accident_id,scene_name,self_driving,target_driving,
  183. self_reaction,conflict_behavior,conflict_type,
  184. scence_resume,scene_time,scene_weather,
  185. create_user_id,create_time,modify_user_id,modify_time,
  186. is_deleted,share,video_address,video_preview,osgb_address,xml_address,xodr_address,
  187. json_address,max_time
  188. from simulation.scene_accident
  189. <where>
  190. is_deleted = '0'
  191. <if test="sceneName != null and sceneName != ''">
  192. and scene_name like CONCAT('%',#{sceneName,jdbcType=VARCHAR},'%')
  193. </if>
  194. <if test="selfDriving != null and selfDriving.size()>0 ">
  195. and self_driving in
  196. <foreach collection="selfDriving" item="item" index="index"
  197. separator="," open="(" close=")">
  198. #{item}
  199. </foreach>
  200. </if>
  201. <if test="targetDriving != null and targetDriving.size()>0">
  202. and target_driving in
  203. <foreach collection="targetDriving" item="item" index="index"
  204. separator="," open="(" close=")">
  205. #{item}
  206. </foreach>
  207. </if>
  208. <if test="selfReaction != null and selfReaction.size()>0">
  209. and self_reaction in
  210. <foreach collection="selfReaction" item="item" index="index"
  211. separator="," open="(" close=")">
  212. #{item}
  213. </foreach>
  214. </if>
  215. <if test="conflictBehavior != null and conflictBehavior.size()>0">
  216. and conflict_behavior in
  217. <foreach collection="conflictBehavior" item="item" index="index"
  218. separator="," open="(" close=")">
  219. #{item}
  220. </foreach>
  221. </if>
  222. <if test="conflictType != null and conflictType.size()>0">
  223. and conflict_type in
  224. <foreach collection="conflictType" item="item" index="index"
  225. separator="," open="(" close=")">
  226. #{item}
  227. </foreach>
  228. </if>
  229. <if test="ids != null and ids.length>0">
  230. and accident_id in
  231. <foreach collection="ids" item="item" index="index"
  232. separator="," open="(" close=")">
  233. #{item}
  234. </foreach>
  235. </if>
  236. <if test="AllIds != null and AllIds.size()>0">
  237. and accident_id in
  238. <foreach collection="AllIds" item="item" index="index"
  239. separator="," open="(" close=")">
  240. #{item}
  241. </foreach>
  242. </if>
  243. </where>
  244. order by modify_time desc
  245. </select>
  246. <update id="deleteSceneAccidentList" parameterType="api.common.pojo.po.scene.SceneAccidentPO">
  247. update simulation.scene_accident
  248. <set>
  249. <if test="isDeleted != null and isDeleted!=''">
  250. is_deleted = #{isDeleted,jdbcType=VARCHAR},
  251. </if>
  252. <if test="modifyUserId != null and modifyUserId!=''">
  253. modify_user_id = #{modifyUserId,jdbcType=VARCHAR},
  254. </if>
  255. <if test="modifyTime != null">
  256. modify_time = #{modifyTime},
  257. </if>
  258. </set>
  259. where accident_id = #{accidentId,jdbcType=VARCHAR}
  260. </update>
  261. <select id="querySceneAccidentByNmae" parameterType="java.lang.String" resultType="java.lang.String">
  262. select
  263. accident_id sceneId
  264. from simulation.scene_accident
  265. where
  266. is_deleted = '0'
  267. and scene_name =#{sceneName,jdbcType=VARCHAR}
  268. </select>
  269. <update id="updateSceneAccident" parameterType="api.common.pojo.po.scene.SceneAccidentPO">
  270. update simulation.scene_accident
  271. set scene_name=#{sceneName},self_driving=#{selfDriving},
  272. target_driving=#{targetDriving},self_reaction=#{selfReaction},
  273. conflict_behavior=#{conflictBehavior},conflict_type=#{conflictType},
  274. scence_resume=#{scenceResume},scene_time=#{sceneTime},
  275. scene_weather=#{sceneWeather},modify_time=#{modifyTime},
  276. modify_user_id=#{modifyUserId},video_address=#{videoAddress},
  277. osgb_address=#{osgbAddress},xml_address=#{xmlAddress},
  278. xodr_address=#{xodrAddress},json_address=#{jsonAddress},max_time=#{maxTime}
  279. where accident_id = #{accidentId,jdbcType=VARCHAR}
  280. </update>
  281. <update id="updateSceneAccidentList" parameterType="java.util.List">
  282. <foreach collection="list" index="index" item="item" separator=";">
  283. update simulation.scene_accident
  284. set scene_name=#{item.sceneName},self_driving=#{item.selfDriving},
  285. target_driving=#{item.targetDriving},self_reaction=#{item.selfReaction},
  286. conflict_behavior=#{item.conflictBehavior},conflict_type=#{item.conflictType},
  287. scence_resume=#{item.scenceResume},scene_time=#{item.sceneTime},
  288. scene_weather=#{item.sceneWeather},modify_time=#{item.modifyTime},
  289. modify_user_id=#{item.modifyUserId},video_address=#{item.videoAddress},
  290. osgb_address=#{item.osgbAddress},xml_address=#{item.xmlAddress},
  291. xodr_address=#{item.xodrAddress},json_address=#{item.jsonAddress},max_time=#{item.maxTime}
  292. where accident_id = #{item.accidentId,jdbcType=VARCHAR}
  293. </foreach>
  294. </update>
  295. <select id="querySceneAccidentListByQx" parameterType="api.common.pojo.param.scene.SceneAccidentParam"
  296. resultType="api.common.pojo.po.scene.SceneAccidentPO">
  297. select
  298. accident_id,scene_name,self_driving,target_driving,
  299. self_reaction,conflict_behavior,conflict_type,
  300. scence_resume,scene_time,scene_weather,
  301. create_user_id,create_time,modify_user_id,modify_time,
  302. is_deleted,share,video_address,video_preview,osgb_address,xml_address,xodr_address,
  303. json_address,max_time
  304. from(
  305. select
  306. accident_id,scene_name,self_driving,target_driving,
  307. self_reaction,conflict_behavior,conflict_type,
  308. scence_resume,scene_time,scene_weather,
  309. create_user_id,create_time,modify_user_id,modify_time,
  310. is_deleted,share,video_address,video_preview,osgb_address,xml_address,xodr_address,
  311. json_address,max_time
  312. from ( select jt.* from( select s.scene_name
  313. FROM system_scene_package p
  314. JOIN system_user_scene u on p.id = u.package_id and u.is_deleted = '0' and p.is_deleted = '0'
  315. JOIN system_scene_package_sublist s on p.id = s.scene_and_package
  316. where scene_type='3' and s.is_deleted = '0' and user_id=#{userId} group by s.scene_name)qx join scene_accident jt on qx.scene_name=jt.scene_name) cc
  317. <where>
  318. <if test="sceneName != null and sceneName != ''">
  319. and scene_name like CONCAT('%',#{sceneName,jdbcType=VARCHAR},'%')
  320. </if>
  321. <if test="selfDriving != null and selfDriving.size()>0 ">
  322. and self_driving in
  323. <foreach collection="selfDriving" item="item" index="index"
  324. separator="," open="(" close=")">
  325. #{item}
  326. </foreach>
  327. </if>
  328. <if test="targetDriving != null and targetDriving.size()>0">
  329. and target_driving in
  330. <foreach collection="targetDriving" item="item" index="index"
  331. separator="," open="(" close=")">
  332. #{item}
  333. </foreach>
  334. </if>
  335. <if test="selfReaction != null and selfReaction.size()>0">
  336. and self_reaction in
  337. <foreach collection="selfReaction" item="item" index="index"
  338. separator="," open="(" close=")">
  339. #{item}
  340. </foreach>
  341. </if>
  342. <if test="conflictBehavior != null and conflictBehavior.size()>0">
  343. and conflict_behavior in
  344. <foreach collection="conflictBehavior" item="item" index="index"
  345. separator="," open="(" close=")">
  346. #{item}
  347. </foreach>
  348. </if>
  349. <if test="conflictType != null and conflictType.size()>0">
  350. and conflict_type in
  351. <foreach collection="conflictType" item="item" index="index"
  352. separator="," open="(" close=")">
  353. #{item}
  354. </foreach>
  355. </if>
  356. <if test="ids != null and ids.length>0">
  357. and accident_id in
  358. <foreach collection="ids" item="item" index="index"
  359. separator="," open="(" close=")">
  360. #{item}
  361. </foreach>
  362. </if>
  363. </where>
  364. <if test="bq != null and bq.equals(1)">
  365. union
  366. select
  367. accident_id,scene_name,self_driving,target_driving,
  368. self_reaction,conflict_behavior,conflict_type,
  369. scence_resume,scene_time,scene_weather,
  370. create_user_id,create_time,modify_user_id,modify_time,
  371. is_deleted,share,video_address,video_preview,osgb_address,xml_address,xodr_address,
  372. json_address,max_time
  373. from ( select jt.* from( select s.scene_name
  374. FROM system_scene_package p
  375. JOIN system_user_scene u on p.id = u.package_id and u.is_deleted = '0' and p.is_deleted = '0'
  376. JOIN system_scene_package_sublist s on p.id = s.scene_and_package
  377. where scene_type='3' and s.is_deleted = '0' and user_id=#{userId} group by s.scene_name)qx join scene_accident jt on qx.scene_name=jt.scene_name) dd
  378. <where>
  379. <if test="rearEndCollision != null and rearEndCollision!=''">
  380. or conflict_behavior =#{rearEndCollision}
  381. </if>
  382. <if test="cutIn != null and cutIn!=''">
  383. or target_driving =#{cutIn}
  384. </if>
  385. <if test="driveCurve != null and driveCurve!=''">
  386. or target_driving =#{driveCurve}
  387. </if>
  388. <if test="carConflict != null and carConflict!=''">
  389. or conflict_type =#{carConflict}
  390. </if>
  391. </where>
  392. </if>
  393. ) a where
  394. a.is_deleted = '0'
  395. <if test="AllIds != null and AllIds.size()>0">
  396. and a.accident_id in
  397. <foreach collection="AllIds" item="item" index="index"
  398. separator="," open="(" close=")">
  399. #{item}
  400. </foreach>
  401. </if>
  402. order by a.modify_time desc
  403. </select>
  404. <select id="querySceneAccidentListByBqAndQx" parameterType="api.common.pojo.param.scene.SceneAccidentParam"
  405. resultType="api.common.pojo.po.scene.SceneAccidentPO">
  406. select
  407. accident_id,scene_name,self_driving,target_driving,
  408. self_reaction,conflict_behavior,conflict_type,
  409. scence_resume,scene_time,scene_weather,
  410. create_user_id,create_time,modify_user_id,modify_time,
  411. is_deleted,share,video_address,video_preview,osgb_address,xml_address,xodr_address,
  412. json_address,max_time
  413. from( select
  414. accident_id,scene_name,self_driving,target_driving,
  415. self_reaction,conflict_behavior,conflict_type,
  416. scence_resume,scene_time,scene_weather,
  417. create_user_id,create_time,modify_user_id,modify_time,
  418. is_deleted,share,video_address,video_preview,osgb_address,xml_address,xodr_address,
  419. json_address,max_time
  420. from ( select jt.* from( select s.scene_name
  421. FROM system_scene_package p
  422. JOIN system_user_scene u on p.id = u.package_id and u.is_deleted = '0' and p.is_deleted = '0'
  423. JOIN system_scene_package_sublist s on p.id = s.scene_and_package
  424. where scene_type='3' and s.is_deleted = '0' and user_id=#{userId} group by s.scene_name)qx join scene_accident jt on qx.scene_name=jt.scene_name) dd
  425. <where>
  426. <if test="rearEndCollision != null and rearEndCollision!=''">
  427. conflict_behavior =#{rearEndCollision}
  428. </if>
  429. <if test="cutIn != null and cutIn!=''">
  430. or target_driving =#{cutIn}
  431. </if>
  432. <if test="driveCurve != null and driveCurve!=''">
  433. or target_driving =#{driveCurve}
  434. </if>
  435. <if test="carConflict != null and carConflict!=''">
  436. or conflict_type =#{carConflict}
  437. </if>
  438. </where>
  439. ) a where a.is_deleted = '0'
  440. <if test="AllIds != null and AllIds.size()>0">
  441. and a.accident_id in
  442. <foreach collection="AllIds" item="item" index="index"
  443. separator="," open="(" close=")">
  444. #{item}
  445. </foreach>
  446. </if>
  447. order by a.modify_time desc
  448. </select>
  449. </mapper>