SimulationProjectTaskMapper.xml 9.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240
  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.infrastructure.mysql.mapper.SimulationProjectTaskMapper">
  4. <!--查询任务列表-->
  5. <select id="selectProjectTask" parameterType="api.common.pojo.param.project.ProjectTaskParam"
  6. resultType="api.common.pojo.po.project.ManualProjectTaskPO">
  7. select id,
  8. p_id,
  9. last_targer_id,
  10. scene_id,
  11. scene_name,
  12. scene_type,
  13. run_start_time,
  14. run_end_time,
  15. run_state,
  16. run_result,
  17. run_result_file_path,
  18. score,
  19. target_evaluate,
  20. return_scene_id,
  21. score_explain,
  22. mileage,
  23. average_velocity,
  24. maximun_speed,
  25. minimun_velocity,
  26. maximum_acceleration,
  27. maximum_deceleration,
  28. maximum_swingSpeed,
  29. speed_variance,
  30. speed_comfort_level,
  31. swing_speed_mean_square_root,
  32. swing_comfort_level,
  33. acceleration,
  34. lane_offset,
  35. brake,
  36. steeting_wheel,
  37. throttle,
  38. yaw_rate,
  39. velocity,
  40. other_curve,
  41. timer_shaft,
  42. create_time,
  43. create_user_id,
  44. modify_time,
  45. modify_user_id,
  46. is_deleted,
  47. retry_count
  48. from simulation_manual_project_task
  49. <where>
  50. is_deleted = '0'
  51. <if test="id != null and id != ''">
  52. and id = #{id,jdbcType=VARCHAR}
  53. </if>
  54. <if test="pId != null and pId != ''">
  55. and p_id = #{pId,jdbcType=VARCHAR}
  56. </if>
  57. <if test="sceneId != null and sceneId != ''">
  58. and scene_id = #{sceneId,jdbcType=VARCHAR}
  59. </if>
  60. </where>
  61. </select>
  62. <!--根据项目id查询任务列表-->
  63. <select id="selectProjectTaskByProjectId" parameterType="api.common.pojo.param.project.ProjectTaskParam"
  64. resultType="api.common.pojo.vo.project.ManualProjectTaskVo">
  65. select id,
  66. p_id,
  67. last_targer_id,
  68. scene_id,
  69. scene_name,
  70. scene_type,
  71. run_start_time,
  72. run_end_time,
  73. run_state,
  74. run_result,
  75. run_result_file_path,
  76. score,
  77. target_evaluate,
  78. return_scene_id,
  79. score_explain,
  80. mileage,
  81. average_velocity,
  82. maximun_speed,
  83. minimun_velocity,
  84. maximum_acceleration,
  85. maximum_deceleration,
  86. maximum_swingSpeed,
  87. speed_variance,
  88. speed_comfort_level,
  89. swing_speed_mean_square_root,
  90. swing_comfort_level,
  91. acceleration,
  92. lane_offset,
  93. brake,
  94. steeting_wheel,
  95. throttle,
  96. yaw_rate,
  97. velocity,
  98. other_curve,
  99. timer_shaft,
  100. create_time,
  101. create_user_id,
  102. modify_time,
  103. modify_user_id,
  104. is_deleted,
  105. retry_count
  106. from simulation_manual_project_task
  107. where is_deleted = '0' and p_id = #{pId,jdbcType=VARCHAR}
  108. <if test="taskId != null and taskId != ''">
  109. and id = #{taskId, jdbcType=VARCHAR}
  110. </if>
  111. order by run_start_time desc
  112. </select>
  113. <!--根据项目id查询任务列表总数-->
  114. <select id="selectProjectTaskNumByProjectId" parameterType="api.common.pojo.param.project.ProjectTaskParam"
  115. resultType="int">
  116. select count(*) as num
  117. from simulation_manual_project_task
  118. where is_deleted = '0'
  119. and p_id = #{pId,jdbcType=VARCHAR}
  120. </select>
  121. <!--根据任务运行状态分组查询统计数量-->
  122. <select id="selectRunStateCount" parameterType="string"
  123. resultType="api.common.pojo.vo.project.ProjectRunStateNumVo">
  124. select run_state as stateName, count(*) as num
  125. from simulation_manual_project_task
  126. where p_id = #{id,jdbcType=VARCHAR}
  127. and is_deleted = '0'
  128. group by run_state
  129. </select>
  130. <!--根据任务运行状态分组查询统计数量-->
  131. <select id="selectRunResultCount" parameterType="string"
  132. resultType="api.common.pojo.vo.project.ProjectRunResultRatioNumVo">
  133. select run_result as resultName, count(*) as num
  134. from simulation_manual_project_task
  135. where p_id = #{id,jdbcType=VARCHAR}
  136. and is_deleted = '0'
  137. and run_result is not null
  138. and run_result != ""
  139. group by run_result
  140. </select>
  141. <!--任务得分统计分组-->
  142. <select id="selectScoreCount" parameterType="string"
  143. resultType="api.common.pojo.vo.project.ProjectRunResultRatioNumVo">
  144. select score as resultName, count(*) as num
  145. from simulation_manual_project_task
  146. where p_id = #{id,jdbcType=VARCHAR}
  147. and is_deleted = '0'
  148. group by score
  149. </select>
  150. <!--运行任务状态-->
  151. <select id="selectRunTaskByState" parameterType="java.util.Map" resultType="java.util.Map">
  152. select count(1) num, smpt.run_state runState
  153. from simulation_manual_project_task smpt
  154. left join simulation_manual_project smp on smpt.p_id = smp.id
  155. left join simulation_automatic_subproject sas on smpt.p_id = sas.id
  156. where smpt.is_deleted = '0'
  157. and (smp.is_deleted = '0' or sas.is_deleted = '0')
  158. <if test="createUserId != null and createUserId != ''">
  159. and smpt.create_user_id = #{createUserId}
  160. </if>
  161. group by smpt.run_state
  162. </select>
  163. <!--查询场景不等于0的得分的数量-->
  164. <select id="selectSceneScoreNumQuery" parameterType="api.common.pojo.po.project.SimulationMptSceneScorePO"
  165. resultType="api.common.pojo.vo.project.SceneScoreVo">
  166. select count(*) as num
  167. from simulation_manual_project_task
  168. where p_id = #{pId,jdbcType=VARCHAR}
  169. and last_targer_id = #{lastTargerId}
  170. and score != 0 and is_deleted = '0'
  171. </select>
  172. <!--批量查询场景得分-->
  173. <select id="selectSceneScoreByIds" parameterType="api.common.pojo.param.project.SceneScoreParam"
  174. resultType="api.common.pojo.vo.project.SceneScoreVo">
  175. select id, scene_id, scene_type,score, target_evaluate, return_scene_id, score_explain
  176. from simulation_manual_project_task
  177. where p_id = #{pId,jdbcType=VARCHAR} and scene_type = #{sceneType,jdbcType=VARCHAR}
  178. and last_targer_id = #{lastTargerId,jdbcType=VARCHAR} and is_deleted = '0'
  179. and scene_id in
  180. <foreach collection="sceneIds" open="(" separator="," close=")" item="id">
  181. #{id,jdbcType=VARCHAR}
  182. </foreach>
  183. </select>
  184. <!--更新仿真结果到数据库-->
  185. <update id="updateTaksResult" parameterType="api.common.pojo.po.project.ManualProjectTaskPO">
  186. update simulation_manual_project_task
  187. set mileage = #{mileage, jdbcType=VARCHAR},
  188. average_velocity = #{averageVelocity, jdbcType=VARCHAR},
  189. maximun_speed = #{maximunSpeed, jdbcType=VARCHAR},
  190. minimun_velocity = #{minimunVelocity, jdbcType=VARCHAR},
  191. maximum_acceleration = #{maximumAcceleration, jdbcType=VARCHAR},
  192. maximum_deceleration = #{maximumDeceleration, jdbcType=VARCHAR},
  193. maximum_swingSpeed = #{maximumSwingSpeed, jdbcType=VARCHAR},
  194. speed_variance = #{speedVariance, jdbcType=VARCHAR},
  195. swing_speed_mean_square_root = #{swingSpeedMeanSquareRoot, jdbcType=VARCHAR},
  196. acceleration = #{acceleration, jdbcType=LONGVARCHAR},
  197. lane_offset = #{laneOffset, jdbcType=LONGVARCHAR},
  198. brake = #{brake, jdbcType=LONGVARCHAR},
  199. steeting_wheel = #{steetingWheel, jdbcType=LONGVARCHAR},
  200. throttle = #{throttle, jdbcType=LONGVARCHAR},
  201. yaw_rate = #{yawRate, jdbcType=LONGVARCHAR},
  202. velocity = #{velocity, jdbcType=LONGVARCHAR},
  203. other_curve = #{otherCurve, jdbcType=LONGVARCHAR},
  204. timer_shaft = #{timerShaft, jdbcType=LONGVARCHAR}
  205. where id = #{id, jdbcType=VARCHAR}
  206. and p_id = #{pId, jdbcType=VARCHAR}
  207. and is_deleted = '0'
  208. </update>
  209. <!--查询Aborted的数量-->
  210. <select id="selectRunStateByAborted" parameterType="api.common.pojo.po.project.SimulationMptSceneScorePO"
  211. resultType="api.common.pojo.vo.project.SceneScoreVo">
  212. select count(*) as num
  213. from simulation_manual_project_task
  214. where p_id = #{pId,jdbcType=VARCHAR}
  215. and run_state = 'Aborted'
  216. and is_deleted = '0'
  217. </select>
  218. <select id="selectProjectTaskById" parameterType="string"
  219. resultType="api.common.pojo.vo.project.ManualProjectTaskVo">
  220. select *
  221. from simulation_manual_project_task
  222. where id = #{id}
  223. </select>
  224. </mapper>