AlgorithmMapper.xml 7.0 KB

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