ScenePackageSublistMapper.xml 10 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215
  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.ScenePackageSublistMapper">
  4. <insert id="saveScenePackageSublist" parameterType="api.common.pojo.po.scene.ScenePackageSublistPO">
  5. insert into simulation.scene_package_sublist
  6. (sublist_id, sublist_name, weight, rule_name, package_and_rules,
  7. scene_natural_ids, scene_traffic_ids, scene_statue_ids, scene_generalization_ids,
  8. scene_num, parent_id, root_id, seq, package_level, remarks,
  9. create_user_id, create_time, modify_user_id, modify_time,
  10. is_deleted, share, tree_node, template_id, example_id, rule_name_array)
  11. values (#{id,jdbcType=VARCHAR}, #{sublistName,jdbcType=VARCHAR}, #{weight,jdbcType=VARCHAR},
  12. #{ruleName,jdbcType=VARCHAR},
  13. #{packageAndRules,jdbcType=VARCHAR},
  14. #{sceneNaturalIds}, #{sceneTrafficIds}, #{sceneStatueIds}, #{sceneGeneralizationIds},
  15. #{sceneNum}, #{parentId,jdbcType=VARCHAR}, #{rootId,jdbcType=VARCHAR}, #{seq},
  16. #{packageLevel}, #{remarks},
  17. #{createUserId,jdbcType=VARCHAR}, #{createTime}, #{modifyUserId,jdbcType=VARCHAR}, #{modifyTime},
  18. #{isDeleted,jdbcType=VARCHAR}, #{share,jdbcType=VARCHAR}, #{treeNode,jdbcType=VARCHAR},
  19. #{templateId,jdbcType=VARCHAR}, #{exampleId,jdbcType=VARCHAR}, #{ruleNameArray,jdbcType=VARCHAR})
  20. </insert>
  21. <insert id="saveScenePackageSublistAll" parameterType="java.util.List">
  22. insert into simulation.scene_package_sublist
  23. (sublist_id,sublist_name,weight,rule_name,package_and_rules,
  24. scene_natural_ids,scene_traffic_ids,scene_statue_ids,scene_generalization_ids,
  25. scene_num,parent_id,root_id,seq,package_level,remarks,
  26. create_user_id,create_time,modify_user_id,modify_time,
  27. is_deleted,share,tree_node,template_id,example_id,rule_name_array) values
  28. <foreach collection="list" index="index" item="item" separator=",">
  29. (#{item.id,jdbcType=VARCHAR},#{item.sublistName,jdbcType=VARCHAR},#{item.weight,jdbcType=VARCHAR},#{item.ruleName,jdbcType=VARCHAR},
  30. #{item.packageAndRules,jdbcType=VARCHAR},
  31. #{item.sceneNaturalIds}, #{item.sceneTrafficIds}, #{item.sceneStatueIds}, #{item.sceneGeneralizationIds},
  32. #{item.sceneNum},#{item.parentId,jdbcType=VARCHAR},#{item.rootId,jdbcType=VARCHAR},#{index}+1,
  33. #{item.packageLevel},#{item.remarks},
  34. #{item.createUserId,jdbcType=VARCHAR},#{item.createTime},#{item.modifyUserId,jdbcType=VARCHAR},#{item.modifyTime},
  35. #{item.isDeleted,jdbcType=VARCHAR}, #{item.share,jdbcType=VARCHAR}, #{item.treeNode,jdbcType=VARCHAR},
  36. #{item.templateId,jdbcType=VARCHAR},#{item.exampleId,jdbcType=VARCHAR},#{item.ruleNameArray,jdbcType=VARCHAR})
  37. </foreach>
  38. </insert>
  39. <select id="queryScenePackageSublistList" parameterType="api.common.pojo.po.scene.ScenePackageSublistPO"
  40. resultType="api.common.pojo.vo.scene.ScenePackageSublistVO">
  41. select
  42. a.sublist_id id,a.sublist_name,a.weight,b.rule_name,
  43. a.scene_num,a.parent_id,a.root_id,a.package_level,a.remarks,a.seq,a.package_and_rules,a.rule_name_array,
  44. a.scene_natural_ids,a.scene_traffic_ids,a.scene_statue_ids,a.scene_generalization_ids,a.tree_node,a.template_id,a.example_id
  45. from simulation.scene_package_sublist as a left join simulation.scoring_rules as b on
  46. a.package_and_rules=b.rules_id
  47. <where>
  48. a.is_deleted = '0'
  49. <if test="id != null and id != ''">
  50. and a.sublist_id = #{id,jdbcType=VARCHAR}
  51. </if>
  52. <if test="sublistName != null and sublistName != ''">
  53. and a.sublist_name = #{sublistName,jdbcType=VARCHAR}
  54. </if>
  55. <if test="createUserId != null and createUserId != ''">
  56. and create_user_id=#{createUserId,jdbcType=VARCHAR}
  57. </if>
  58. <if test="parentId != null and parentId != ''">
  59. and a.parent_id = #{parentId}
  60. </if>
  61. <if test="rootId != null and rootId != ''">
  62. and a.root_id = #{rootId}
  63. </if>
  64. <if test="templateId != null and templateId != ''">
  65. and a.template_id = #{templateId}
  66. </if>
  67. <if test="exampleId != null and exampleId != ''">
  68. and a.example_id = #{exampleId}
  69. </if>
  70. order by seq
  71. </where>
  72. </select>
  73. <update id="deleteScenePackageSublist" parameterType="java.lang.String">
  74. update simulation.scene_package_sublist
  75. set is_deleted='1'
  76. where root_id = #{rootId,jdbcType=VARCHAR}
  77. </update>
  78. <delete id="deleteScenePackageSublistById" parameterType="java.lang.String">
  79. delete
  80. from simulation.scene_package_sublist
  81. where sublist_id = #{sublistId,jdbcType=VARCHAR}
  82. </delete>
  83. <select id="queryBySublistName" parameterType="api.common.pojo.po.scene.ScenePackageSublistPO"
  84. resultType="api.common.pojo.vo.scene.ScenePackageSublistVO">
  85. select sublist_id id,sublist_name
  86. from simulation.scene_package_sublist
  87. <where>
  88. is_deleted = '0'
  89. <if test="id != null and id != ''">
  90. and a.sublist_id != #{id,jdbcType=VARCHAR}
  91. </if>
  92. <if test="sublistName != null and sublistName != ''">
  93. and a.sublist_name = #{sublistName,jdbcType=VARCHAR}
  94. </if>
  95. <if test="createUserId != null and createUserId != ''">
  96. and create_user_id=#{createUserId,jdbcType=VARCHAR}
  97. </if>
  98. <if test="share != null and share != ''">
  99. and share=#{share,jdbcType=VARCHAR}
  100. </if>
  101. <if test="templateId != null and templateId != ''">
  102. and a.template_id = #{templateId}
  103. </if>
  104. <if test="exampleId != null and exampleId != ''">
  105. and a.example_id = #{exampleId}
  106. </if>
  107. </where>
  108. </select>
  109. <update id="updateScenePackageSublistById" parameterType="api.common.pojo.param.scene.SceneDeleteParam">
  110. update simulation.scene_package_sublist
  111. <set>
  112. <if test="sceneFhId != null and sceneFhId!=''">
  113. scene_generalization_ids='',
  114. scene_num='0',
  115. template_id ='',
  116. </if>
  117. <if test="modifyUserId != null and modifyUserId!=''">
  118. modify_user_id = #{modifyUserId,jdbcType=VARCHAR},
  119. </if>
  120. <if test="modifyTime != null">
  121. modify_time = #{modifyTime},
  122. </if>
  123. </set>
  124. where
  125. is_deleted='0'
  126. <if test="sceneZrId != null and sceneZrId != ''">
  127. and scene_natural_ids like CONCAT('%',#{sceneZrId,jdbcType=VARCHAR},'%')
  128. </if>
  129. <if test="sceneJtId != null and sceneJtId != ''">
  130. and scene_traffic_ids like CONCAT('%',#{sceneJtId,jdbcType=VARCHAR},'%')
  131. </if>
  132. <if test="sceneBzId != null and sceneBzId != ''">
  133. and scene_statue_ids like CONCAT('%',#{sceneBzId,jdbcType=VARCHAR},'%')
  134. </if>
  135. <if test="sceneFhId != null and sceneFhId != ''">
  136. and template_id =#{sceneFhId}
  137. </if>
  138. </update>
  139. <update id="update" parameterType="java.util.List">
  140. <foreach collection="indexes" item="item" index="index" open="" close="" separator=";">
  141. update scene_package_sublist
  142. set scene_natural_ids = #{item.sceneNaturalIds},
  143. scene_traffic_ids = #{item.sceneTrafficIds},
  144. scene_statue_ids = #{item.sceneStatueIds},
  145. scene_generalization_ids = #{item.sceneGeneralizationIds},
  146. scene_num = #{item.sceneNum}
  147. where sublist_id = #{item.sublistId}
  148. </foreach>
  149. </update>
  150. <select id="selectPackageIdById" parameterType="api.common.pojo.param.scene.SceneDeleteParam"
  151. resultType="java.lang.String">
  152. select root_id
  153. from simulation.scene_package_sublist
  154. <where>
  155. is_deleted = '0'
  156. <if test="sceneZrId != null and sceneZrId != ''">
  157. and scene_natural_ids like CONCAT('%',#{sceneZrId,jdbcType=VARCHAR},'%')
  158. </if>
  159. <if test="sceneJtId != null and sceneJtId != ''">
  160. and scene_traffic_ids like CONCAT('%',#{sceneJtId,jdbcType=VARCHAR},'%')
  161. </if>
  162. <if test="sceneBzId != null and sceneBzId != ''">
  163. and scene_statue_ids like CONCAT('%',#{sceneBzId,jdbcType=VARCHAR},'%')
  164. </if>
  165. <if test="sceneFhId != null and sceneFhId != ''">
  166. and scene_generalization_ids like CONCAT('%',#{sceneFhId,jdbcType=VARCHAR},'%')
  167. </if>
  168. </where>
  169. </select>
  170. <select id="selectPackageFhById" parameterType="api.common.pojo.param.scene.SceneDeleteParam"
  171. resultType="api.common.pojo.po.scene.ScenePackageSublistPO">
  172. select root_id, scene_num, sublist_id
  173. from simulation.scene_package_sublist
  174. where is_deleted = '0'
  175. and template_id = #{sceneFhId}
  176. </select>
  177. <select id="selectBySceneIds" resultType="api.common.pojo.po.scene.ScenePackageSublistPO">
  178. select sublist_id, scene_natural_ids, scene_traffic_ids, scene_statue_ids, scene_generalization_ids
  179. from scene_package_sublist
  180. where is_deleted = '0' and
  181. <if test='sceneType == "1"'>
  182. <foreach item="item" collection="sceneIds" separator=" or " open="(" close=")">
  183. scene_natural_ids like concat('%',#{item},'%')
  184. </foreach>
  185. </if>
  186. <if test='sceneType == "2"'>
  187. <foreach item="item" collection="sceneIds" separator=" or " open="(" close=")">
  188. scene_statue_ids like concat('%',#{item},'%')
  189. </foreach>
  190. </if>
  191. <if test='sceneType == "3"'>
  192. <foreach item="item" collection="sceneIds" separator=" or " open="(" close=")">
  193. scene_traffic_ids like concat('%',#{item},'%')
  194. </foreach>
  195. </if>
  196. </select>
  197. <select id="selectSceneNumByPackageId" resultType="java.lang.Integer">
  198. select sum(scene_num)
  199. from scene_package_sublist
  200. where root_id = #{scenePackageId}
  201. </select>
  202. </mapper>