SimulationProjectMapper.xml 25 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625
  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.project.mapper.SimulationProjectMapper">
  4. <!--添加-->
  5. <insert id="add" parameterType="api.common.pojo.po.project.SimulationManualProjectPo">
  6. insert into simulation_manual_project
  7. (id,
  8. project_date,
  9. project_num,
  10. project_id,
  11. project_name,
  12. project_describe,
  13. algorithm,
  14. algorithm_type,
  15. vehicle,
  16. scene,
  17. operation_cycle,
  18. parallelism,
  19. rule_view,
  20. is_choice_gpu,
  21. automatic_run_times,
  22. last_run_time,
  23. automatic_run_state,
  24. now_run_state,
  25. evaluation_level,
  26. start_time,
  27. finish_time,
  28. max_simulation_time,
  29. create_time,
  30. create_user_id,
  31. modify_time,
  32. modify_user_id,
  33. is_deleted)
  34. values (#{id,jdbcType=VARCHAR},
  35. #{projectDate,jdbcType=INTEGER},
  36. #{projectNum,jdbcType=INTEGER},
  37. #{projectId,jdbcType=VARCHAR},
  38. #{projectName,jdbcType=VARCHAR},
  39. #{projectDescribe,jdbcType=VARCHAR},
  40. #{algorithm,jdbcType=VARCHAR},
  41. #{algorithmType,jdbcType=VARCHAR},
  42. #{vehicle,jdbcType=VARCHAR},
  43. #{scene,jdbcType=VARCHAR},
  44. #{operationCycle,jdbcType=VARCHAR},
  45. #{parallelism,jdbcType=VARCHAR},
  46. #{ruleView,jdbcType=VARCHAR},
  47. #{isChoiceGpu,jdbcType=VARCHAR},
  48. #{automaticRunTimes,jdbcType=BIGINT},
  49. #{lastRunTime,jdbcType=TIMESTAMP},
  50. #{automaticRunState,jdbcType=VARCHAR},
  51. #{nowRunState,jdbcType=VARCHAR},
  52. #{evaluationLevel,jdbcType=VARCHAR},
  53. #{startTime,jdbcType=TIMESTAMP},
  54. #{finishTime,jdbcType=TIMESTAMP},
  55. #{maxSimulationTime,jdbcType=BIGINT},
  56. #{createTime,jdbcType=TIMESTAMP},
  57. #{createUserId,jdbcType=VARCHAR},
  58. #{modifyTime,jdbcType=TIMESTAMP},
  59. #{modifyUserId,jdbcType=VARCHAR},
  60. #{isDeleted,jdbcType=VARCHAR})
  61. </insert>
  62. <!--修改-->
  63. <update id="update" parameterType="api.common.pojo.po.project.SimulationManualProjectPo">
  64. update simulation_manual_project
  65. set project_name = #{projectName,jdbcType=VARCHAR},
  66. project_describe = #{projectDescribe,jdbcType=VARCHAR},
  67. algorithm = #{algorithm,jdbcType=VARCHAR},
  68. algorithm_type = #{algorithmType,jdbcType=VARCHAR},
  69. vehicle = #{vehicle,jdbcType=VARCHAR},
  70. scene = #{scene,jdbcType=VARCHAR},
  71. max_simulation_time = #{maxSimulationTime,jdbcType=BIGINT},
  72. parallelism = #{parallelism,jdbcType=VARCHAR},
  73. is_choice_gpu = #{isChoiceGpu,jdbcType=VARCHAR}
  74. where id = #{id,jdbcType=VARCHAR}
  75. and is_deleted = '0'
  76. </update>
  77. <!--查询项目最新id-->
  78. <select id="selectLastProjectId" resultType="api.common.pojo.po.project.SimulationManualProjectPo">
  79. select project_date, project_num, project_id
  80. from simulation_manual_project
  81. where project_date = #{nowRq,jdbcType=INTEGER}
  82. and is_deleted = '0'
  83. order by project_date desc, project_num desc limit 1
  84. </select>
  85. <!--查询项目列表-->
  86. <select id="selectProject" parameterType="api.common.pojo.param.project.SimulationManualProjectParam"
  87. resultType="api.common.pojo.po.project.SimulationManualProjectPo">
  88. select * from simulation_manual_project
  89. <where>
  90. is_deleted = '0'
  91. <if test="projectId != null and projectId != ''">
  92. and project_id like CONCAT('%',#{project_id,jdbcType=VARCHAR},'%')
  93. </if>
  94. <if test="projectName != null and projectName != ''">
  95. and project_name like CONCAT('%',#{project_name,jdbcType=VARCHAR},'%')
  96. </if>
  97. <if test="nowRunState != null and nowRunState != ''">
  98. and now_run_state = #{nowRunState}
  99. </if>
  100. <if test="evaluationLevel != null and evaluationLevel != ''">
  101. and evaluation_level = #{evaluationLevel}
  102. </if>
  103. <if test="createTimeStart != null">
  104. and create_time &gt;= #{createTimeStart,jdbcType=TIMESTAMP}
  105. </if>
  106. <if test="createTimeEnd != null">
  107. and create_time &lt;= #{createTimeEnd,jdbcType=TIMESTAMP}
  108. </if>
  109. <if test="finishTimeStart != null">
  110. and finish_time &gt;= #{finishTimeStart,jdbcType=TIMESTAMP}
  111. </if>
  112. <if test="finishTimeEnd != null">
  113. and finish_time &lt;= #{finishTimeEnd,jdbcType=TIMESTAMP}
  114. </if>
  115. <if test="isDeleted != null and isDeleted != ''">
  116. and is_deleted = #{isDeleted,jdbcType=VARCHAR}
  117. </if>
  118. </where>
  119. order by project_date desc, project_num desc, modify_time desc
  120. </select>
  121. <!--查询项目列表-->
  122. <select id="selectProjectList" parameterType="api.common.pojo.param.project.SimulationManualProjectParam"
  123. resultType="api.common.pojo.vo.project.SimulationManualProjectVo">
  124. select * from simulation_manual_project
  125. <where>
  126. is_deleted = '0'
  127. <if test="projectId != null and projectId != ''">
  128. and project_id like CONCAT('%',#{projectId,jdbcType=VARCHAR},'%')
  129. </if>
  130. <if test="projectName != null and projectName != ''">
  131. and project_name like CONCAT('%',#{projectName,jdbcType=VARCHAR},'%')
  132. </if>
  133. <if test="nowRunState != null and nowRunState != ''">
  134. and now_run_state = #{nowRunState}
  135. </if>
  136. <if test="evaluationLevel != null and evaluationLevel != ''">
  137. and evaluation_level = #{evaluationLevel}
  138. </if>
  139. <if test="createTimeStart != null">
  140. and create_time &gt;= #{createTimeStart,jdbcType=TIMESTAMP}
  141. </if>
  142. <if test="createTimeEnd != null">
  143. and create_time &lt;= #{createTimeEnd,jdbcType=TIMESTAMP}
  144. </if>
  145. <if test="finishTimeStart != null">
  146. and finish_time &gt;= #{finishTimeStart,jdbcType=TIMESTAMP}
  147. </if>
  148. <if test="finishTimeEnd != null">
  149. and finish_time &lt;= #{finishTimeEnd,jdbcType=TIMESTAMP}
  150. </if>
  151. <if test="isDeleted != null and isDeleted != ''">
  152. and is_deleted = #{isDeleted,jdbcType=VARCHAR}
  153. </if>
  154. <if test="createUserId != null and createUserId != ''">
  155. and create_user_id = #{createUserId,jdbcType=VARCHAR}
  156. </if>
  157. </where>
  158. order by project_date desc, project_num desc, modify_time desc
  159. </select>
  160. <!--根据id查询-->
  161. <select id="selectProjectById" parameterType="api.common.pojo.param.project.SimulationManualProjectParam"
  162. resultType="api.common.pojo.po.project.SimulationManualProjectPo">
  163. select *
  164. from simulation_manual_project
  165. where id = #{id,jdbcType=VARCHAR}
  166. and is_deleted = '0'
  167. </select>
  168. <!--根据项目名查询工作信息-->
  169. <select id="selectProjectByName" parameterType="api.common.pojo.param.project.SimulationManualProjectParam"
  170. resultType="api.common.pojo.po.project.SimulationManualProjectPo">
  171. select *
  172. from simulation_manual_project
  173. where project_name = #{projectName,jdbcType=VARCHAR}
  174. and is_deleted = '0'
  175. </select>
  176. <!--根据id查询基本信息-->
  177. <select id="selectProjectBaseById" parameterType="api.common.pojo.param.project.SimulationManualProjectParam"
  178. resultType="api.common.pojo.po.project.SimulationManualProjectPo">
  179. select id,
  180. algorithm,
  181. scene,
  182. algorithm_score,
  183. project_name,
  184. project_id,
  185. algorithm_type,
  186. evaluation_level
  187. from simulation_manual_project
  188. where is_deleted = '0'
  189. and id = #{id,jdbcType=VARCHAR}
  190. </select>
  191. <!--删除-->
  192. <update id="deleteProject">
  193. update simulation_manual_project
  194. set is_deleted='1'
  195. where id in
  196. <foreach collection="array" open="(" separator="," close=")" item="id">
  197. #{id,jdbcType=VARCHAR}
  198. </foreach>
  199. </update>
  200. <!--查询项目状态-->
  201. <select id="selectProjectNowRunState" resultType="api.common.pojo.po.project.SimulationManualProjectPo">
  202. select now_run_state
  203. from simulation_manual_project
  204. where
  205. is_deleted='0' and
  206. id in
  207. <foreach collection="array" open="(" separator="," close=")" item="id">
  208. #{id,jdbcType=VARCHAR}
  209. </foreach>
  210. </select>
  211. <!--修改运行状态-->
  212. <update id="updateProjectNowRunState" parameterType="api.common.pojo.param.project.SimulationManualProjectParam">
  213. update simulation_manual_project
  214. <set>
  215. <if test="nowRunState != null and nowRunState != ''">
  216. now_run_state = #{nowRunState,jdbcType=VARCHAR},
  217. </if>
  218. <if test="startTime != null">
  219. start_time=#{startTime,jdbcType=TIMESTAMP},
  220. </if>
  221. <if test="finishTime != null">
  222. finish_time=#{finishTime,jdbcType=TIMESTAMP},
  223. </if>
  224. </set>
  225. where id = #{id,jdbcType=VARCHAR} and is_deleted = '0'
  226. </update>
  227. <!--获取算法基本信息 /*where a.share = '0' and a.is_deleted = '0'*/-->
  228. <select id="selectAlgorithmBaseInfoById" resultType="api.common.pojo.po.algorithm.AlgorithmPO">
  229. select a.id, a.algorithm_name, a.description
  230. from algorithm a
  231. where a.share = '0' and a.is_deleted = '0'
  232. <if test="id != null and id != ''">
  233. and a.id = #{id,jdbcType=VARCHAR}
  234. </if>
  235. <if test="createUserId != null and createUserId !=''">
  236. and create_user_id=#{createUserId,jdbcType=VARCHAR}
  237. </if>
  238. <if test="uploadMode != null and uploadMode != ''">
  239. and upload_mode = #{uploadMode,jdbcType=VARCHAR}
  240. </if>
  241. </select>
  242. <!--获取车辆基本信息-->
  243. <select id="selectVehicleBaseInfoById" parameterType="string" resultType="api.common.pojo.po.model.VehiclePO">
  244. select a.id, a.vehicle_name, a.description, a.vehicle_top_view
  245. from model_vehicle a
  246. where is_deleted = '0'
  247. <if test="id != null and id != ''">
  248. and a.id = #{id,jdbcType=VARCHAR}
  249. </if>
  250. </select>
  251. <!--获取车辆配置信息-->
  252. <select id="selectConfigVehicle" resultType="api.common.pojo.po.model.ConfigPO">
  253. select id, config_name, vehicle_id, description
  254. from model_config
  255. where share = '0' and is_deleted = '0'
  256. <if test="id != null and id != ''">
  257. and id = #{id,jdbcType=VARCHAR}
  258. </if>
  259. <if test="createUserId != null and createUserId !=''">
  260. and create_user_id=#{createUserId,jdbcType=VARCHAR}
  261. </if>
  262. </select>
  263. <!--查询车辆配置传感器信息-->
  264. <select id="selectConfigSensor" parameterType="string" resultType="api.common.pojo.po.model.ConfigSensorPO">
  265. select sensor_type
  266. from relation_config_sensor
  267. where is_deleted = '0'
  268. <if test="id != null and id != ''">
  269. and config_id = #{id,jdbcType=VARCHAR}
  270. </if>
  271. group by sensor_type
  272. </select>
  273. <!--获取场景包基本信息-->
  274. <select id="selectScenePackageBaseById" resultType="api.common.pojo.po.scene.ScenePackagePO">
  275. select a.package_id,a.package_name, a.scene_num
  276. from scene_package a
  277. where a.share = '0' and a.is_deleted = '0'
  278. <if test="packageId != null and packageId != ''">
  279. and a.package_id = #{packageId,jdbcType=VARCHAR}
  280. </if>
  281. <if test="createUserId != null and createUserId !=''">
  282. and create_user_id=#{createUserId,jdbcType=VARCHAR}
  283. </if>
  284. order by modify_time desc
  285. </select>
  286. <!--根据id查询场景包信息-->
  287. <select id="selectScenePackageInfoById" parameterType="string" resultType="api.common.pojo.po.scene.ScenePackagePO">
  288. select a.package_id, a.package_name, a.scene_num
  289. from scene_package a
  290. where a.package_id = #{id,jdbcType=VARCHAR}
  291. </select>
  292. <!--查询车辆与传感器关联信息-->
  293. <select id="selectVehicleSensor" parameterType="string" resultType="api.common.pojo.po.model.ConfigSensorPO">
  294. select sensor_id,
  295. sensor_type,
  296. config_id,
  297. sensor_x,
  298. sensor_y,
  299. sensor_z,
  300. sensor_h,
  301. sensor_p,
  302. sensor_r,
  303. sensor_port
  304. from relation_config_sensor
  305. where config_id = #{id,jdbcType=VARCHAR}
  306. and is_deleted = '0'
  307. </select>
  308. <!--摄像头基本信息-->
  309. <select id="selectSensorCamera" parameterType="string" resultType="api.common.pojo.vo.project.SensorBaseInfoVo">
  310. select a.sensor_name, description as sensorDescription
  311. from model_sensor_camera a
  312. where a.id = #{id,jdbcType=VARCHAR}
  313. </select>
  314. <!--完美传感器基本信息-->
  315. <select id="selectSensorOgt" parameterType="string" resultType="api.common.pojo.vo.project.SensorBaseInfoVo">
  316. select a.sensor_name, description as sensorDescription
  317. from model_sensor_ogt a
  318. where a.id = #{id,jdbcType=VARCHAR}
  319. </select>
  320. <!--激光雷达基本信息-->
  321. <select id="selectSensorLidar" parameterType="string" resultType="api.common.pojo.vo.project.SensorBaseInfoVo">
  322. select a.sensor_name, description as sensorDescription
  323. from model_sensor_lidar a
  324. where a.id = #{id,jdbcType=VARCHAR}
  325. </select>
  326. <!--毫米波雷达基本信息-->
  327. <select id="selectSensorRadar" parameterType="string" resultType="api.common.pojo.vo.project.SensorBaseInfoVo">
  328. select a.name as sensor_name, description as sensorDescription
  329. from model_sensor_radar a
  330. where a.id = #{id,jdbcType=VARCHAR}
  331. </select>
  332. <!--gps基本信息-->
  333. <select id="selectSensorGps" parameterType="string" resultType="api.common.pojo.vo.project.SensorBaseInfoVo">
  334. select a.sensor_name, description as sensorDescription
  335. from model_sensor_gps a
  336. where a.id = #{id,jdbcType=VARCHAR}
  337. </select>
  338. <!--查询交通事故场景信息-->
  339. <select id="selectSceneAccidentById" parameterType="string" resultType="api.common.pojo.vo.project.SceneBaseInfoVo">
  340. select scene_name
  341. from scene_accident
  342. where accident_id = #{id,jdbcType=VARCHAR}
  343. </select>
  344. <!--查询自然场景信息-->
  345. <select id="selectSceneNatural" parameterType="string" resultType="api.common.pojo.vo.project.SceneBaseInfoVo">
  346. select natural_name
  347. from scene_natural
  348. where natural_id = #{id,jdbcType=VARCHAR}
  349. </select>
  350. <!--查询泛化场景信息-->
  351. <select id="selectSceneGeneralDataById" parameterType="string"
  352. resultType="api.common.pojo.vo.project.SceneBaseInfoVo">
  353. select scene_id scene_name
  354. from scene_general_data
  355. where id = #{id,jdbcType=VARCHAR}
  356. </select>
  357. <!--查询标准法规场景信息-->
  358. <select id="selectSceneStandardsRegulations" parameterType="string"
  359. resultType="api.common.pojo.vo.project.SceneBaseInfoVo">
  360. select scene_name
  361. from scene_standards_regulations
  362. where regulations_id = #{id,jdbcType=VARCHAR}
  363. </select>
  364. <!--根据场景包id获取场景子集-->
  365. <select id="selectSubSceneByPid" parameterType="string"
  366. resultType="api.common.pojo.vo.project.ScenePackageSubListVO">
  367. select sublist_id,
  368. sublist_name,
  369. scene_num,
  370. weight,
  371. parent_id,
  372. scene_natural_ids,
  373. scene_traffic_ids,
  374. scene_statue_ids,
  375. scene_generalization_ids
  376. from scene_package_sublist
  377. where parent_id = #{id,jdbcType=VARCHAR}
  378. order by seq
  379. </select>
  380. <!--获取指标信息-->
  381. <select id="selectsublistBySublistId" parameterType="string"
  382. resultType="api.common.pojo.vo.project.ScenePackageSubListVO">
  383. select sublist_id,
  384. sublist_name,
  385. scene_num,
  386. weight,
  387. parent_id,
  388. scene_natural_ids,
  389. scene_traffic_ids,
  390. scene_statue_ids,
  391. scene_generalization_ids
  392. from scene_package_sublist
  393. where sublist_id = #{id,jdbcType=VARCHAR}
  394. </select>
  395. <!--获取场景包下指标信息-->
  396. <select id="selectsublistByRootId" parameterType="api.common.pojo.param.project.SimulationManualProjectParam"
  397. resultType="api.common.pojo.vo.project.SublistScoreVo">
  398. select sub.sublist_id as id, sub.parent_id, sub.sublist_name, sub.scene_num, sub.package_and_rules
  399. from scene_package_sublist sub
  400. where sub.root_id = #{packageId,jdbcType=VARCHAR}
  401. order by sub.seq
  402. </select>
  403. <!--查询场景包id下最后一级所有指标和场景-->
  404. <select id="selectSubListByPid" parameterType="string"
  405. resultType="api.common.pojo.vo.project.ScenePackageSubListVO">
  406. select sublist_id,
  407. parent_id,
  408. sublist_name,
  409. scene_num,
  410. scene_natural_ids,
  411. scene_traffic_ids,
  412. scene_statue_ids,
  413. scene_generalization_ids
  414. from scene_package_sublist
  415. where package_and_rules != null
  416. and package_and_rules != ''
  417. and root_id = #{id,jdbcType=VARCHAR}
  418. and is_deleted = '0'
  419. </select>
  420. <!--保存项目最后一级指标信息-->
  421. <insert id="insertSimulationMptLastTargetScorePo"
  422. parameterType="api.common.pojo.po.project.SimulationMptLastTargetScorePo">
  423. insert into simulation_mpt_last_target_score
  424. (id,
  425. p_id,
  426. target,
  427. create_time,
  428. create_user_id,
  429. modify_time,
  430. modify_user_id,
  431. is_deleted)
  432. values (#{id,jdbcType=VARCHAR}
  433. #{pId,jdbcType=VARCHAR}
  434. #{target,jdbcType=VARCHAR}
  435. #{createTime,jdbcType=TIMESTAMP},
  436. #{createUserId,jdbcType=VARCHAR},
  437. #{modifyTime,jdbcType=TIMESTAMP},
  438. #{modifyUserId,jdbcType=VARCHAR},
  439. #{isDeleted,jdbcType=VARCHAR})
  440. </insert>
  441. <!--保存第一级指标信息-->
  442. <insert id="insertSimulationMptFirstTargetScorePo"
  443. parameterType="api.common.pojo.po.project.SimulationMptFirstTargetScorePo">
  444. insert into simulation_mpt_first_target_score
  445. (id,
  446. p_id,
  447. target,
  448. create_time,
  449. create_user_id,
  450. modify_time,
  451. modify_user_id,
  452. is_deleted)
  453. values (#{id,jdbcType=VARCHAR}
  454. #{pId,jdbcType=VARCHAR}
  455. #{target,jdbcType=VARCHAR}
  456. #{createTime,jdbcType=TIMESTAMP},
  457. #{createUserId,jdbcType=VARCHAR},
  458. #{modifyTime,jdbcType=TIMESTAMP},
  459. #{modifyUserId,jdbcType=VARCHAR},
  460. #{isDeleted,jdbcType=VARCHAR})
  461. </insert>
  462. <!--查询场景得分-->
  463. <select id="selectSceneScore" parameterType="api.common.pojo.po.project.SimulationMptSceneScorePo"
  464. resultType="api.common.pojo.po.project.SimulationMptSceneScorePo">
  465. select score, target_evaluate
  466. from simulation_mpt_scene_score
  467. where p_id = #{pId,jdbcType=VARCHAR} and is_deleted = '0'
  468. <if test="sceneId != null and sceneId != ''">
  469. and scene_id = #{sceneId,jdbcType=VARCHAR}
  470. </if>
  471. </select>
  472. <!--获取人员信息-->
  473. <select id="selectUserById" resultType="api.common.pojo.vo.project.SystemUserVo">
  474. select *
  475. from system_user
  476. where id = #{id,jdbcType=VARCHAR}
  477. </select>
  478. <!--查询所有指标得分-->
  479. <select id="selectSubScore" parameterType="api.common.pojo.param.project.SimulationManualProjectParam"
  480. resultType="api.common.pojo.vo.project.SublistScoreVo">
  481. select sub.sublist_id as id,
  482. sub.parent_id,
  483. sub.sublist_name,
  484. sub.scene_num,
  485. fir.score as firScore,
  486. las.score as lasScore,
  487. sub.package_and_rules,
  488. las.not_standard_scene_num,
  489. las.score_explain
  490. from scene_package_sublist sub
  491. left JOIN simulation_mpt_first_target_score fir
  492. on fir.target = sub.sublist_id and fir.p_id = #{id,jdbcType=VARCHAR}
  493. left JOIN simulation_mpt_last_target_score las
  494. on las.target = sub.sublist_id and las.p_id = #{id,jdbcType=VARCHAR}
  495. where sub.root_id = #{packageId,jdbcType=VARCHAR}
  496. and (fir.target is not null or las.target is not null)
  497. order by sub.seq
  498. </select>
  499. <!--查询所有指标得分-->
  500. <select id="selectSubScore2" parameterType="api.common.pojo.param.project.SimulationManualProjectParam"
  501. resultType="api.common.pojo.vo.project.SublistScoreVo">
  502. select sub.sublist_id as id,
  503. sub.parent_id,
  504. sub.sublist_name,
  505. sub.scene_num,
  506. fir.score as firScore,
  507. las.score as lasScore,
  508. sub.package_and_rules,
  509. las.not_standard_scene_num,
  510. las.score_explain,
  511. fir.target as firTarget,
  512. las.target as lasTarget
  513. from scene_package_sublist sub
  514. left join simulation_mpt_first_target_score fir
  515. on fir.target = sub.sublist_id and fir.p_id = #{id,jdbcType=VARCHAR}
  516. left join simulation_mpt_last_target_score las
  517. on las.target = sub.sublist_id and las.p_id = #{id,jdbcType=VARCHAR}
  518. where sub.root_id = #{packageId,jdbcType=VARCHAR}
  519. order by sub.seq
  520. </select>
  521. <!--运行项目状态-->
  522. <select id="selectRunProjectByState" parameterType="java.util.Map" resultType="java.util.Map">
  523. select count(1) num, temp.now_run_state nowRunState
  524. from (select now_run_state, create_user_id
  525. from simulation_manual_project
  526. where is_deleted = 0
  527. union all
  528. select now_run_state, create_user_id
  529. from simulation_automatic_subproject
  530. where is_deleted = 0) temp
  531. <if test="createUserId != null and createUserId != ''">
  532. where temp.create_user_id = '#{createUserId}'
  533. </if>
  534. group by now_run_state
  535. </select>
  536. <!--评测等级分布-->
  537. <select id="selectEvaluationLevel" parameterType="java.util.Map" resultType="java.util.Map">
  538. select count(evaluation_level) num,evaluation_level evaluationLevel from simulation_manual_project
  539. where
  540. is_deleted = '0' and evaluation_level is not null
  541. <if test="createUserId != null and createUserId != ''">
  542. and create_user_id=#{createUserId,jdbcType=VARCHAR}
  543. </if>
  544. group by evaluation_level
  545. </select>
  546. <!--添加第三方算法信息到算发表-->
  547. <insert id="insertOtherAlgorithm" parameterType="api.common.pojo.po.algorithm.AlgorithmPO">
  548. insert into algorithm
  549. (id,
  550. algorithm_name,
  551. upload_mode,
  552. is_deleted)
  553. values (id = #{id,jdbcType=VARCHAR},
  554. algorithm_name = #{algorithmName,jdbcType=VARCHAR},
  555. upload_mode = #{uploadMode,jdbcType=VARCHAR},
  556. is_deleted = #{isDeleted,jdbcType=VARCHAR},)
  557. </insert>
  558. <!--更新第三方算法信息到算法表-->
  559. <update id="updateOtherAlgorithm" parameterType="api.common.pojo.po.algorithm.AlgorithmPO">
  560. update algorithm
  561. set algorithm_name=#{algorithmName,jdbcType=VARCHAR}
  562. where id = #{id,jdbcType=VARCHAR}
  563. and is_deleted = '0'
  564. </update>
  565. <!--查询第三方算法信息是否已经存在-->
  566. <select id="selectalgorithmByQuery" parameterType="api.common.pojo.po.algorithm.AlgorithmPO"
  567. resultType="api.common.pojo.po.algorithm.AlgorithmPO">
  568. select id, algorithmName
  569. from algorithm
  570. where id = #{id,jdbcType=VARCHAR}
  571. and is_deleted = '0'
  572. </select>
  573. <!--根据算法id获取最新的一条报告id-->
  574. <select id="selectProjectReportIdByAlgorithmId" parameterType="string"
  575. resultType="api.common.pojo.po.project.SimulationManualProjectPo">
  576. select id
  577. from simulation_manual_project
  578. where algorithm = #{algorithmId,jdbcType=VARCHAR}
  579. and is_deleted = '0'
  580. and now_run_state = '30'
  581. order by finish_time desc limit 1
  582. </select>
  583. </mapper>