PostPublisherMapper.xml 7.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140
  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.post.mapper.PostPublisherMapper">
  6. <resultMap type="PostPublisher" id="PostPublisherResult">
  7. <result property="publisherId" column="publisher_id"/>
  8. <result property="publisherImage" column="publisher_image"/>
  9. <result property="publisherName" column="publisher_name"/>
  10. <result property="nickName" column="nick_name"/>
  11. <result property="publisherEmail" column="publisher_email"/>
  12. <result property="publisherPhonenumber" column="publisher_phonenumber"/>
  13. <result property="status" column="status"/>
  14. <result property="publisherAddress" column="publisher_address"/>
  15. <result property="delFlag" column="del_flag"/>
  16. <result property="createBy" column="create_by"/>
  17. <result property="createTime" column="create_time"/>
  18. <result property="updateBy" column="update_by"/>
  19. <result property="updateTime" column="update_time"/>
  20. <result property="remark" column="remark"/>
  21. </resultMap>
  22. <sql id="selectPostPublisherVo">
  23. select publisher_id,
  24. publisher_image,
  25. publisher_name,
  26. nick_name,
  27. publisher_email,
  28. publisher_phonenumber,
  29. status,
  30. publisher_address,
  31. del_flag,
  32. create_by,
  33. create_time,
  34. update_by,
  35. update_time,
  36. remark
  37. from post_publisher
  38. </sql>
  39. <!--查询发行方列表-->
  40. <select id="selectPostPublisherList" parameterType="PostPublisher" resultMap="PostPublisherResult">
  41. <include refid="selectPostPublisherVo"/>
  42. <where>
  43. <if test="publisherImage != null and publisherImage != ''">and publisher_image = #{publisherImage}</if>
  44. <if test="publisherName != null and publisherName != ''">and publisher_name like concat('%',
  45. #{publisherName}, '%')
  46. </if>
  47. <if test="nickName != null and nickName != ''">and nick_name like concat('%', #{nickName}, '%')</if>
  48. <if test="publisherEmail != null and publisherEmail != ''">and publisher_email = #{publisherEmail}</if>
  49. <if test="publisherPhonenumber != null and publisherPhonenumber != ''">and publisher_phonenumber =
  50. #{publisherPhonenumber}
  51. </if>
  52. <if test="status != null and status != ''">and status = #{status}</if>
  53. <if test="publisherAddress != null and publisherAddress != ''">and publisher_address =
  54. #{publisherAddress}
  55. </if>
  56. </where>
  57. </select>
  58. <!--查询单个用户-->
  59. <select id="selectPostPublisherByPublisherId" parameterType="Long" resultMap="PostPublisherResult">
  60. <include refid="selectPostPublisherVo"/>
  61. where publisher_id = #{publisherId}
  62. </select>
  63. <!--添加发行方信息-->
  64. <insert id="insertPostPublisher" parameterType="PostPublisher" useGeneratedKeys="true" keyProperty="publisherId">
  65. insert into post_publisher
  66. <trim prefix="(" suffix=")" suffixOverrides=",">
  67. <if test="publisherImage != null">publisher_image,</if>
  68. <if test="publisherName != null and publisherName != ''">publisher_name,</if>
  69. <if test="nickName != null and nickName != ''">nick_name,</if>
  70. <if test="publisherEmail != null">publisher_email,</if>
  71. <if test="publisherPhonenumber != null">publisher_phonenumber,</if>
  72. <if test="status != null">status,</if>
  73. <if test="publisherAddress != null">publisher_address,</if>
  74. <if test="delFlag != null">del_flag,</if>
  75. <if test="createBy != null">create_by,</if>
  76. <if test="createTime != null">create_time,</if>
  77. <if test="updateBy != null">update_by,</if>
  78. <if test="updateTime != null">update_time,</if>
  79. <if test="remark != null">remark,</if>
  80. </trim>
  81. <trim prefix="values (" suffix=")" suffixOverrides=",">
  82. <if test="publisherImage != null">#{publisherImage},</if>
  83. <if test="publisherName != null and publisherName != ''">#{publisherName},</if>
  84. <if test="nickName != null and nickName != ''">#{nickName},</if>
  85. <if test="publisherEmail != null">#{publisherEmail},</if>
  86. <if test="publisherPhonenumber != null">#{publisherPhonenumber},</if>
  87. <if test="status != null">#{status},</if>
  88. <if test="publisherAddress != null">#{publisherAddress},</if>
  89. <if test="delFlag != null">#{delFlag},</if>
  90. <if test="createBy != null">#{createBy},</if>
  91. <if test="createTime != null">#{createTime},</if>
  92. <if test="updateBy != null">#{updateBy},</if>
  93. <if test="updateTime != null">#{updateTime},</if>
  94. <if test="remark != null">#{remark},</if>
  95. </trim>
  96. </insert>
  97. <!--修改发行方信息-->
  98. <update id="updatePostPublisher" parameterType="PostPublisher">
  99. update post_publisher
  100. <trim prefix="SET" suffixOverrides=",">
  101. <if test="publisherImage != null">publisher_image = #{publisherImage},</if>
  102. <if test="publisherName != null and publisherName != ''">publisher_name = #{publisherName},</if>
  103. <if test="nickName != null and nickName != ''">nick_name = #{nickName},</if>
  104. <if test="publisherEmail != null">publisher_email = #{publisherEmail},</if>
  105. <if test="publisherPhonenumber != null">publisher_phonenumber = #{publisherPhonenumber},</if>
  106. <if test="status != null">status = #{status},</if>
  107. <if test="publisherAddress != null">publisher_address = #{publisherAddress},</if>
  108. <if test="delFlag != null">del_flag = #{delFlag},</if>
  109. <if test="createBy != null">create_by = #{createBy},</if>
  110. <if test="createTime != null">create_time = #{createTime},</if>
  111. <if test="updateBy != null">update_by = #{updateBy},</if>
  112. <if test="updateTime != null">update_time = #{updateTime},</if>
  113. <if test="remark != null">remark = #{remark},</if>
  114. </trim>
  115. where publisher_id = #{publisherId}
  116. </update>
  117. <!--发行方ID删除-->
  118. <delete id="deletePostPublisherByPublisherId" parameterType="Long">
  119. delete
  120. from post_publisher
  121. where publisher_id = #{publisherId}
  122. </delete>
  123. <!--批量删除-->
  124. <delete id="deletePostPublisherByPublisherIds" parameterType="String">
  125. delete from post_publisher where publisher_id in
  126. <foreach item="publisherId" collection="array" open="(" separator="," close=")">
  127. #{publisherId}
  128. </foreach>
  129. </delete>
  130. <!-- 账号是否重复-->
  131. <select id="checkPublisherNameUnique" parameterType="String" resultMap="PostPublisherResult">
  132. select publisher_id,publisher_name from post_publisher where publisher_name = #{publisherName} limit 1
  133. </select>
  134. <!-- 头像是否重复-->
  135. <select id="checkImageUnique" parameterType="String" resultMap="PostPublisherResult">
  136. select publisher_id, publisher_image from post_publisher where publisher_image = #{publisherImage} limit 1
  137. </select>
  138. </mapper>