MvMapper.xml 8.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182
  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.ruoyi.predict.mapper.MvMapper">
  6. <resultMap type="Mv" id="MvResult">
  7. <result property="windplantNo" column="windplant_no"/>
  8. <result property="mvNo" column="mv_no"/>
  9. <result property="wturNo" column="wtur_no"/>
  10. <result property="oftype" column="oftype"/>
  11. <result property="name" column="name"/>
  12. <result property="ref" column="ref"/>
  13. <result property="presence" column="presence"/>
  14. <result property="instmag" column="instmag"/>
  15. <result property="mag" column="mag"/>
  16. <result property="coeff" column="coeff"/>
  17. <result property="range" column="range"/>
  18. <result property="q" column="q"/>
  19. <result property="t" column="t"/>
  20. <result property="measurementtypeNo" column="measurementtype_no"/>
  21. <result property="statTag" column="stat_tag"/>
  22. <result property="unifiedPoint" column="unified_point"/>
  23. </resultMap>
  24. <sql id="selectMvVo">
  25. select windplant_no, mv_no, wtur_no, oftype, name, ref, presence, instmag, mag, coeff, range, q, t, measurementtype_no, stat_tag, unified_point from mv
  26. </sql>
  27. <select id="selectMvList" parameterType="Mv" resultMap="MvResult">
  28. select
  29. m.*,
  30. w.name as "windplantName",
  31. wt.name as "wturName"
  32. from
  33. mv m
  34. left join windplant w on w.windplant_no = m.windplant_no
  35. left join wtur wt on wt.wtur_no = m.wtur_no
  36. <where>
  37. <if test="windplantNo != null ">and m.windplant_no = #{windplantNo}</if>
  38. <if test="mvNo != null ">and m.mv_no = #{mvNo}</if>
  39. <if test="wturNo != null ">and m.wtur_no = #{wturNo}</if>
  40. <if test="oftype != null ">and m.oftype = #{oftype}</if>
  41. <if test="name != null and name != ''">and m.name like concat(concat('%', #{name}), '%')</if>
  42. <if test="ref != null and ref != ''">and m.ref like concat(concat('%', #{ref}), '%')</if>
  43. <if test="presence != null ">and m.presence = #{presence}</if>
  44. <if test="instmag != null ">and m.instmag = #{instmag}</if>
  45. <if test="mag != null ">and m.mag = #{mag}</if>
  46. <if test="coeff != null ">and m.coeff = #{coeff}</if>
  47. <if test="range != null ">and m.range = #{range}</if>
  48. <if test="q != null ">and m.q = #{q}</if>
  49. <if test="t != null ">and m.t = #{t}</if>
  50. <if test="measurementtypeNo != null ">and m.measurementtype_no = #{measurementtypeNo}</if>
  51. <if test="statTag != null ">and m.stat_tag = #{statTag}</if>
  52. <if test="unifiedPoint != null ">and m.unified_point = #{unifiedPoint}</if>
  53. </where>
  54. order by m.windplant_no asc
  55. </select>
  56. <select id="selectMvById" parameterType="Long" resultMap="MvResult">
  57. <include refid="selectMvVo"/>
  58. where mv_no = #{mvNo}
  59. </select>
  60. <select id="selectMvByWturNoRef" parameterType="Long" resultMap="MvResult">
  61. <include refid="selectMvVo"/>
  62. where wtur_no = #{wtgNo} and measurementtype_no = #{measurementtypeNo}
  63. </select>
  64. <select id="selectMvListIsNot0" parameterType="Mv" resultMap="MvResult">
  65. select
  66. m.*,
  67. w.name as "windplantName",
  68. wt.name as "wturName"
  69. from
  70. mv m
  71. left join windplant w on w.windplant_no = m.windplant_no
  72. left join wtur wt on wt.wtur_no = m.wtur_no
  73. <where>
  74. <if test="windplantNo != null ">and m.windplant_no = #{windplantNo}</if>
  75. <if test="mvNo != null ">and m.mv_no = #{mvNo}</if>
  76. and m.wtur_no != 0
  77. <if test="oftype != null ">and m.oftype = #{oftype}</if>
  78. <if test="name != null and name != ''">and m.name like concat(concat('%', #{name}), '%')</if>
  79. <if test="ref != null and ref != ''">and m.ref like concat(concat('%', #{ref}), '%')</if>
  80. <if test="presence != null ">and m.presence = #{presence}</if>
  81. <if test="instmag != null ">and m.instmag = #{instmag}</if>
  82. <if test="mag != null ">and m.mag = #{mag}</if>
  83. <if test="coeff != null ">and m.coeff = #{coeff}</if>
  84. <if test="range != null ">and m.range = #{range}</if>
  85. <if test="q != null ">and m.q = #{q}</if>
  86. <if test="t != null ">and m.t = #{t}</if>
  87. <if test="measurementtypeNo != null ">and m.measurementtype_no = #{measurementtypeNo}</if>
  88. <if test="statTag != null ">and m.stat_tag = #{statTag}</if>
  89. <if test="unifiedPoint != null ">and m.unified_point = #{unifiedPoint}</if>
  90. </where>
  91. order by m.windplant_no asc
  92. </select>
  93. <insert id="insertMv" parameterType="Mv">
  94. insert into mv
  95. <trim prefix="(" suffix=")" suffixOverrides=",">
  96. <if test="windplantNo != null">windplant_no,</if>
  97. <if test="mvNo != null">mv_no,</if>
  98. <if test="wturNo != null">wtur_no,</if>
  99. <if test="oftype != null">oftype,</if>
  100. <if test="name != null">name,</if>
  101. <if test="ref != null">ref,</if>
  102. <if test="presence != null">presence,</if>
  103. <if test="instmag != null">instmag,</if>
  104. <if test="mag != null">mag,</if>
  105. <if test="coeff != null">coeff,</if>
  106. <if test="range != null">range,</if>
  107. <if test="q != null">q,</if>
  108. <if test="t != null">t,</if>
  109. <if test="measurementtypeNo != null">measurementtype_no,</if>
  110. <if test="statTag != null">stat_tag,</if>
  111. <if test="unifiedPoint != null">unified_point,</if>
  112. </trim>
  113. <trim prefix="values (" suffix=")" suffixOverrides=",">
  114. <if test="windplantNo != null">#{windplantNo},</if>
  115. <if test="mvNo != null">#{mvNo},</if>
  116. <if test="wturNo != null">#{wturNo},</if>
  117. <if test="oftype != null">#{oftype},</if>
  118. <if test="name != null">#{name},</if>
  119. <if test="ref != null">#{ref},</if>
  120. <if test="presence != null">#{presence},</if>
  121. <if test="instmag != null">#{instmag},</if>
  122. <if test="mag != null">#{mag},</if>
  123. <if test="coeff != null">#{coeff},</if>
  124. <if test="range != null">#{range},</if>
  125. <if test="q != null">#{q},</if>
  126. <if test="t != null">#{t},</if>
  127. <if test="measurementtypeNo != null">#{measurementtypeNo},</if>
  128. <if test="statTag != null">#{statTag},</if>
  129. <if test="unifiedPoint != null">#{unifiedPoint},</if>
  130. </trim>
  131. </insert>
  132. <insert id="insertMvList">
  133. insert into mv(windplant_no, mv_no, wtur_no, name, ref, coeff, measurementtype_no, unified_point)
  134. <foreach collection="list" item="item" separator="UNION ALL">
  135. SELECT
  136. #{item.windplantNo},
  137. #{item.mvNo},
  138. #{item.wturNo},
  139. #{item.name},
  140. #{item.ref},
  141. #{item.coeff},
  142. #{item.measurementtypeNo},
  143. #{item.unifiedPoint}
  144. FROM DUAL
  145. </foreach>
  146. </insert>
  147. <update id="updateMv" parameterType="Mv">
  148. update mv
  149. <trim prefix="SET" suffixOverrides=",">
  150. <if test="windplantNo != null">windplant_no = #{windplantNo},</if>
  151. <if test="wturNo != null">wtur_no = #{wturNo},</if>
  152. <if test="oftype != null">oftype = #{oftype},</if>
  153. <if test="name != null">name = #{name},</if>
  154. <if test="ref != null">ref = #{ref},</if>
  155. <if test="presence != null">presence = #{presence},</if>
  156. <if test="instmag != null">instmag = #{instmag},</if>
  157. <if test="mag != null">mag = #{mag},</if>
  158. <if test="coeff != null">coeff = #{coeff},</if>
  159. <if test="range != null">range = #{range},</if>
  160. <if test="q != null">q = #{q},</if>
  161. <if test="t != null">t = #{t},</if>
  162. <if test="measurementtypeNo != null">measurementtype_no = #{measurementtypeNo},</if>
  163. <if test="statTag != null">stat_tag = #{statTag},</if>
  164. <if test="unifiedPoint != null">unified_point = #{unifiedPoint},</if>
  165. </trim>
  166. where mv_no = #{mvNo}
  167. </update>
  168. <delete id="deleteMvById" parameterType="Long">
  169. delete from mv where mv_no = #{mvNo}
  170. </delete>
  171. </mapper>