RtuMapper.xml 2.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162
  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.RtuMapper">
  6. <resultMap type="Rtu" id="RtuResult">
  7. <result property="rtuNo" column="rtu_no"/>
  8. <result property="rtuType" column="rtu_type"/>
  9. </resultMap>
  10. <sql id="selectRtuVo">
  11. select rtu_no, rtu_type from rtu
  12. </sql>
  13. <select id="selectRtuList" parameterType="Rtu" resultMap="RtuResult">
  14. select
  15. r.rtu_no,
  16. r.rtu_type,
  17. w.name as "windplantName",
  18. emi.item_name as "rtuTypeName"
  19. from
  20. rtu r
  21. left join windplant w on w.windplant_no = r.rtu_no
  22. left join enum_menu_item emi on emi.item_val = r.rtu_type and emi.menu_no = 115
  23. <where>
  24. <if test="rtuNo != null ">and r.rtu_no = #{rtuNo}</if>
  25. <if test="rtuType != null ">and r.rtu_type = #{rtuType}</if>
  26. </where>
  27. order by r.rtu_no asc
  28. </select>
  29. <select id="selectRtuById" parameterType="Long" resultMap="RtuResult">
  30. <include refid="selectRtuVo"/>
  31. where rtu_no = #{rtuNo}
  32. </select>
  33. <insert id="insertRtu" parameterType="Rtu">
  34. insert into rtu
  35. <trim prefix="(" suffix=")" suffixOverrides=",">
  36. <if test="rtuNo != null">rtu_no,</if>
  37. <if test="rtuType != null">rtu_type,</if>
  38. </trim>
  39. <trim prefix="values (" suffix=")" suffixOverrides=",">
  40. <if test="rtuNo != null">#{rtuNo},</if>
  41. <if test="rtuType != null">#{rtuType},</if>
  42. </trim>
  43. </insert>
  44. <update id="updateRtu" parameterType="Rtu">
  45. update rtu
  46. <trim prefix="SET" suffixOverrides=",">
  47. <if test="rtuType != null">rtu_type = #{rtuType},</if>
  48. </trim>
  49. where rtu_no = #{rtuNo}
  50. </update>
  51. <delete id="deleteRtuById" parameterType="Long">
  52. delete from rtu where rtu_no = #{rtuNo}
  53. </delete>
  54. </mapper>