BWwwNewsMapper.xml 4.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111
  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.syzy.mapper.BWwwNewsMapper">
  6. <resultMap type="BWwwNews" id="BWwwNewsResult">
  7. <result property="id" column="id" />
  8. <result property="type" column="type" />
  9. <result property="title" column="title" />
  10. <result property="f" column="f" />
  11. <result property="sendDate" column="sendDate" />
  12. <result property="content" column="content" />
  13. <result property="createTime" column="createTime" />
  14. <result property="clicked" column="clicked" />
  15. <result property="status" column="status" />
  16. <result property="keywords" column="keywords" />
  17. <result property="description" column="description" />
  18. <result property="isTop" column="isTop" />
  19. <result property="location" column="location" />
  20. </resultMap>
  21. <sql id="selectBWwwNewsVo">
  22. select id, type, title, f, sendDate, content, createTime, clicked, status,keywords,description,isTop,location from b_www_news
  23. </sql>
  24. <select id="selectBWwwNewsList" parameterType="BWwwNews" resultMap="BWwwNewsResult">
  25. <include refid="selectBWwwNewsVo" />
  26. <where>
  27. <if test="type != null and type != ''"> and type like concat ('%', #{type},'%')</if>
  28. <if test="title != null and title != ''"> and title like concat ('%', #{title},'%')</if>
  29. <if test="f != null and f != ''"> and f = #{f}</if>
  30. <if test="sendDate != null "> and sendDate = #{sendDate}</if>
  31. <if test="content != null and content != ''"> and content = #{content}</if>
  32. <if test="createTime != null "> and createTime = #{createTime}</if>
  33. <if test="clicked != null "> and clicked = #{clicked}</if>
  34. <if test="status != null "> and status = #{status}</if>
  35. <if test="isTop != null "> and isTop = #{isTop}</if>
  36. <if test="description != null and description != ''"> and description = #{description}</if>
  37. <if test="keywords != null and keywords != ''"> and keywords = #{keywords}</if>
  38. <if test="location != null and location != ''"> and location like concat ('%', #{location},'%')</if>
  39. <if test="ids!= null">
  40. and id in
  41. <foreach item="id" collection="ids" open="(" separator="," close=")">
  42. #{id}
  43. </foreach>
  44. </if>
  45. </where>
  46. <if test="tag=='hot'"> order by clicked desc,createTime desc,id desc </if>
  47. <if test="tag==null"> order by createTime desc,id desc </if>
  48. </select>
  49. <select id="selectBWwwNewsById" parameterType="Long" resultMap="BWwwNewsResult">
  50. <include refid="selectBWwwNewsVo" />
  51. where id = #{id}
  52. </select>
  53. <insert id="insertBWwwNews" parameterType="BWwwNews" useGeneratedKeys="true" keyProperty="id">
  54. insert into b_www_news
  55. <trim prefix="(" suffix=")" suffixOverrides=",">
  56. <if test="type != null">type,</if>
  57. <if test="title != null">title,</if>
  58. <if test="f != null">f,</if>
  59. <if test="sendDate != null">sendDate,</if>
  60. <if test="content != null">content,</if>
  61. <if test="createTime != null">createTime,</if>
  62. <if test="clicked != null">clicked,</if>
  63. <if test="status != null">status,</if>
  64. <if test="location != null and location != '' ">location,</if>
  65. </trim>
  66. <trim prefix="values (" suffix=")" suffixOverrides=",">
  67. <if test="type != null">#{type},</if>
  68. <if test="title != null">#{title},</if>
  69. <if test="f != null">#{f},</if>
  70. <if test="sendDate != null">#{sendDate},</if>
  71. <if test="content != null">#{content},</if>
  72. <if test="createTime != null">#{createTime},</if>
  73. <if test="clicked != null">#{clicked},</if>
  74. <if test="status != null">#{status},</if>
  75. <if test="location != null and location != '' ">#{location},</if>
  76. </trim>
  77. </insert>
  78. <update id="updateBWwwNews" parameterType="BWwwNews">
  79. update b_www_news
  80. <trim prefix="SET" suffixOverrides=",">
  81. <if test="type != null">type = #{type},</if>
  82. <if test="title != null">title = #{title},</if>
  83. <if test="f != null">f = #{f},</if>
  84. <if test="sendDate != null">sendDate = #{sendDate},</if>
  85. <if test="content != null">content = #{content},</if>
  86. <if test="createTime != null">createTime = #{createTime},</if>
  87. <if test="clicked != null">clicked = #{clicked},</if>
  88. <if test="status != null">status = #{status},</if>
  89. <if test="isTop != null">isTop = #{isTop},</if>
  90. <if test="location != null and location != ''">location = #{location},</if>
  91. </trim>
  92. where id = #{id}
  93. </update>
  94. <delete id="deleteBWwwNewsById" parameterType="Long">
  95. delete from b_www_news where id = #{id}
  96. </delete>
  97. <delete id="deleteBWwwNewsByIds" parameterType="String">
  98. delete from b_www_news where id in
  99. <foreach item="id" collection="array" open="(" separator="," close=")">
  100. #{id}
  101. </foreach>
  102. </delete>
  103. </mapper>