NewsInfoMapper.xml 6.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107
  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.system.mapper.NewsInfoMapper">
  6. <resultMap type="NewsInfo" id="NewsInfoResult">
  7. <result property="newsInfoId" column="news_info_id" />
  8. <result property="newsInfoTitle" column="news_info_title" />
  9. <result property="newsInfoAuthor" column="news_info_author" />
  10. <result property="newsInfoSource" column="news_info_source" />
  11. <result property="newsInfoContent" column="news_info_content" />
  12. <result property="newsInfoTime" column="news_info_time" />
  13. <result property="newsInfoClick" column="news_info_click" />
  14. <result property="newsInfoInittime" column="news_info_inittime" />
  15. <result property="newsInfoType" column="news_info_type" />
  16. <result property="newsInfoCarousel" column="news_info_carousel" />
  17. <result property="newsInfoUrl" column="news_info_url" />
  18. <result property="newsInfoAuthorid" column="news_info_authorId" />
  19. </resultMap>
  20. <sql id="selectNewsInfoVo">
  21. select news_info_id, news_info_title, news_info_author, news_info_source, news_info_content, news_info_time, news_info_click, news_info_inittime, news_info_type, news_info_carousel, news_info_url, news_info_authorId from news_info
  22. </sql>
  23. <select id="selectNewsInfoList" parameterType="NewsInfo" resultMap="NewsInfoResult">
  24. <include refid="selectNewsInfoVo"/>
  25. <where>
  26. <if test="newsInfoTitle != null and newsInfoTitle != ''"> and news_info_title like concat('%', #{newsInfoTitle}, '%')</if>
  27. <if test="newsInfoAuthor != null and newsInfoAuthor != ''"> and news_info_author = #{newsInfoAuthor}</if>
  28. <if test="newsInfoSource != null and newsInfoSource != ''"> and news_info_source = #{newsInfoSource}</if>
  29. <if test="newsInfoContent != null and newsInfoContent != ''"> and news_info_content like concat('%', #{newsInfoContent}, '%')</if>
  30. <if test="params.beginNewsInfoTime != null and params.beginNewsInfoTime != '' and params.endNewsInfoTime != null and params.endNewsInfoTime != ''"> and news_info_time between #{params.beginNewsInfoTime} and #{params.endNewsInfoTime}</if>
  31. <if test="newsInfoClick != null "> and news_info_click = #{newsInfoClick}</if>
  32. <if test="newsInfoInittime != null "> and news_info_inittime = #{newsInfoInittime}</if>
  33. <if test="newsInfoType != null "> and news_info_type = #{newsInfoType}</if>
  34. <if test="newsInfoCarousel != null "> and news_info_carousel = #{newsInfoCarousel}</if>
  35. <if test="newsInfoUrl != null and newsInfoUrl != ''"> and news_info_url = #{newsInfoUrl}</if>
  36. <if test="newsInfoAuthorid != null "> and news_info_authorId = #{newsInfoAuthorid}</if>
  37. </where>
  38. </select>
  39. <select id="selectNewsInfoByNewsInfoId" parameterType="Long" resultMap="NewsInfoResult">
  40. <include refid="selectNewsInfoVo"/>
  41. where news_info_id = #{newsInfoId}
  42. </select>
  43. <insert id="insertNewsInfo" parameterType="NewsInfo" useGeneratedKeys="true" keyProperty="newsInfoId">
  44. insert into news_info
  45. <trim prefix="(" suffix=")" suffixOverrides=",">
  46. <if test="newsInfoTitle != null and newsInfoTitle != ''">news_info_title,</if>
  47. <if test="newsInfoAuthor != null and newsInfoAuthor != ''">news_info_author,</if>
  48. <if test="newsInfoSource != null">news_info_source,</if>
  49. <if test="newsInfoContent != null and newsInfoContent != ''">news_info_content,</if>
  50. <if test="newsInfoTime != null">news_info_time,</if>
  51. <if test="newsInfoClick != null">news_info_click,</if>
  52. <if test="newsInfoInittime != null">news_info_inittime,</if>
  53. <if test="newsInfoType != null">news_info_type,</if>
  54. <if test="newsInfoCarousel != null">news_info_carousel,</if>
  55. <if test="newsInfoUrl != null">news_info_url,</if>
  56. <if test="newsInfoAuthorid != null">news_info_authorId,</if>
  57. </trim>
  58. <trim prefix="values (" suffix=")" suffixOverrides=",">
  59. <if test="newsInfoTitle != null and newsInfoTitle != ''">#{newsInfoTitle},</if>
  60. <if test="newsInfoAuthor != null and newsInfoAuthor != ''">#{newsInfoAuthor},</if>
  61. <if test="newsInfoSource != null">#{newsInfoSource},</if>
  62. <if test="newsInfoContent != null and newsInfoContent != ''">#{newsInfoContent},</if>
  63. <if test="newsInfoTime != null">#{newsInfoTime},</if>
  64. <if test="newsInfoClick != null">#{newsInfoClick},</if>
  65. <if test="newsInfoInittime != null">#{newsInfoInittime},</if>
  66. <if test="newsInfoType != null">#{newsInfoType},</if>
  67. <if test="newsInfoCarousel != null">#{newsInfoCarousel},</if>
  68. <if test="newsInfoUrl != null">#{newsInfoUrl},</if>
  69. <if test="newsInfoAuthorid != null">#{newsInfoAuthorid},</if>
  70. </trim>
  71. </insert>
  72. <update id="updateNewsInfo" parameterType="NewsInfo">
  73. update news_info
  74. <trim prefix="SET" suffixOverrides=",">
  75. <if test="newsInfoTitle != null and newsInfoTitle != ''">news_info_title = #{newsInfoTitle},</if>
  76. <if test="newsInfoAuthor != null and newsInfoAuthor != ''">news_info_author = #{newsInfoAuthor},</if>
  77. <if test="newsInfoSource != null">news_info_source = #{newsInfoSource},</if>
  78. <if test="newsInfoContent != null and newsInfoContent != ''">news_info_content = #{newsInfoContent},</if>
  79. <if test="newsInfoTime != null">news_info_time = #{newsInfoTime},</if>
  80. <if test="newsInfoClick != null">news_info_click = #{newsInfoClick},</if>
  81. <if test="newsInfoInittime != null">news_info_inittime = #{newsInfoInittime},</if>
  82. <if test="newsInfoType != null">news_info_type = #{newsInfoType},</if>
  83. <if test="newsInfoCarousel != null">news_info_carousel = #{newsInfoCarousel},</if>
  84. <if test="newsInfoUrl != null">news_info_url = #{newsInfoUrl},</if>
  85. <if test="newsInfoAuthorid != null">news_info_authorId = #{newsInfoAuthorid},</if>
  86. </trim>
  87. where news_info_id = #{newsInfoId}
  88. </update>
  89. <delete id="deleteNewsInfoByNewsInfoId" parameterType="Long">
  90. delete from news_info where news_info_id = #{newsInfoId}
  91. </delete>
  92. <delete id="deleteNewsInfoByNewsInfoIds" parameterType="String">
  93. delete from news_info where news_info_id in
  94. <foreach item="newsInfoId" collection="array" open="(" separator="," close=")">
  95. #{newsInfoId}
  96. </foreach>
  97. </delete>
  98. </mapper>