WindplantprojectMapper.xml 8.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181
  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.WindplantprojectMapper">
  6. <resultMap type="Windplantproject" id="WindplantprojectResult">
  7. <result property="wpNo" column="wp_no"/>
  8. <result property="projectNo" column="project_no"/>
  9. <result property="projectName" column="project_name"/>
  10. <result property="projectIssue" column="project_issue"/>
  11. <result property="projectCapacity" column="project_capacity"/>
  12. <result property="analogNo" column="analog_no"/>
  13. <result property="bcrNo" column="bcr_no"/>
  14. <result property="statSpeedTime" column="stat_speed_time"/>
  15. <result property="monthBcrNo" column="month_bcr_no"/>
  16. <result property="yearBcrNo" column="year_bcr_no"/>
  17. <result property="area" column="area"/>
  18. <result property="unitsNumber" column="units_number"/>
  19. </resultMap>
  20. <sql id="selectWindplantprojectVo">
  21. select wp_no, project_no, project_name, project_issue, project_capacity, analog_no, bcr_no, stat_speed_time, month_bcr_no, year_bcr_no, area, units_number from windplantproject
  22. </sql>
  23. <select id="selectWindplantprojectList" parameterType="Windplantproject" resultMap="WindplantprojectResult">
  24. select
  25. wp.*,
  26. w.name as "windplantName",
  27. pps.name as "pvStationName"
  28. from
  29. windplantproject wp
  30. left join windplant w on w.windplant_no = wp.wp_no
  31. left join pv_power_station pps on pps.pv_station_no = wp.wp_no
  32. <where>
  33. <if test="wpNo != null ">and wp.wp_no = #{wpNo}</if>
  34. <if test="projectNo != null ">and wp.project_no = #{projectNo}</if>
  35. <if test="projectName != null and projectName != ''">and wp.project_name like concat(concat('%',
  36. #{projectName}), '%')
  37. </if>
  38. <if test="projectIssue != null ">and wp.project_issue = #{projectIssue}</if>
  39. <if test="projectCapacity != null ">and wp.project_capacity = #{projectCapacity}</if>
  40. <if test="analogNo != null ">and wp.analog_no = #{analogNo}</if>
  41. <if test="bcrNo != null ">and wp.bcr_no = #{bcrNo}</if>
  42. <if test="statSpeedTime != null ">and wp.stat_speed_time = #{statSpeedTime}</if>
  43. <if test="monthBcrNo != null ">and wp.month_bcr_no = #{monthBcrNo}</if>
  44. <if test="yearBcrNo != null ">and wp.year_bcr_no = #{yearBcrNo}</if>
  45. <if test="area != null ">and wp.area = #{area}</if>
  46. <if test="unitsNumber != null ">and wp.units_number = #{unitsNumber}</if>
  47. <if test="params.beginDataTime != null and params.beginDataTime != '' and params.endDataTime != null and params.endDataTime != ''">
  48. and wp.stat_speed_time between to_date(#{params.beginDataTime},'yyyy-MM-dd HH24:MI:SS') and
  49. to_date(#{params.endDataTime},'yyyy-MM-dd HH24:MI:SS')
  50. </if>
  51. </where>
  52. order by wp.wp_no asc
  53. </select>
  54. <select id="selectWindplantprojectById" parameterType="Long" resultMap="WindplantprojectResult">
  55. <include refid="selectWindplantprojectVo"/>
  56. where project_no = #{projectNo}
  57. </select>
  58. <select id="selectWindplantprojectByWindplantNo" parameterType="Long" resultMap="WindplantprojectResult">
  59. <include refid="selectWindplantprojectVo"/>
  60. where wp_no = #{windplantNo}
  61. </select>
  62. <select id="selectWindplantprojectByWpNoProjectNo" parameterType="Long" resultMap="WindplantprojectResult">
  63. <include refid="selectWindplantprojectVo"/>
  64. where wp_no = #{windplantNo} and project_no = #{projectNo}
  65. </select>
  66. <select id="checkProjectNoUnique" parameterType="Long" resultMap="WindplantprojectResult">
  67. select project_no from windplantproject where project_no = #{projectNo} and rownum <![CDATA[ <= ]]> 1
  68. </select>
  69. <select id="checkAnalogNoUnique" parameterType="Long" resultMap="WindplantprojectResult">
  70. select analog_no from windplantproject where analog_no = #{analogNo} and rownum <![CDATA[ <= ]]> 1
  71. </select>
  72. <select id="selectNewData" resultType="Long">
  73. SELECT * FROM ( SELECT project_no FROM windplantproject ORDER BY project_no DESC ) WHERE ROWNUM = 1
  74. </select>
  75. <select id="checkBcrNoUnique" parameterType="Long" resultType="int">
  76. select count(1) from windplantproject where bcr_no = #{bcrNo} and rownum <![CDATA[ <= ]]> 1
  77. </select>
  78. <select id="checkMonthBcrNoUnique" parameterType="Long" resultType="int">
  79. select count(1) from windplantproject where month_bcr_no = #{monthBcrNo} and rownum <![CDATA[ <= ]]> 1
  80. </select>
  81. <select id="checkYearBcrNoUnique" parameterType="Long" resultType="int">
  82. select count(1) from windplantproject where year_bcr_no = #{yearBcrNo} and rownum <![CDATA[ <= ]]> 1
  83. </select>
  84. <select id="selectWindplantprojectByProjectIssue" parameterType="String" resultMap="WindplantprojectResult">
  85. <include refid="selectWindplantprojectVo"/>
  86. where project_issue = #{projectIssue}
  87. </select>
  88. <insert id="insertWindplantproject" parameterType="Windplantproject">
  89. insert into windplantproject
  90. <trim prefix="(" suffix=")" suffixOverrides=",">
  91. <if test="wpNo != null">wp_no,</if>
  92. <if test="projectNo != null">project_no,</if>
  93. <if test="projectName != null">project_name,</if>
  94. <if test="projectIssue != null">project_issue,</if>
  95. <if test="projectCapacity != null">project_capacity,</if>
  96. <if test="analogNo != null">analog_no,</if>
  97. <if test="bcrNo != null">bcr_no,</if>
  98. <if test="statSpeedTime != null">stat_speed_time,</if>
  99. <if test="monthBcrNo != null">month_bcr_no,</if>
  100. <if test="yearBcrNo != null">year_bcr_no,</if>
  101. <if test="area != null">area,</if>
  102. <if test="unitsNumber != null">units_number,</if>
  103. </trim>
  104. <trim prefix="values (" suffix=")" suffixOverrides=",">
  105. <if test="wpNo != null">#{wpNo},</if>
  106. <if test="projectNo != null">#{projectNo},</if>
  107. <if test="projectName != null">#{projectName},</if>
  108. <if test="projectIssue != null">#{projectIssue},</if>
  109. <if test="projectCapacity != null">#{projectCapacity},</if>
  110. <if test="analogNo != null">#{analogNo},</if>
  111. <if test="bcrNo != null">#{bcrNo},</if>
  112. <if test="statSpeedTime != null">#{statSpeedTime},</if>
  113. <if test="monthBcrNo != null">#{monthBcrNo},</if>
  114. <if test="yearBcrNo != null">#{yearBcrNo},</if>
  115. <if test="area != null">#{area},</if>
  116. <if test="unitsNumber != null">#{unitsNumber},</if>
  117. </trim>
  118. </insert>
  119. <insert id="insertWindplantprojectList">
  120. insert into windplantproject(project_no, wp_no, project_name, project_capacity, analog_no, stat_speed_time)
  121. <foreach collection="list" item="item" separator="UNION ALL">
  122. SELECT
  123. #{item.projectNo},
  124. #{item.wpNo},
  125. #{item.projectName},
  126. #{item.projectCapacity},
  127. #{item.analogNo},
  128. #{item.statSpeedTime}
  129. FROM DUAL
  130. </foreach>
  131. </insert>
  132. <update id="updateWindplantproject" parameterType="Windplantproject">
  133. update windplantproject
  134. <trim prefix="SET" suffixOverrides=",">
  135. <if test="wpNo != null">wp_no = #{wpNo},</if>
  136. <if test="projectName != null">project_name = #{projectName},</if>
  137. <if test="projectIssue != null">project_issue = #{projectIssue},</if>
  138. <if test="projectCapacity != null">project_capacity = #{projectCapacity},</if>
  139. <if test="analogNo != null">analog_no = #{analogNo},</if>
  140. <if test="bcrNo != null">bcr_no = #{bcrNo},</if>
  141. <if test="statSpeedTime != null">stat_speed_time = #{statSpeedTime},</if>
  142. <if test="monthBcrNo != null">month_bcr_no = #{monthBcrNo},</if>
  143. <if test="yearBcrNo != null">year_bcr_no = #{yearBcrNo},</if>
  144. <if test="area != null">area = #{area},</if>
  145. <if test="unitsNumber != null">units_number = #{unitsNumber},</if>
  146. </trim>
  147. where project_no = #{projectNo}
  148. </update>
  149. <delete id="deleteWindplantprojectById" parameterType="Long">
  150. delete from windplantproject where project_no = #{projectNo}
  151. </delete>
  152. <delete id="deleteWindplantprojectByIds" parameterType="String">
  153. delete from windplantproject where project_no in
  154. <foreach item="projectNo" collection="array" open="(" separator="," close=")">
  155. #{projectNo}
  156. </foreach>
  157. </delete>
  158. <delete id="deleteWindplantprojectByWindplantNo" parameterType="Long">
  159. delete from windplantproject where wp_no = #{windplantNo}
  160. </delete>
  161. </mapper>