浏览代码

content-service 中 im 相关的表添加 im_ 前缀

reghao 1 年之前
父节点
当前提交
52f64a1b6e

+ 11 - 11
content/content-service/src/main/resources/mapper/im/ChatDialogMapper.xml

@@ -3,13 +3,13 @@
 
 <mapper namespace="cn.reghao.tnb.content.app.im.db.mapper.ChatDialogMapper">
     <insert id="save" useGeneratedKeys="true" keyProperty="id">
-        insert into chat_dialog
+        insert into im_chat_dialog
         (`chat_id`,`chat_type`,`receiver_id`,`disturb`,`robot`,`top`,`display`,`user_id`,`unread_num`)
         values 
         (#{chatId},#{chatType},#{receiverId},#{disturb},#{robot},#{top},#{display},#{userId},#{unreadNum})
     </insert>
     <insert id="saveAll" useGeneratedKeys="true" keyProperty="id">
-        insert into chat_dialog
+        insert into im_chat_dialog
         (`chat_id`,`chat_type`,`receiver_id`,`disturb`,`robot`,`top`,`display`,`user_id`,`unread_num`)
         values
         <foreach collection="list" item="item" index="index" separator=",">
@@ -18,28 +18,28 @@
     </insert>
 
     <update id="updateSetDisturb">
-        update chat_dialog set update_time=now(),disturb=#{disturb}
+        update im_chat_dialog set update_time=now(),disturb=#{disturb}
         where id=#{dialogId} and user_id=#{userId}
     </update>
     <update id="updateSetTop">
-        update chat_dialog set update_time=now(),top=#{top}
+        update im_chat_dialog set update_time=now(),top=#{top}
         where id=#{dialogId} and user_id=#{userId}
     </update>
     <update id="updateSetDisplay">
-        update chat_dialog set update_time=now(),display=#{display}
+        update im_chat_dialog set update_time=now(),display=#{display}
         where id=#{dialogId} and user_id=#{userId}
     </update>
     <update id="updateSetClearUnread">
-        update chat_dialog set update_time=now(),unread_num=unread_num+1
+        update im_chat_dialog set update_time=now(),unread_num=unread_num+1
         where receiver_id=#{receiverId} and user_id=#{userId}
     </update>
     <update id="updateSetIncreaseUnread">
-        update chat_dialog set update_time=now(),unread_num=0
+        update im_chat_dialog set update_time=now(),unread_num=0
         where receiver_id=#{receiverId} and user_id=#{userId}
     </update>
 
     <delete id="deleteGroupChatDialog">
-        delete from chat_dialog
+        delete from im_chat_dialog
         where receiver_id=#{groupId} and user_id in
         <foreach collection="list" item="item" index="index" open="(" separator="," close=")">
             #{item}
@@ -47,15 +47,15 @@
     </delete>
 
     <select id="findByReceiverAndUserId" resultType="cn.reghao.tnb.content.app.im.model.po.chat.ChatDialog">
-        select * from chat_dialog where receiver_id=#{receiverId} and user_id=#{userId}
+        select * from im_chat_dialog where receiver_id=#{receiverId} and user_id=#{userId}
     </select>
     <select id="findChatDialog" resultType="cn.reghao.tnb.content.app.im.model.po.chat.ChatDialog">
-        select * from chat_dialog
+        select * from im_chat_dialog
         where chat_type=#{chatType} and receiver_id=#{receiverId} and user_id=#{userId}
     </select>
     <select id="findChatDialogsByUserId" resultType="cn.reghao.tnb.content.app.im.model.po.chat.ChatDialog">
         select *
-        from chat_dialog
+        from im_chat_dialog
         where display is true and user_id=#{userId}
     </select>
 </mapper>

+ 5 - 5
content/content-service/src/main/resources/mapper/im/ChatRecordMapper.xml

@@ -3,14 +3,14 @@
 
 <mapper namespace="cn.reghao.tnb.content.app.im.db.mapper.ChatRecordMapper">
     <insert id="save" useGeneratedKeys="true" keyProperty="id" keyColumn="id">
-        insert into chat_record
+        insert into im_chat_record
         (`record_id`,`chat_id`,`chat_type`,`sender_id`,`receiver_id`,`msg_type`,`read`,`revoke`)
         values 
         (#{recordId},#{chatId},#{chatType},#{senderId},#{receiverId},#{msgType},#{read},#{revoke})
     </insert>
 
     <update id="updateSetRevoke">
-        update chat_record
+        update im_chat_record
         set `revoke`=1
         where id=#{recordId}
     </update>
@@ -19,7 +19,7 @@
         select chatRecord.record_id, chatRecord.chat_type as talkType,chatRecord.receiver_id,chatRecord.read as isRead,chatRecord.revoke as isRevoke,
         chatRecord.msg_type,date_format(chatRecord.create_time,'%Y-%m-%d %H:%i:%s') as createdAt,
         chatRecord.sender_id as user_id
-        from chat_record chatRecord
+        from im_chat_record chatRecord
         <!--and chatRecord.revoke is false-->
         where chatRecord.chat_id=(select chat_id from chat_dialog where receiver_id=#{receiverId} and user_id=#{userId}) and chatRecord.record_id > #{lastRecordId}
         order by chatRecord.create_time desc
@@ -29,7 +29,7 @@
         select chatRecord.record_id, chatRecord.chat_type as talkType,chatRecord.receiver_id,chatRecord.read as isRead,chatRecord.revoke as isRevoke,
         chatRecord.msg_type,date_format(chatRecord.create_time,'%Y-%m-%d %H:%i:%s') as createdAt,
         chatRecord.sender_id as user_id
-        from chat_record chatRecord
+        from im_chat_record chatRecord
         <!--and chatRecord.revoke is false-->
         where chatRecord.msg_type=#{msgType}
         and chatRecord.chat_id=(select chat_id from chat_dialog where receiver_id=#{receiverId} and user_id=#{userId}) and chatRecord.record_id > #{lastRecordId}
@@ -37,6 +37,6 @@
         limit #{limit}
     </select>
     <select id="findByRecordId" resultType="cn.reghao.tnb.content.app.im.model.po.chat.ChatRecord">
-        select * from chat_record where record_id=#{recordId}
+        select * from im_chat_record where record_id=#{recordId}
     </select>
 </mapper>

+ 2 - 2
content/content-service/src/main/resources/mapper/im/CodeBlockMessageMapper.xml

@@ -3,13 +3,13 @@
 
 <mapper namespace="cn.reghao.tnb.content.app.im.db.mapper.CodeBlockMessageMapper">
     <insert id="save" useGeneratedKeys="true" keyProperty="id">
-        insert into code_block_message
+        insert into im_code_block_message
         (`id`,`deleted`,`create_time`,`update_time`,`record_id`,`lang`,`code`)
         values 
         (#{id},#{deleted},#{createTime},#{updateTime},#{recordId},#{lang},#{code})
     </insert>
 
     <select id="findByRecordId" resultType="cn.reghao.tnb.content.app.im.model.po.message.CodeBlockMessage">
-        select * from code_block_message where record_id=#{recordId}
+        select * from im_code_block_message where record_id=#{recordId}
     </select>
 </mapper>

+ 2 - 2
content/content-service/src/main/resources/mapper/im/FileMessageMapper.xml

@@ -3,7 +3,7 @@
 
 <mapper namespace="cn.reghao.tnb.content.app.im.db.mapper.FileMessageMapper">
     <insert id="save" useGeneratedKeys="true" keyProperty="id">
-        insert into file_message
+        insert into im_file_message
         (`file_type`,`record_id`,`upload_id`,`channel_id`,`filename`,`width`,`height`)
         values 
         (#{fileType},#{recordId},#{uploadId},#{channelId},#{filename},#{width},#{height})
@@ -11,7 +11,7 @@
 
     <select id="findByRecordId" resultType="cn.reghao.tnb.content.app.im.model.po.message.FileMessage">
         select *
-        from file_message
+        from im_file_message
         where record_id=#{recordId}
     </select>
 </mapper>

+ 6 - 6
content/content-service/src/main/resources/mapper/im/GroupInfoMapper.xml

@@ -3,36 +3,36 @@
 
 <mapper namespace="cn.reghao.tnb.content.app.im.db.mapper.GroupInfoMapper">
     <insert id="save" useGeneratedKeys="true" keyProperty="id">
-        insert into group_info
+        insert into im_group_info
         (`id`,`deleted`,`create_time`,`update_time`,`group_id`,`name`,`avatar`,`profile`,`owner_id`)
         values 
         (#{id},#{deleted},#{createTime},#{updateTime},#{groupId},#{name},#{avatar},#{profile},#{ownerId})
     </insert>
 
     <update id="updateGroupInfo">
-        update group_info set update_time=now(),name=#{name},avatar=#{avatar},profile=#{profile}
+        update im_group_info set update_time=now(),name=#{name},avatar=#{avatar},profile=#{profile}
         where group_id=#{groupId}
     </update>
 
     <select id="findByGroupId" resultType="cn.reghao.tnb.content.app.im.model.po.group.GroupInfo">
-        select * from group_info where id=#{groupId}
+        select * from im_group_info where id=#{groupId}
     </select>
     <select id="findDetailByGroupId" resultType="cn.reghao.tnb.content.app.im.model.dto.group.GroupDetailRet">
         select groupInfo.id as groupId,groupInfo.name as groupName,groupInfo.avatar,groupInfo.profile,
         groupInfo.owner_id as ownerId,date_format(groupInfo.create_time,'%Y-%m-%d %H:%i:%s') as createdAt
-        from group_info groupInfo
+        from im_group_info groupInfo
         where groupInfo.id=#{groupId}
     </select>
     <select id="findGroupsByUserId" resultType="cn.reghao.tnb.content.app.im.model.dto.group.GroupInfoRet">
         select groupInfo.id,groupInfo.name as groupName,groupInfo.profile as groupProfile,groupInfo.avatar,
         groupMember.owner,groupMember.disturb
-        from group_info groupInfo
+        from im_group_info groupInfo
         inner join group_member groupMember
         on groupInfo.id=groupMember.group_id and groupMember.user_id=#{userId}
     </select>
     <select id="findDialogGroupInfo" resultType="cn.reghao.tnb.content.app.im.model.dto.chat.ChatUserInfo">
         select group_id as receiverId,`name`,avatar
-        from group_info
+        from im_group_info
         where group_id=#{groupId}
     </select>
 </mapper>

+ 7 - 7
content/content-service/src/main/resources/mapper/im/GroupMemberMapper.xml

@@ -3,13 +3,13 @@
 
 <mapper namespace="cn.reghao.tnb.content.app.im.db.mapper.GroupMemberMapper">
     <insert id="save" useGeneratedKeys="true" keyProperty="id">
-        insert into group_member
+        insert into im_group_member
         (`id`,`deleted`,`create_time`,`update_time`,`group_id`,`user_id`,`nickname`,`owner`,`disturb`)
         values 
         (#{id},#{deleted},#{createTime},#{updateTime},#{groupId},#{userId},#{nickname},#{owner},#{disturb})
     </insert>
     <insert id="saveAll" useGeneratedKeys="true" keyProperty="id">
-        insert ignore into group_member
+        insert ignore into im_group_member
         (`id`,`deleted`,`create_time`,`update_time`,`group_id`,`user_id`,`nickname`,`owner`,`disturb`)
         values
         <foreach collection="list" item="item" index="index" separator=",">
@@ -18,12 +18,12 @@
     </insert>
 
     <update id="updateSetMemberRemark">
-        update group_member set update_time=now(),nickname=#{nickname}
+        update im_group_member set update_time=now(),nickname=#{nickname}
         where group_id=#{groupId} and user_id=#{userId}
     </update>
 
     <delete id="deleteGroupMembers">
-        delete from group_member
+        delete from im_group_member
         where group_id=#{groupId} and user_id in
         <foreach collection="list" item="item" index="index" open="(" separator="," close=")">
             #{item}
@@ -31,14 +31,14 @@
     </delete>
 
     <select id="findUserIdsByGroupId" resultType="java.lang.Long">
-        select user_id from group_member where group_id=#{groupId}
+        select user_id from im_group_member where group_id=#{groupId}
     </select>
     <select id="findByGroupAndUserId" resultType="cn.reghao.tnb.content.app.im.model.po.group.GroupMember">
-        select * from group_member where group_id=#{groupId} and user_id=#{userId}
+        select * from im_group_member where group_id=#{groupId} and user_id=#{userId}
     </select>
     <select id="findByGroupId" resultType="cn.reghao.tnb.content.app.im.model.dto.group.GroupMemberRet">
         select groupMember.id,groupMember.nickname as userCard,groupMember.owner
-        from group_member groupMember
+        from im_group_member groupMember
         where groupMember.group_id=#{groupId}
     </select>
 </mapper>

+ 5 - 5
content/content-service/src/main/resources/mapper/im/GroupNoticeMapper.xml

@@ -3,32 +3,32 @@
 
 <mapper namespace="cn.reghao.tnb.content.app.im.db.mapper.GroupNoticeMapper">
     <insert id="save" useGeneratedKeys="true" keyProperty="id">
-        insert into group_notice
+        insert into im_group_notice
         (`id`,`deleted`,`create_time`,`update_time`,`notice_id`,`group_id`,`title`,`content`,`top`,`confirmed`,`create_by`)
         values 
         (#{id},#{deleted},#{createTime},#{updateTime},#{noticeId},#{groupId},#{title},#{content},#{top},#{confirmed},#{createBy})
     </insert>
 
     <update id="updateSetNotice">
-        update group_notice set update_time=now(),title=#{title},content=#{content}
+        update im_group_notice set update_time=now(),title=#{title},content=#{content}
         where id=#{noticeId}
     </update>
 
     <select id="findByNoticeId" resultType="cn.reghao.tnb.content.app.im.model.po.group.GroupNotice">
-        select * from group_notice where id=#{noticeId}
+        select * from im_group_notice where id=#{noticeId}
     </select>
     <select id="findByGroupId" resultType="cn.reghao.tnb.content.app.im.model.dto.group.NoticeRet">
         select groupNotice.id,groupNotice.title,groupNotice.content,groupNotice.confirmed as isConfirm,groupNotice.top as isTop,
         date_format(groupNotice.create_time,'%Y-%m-%d %H:%i:%s') as createdAt,
         date_format(groupNotice.update_time,'%Y-%m-%d %H:%i:%s') as updatedAt
-        from group_notice groupNotice
+        from im_group_notice groupNotice
         where groupNotice.group_id=#{groupId}
     </select>
     <select id="findByLatest" resultType="cn.reghao.tnb.content.app.im.model.dto.group.NoticeRet">
         select groupNotice.id,groupNotice.title,groupNotice.content,groupNotice.confirmed as isConfirm,groupNotice.top as isTop,
         date_format(groupNotice.create_time,'%Y-%m-%d %H:%i:%s') as createdAt,
         date_format(groupNotice.update_time,'%Y-%m-%d %H:%i:%s') as updatedAt
-        from group_notice groupNotice
+        from im_group_notice groupNotice
         where groupNotice.group_id=#{groupId}
         order by groupNotice.create_time desc
         limit 1

+ 2 - 2
content/content-service/src/main/resources/mapper/im/SettingMapper.xml

@@ -3,13 +3,13 @@
 
 <mapper namespace="cn.reghao.tnb.content.app.im.db.mapper.SettingMapper">
     <insert id="save" useGeneratedKeys="true" keyProperty="id">
-        insert into setting
+        insert into im_setting
         (`id`,`deleted`,`create_time`,`update_time`,`user_id`,`keyboard_event_notify`,`notify_cue_tone`,`theme_bag_img`,`theme_color`,`theme_mode`)
         values 
         (#{id},#{deleted},#{createTime},#{updateTime},#{userId},#{keyboardEventNotify},#{notifyCueTone},#{themeBagImg},#{themeColor},#{themeMode})
     </insert>
 
     <select id="findByUserId" resultType="cn.reghao.tnb.content.app.im.model.po.Setting">
-        select * from setting where user_id=#{userId}
+        select * from im_setting where user_id=#{userId}
     </select>
 </mapper>

+ 2 - 2
content/content-service/src/main/resources/mapper/im/TextMessageMapper.xml

@@ -3,7 +3,7 @@
 
 <mapper namespace="cn.reghao.tnb.content.app.im.db.mapper.TextMessageMapper">
     <insert id="save" useGeneratedKeys="true" keyProperty="id">
-        insert into text_message
+        insert into im_text_message
         (`id`,`deleted`,`create_time`,`update_time`,`record_id`,`content`)
         values 
         (#{id},#{deleted},#{createTime},#{updateTime},#{recordId},#{content})
@@ -11,7 +11,7 @@
 
     <select id="findByRecordId" resultType="cn.reghao.tnb.content.app.im.model.po.message.TextMessage">
         select *
-        from text_message
+        from im_text_message
         where record_id=#{recordId}
     </select>
 </mapper>

+ 7 - 7
content/content-service/src/main/resources/mapper/im/UserContactMapper.xml

@@ -3,13 +3,13 @@
 
 <mapper namespace="cn.reghao.tnb.content.app.im.db.mapper.UserContactMapper">
     <insert id="save" useGeneratedKeys="true" keyProperty="id">
-        insert into user_contact
+        insert into im_user_contact
         (`user_id`,`friend_id`,`remark`,`status`,`online`)
         values 
         (#{userId},#{friendId},#{remark},#{status},#{online})
     </insert>
     <insert id="saveAll" useGeneratedKeys="true" keyProperty="id">
-        insert into user_contact
+        insert into im_user_contact
         (`user_id`,`friend_id`,`remark`,`status`,`online`)
         values
         <foreach collection="list" item="item" index="index" separator=",">
@@ -18,29 +18,29 @@
     </insert>
 
     <update id="updateOnline">
-        update user_contact
+        update im_user_contact
         set update_time=now(),`online`=#{online}
         where friend_id=#{userId}
     </update>
     
     <select id="findByUserId" resultType="cn.reghao.tnb.content.app.im.model.po.contact.UserContact">
         select *
-        from user_contact contact
+        from im_user_contact contact
         where contact.user_id=#{userId}
     </select>
     <select id="findByUserId1" resultType="cn.reghao.tnb.content.app.im.model.po.contact.UserContact">
         select *
-        from user_contact
+        from im_user_contact
         where user_id=#{userId}
     </select>
     <select id="findByUserIdAndFriendId1" resultType="cn.reghao.tnb.content.app.im.model.po.contact.UserContact">
         select *
-        from user_contact
+        from im_user_contact
         where user_id=#{userId} and friend_id=#{friendId}
     </select>
     <select id="findFriendsByNotInGroup" resultType="cn.reghao.tnb.content.app.im.model.po.contact.UserContact">
         select *
-        from user_contact contact
+        from im_user_contact contact
         where contact.user_id=#{userId} and contact.friend_id not in
         (select user_id from group_member where group_id=#{groupId} and user_id!=#{userId})
     </select>

+ 6 - 6
content/content-service/src/main/resources/mapper/im/UserContactRecordMapper.xml

@@ -3,37 +3,37 @@
 
 <mapper namespace="cn.reghao.tnb.content.app.im.db.mapper.UserContactRecordMapper">
     <insert id="save" useGeneratedKeys="true" keyProperty="id">
-        insert into user_contact_record
+        insert into im_user_contact_record
         (`apply_user`,`applied_user`,`apply_status`,`remark`)
         values 
         (#{applyUser},#{appliedUser},#{applyStatus},#{remark})
     </insert>
 
     <update id="updateContactApply">
-        update user_contact_record
+        update im_user_contact_record
         set update_time=now(),apply_status=#{applyStatus}
         where id=#{applyId} and applied_user=#{appliedUser}
     </update>
 
     <select id="findByUserIdAndFriendId" resultType="cn.reghao.tnb.content.app.im.model.po.contact.UserContactRecord">
         select *
-        from user_contact_record
+        from im_user_contact_record
         where apply_status=1 and apply_user=#{applyUser} and applied_user=#{appliedUser}
     </select>
 
     <select id="findByApplyId" resultType="cn.reghao.tnb.content.app.im.model.po.contact.UserContactRecord">
         select *
-        from user_contact_record
+        from im_user_contact_record
         where id=#{applyId} and applied_user=#{appliedUser}
     </select>
     <select id="countNewApply" resultType="java.lang.Integer">
         select count(*)
-        from user_contact_record
+        from im_user_contact_record
         where apply_status=1 and applied_user=#{userId}
     </select>
     <select id="findByNewApply" resultType="cn.reghao.tnb.content.app.im.model.dto.contact.ContactApplyInfo">
         select id,apply_user as user_id,remark,date_format(create_time, '%Y-%m-%d %H:%i:%s') as createdAt
-        from user_contact_record addRequest
+        from im_user_contact_record addRequest
         where apply_status=1 and applied_user=#{userId}
     </select>
 </mapper>