UserNamesMapper.xml 5.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162
  1. <?xml version="1.0" encoding="UTF-8"?>
  2. <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
  3. <mapper namespace="com.goafanti.common.dao.UserNamesMapper">
  4. <resultMap id="BaseResultMap" type="com.goafanti.common.model.UserNames">
  5. <!--
  6. WARNING - @mbg.generated
  7. This element is automatically generated by MyBatis Generator, do not modify.
  8. This element was generated on Mon Jul 05 11:40:49 CST 2021.
  9. -->
  10. <id column="id" jdbcType="INTEGER" property="id" />
  11. <result column="uid" jdbcType="VARCHAR" property="uid" />
  12. <result column="aid" jdbcType="VARCHAR" property="aid" />
  13. <result column="name" jdbcType="VARCHAR" property="name" />
  14. <result column="create_time" jdbcType="TIMESTAMP" property="createTime" />
  15. </resultMap>
  16. <sql id="Base_Column_List">
  17. <!--
  18. WARNING - @mbg.generated
  19. This element is automatically generated by MyBatis Generator, do not modify.
  20. This element was generated on Mon Jul 05 11:40:49 CST 2021.
  21. -->
  22. id, `uid`, aid, `name`, create_time
  23. </sql>
  24. <select id="selectByPrimaryKey" parameterType="java.lang.Integer" resultMap="BaseResultMap">
  25. <!--
  26. WARNING - @mbg.generated
  27. This element is automatically generated by MyBatis Generator, do not modify.
  28. This element was generated on Mon Jul 05 11:40:49 CST 2021.
  29. -->
  30. select
  31. <include refid="Base_Column_List" />
  32. from user_names
  33. where id = #{id,jdbcType=INTEGER}
  34. </select>
  35. <delete id="deleteByPrimaryKey" parameterType="java.lang.Integer">
  36. <!--
  37. WARNING - @mbg.generated
  38. This element is automatically generated by MyBatis Generator, do not modify.
  39. This element was generated on Mon Jul 05 11:40:49 CST 2021.
  40. -->
  41. delete from user_names
  42. where id = #{id,jdbcType=INTEGER}
  43. </delete>
  44. <insert id="insert" parameterType="com.goafanti.common.model.UserNames">
  45. <!--
  46. WARNING - @mbg.generated
  47. This element is automatically generated by MyBatis Generator, do not modify.
  48. This element was generated on Mon Jul 05 11:40:49 CST 2021.
  49. -->
  50. insert into user_names (id, `uid`, aid,
  51. `name`, create_time)
  52. values (#{id,jdbcType=INTEGER}, #{uid,jdbcType=VARCHAR}, #{aid,jdbcType=VARCHAR},
  53. #{name,jdbcType=VARCHAR}, #{createTime,jdbcType=TIMESTAMP})
  54. </insert>
  55. <insert id="insertSelective" parameterType="com.goafanti.common.model.UserNames">
  56. <!--
  57. WARNING - @mbg.generated
  58. This element is automatically generated by MyBatis Generator, do not modify.
  59. This element was generated on Mon Jul 05 11:40:49 CST 2021.
  60. -->
  61. insert into user_names
  62. <trim prefix="(" suffix=")" suffixOverrides=",">
  63. <if test="id != null">
  64. id,
  65. </if>
  66. <if test="uid != null">
  67. `uid`,
  68. </if>
  69. <if test="aid != null">
  70. aid,
  71. </if>
  72. <if test="name != null">
  73. `name`,
  74. </if>
  75. <if test="createTime != null">
  76. create_time,
  77. </if>
  78. </trim>
  79. <trim prefix="values (" suffix=")" suffixOverrides=",">
  80. <if test="id != null">
  81. #{id,jdbcType=INTEGER},
  82. </if>
  83. <if test="uid != null">
  84. #{uid,jdbcType=VARCHAR},
  85. </if>
  86. <if test="aid != null">
  87. #{aid,jdbcType=VARCHAR},
  88. </if>
  89. <if test="name != null">
  90. #{name,jdbcType=VARCHAR},
  91. </if>
  92. <if test="createTime != null">
  93. #{createTime,jdbcType=TIMESTAMP},
  94. </if>
  95. </trim>
  96. </insert>
  97. <update id="updateByPrimaryKeySelective" parameterType="com.goafanti.common.model.UserNames">
  98. <!--
  99. WARNING - @mbg.generated
  100. This element is automatically generated by MyBatis Generator, do not modify.
  101. This element was generated on Mon Jul 05 11:40:49 CST 2021.
  102. -->
  103. update user_names
  104. <set>
  105. <if test="uid != null">
  106. `uid` = #{uid,jdbcType=VARCHAR},
  107. </if>
  108. <if test="aid != null">
  109. aid = #{aid,jdbcType=VARCHAR},
  110. </if>
  111. <if test="name != null">
  112. `name` = #{name,jdbcType=VARCHAR},
  113. </if>
  114. <if test="createTime != null">
  115. create_time = #{createTime,jdbcType=TIMESTAMP},
  116. </if>
  117. </set>
  118. where id = #{id,jdbcType=INTEGER}
  119. </update>
  120. <update id="updateByPrimaryKey" parameterType="com.goafanti.common.model.UserNames">
  121. <!--
  122. WARNING - @mbg.generated
  123. This element is automatically generated by MyBatis Generator, do not modify.
  124. This element was generated on Mon Jul 05 11:40:49 CST 2021.
  125. -->
  126. update user_names
  127. set `uid` = #{uid,jdbcType=VARCHAR},
  128. aid = #{aid,jdbcType=VARCHAR},
  129. `name` = #{name,jdbcType=VARCHAR},
  130. create_time = #{createTime,jdbcType=TIMESTAMP}
  131. where id = #{id,jdbcType=INTEGER}
  132. </update>
  133. <update id="updateAddUserName">
  134. update `user` set nickname=concat(#{userName},'[',username ,']'),username = #{userName}
  135. where id= #{uid};
  136. </update>
  137. <select id="getUserList" resultType="com.goafanti.customer.bo.UserNamesListBo">
  138. select a.id,a.uid,a.aid,a.name ,date_format(a.create_time,'%Y-%m-%d %H:%i:%S') createTimes ,b.name adminName
  139. from user_names a left join admin b on a.aid =b.id
  140. where a.uid = #{uid}
  141. order by a.create_time
  142. </select>
  143. <select id="checkUserName" resultType="com.goafanti.customer.bo.UserNamesListBo">
  144. select id,uid,aid,name ,date_format(create_time,'%Y-%m-%d %H:%i:%S') createTimes
  145. from user_names where name= #{userName}
  146. </select>
  147. <insert id="insertBatch" parameterType="com.goafanti.user.bo.InputUserChannel">
  148. INSERT INTO `user_names` (uid,name)VALUES
  149. <foreach item="item" index="index" collection="list"
  150. separator=",">
  151. (#{item.uid,jdbcType=VARCHAR},#{item.userName})
  152. </foreach>
  153. </insert>
  154. <select id="selectUserNameList" resultType="com.goafanti.customer.bo.UserNamesListBo">
  155. select id,uid,aid,name
  156. from user_names where name in
  157. <foreach item="item" index="index" collection="list" separator="," open="(" close=")">
  158. (#{item.name})
  159. </foreach>
  160. </select>
  161. </mapper>