WtgStopPlantMapper.xml 6.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132
  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.WtgStopPlantMapper">
  6. <resultMap type="WtgStopPlant" id="WtgStopPlantResult">
  7. <result property="windplantNo" column="windplant_no"/>
  8. <result property="wturNo" column="wtur_no"/>
  9. <result property="dataTime" column="data_time"/>
  10. <result property="setTime" column="set_time"/>
  11. <result property="ratePower" column="rate_power"/>
  12. <result property="ifstop" column="ifstop"/>
  13. <result property="outageType" column="outage_type"/>
  14. <result property="reasonDowntime" column="reason_downtime"/>
  15. <result property="overhaulResults" column="overhaul_results"/>
  16. </resultMap>
  17. <sql id="selectWtgStopPlantVo">
  18. select windplant_no, wtur_no, data_time, set_time, rate_power, ifstop, outage_type, reason_downtime, overhaul_results from wtg_stop_plant
  19. </sql>
  20. <select id="selectWtgStopPlantList" parameterType="WtgStopPlant" resultMap="WtgStopPlantResult">
  21. select
  22. wsp.windplant_no,
  23. wsp.wtur_no,
  24. wsp.data_time,
  25. wsp.set_time,
  26. wsp.rate_power,
  27. wsp.ifstop,
  28. wsp.outage_type,
  29. wsp.reason_downtime,
  30. wsp.overhaul_results,
  31. w.name as "wturName"
  32. from
  33. wtg_stop_plant wsp
  34. left join wtur w on w.wtur_no = wsp.wtur_no
  35. <where>
  36. <if test="windplantNo != null ">and wsp.windplant_no = #{windplantNo}</if>
  37. <if test="wturNo != null ">and wsp.wtur_no = #{wturNo}</if>
  38. <if test="dataTime != null ">and wsp.data_time = #{dataTime}</if>
  39. <if test="setTime != null ">and wsp.set_time = #{setTime}</if>
  40. <if test="ratePower != null ">and wsp.rate_power = #{ratePower}</if>
  41. <if test="ifstop != null ">and wsp.ifstop = #{ifstop}</if>
  42. <if test="outageType != null ">and wsp.outage_type = #{outageType}</if>
  43. <if test="reasonDowntime != null and reasonDowntime != ''">and wsp.reason_downtime = #{reasonDowntime}</if>
  44. <if test="overhaulResults != null and overhaulResults != ''">and wsp.overhaul_results = #{overhaulResults}</if>
  45. <if test="params.beginDataTime != null and params.beginDataTime != '' and params.endDataTime != null and params.endDataTime != ''">
  46. and wsp.data_time between to_date(#{params.beginDataTime},'yyyy-MM-dd HH24:MI:SS') and
  47. to_date(#{params.endDataTime},'yyyy-MM-dd HH24:MI:SS')
  48. </if>
  49. </where>
  50. order by wsp.set_time desc
  51. </select>
  52. <select id="selectWtgStopPlantById" parameterType="WtgStopPlant" resultMap="WtgStopPlantResult">
  53. <include refid="selectWtgStopPlantVo"/>
  54. where windplant_no = #{windplantNo} and wtur_no = #{wturNo} and data_time = #{dataTime}
  55. </select>
  56. <select id="selectWtgStopPlantByWindplantNo" parameterType="WtgStopPlant" resultMap="WtgStopPlantResult">
  57. <include refid="selectWtgStopPlantVo"/>
  58. where windplant_no = #{windplantNo} and ifstop = 1 and data_time >= to_date(to_char(#{dataTime},'yyyy-MM-dd HH24:MI:SS'),'yyyy-MM-dd HH24:MI:SS')
  59. </select>
  60. <select id="selectWtgStopPlantByWturNo" parameterType="WtgStopPlant" resultMap="WtgStopPlantResult">
  61. <include refid="selectWtgStopPlantVo"/>
  62. where windplant_no = #{windplantNo} and wtur_no = #{wturNo} and ifstop = 1 and data_time >= to_date(to_char(#{dataTime},'yyyy-MM-dd HH24:MI:SS'),'yyyy-MM-dd HH24:MI:SS')
  63. </select>
  64. <insert id="insertWtgStopPlant" parameterType="WtgStopPlant">
  65. insert into wtg_stop_plant
  66. <trim prefix="(" suffix=")" suffixOverrides=",">
  67. <if test="windplantNo != null">windplant_no,</if>
  68. <if test="wturNo != null">wtur_no,</if>
  69. <if test="dataTime != null">data_time,</if>
  70. <if test="setTime != null">set_time,</if>
  71. <if test="ratePower != null">rate_power,</if>
  72. <if test="ifstop != null">ifstop,</if>
  73. <if test="outageType != null">outage_type,</if>
  74. <if test="reasonDowntime != null">reason_downtime,</if>
  75. <if test="overhaulResults != null">overhaul_results,</if>
  76. </trim>
  77. <trim prefix="values (" suffix=")" suffixOverrides=",">
  78. <if test="windplantNo != null">#{windplantNo},</if>
  79. <if test="wturNo != null">#{wturNo},</if>
  80. <if test="dataTime != null">#{dataTime},</if>
  81. <if test="setTime != null">#{setTime},</if>
  82. <if test="ratePower != null">#{ratePower},</if>
  83. <if test="ifstop != null">#{ifstop},</if>
  84. <if test="outageType != null">#{outageType},</if>
  85. <if test="reasonDowntime != null">#{reasonDowntime},</if>
  86. <if test="overhaulResults != null">#{overhaulResults},</if>
  87. </trim>
  88. </insert>
  89. <insert id="insertWtgStopPlantList">
  90. insert into wtg_stop_plant(windplant_no, wtur_no, data_time, set_time, rate_power, ifstop, outage_type, reason_downtime)
  91. <foreach collection="list" item="item" separator="UNION ALL">
  92. SELECT
  93. #{item.windplantNo},
  94. #{item.wturNo},
  95. #{item.dataTime},
  96. #{item.setTime},
  97. #{item.ratePower},
  98. #{item.ifstop},
  99. #{item.outageType},
  100. #{item.reasonDowntime}
  101. FROM DUAL
  102. </foreach>
  103. </insert>
  104. <update id="updateWtgStopPlant" parameterType="WtgStopPlant">
  105. update wtg_stop_plant
  106. <trim prefix="SET" suffixOverrides=",">
  107. <if test="wturNo != null">wtur_no = #{wturNo},</if>
  108. <if test="dataTime != null">data_time = #{dataTime},</if>
  109. <if test="setTime != null">set_time = #{setTime},</if>
  110. <if test="ratePower != null">rate_power = #{ratePower},</if>
  111. <if test="ifstop != null">ifstop = #{ifstop},</if>
  112. <if test="outageType != null">outage_type = #{outageType},</if>
  113. <if test="reasonDowntime != null">reason_downtime = #{reasonDowntime},</if>
  114. <if test="overhaulResults != null">overhaul_results = #{overhaulResults},</if>
  115. </trim>
  116. where windplant_no = #{windplantNo}
  117. </update>
  118. <delete id="deleteWtgStopPlantById" parameterType="WtgStopPlant">
  119. delete from wtg_stop_plant where windplant_no = #{windplantNo} and wtur_no = #{wturNo} and data_time = #{dataTime} and ifstop = #{ifstop}
  120. </delete>
  121. </mapper>