ImageDataMapper.xml 5.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118
  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.ImageDataMapper">
  6. <resultMap type="com.ruoyi.common.core.domain.entity.ImageDatas" id="ImageDataResult">
  7. <result property="imageId" column="image_id"/>
  8. <result property="newsId" column="news_id"/>
  9. <result property="imageName" column="image_name"/>
  10. <result property="imageContent" column="image_content"/>
  11. <result property="imageIntroduce" column="image_introduce"/>
  12. <result property="status" column="status"/>
  13. <result property="type" column="type"/>
  14. <result property="isDel" column="is_del"/>
  15. <result property="createBy" column="create_by"/>
  16. <result property="createTime" column="create_time"/>
  17. <result property="updateBy" column="update_by"/>
  18. <result property="updateTime" column="update_time"/>
  19. <result property="remark" column="remark"/>
  20. </resultMap>
  21. <sql id="selectImageDataVo">
  22. select image_id,news_id, image_name, image_content, image_introduce, status, type, is_del, create_by, create_time, update_by, update_time, remark from image_data
  23. </sql>
  24. <select id="selectImageDatasList" parameterType="ImageDatas" resultMap="ImageDataResult">
  25. <include refid="selectImageDataVo"/>
  26. where
  27. is_del = 'N'
  28. <if test="imageName != null and imageName != ''">and image_name like concat('%', #{imageName}, '%')</if>
  29. <if test="type != null and type != ''">and type = #{type}</if>
  30. order by create_time DESC
  31. </select>
  32. <select id="selectImageDatasListMenHu" parameterType="ImageDatas" resultMap="ImageDataResult">
  33. select image_name,image_name, image_content, image_introduce,type from image_data
  34. <where>
  35. is_del = 'N'
  36. and status = '0'
  37. <if test="imageName != null and imageName != ''">and image_name like concat('%', #{imageName}, '%')</if>
  38. <if test="type != null and type != ''">and type = #{type}</if>
  39. </where>
  40. order by create_time DESC
  41. </select>
  42. <select id="selectImageDatasByImageId" parameterType="Long" resultMap="ImageDataResult">
  43. <include refid="selectImageDataVo"/>
  44. where image_id = #{imageId} and is_del = 'N'
  45. </select>
  46. <insert id="insertImageDatas" parameterType="ImageDatas" useGeneratedKeys="true" keyProperty="imageId">
  47. insert into image_data
  48. <trim prefix="(" suffix=")" suffixOverrides=",">
  49. <if test="newsId != null and newsId != ''">news_id,</if>
  50. <if test="imageName != null and imageName != ''">image_name,</if>
  51. <if test="imageContent != null">image_content,</if>
  52. <if test="imageIntroduce != null">image_introduce,</if>
  53. <if test="status != null">status,</if>
  54. <if test="type != null">type,</if>
  55. <if test="isDel != null">is_del,</if>
  56. <if test="createBy != null">create_by,</if>
  57. <if test="createTime != null">create_time,</if>
  58. <if test="updateBy != null">update_by,</if>
  59. <if test="updateTime != null">update_time,</if>
  60. <if test="remark != null">remark,</if>
  61. </trim>
  62. <trim prefix="values (" suffix=")" suffixOverrides=",">
  63. <if test="newsId != null and newsId != ''">#{newsId},</if>
  64. <if test="imageName != null and imageName != ''">#{imageName},</if>
  65. <if test="imageContent != null">#{imageContent},</if>
  66. <if test="imageIntroduce != null">#{imageIntroduce},</if>
  67. <if test="status != null">#{status},</if>
  68. <if test="type != null">#{type},</if>
  69. <if test="isDel != null">#{isDel},</if>
  70. <if test="createBy != null">#{createBy},</if>
  71. <if test="createTime != null">#{createTime},</if>
  72. <if test="updateBy != null">#{updateBy},</if>
  73. <if test="updateTime != null">#{updateTime},</if>
  74. <if test="remark != null">#{remark},</if>
  75. </trim>
  76. </insert>
  77. <update id="updateImageDatas" parameterType="ImageDatas">
  78. update image_data
  79. <trim prefix="SET" suffixOverrides=",">
  80. <if test="newsId != null and newsId != ''">news_id = #{newsId},</if>
  81. <if test="imageName != null and imageName != ''">image_name = #{imageName},</if>
  82. <if test="imageContent != null">image_content = #{imageContent},</if>
  83. <if test="imageIntroduce != null">image_introduce = #{imageIntroduce},</if>
  84. <if test="status != null">status = #{status},</if>
  85. <if test="type != null">type = #{type},</if>
  86. <if test="isDel != null">is_del = #{isDel},</if>
  87. <if test="createBy != null">create_by = #{createBy},</if>
  88. <if test="createTime != null">create_time = #{createTime},</if>
  89. <if test="updateBy != null">update_by = #{updateBy},</if>
  90. <if test="updateTime != null">update_time = #{updateTime},</if>
  91. <if test="remark != null">remark = #{remark},</if>
  92. </trim>
  93. where image_id = #{imageId}
  94. </update>
  95. <delete id="deleteImageDatasByImageId" parameterType="Long">
  96. delete from image_data where image_id = #{imageId}
  97. </delete>
  98. <delete id="deleteImageDatasByImageIds" parameterType="String">
  99. delete from image_data where image_id in
  100. <foreach item="imageId" collection="array" open="(" separator="," close=")">
  101. #{imageId}
  102. </foreach>
  103. </delete>
  104. <update id="deleteImageDatasByNewsId" parameterType="integer">
  105. update image_data set is_del = 'Y'
  106. where news_id = #{newsId}
  107. </update>
  108. </mapper>