ProjectplanMapper.xml 4.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110
  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.ProjectplanMapper">
  6. <resultMap type="Projectplan" id="ProjectplanResult">
  7. <result property="id" column="id" />
  8. <result property="projectid" column="projectid" />
  9. <result property="generatingcapacity" column="generatingcapacity" />
  10. <result property="year" column="year" />
  11. <result property="month" column="month" />
  12. <result property="windpower" column="windpower" />
  13. </resultMap>
  14. <sql id="selectProjectplanVo">
  15. select id, projectid, generatingcapacity, year, month, windpower from projectplan
  16. </sql>
  17. <select id="selectProjectplanList" parameterType="Projectplan" resultMap="ProjectplanResult">
  18. select
  19. p.*,
  20. w.name as "windplantName",
  21. pps.name as "pvStationName"
  22. from
  23. projectplan p
  24. left join windplant w on w.windplant_no = p.windpower
  25. left join pv_power_station pps on pps.pv_station_no = p.windpower
  26. <where>
  27. <if test="id != null and id != ''"> and p.id = #{id}</if>
  28. <if test="projectid != null and projectid != ''"> and p.projectid = #{projectid}</if>
  29. <if test="generatingcapacity != null and generatingcapacity != ''"> and p.generatingcapacity = #{generatingcapacity}</if>
  30. <if test="year != null and year != ''"> and p.year = #{year}</if>
  31. <if test="month != null and month != ''"> and p.month = #{month}</if>
  32. <if test="windpower != null and windpower != ''"> and p.windpower = #{windpower}</if>
  33. </where>
  34. order by w.windplant_no asc
  35. </select>
  36. <select id="selectProjectplanById" parameterType="String" resultMap="ProjectplanResult">
  37. <include refid="selectProjectplanVo"/>
  38. where id = #{id}
  39. </select>
  40. <select id="selectNewData" resultType="Long">
  41. SELECT * FROM ( SELECT id FROM projectplan ORDER BY id DESC ) WHERE ROWNUM = 1
  42. </select>
  43. <select id="checkProjectplanUnique" resultType="int">
  44. select count(1) from projectplan where windpower = #{windpower} and projectid = #{projectid} and year = #{year} and month = #{month} and rownum <![CDATA[ <= ]]> 1
  45. </select>
  46. <select id="selectProjectplan" parameterType="Projectplan" resultMap="ProjectplanResult">
  47. <include refid="selectProjectplanVo"/>
  48. where windpower = #{windplantNo} and year = #{year} and month = #{month}
  49. </select>
  50. <select id="selectProjectplanByYear" parameterType="Projectplan" resultMap="ProjectplanResult">
  51. <include refid="selectProjectplanVo"/>
  52. where windpower = #{windplantNo} and year = #{year}
  53. </select>
  54. <select id="selectProjectplanByProjectNo" parameterType="Projectplan" resultMap="ProjectplanResult">
  55. <include refid="selectProjectplanVo"/>
  56. where windpower = #{windplantNo} and projectid = #{projectid} and year = #{year} and month = #{month}
  57. </select>
  58. <insert id="insertProjectplan" parameterType="Projectplan">
  59. insert into projectplan
  60. <trim prefix="(" suffix=")" suffixOverrides=",">
  61. <if test="id != null">id,</if>
  62. <if test="projectid != null">projectid,</if>
  63. <if test="generatingcapacity != null">generatingcapacity,</if>
  64. <if test="year != null">year,</if>
  65. <if test="month != null">month,</if>
  66. <if test="windpower != null">windpower,</if>
  67. </trim>
  68. <trim prefix="values (" suffix=")" suffixOverrides=",">
  69. <if test="id != null">#{id},</if>
  70. <if test="projectid != null">#{projectid},</if>
  71. <if test="generatingcapacity != null">#{generatingcapacity},</if>
  72. <if test="year != null">#{year},</if>
  73. <if test="month != null">#{month},</if>
  74. <if test="windpower != null">#{windpower},</if>
  75. </trim>
  76. </insert>
  77. <update id="updateProjectplan" parameterType="Projectplan">
  78. update projectplan
  79. <trim prefix="SET" suffixOverrides=",">
  80. <if test="projectid != null">projectid = #{projectid},</if>
  81. <if test="generatingcapacity != null">generatingcapacity = #{generatingcapacity},</if>
  82. <if test="year != null">year = #{year},</if>
  83. <if test="month != null">month = #{month},</if>
  84. <if test="windpower != null">windpower = #{windpower},</if>
  85. </trim>
  86. where id = #{id}
  87. </update>
  88. <delete id="deleteProjectplanById" parameterType="String">
  89. delete from projectplan where id = #{id}
  90. </delete>
  91. <delete id="deleteProjectplanByIds" parameterType="String">
  92. delete from projectplan where id in
  93. <foreach item="id" collection="array" open="(" separator="," close=")">
  94. #{id}
  95. </foreach>
  96. </delete>
  97. </mapper>