PostPublisherMapper.xml 7.4 KB

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