WeatherForecastMapper.xml 2.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152
  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.WeatherForecastMapper">
  6. <resultMap type="WeatherForecast" id="WeatherForecastResult">
  7. <result property="terminalNumber" column="terminal_number" />
  8. <result property="dataTime" column="data_time" />
  9. <result property="content" column="content" />
  10. </resultMap>
  11. <sql id="selectWeatherForecastVo">
  12. select terminal_number, data_time, content from weather_forecast
  13. </sql>
  14. <select id="selectWeatherForecastList" parameterType="WeatherForecast" resultMap="WeatherForecastResult">
  15. <include refid="selectWeatherForecastVo"/>
  16. <where>
  17. <if test="terminalNumber != null ">and terminal_number = #{terminalNumber}</if>
  18. <if test="dataTime != null ">and data_time = #{dataTime}</if>
  19. <if test="content != null and content != ''"> and content = #{content}</if>
  20. </where>
  21. </select>
  22. <select id="selectWeatherForecastById" parameterType="WeatherForecast" resultMap="WeatherForecastResult">
  23. <include refid="selectWeatherForecastVo"/>
  24. where terminal_number = #{terminalNumber} and data_time = #{dataTime}
  25. </select>
  26. <insert id="insertWeatherForecast" parameterType="WeatherForecast">
  27. insert into weather_forecast
  28. <trim prefix="(" suffix=")" suffixOverrides=",">
  29. <if test="terminalNumber != null">terminal_number,</if>
  30. <if test="dataTime != null">data_time,</if>
  31. <if test="content != null">content,</if>
  32. </trim>
  33. <trim prefix="values (" suffix=")" suffixOverrides=",">
  34. <if test="terminalNumber != null">#{terminalNumber},</if>
  35. <if test="dataTime != null">#{dataTime},</if>
  36. <if test="content != null">#{content},</if>
  37. </trim>
  38. </insert>
  39. <update id="updateWeatherForecast" parameterType="WeatherForecast">
  40. update weather_forecast
  41. <trim prefix="SET" suffixOverrides=",">
  42. <if test="content != null">content = #{content},</if>
  43. </trim>
  44. where terminal_number = #{terminalNumber} and data_time = #{dataTime}
  45. </update>
  46. </mapper>