PlanpowerDistributionMapper.xml 2.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253
  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.PlanpowerDistributionMapper">
  6. <resultMap type="PlanpowerDistribution" id="PlanpowerDistributionResult">
  7. <result property="stationNumber" column="station_number" />
  8. <result property="type" column="type" />
  9. </resultMap>
  10. <sql id="selectPlanpowerDistributionVo">
  11. select station_number, type from planpower_distribution
  12. </sql>
  13. <select id="selectPlanpowerDistributionList" parameterType="PlanpowerDistribution" resultMap="PlanpowerDistributionResult">
  14. <include refid="selectPlanpowerDistributionVo"/>
  15. <where>
  16. <if test="stationNumber != null "> and station_number = #{stationNumber}</if>
  17. <if test="type != null "> and type = #{type}</if>
  18. </where>
  19. </select>
  20. <select id="selectPlanpowerDistributionById" parameterType="Long" resultMap="PlanpowerDistributionResult">
  21. <include refid="selectPlanpowerDistributionVo"/>
  22. where station_number = #{stationNumber}
  23. </select>
  24. <insert id="insertPlanpowerDistribution" parameterType="PlanpowerDistribution">
  25. insert into planpower_distribution
  26. <trim prefix="(" suffix=")" suffixOverrides=",">
  27. <if test="stationNumber != null">station_number,</if>
  28. <if test="type != null">type,</if>
  29. </trim>
  30. <trim prefix="values (" suffix=")" suffixOverrides=",">
  31. <if test="stationNumber != null">#{stationNumber},</if>
  32. <if test="type != null">#{type},</if>
  33. </trim>
  34. </insert>
  35. <update id="updatePlanpowerDistribution" parameterType="PlanpowerDistribution">
  36. update planpower_distribution
  37. <trim prefix="SET" suffixOverrides=",">
  38. <if test="type != null">type = #{type},</if>
  39. </trim>
  40. where station_number = #{stationNumber}
  41. </update>
  42. <delete id="deletePlanpowerDistributionById" parameterType="Long">
  43. delete from planpower_distribution where station_number = #{stationNumber}
  44. </delete>
  45. </mapper>