ForecastReportMapper.xml 3.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879
  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.ForecastReportMapper">
  6. <resultMap type="ForecastReport" id="ForecastReportResult">
  7. <result property="terminalNo" column="terminal_no" />
  8. <result property="terminalType" column="terminal_type" />
  9. <result property="reportTime" column="report_time" />
  10. <result property="dataTime" column="data_time" />
  11. <result property="statTag" column="stat_tag" />
  12. <result property="reportTag" column="report_tag" />
  13. </resultMap>
  14. <sql id="selectForecastReportVo">
  15. select terminal_no, terminal_type, report_time, data_time, stat_tag, report_tag from forecast_report
  16. </sql>
  17. <select id="selectForecastReportList" parameterType="ForecastReport" resultMap="ForecastReportResult">
  18. select
  19. fr.*,
  20. win.name as "terminalNameW",
  21. pps.name as "terminalNameP"
  22. from
  23. forecast_report fr
  24. left join windplant win on win.windplant_no = fr.terminal_no
  25. left join pv_power_station pps on pps.pv_station_no = fr.terminal_no
  26. <where>
  27. <if test="terminalNo != null "> and fr.terminal_no = #{terminalNo}</if>
  28. <if test="terminalType != null "> and fr.terminal_type = #{terminalType}</if>
  29. <if test="reportTime != null "> and fr.report_time = #{reportTime}</if>
  30. <if test="dataTime != null "> and fr.data_time = #{dataTime}</if>
  31. <if test="statTag != null "> and fr.stat_tag = #{statTag}</if>
  32. <if test="reportTag != null "> and fr.report_tag = #{reportTag}</if>
  33. </where>
  34. </select>
  35. <select id="selectForecastReportById" parameterType="Long" resultMap="ForecastReportResult">
  36. <include refid="selectForecastReportVo"/>
  37. where terminal_no = #{terminalNo} and terminal_type = #{terminalType}
  38. </select>
  39. <insert id="insertForecastReport" parameterType="ForecastReport">
  40. insert into forecast_report
  41. <trim prefix="(" suffix=")" suffixOverrides=",">
  42. <if test="terminalNo != null">terminal_no,</if>
  43. <if test="terminalType != null">terminal_type,</if>
  44. <if test="reportTime != null">report_time,</if>
  45. <if test="dataTime != null">data_time,</if>
  46. <if test="statTag != null">stat_tag,</if>
  47. <if test="reportTag != null">report_tag,</if>
  48. </trim>
  49. <trim prefix="values (" suffix=")" suffixOverrides=",">
  50. <if test="terminalNo != null">#{terminalNo},</if>
  51. <if test="terminalType != null">#{terminalType},</if>
  52. <if test="reportTime != null">#{reportTime},</if>
  53. <if test="dataTime != null">#{dataTime},</if>
  54. <if test="statTag != null">#{statTag},</if>
  55. <if test="reportTag != null">#{reportTag},</if>
  56. </trim>
  57. </insert>
  58. <update id="updateForecastReport" parameterType="ForecastReport">
  59. update forecast_report
  60. <trim prefix="SET" suffixOverrides=",">
  61. <if test="reportTime != null">report_time = #{reportTime},</if>
  62. <if test="dataTime != null">data_time = #{dataTime},</if>
  63. <if test="statTag != null">stat_tag = #{statTag},</if>
  64. <if test="reportTag != null">report_tag = #{reportTag},</if>
  65. </trim>
  66. where terminal_no = #{terminalNo} and terminal_type = #{terminalType}
  67. </update>
  68. <delete id="deleteForecastReportById" parameterType="Long">
  69. delete from forecast_report where terminal_no = #{terminalNo} and terminal_type = #{terminalType}
  70. </delete>
  71. </mapper>