AlgorithmIoFieldMapper.xml 6.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162
  1. <?xml version="1.0" encoding="UTF-8" ?>
  2. <!DOCTYPE mapper
  3. PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
  4. "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
  5. <mapper namespace="com.pdaaphm.biz.mapper.AlgorithmIoFieldMapper">
  6. <resultMap type="AlgorithmIoField" id="AlgorithmIoFieldResult">
  7. <result property="id" column="id" />
  8. <result property="algorithmSubId" column="algorithm_sub_id" />
  9. <result property="type" column="type" />
  10. <result property="name" column="name" />
  11. <result property="index" column="index" />
  12. <result property="matlabIoPath" column="matlab_io_path" />
  13. <result property="createBy" column="create_by" />
  14. <result property="createTime" column="create_time" />
  15. <result property="updateBy" column="update_by" />
  16. <result property="updateTime" column="update_time" />
  17. <result property="remark" column="remark" />
  18. <result property="algoSubName" column="sub_name" />
  19. </resultMap>
  20. <sql id="selectAlgorithmIoFieldVo">
  21. select io.id, io.algorithm_sub_id, io.`type`, io.`name`, io.`index`,io.matlab_io_path ,io.create_by, io.create_time, io.update_by, io.update_time, io.remark, sub.name as sub_name from t_algorithm_io_field as io left join t_algorithm_sub_type as sub on io.algorithm_sub_id = sub.id
  22. </sql>
  23. <select id="selectAlgorithmIoFieldList" parameterType="AlgorithmIoField" resultMap="AlgorithmIoFieldResult">
  24. <include refid="selectAlgorithmIoFieldVo"/>
  25. <where>
  26. <if test="algorithmSubId != null "> and algorithm_sub_id = #{algorithmSubId}</if>
  27. <if test="type != null and type != ''"> and `type` = #{type}</if>
  28. <if test="name != null and name != ''"> and `name` like concat('%', #{name}, '%')</if>
  29. <if test="index != null "> and `index` = #{index}</if>
  30. <if test="matlabIoPath != null and matlabIoPath != ''"> and matlab_io_path = #{matlabIoPath}</if>
  31. </where>
  32. </select>
  33. <select id="selectAlgorithmIoFieldById" parameterType="Long" resultMap="AlgorithmIoFieldResult">
  34. <include refid="selectAlgorithmIoFieldVo"/>
  35. where io.id = #{id}
  36. </select>
  37. <insert id="insertAlgorithmIoField" parameterType="AlgorithmIoField" useGeneratedKeys="true" keyProperty="id">
  38. insert into t_algorithm_io_field
  39. <trim prefix="(" suffix=")" suffixOverrides=",">
  40. <if test="algorithmSubId != null">algorithm_sub_id,</if>
  41. <if test="type != null">`type`,</if>
  42. <if test="name != null">`name`,</if>
  43. <if test="index != null">`index`,</if>
  44. <if test="matlabIoPath != null">matlab_io_path,</if>
  45. <if test="createBy != null">create_by,</if>
  46. <if test="createTime != null">create_time,</if>
  47. <if test="updateBy != null">update_by,</if>
  48. <if test="updateTime != null">update_time,</if>
  49. <if test="remark != null">remark,</if>
  50. </trim>
  51. <trim prefix="values (" suffix=")" suffixOverrides=",">
  52. <if test="algorithmSubId != null">#{algorithmSubId},</if>
  53. <if test="type != null">#{type},</if>
  54. <if test="name != null">#{name},</if>
  55. <if test="index != null">#{index},</if>
  56. <if test="matlabIoPath != null">#{matlabIoPath},</if>
  57. <if test="createBy != null">#{createBy},</if>
  58. <if test="createTime != null">#{createTime},</if>
  59. <if test="updateBy != null">#{updateBy},</if>
  60. <if test="updateTime != null">#{updateTime},</if>
  61. <if test="remark != null">#{remark},</if>
  62. </trim>
  63. </insert>
  64. <update id="updateAlgorithmIoField" parameterType="AlgorithmIoField">
  65. update t_algorithm_io_field
  66. <trim prefix="SET" suffixOverrides=",">
  67. <if test="algorithmSubId != null">algorithm_sub_id = #{algorithmSubId},</if>
  68. <if test="type != null">`type` = #{type},</if>
  69. <if test="name != null">`name` = #{name},</if>
  70. <if test="index != null">`index` = #{index},</if>
  71. <if test="matlabIoPath != null">matlab_io_path = #{matlabIoPath},</if>
  72. <if test="createBy != null">create_by = #{createBy},</if>
  73. <if test="createTime != null">create_time = #{createTime},</if>
  74. <if test="updateBy != null">update_by = #{updateBy},</if>
  75. <if test="updateTime != null">update_time = #{updateTime},</if>
  76. <if test="remark != null">remark = #{remark},</if>
  77. </trim>
  78. where id = #{id}
  79. </update>
  80. <delete id="deleteAlgorithmIoFieldById" parameterType="Long">
  81. delete from t_algorithm_io_field where id = #{id}
  82. </delete>
  83. <delete id="deleteAlgorithmIoFieldBySubTypeId" parameterType="Long">
  84. delete from t_algorithm_io_field where algorithm_sub_id = #{id}
  85. </delete>
  86. <delete id="deleteAlgorithmIoFieldByIds" parameterType="String">
  87. delete from t_algorithm_io_field where id in
  88. <foreach item="id" collection="array" open="(" separator="," close=")">
  89. #{id}
  90. </foreach>
  91. </delete>
  92. <select id="getIoSubList" resultType="com.pdaaphm.biz.dto.SubAlgorithmDTO">
  93. SELECT
  94. io.id as fieldId,
  95. io.`type`,
  96. io.`name`,
  97. (
  98. SELECT
  99. sa.id
  100. FROM
  101. t_sub_algorithm sa,
  102. t_algorithm a
  103. WHERE
  104. sa.algorithm_id = a.id
  105. AND sa.field_id = io.id
  106. AND a.id = #{algoId}
  107. ) AS id,
  108. (
  109. SELECT
  110. sa.upload_id
  111. FROM
  112. t_sub_algorithm sa,
  113. t_algorithm a
  114. WHERE
  115. sa.algorithm_id = a.id
  116. AND sa.field_id = io.id
  117. AND a.id = #{algoId}
  118. ) AS uploadId,
  119. (
  120. SELECT
  121. f.path
  122. FROM
  123. t_sub_algorithm sa,
  124. t_file f,
  125. t_algorithm a
  126. WHERE
  127. sa.upload_id = f.id
  128. AND sa.algorithm_id = a.id
  129. AND sa.field_id = io.id
  130. AND a.id = #{algoId}
  131. ) AS path
  132. FROM
  133. t_algorithm_io_field AS io
  134. WHERE
  135. io.algorithm_sub_id = #{subTypeId}
  136. </select>
  137. <select id="selectMatlabIoPathTypeIndexByAlgoId" resultType="map">
  138. SELECT
  139. io.matlab_io_path,
  140. io.type,
  141. io.`index`
  142. FROM
  143. t_algorithm_io_field io
  144. JOIN t_algorithm_sub_type ast ON ast.id = io.algorithm_sub_id
  145. JOIN t_algorithm a ON a.sub_type_id = ast.id
  146. WHERE
  147. a.id = #{id}
  148. ORDER BY
  149. io.`index`
  150. </select>
  151. </mapper>