ImGroupMemberMapper.xml 4.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139
  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. <!--
  4. 这个文件是自动生成的。
  5. 不要修改此文件。所有改动将在下次重新自动生成时丢失。
  6. -->
  7. <mapper namespace="com.ym.mec.biz.dal.dao.ImGroupMemberDao">
  8. <resultMap type="com.ym.mec.biz.dal.entity.ImGroupMember" id="ImGroupMember">
  9. <result column="id_" property="id" />
  10. <result column="im_group_id_" property="imGroupId" />
  11. <result column="user_id_" property="userId" />
  12. <result column="nickname_" property="nickname" />
  13. <result column="is_admin_" property="isAdmin" />
  14. <result column="role_type_" property="roleType" />
  15. <result column="create_time_" property="createTime" />
  16. <result column="update_time_" property="updateTime" />
  17. </resultMap>
  18. <!-- 根据主键查询一条记录 -->
  19. <select id="get" resultMap="ImGroupMember" >
  20. SELECT * FROM im_group_member WHERE id_ = #{id}
  21. </select>
  22. <!-- 全查询 -->
  23. <select id="findAll" resultMap="ImGroupMember">
  24. SELECT * FROM im_group_member ORDER BY id_
  25. </select>
  26. <!-- 向数据库增加一条记录 -->
  27. <insert id="insert" parameterType="com.ym.mec.biz.dal.entity.ImGroupMember" useGeneratedKeys="true" keyColumn="id" keyProperty="id">
  28. <!--
  29. <selectKey resultClass="int" keyProperty="id" >
  30. SELECT SEQ_WSDEFINITION_ID.nextval AS ID FROM DUAL
  31. </selectKey>
  32. -->
  33. INSERT INTO im_group_member (id_,im_group_id_,user_id_,nickname_,is_admin_,role_type_,create_time_,update_time_) VALUES(#{id},#{imGroupId},#{userId},#{nickname},#{isAdmin},#{roleType},#{createTime},#{updateTime})
  34. </insert>
  35. <insert id="batchInsert" parameterType="com.ym.mec.biz.dal.entity.ImGroupMember" useGeneratedKeys="true" keyColumn="id" keyProperty="id">
  36. INSERT INTO im_group_member (id_,im_group_id_,user_id_,nickname_,is_admin_,role_type_,create_time_,update_time_) VALUES
  37. <foreach collection="list" item="item" separator=";">
  38. (#{item.id},#{item.imGroupId},#{item.userId},#{item.nickname},#{item.isAdmin},#{item.roleType},#{item.createTime},#{item.updateTime})
  39. </foreach>
  40. </insert>
  41. <!-- 根据主键查询一条记录 -->
  42. <update id="update" parameterType="com.ym.mec.biz.dal.entity.ImGroupMember">
  43. UPDATE im_group_member <set>
  44. <if test="roleType != null">
  45. role_type_ = #{roleType},
  46. </if>
  47. <if test="userId != null">
  48. user_id_ = #{userId},
  49. </if>
  50. <if test="nickname != null">
  51. nickname_ = #{nickname},
  52. </if>
  53. <if test="id != null">
  54. id_ = #{id},
  55. </if>
  56. <if test="isAdmin != null">
  57. is_admin_ = #{isAdmin},
  58. </if>
  59. <if test="imGroupId != null">
  60. im_group_id_ = #{imGroupId},
  61. </if>
  62. <if test="updateTime != null">
  63. update_time_ = #{updateTime},
  64. </if>
  65. <if test="createTime != null">
  66. create_time_ = #{createTime},
  67. </if>
  68. </set> WHERE id_ = #{id}
  69. </update>
  70. <update id="batchUpdate" parameterType="com.ym.mec.biz.dal.entity.ImGroupMember">
  71. <foreach collection="list" item="item" index="index" open="" close="" separator=";">
  72. UPDATE im_group_member
  73. <set>
  74. <if test="item。roleType != null">
  75. role_type_ = #{item。roleType},
  76. </if>
  77. <if test="item。userId != null">
  78. user_id_ = #{item。userId},
  79. </if>
  80. <if test="item.nickname != null">
  81. nickname_ = #{item.nickname},
  82. </if>
  83. <if test="item。id != null">
  84. id_ = #{item。id},
  85. </if>
  86. <if test="item。isAdmin != null">
  87. is_admin_ = #{item。isAdmin},
  88. </if>
  89. <if test="item。imGroupId != null">
  90. im_group_id_ = #{item。imGroupId},
  91. </if>
  92. <if test="item。updateTime != null">
  93. update_time_ = #{item。updateTime},
  94. </if>
  95. <if test="item。createTime != null">
  96. create_time_ = #{item。createTime},
  97. </if>
  98. </set>
  99. WHERE id_ = #{item。id}
  100. </foreach>
  101. </update>
  102. <!-- 根据主键删除一条记录 -->
  103. <delete id="delete" >
  104. DELETE FROM im_group_member WHERE id_ = #{id}
  105. </delete>
  106. <!-- 分页查询 -->
  107. <select id="queryPage" resultMap="ImGroupMember" parameterType="map">
  108. SELECT * FROM im_group_member ORDER BY id_ <include refid="global.limit"/>
  109. </select>
  110. <!-- 查询当前表的总记录数 -->
  111. <select id="queryCount" resultType="int">
  112. SELECT COUNT(*) FROM im_group_member
  113. </select>
  114. <delete id="deleteByImGroupId" >
  115. DELETE FROM im_group_member WHERE im_group_id_ = #{imGroupId}
  116. </delete>
  117. <delete id="batchDelete" >
  118. DELETE FROM im_group_member WHERE id_ in
  119. <foreach collection="list" item="item" open="(" separator="," close=")">
  120. #{item.id}
  121. </foreach>
  122. </delete>
  123. <select id="queryByImGroupIdAndUserId" resultMap="ImGroupMember" parameterType="map">
  124. SELECT * FROM im_group_member where find_in_set(im_group_id_,#{imGroupIdList}) and find_in_set(user_id_,#{userIdList})
  125. </select>
  126. </mapper>