AlgorithmMapper.xml 8.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210
  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.algorithm.mapper.AlgorithmMapper">
  4. <!--添加-->
  5. <insert id="add" parameterType="api.common.pojo.po.algorithm.AlgorithmPO">
  6. insert into algorithm
  7. (id,
  8. algorithm_name,
  9. algorithm_code,
  10. description,
  11. validation_status,
  12. upload_mode,
  13. git_url,
  14. git_user_name,
  15. git_password,
  16. file_name,
  17. minio_path,
  18. share,
  19. create_time,
  20. create_user_id,
  21. modify_time,
  22. modify_user_id,
  23. is_deleted)
  24. value
  25. ( #{id,jdbcType=VARCHAR},
  26. #{algorithmName,jdbcType=VARCHAR},
  27. #{algorithmCode,jdbcType=VARCHAR},
  28. #{description,jdbcType=LONGNVARCHAR},
  29. #{validationStatus,jdbcType=VARCHAR},
  30. #{uploadMode,jdbcType=VARCHAR},
  31. #{gitUrl,jdbcType=VARCHAR},
  32. #{gitUserName,jdbcType=VARCHAR},
  33. #{gitPassword,jdbcType=VARCHAR},
  34. #{fileName,jdbcType=VARCHAR},
  35. #{minioPath,jdbcType=VARCHAR},
  36. #{share,jdbcType=VARCHAR},
  37. #{createTime,jdbcType=TIMESTAMP},
  38. #{createUserId,jdbcType=VARCHAR},
  39. #{modifyTime,jdbcType=TIMESTAMP},
  40. #{modifyUserId,jdbcType=VARCHAR},
  41. #{isDeleted,jdbcType=VARCHAR}
  42. )
  43. </insert>
  44. <!--查询算法详情-->
  45. <select id="selectDetailsById" parameterType="java.lang.String"
  46. resultType="api.common.pojo.po.algorithm.AlgorithmPO">
  47. select *
  48. from algorithm
  49. where id = #{algorithmId,jdbcType=VARCHAR}
  50. </select>
  51. <!--查询算法列表—私有-->
  52. <select id="selectAlgorithmList" parameterType="api.common.pojo.param.algorithm.AlgorithmParameter"
  53. resultType="api.common.pojo.vo.algorithm.AlgorithmVO">
  54. select id, algorithm_code, algorithm_name, description, validation_status, upload_mode from algorithm
  55. <where>
  56. is_deleted = '0' and share = '0'
  57. </where>
  58. <if test="algorithmCode != null and algorithmCode != ''">
  59. and algorithm_code like CONCAT('%',#{algorithmCode,jdbcType=VARCHAR},'%')
  60. </if>
  61. <if test="algorithmName != null and algorithmName != ''">
  62. and algorithm_name like CONCAT('%',#{algorithmName,jdbcType=VARCHAR},'%')
  63. </if>
  64. <if test="description != null and description != ''">
  65. and description like CONCAT('%',#{description,jdbcType=LONGNVARCHAR},'%')
  66. </if>
  67. <if test="validationStatus != null and validationStatus != ''">
  68. and validation_status = #{validationStatus,jdbcType=VARCHAR}
  69. </if>
  70. <if test="uploadMode != null and uploadMode != ''">
  71. and upload_mode = #{uploadMode,jdbcType=VARCHAR}
  72. </if>
  73. <if test="createUserId != null and createUserId != ''">
  74. and create_user_id = #{createUserId,jdbcType=VARCHAR}
  75. </if>
  76. order by modify_time desc, create_time desc
  77. </select>
  78. <!--查询绑定算法的正在运行的项目-->
  79. <select id="selectRunningProject" parameterType="java.lang.String"
  80. resultType="api.common.pojo.vo.algorithm.RunningProjectVO">
  81. select a.id,a.project_id from simulation_automatic_subproject a left join simulation_automatic_project b
  82. on a.parent_id=b.id
  83. where a.now_run_state = '20' and a.is_deleted = '0' and b.is_deleted = '0'
  84. <if test="id != null and id != ''">
  85. and b.algorithm = #{id,jdbcType=VARCHAR}
  86. </if>
  87. </select>
  88. <!--查询绑定算法的正在运行的项目的父项目-->
  89. <select id="selectRunningProjectParent" parameterType="java.lang.String"
  90. resultType="api.common.pojo.vo.algorithm.RunningProjectVO">
  91. select distinct a.parent_id as id,a.parent_project_id as projectId from simulation_automatic_subproject a left
  92. join simulation_automatic_project b
  93. on a.parent_id=b.id
  94. where a.now_run_state = '20' and a.is_deleted = '0' and b.is_deleted = '0'
  95. <if test="id != null and id != ''">
  96. and b.algorithm = #{id,jdbcType=VARCHAR}
  97. </if>
  98. </select>
  99. <!--查询算法绑定的自动运行父项目-->
  100. <select id="selectAutoProjectIdByAlgorithmId" parameterType="java.lang.String"
  101. resultType="api.common.pojo.vo.algorithm.RunningProjectVO">
  102. select id, project_id
  103. from simulation_automatic_project
  104. where is_deleted = '0'
  105. and algorithm = #{algorithmId}
  106. </select>
  107. <!--查询算法名称是否已存在-当前用户-->
  108. <select id="selectAlgorithmName" parameterType="api.common.pojo.param.algorithm.AlgorithmParameter"
  109. resultType="api.common.pojo.po.algorithm.AlgorithmPO">
  110. select id from algorithm
  111. where is_deleted = '0'
  112. <if test="algorithmName != null and algorithmName != ''">
  113. and algorithm_name = #{algorithmName,jdbcType=VARCHAR}
  114. </if>
  115. <if test="createUserId != null and createUserId != ''">
  116. and create_user_id = #{createUserId,jdbcType=VARCHAR}
  117. </if>
  118. <if test="id != null and id != ''">
  119. and id != #{id,jdbcType=VARCHAR}
  120. </if>
  121. <if test="share != null and share != ''">
  122. and share = #{share,jdbcType=VARCHAR}
  123. </if>
  124. </select>
  125. <!--查询算法列表—公有-->
  126. <select id="selectSharedAlgorithmList" parameterType="api.common.pojo.param.algorithm.AlgorithmParameter"
  127. resultType="api.common.pojo.vo.algorithm.AlgorithmVO">
  128. select id, algorithm_code, algorithm_name, description, validation_status, upload_mode from algorithm
  129. <where>
  130. is_deleted = '0'
  131. </where>
  132. <if test="algorithmCode != null and algorithmCode != ''">
  133. and algorithm_code like CONCAT('%',#{algorithmCode,jdbcType=VARCHAR},'%')
  134. </if>
  135. <if test="algorithmName != null and algorithmName != ''">
  136. and algorithm_name like CONCAT('%',#{algorithmName,jdbcType=VARCHAR},'%')
  137. </if>
  138. <if test="description != null and description != ''">
  139. and description like CONCAT('%',#{description,jdbcType=LONGNVARCHAR},'%')
  140. </if>
  141. <if test="validationStatus != null and validationStatus != ''">
  142. and validation_status = #{validationStatus,jdbcType=VARCHAR}
  143. </if>
  144. <if test="share != null and share != ''">
  145. and share = #{share,jdbcType=VARCHAR}
  146. </if>
  147. order by modify_time desc, create_time desc
  148. </select>
  149. <!--查询算法名称是否已存在-公有-->
  150. <select id="selectSharedAlgorithmName" resultType="api.common.pojo.po.algorithm.AlgorithmPO">
  151. select id from algorithm
  152. where is_deleted = '0' and share = '1'
  153. <if test="algorithmName != null and algorithmName != ''">
  154. and algorithm_name = #{algorithmName,jdbcType=VARCHAR}
  155. </if>
  156. </select>
  157. <!--删除-->
  158. <update id="deleteById">
  159. update algorithm
  160. set is_deleted = '1'
  161. where id = #{id,jdbcType=VARCHAR}
  162. </update>
  163. <update id="update" parameterType="api.common.pojo.po.algorithm.AlgorithmPO">
  164. update algorithm
  165. set algorithm_name=#{algorithmName,jdbcType=VARCHAR},
  166. description=#{description,jdbcType=VARCHAR},
  167. validation_status=#{validationStatus,jdbcType=VARCHAR},
  168. upload_mode=#{uploadMode,jdbcType=VARCHAR},
  169. git_url=#{gitUrl,jdbcType=VARCHAR},
  170. git_user_name=#{gitUserName,jdbcType=VARCHAR},
  171. git_password=#{gitPassword,jdbcType=VARCHAR},
  172. file_name=#{fileName,jdbcType=VARCHAR},
  173. minio_path=#{minioPath,jdbcType=VARCHAR},
  174. modify_time=#{modifyTime,jdbcType=VARCHAR},
  175. modify_user_id=#{modifyUserId,jdbcType=VARCHAR}
  176. where id = #{id,jdbcType=VARCHAR}
  177. </update>
  178. <!--查询算法数量首页-->
  179. <select id="selectDetailsBySy" parameterType="api.common.pojo.param.algorithm.AlgorithmParameter"
  180. resultType="java.lang.Integer">
  181. select count(id)
  182. from algorithm
  183. where
  184. is_deleted = '0'
  185. <if test="createUserId != null and createUserId != ''">
  186. and create_user_id=#{createUserId,jdbcType=VARCHAR}
  187. </if>
  188. <if test="share != null and share != ''">
  189. and share=#{share}
  190. </if>
  191. <if test="uploadMode != null and uploadMode != ''">
  192. and upload_mode=#{uploadMode}
  193. </if>
  194. </select>
  195. </mapper>