|
|
@@ -8,10 +8,11 @@
|
|
|
<result property="name" column="name" jdbcType="VARCHAR"/>
|
|
|
<result property="type" column="type" jdbcType="INTEGER"/>
|
|
|
<result property="createTime" column="create_time" jdbcType="TIMESTAMP"/>
|
|
|
+ <result property="provinceType" column="province_type" jdbcType="INTEGER"/>
|
|
|
</resultMap>
|
|
|
|
|
|
<sql id="ChatMsgUserAllSql">
|
|
|
- id, user_id, name, type, create_time
|
|
|
+ id, user_id, name, type, create_time, province_type
|
|
|
</sql>
|
|
|
|
|
|
<!--查询单个-->
|
|
|
@@ -24,29 +25,30 @@
|
|
|
|
|
|
<!--新增所有列-->
|
|
|
<insert id="insert" keyProperty="id" useGeneratedKeys="true">
|
|
|
- insert into chat_msg_user(user_id, name, type, create_time)
|
|
|
- values (#{userId}, #{name}, #{type}, #{createTime})
|
|
|
+ insert into chat_msg_user(user_id, name, type, create_time, province_type)
|
|
|
+ values (#{userId}, #{name}, #{type}, #{createTime}, #{provinceType})
|
|
|
</insert>
|
|
|
|
|
|
<insert id="insertBatch">
|
|
|
- insert into chat_msg_user(user_id, name, type, create_time)
|
|
|
+ insert into chat_msg_user(user_id, name, type, create_time, province_type)
|
|
|
values
|
|
|
<foreach collection="entities" item="entity" separator=",">
|
|
|
- (#{entity.userId}, #{entity.name}, #{entity.type}, #{entity.createTime})
|
|
|
+ (#{entity.userId}, #{entity.name}, #{entity.type}, #{entity.createTime}, #{entity.provinceType})
|
|
|
</foreach>
|
|
|
</insert>
|
|
|
|
|
|
<insert id="insertOrUpdateBatch" keyProperty="id" useGeneratedKeys="true">
|
|
|
- insert into chat_msg_user(user_id, name, type, create_time)
|
|
|
+ insert into chat_msg_user(user_id, name, type, create_time, province_type)
|
|
|
values
|
|
|
<foreach collection="entities" item="entity" separator=",">
|
|
|
- (#{entity.userId}, #{entity.name}, #{entity.type}, #{entity.createTime})
|
|
|
+ (#{entity.userId}, #{entity.name}, #{entity.type}, #{entity.createTime}, #{entity.provinceType})
|
|
|
</foreach>
|
|
|
on duplicate key update
|
|
|
user_id = values(user_id),
|
|
|
name = values(name),
|
|
|
type = values(type),
|
|
|
- create_time = values(create_time)
|
|
|
+ create_time = values(create_time),
|
|
|
+ province_type = values(province_type)
|
|
|
</insert>
|
|
|
|
|
|
<!--通过主键修改数据-->
|
|
|
@@ -65,6 +67,9 @@
|
|
|
<if test="createTime != null">
|
|
|
create_time = #{createTime},
|
|
|
</if>
|
|
|
+ <if test="provinceType != null">
|
|
|
+ province_type = #{provinceType},
|
|
|
+ </if>
|
|
|
</set>
|
|
|
where id = #{id}
|
|
|
</update>
|
|
|
@@ -91,6 +96,9 @@
|
|
|
<if test="createTime != null">
|
|
|
and create_time = #{createTime}
|
|
|
</if>
|
|
|
+ <if test="provinceType != null">
|
|
|
+ and province_type = #{provinceType}
|
|
|
+ </if>
|
|
|
</where>
|
|
|
<if test="page_sql != null">
|
|
|
${page_sql}
|
|
|
@@ -117,16 +125,19 @@
|
|
|
<if test="createTime != null">
|
|
|
and create_time = #{createTime}
|
|
|
</if>
|
|
|
+ <if test="provinceType != null">
|
|
|
+ and province_type = #{provinceType}
|
|
|
+ </if>
|
|
|
</where>
|
|
|
</select>
|
|
|
|
|
|
-
|
|
|
<!--通过主键删除-->
|
|
|
<delete id="deleteById">
|
|
|
delete
|
|
|
from chat_msg_user
|
|
|
where id = #{id}
|
|
|
</delete>
|
|
|
+
|
|
|
<delete id="deleteByUserId">
|
|
|
delete
|
|
|
from chat_msg_user
|
|
|
@@ -138,54 +149,59 @@
|
|
|
<include refid="ChatMsgUserAllSql"/>
|
|
|
from chat_msg_user
|
|
|
where user_id = #{id}
|
|
|
+ <if test="provinceType != null">
|
|
|
+ and province_type = #{provinceType}
|
|
|
+ </if>
|
|
|
</select>
|
|
|
<select id="getUserList" resultMap="ChatMsgUserMap">
|
|
|
select
|
|
|
<include refid="ChatMsgUserAllSql"/>
|
|
|
from chat_msg_user
|
|
|
<where>
|
|
|
- <if test="type != null">
|
|
|
- and type = #{type}
|
|
|
- </if>
|
|
|
- <if test="provinceType != null">
|
|
|
- and province_type = #{provinceType}
|
|
|
- </if>
|
|
|
+ <if test="type != null">
|
|
|
+ and type = #{type}
|
|
|
+ </if>
|
|
|
+ <if test="provinceType != null">
|
|
|
+ and province_type = #{provinceType}
|
|
|
+ </if>
|
|
|
</where>
|
|
|
</select>
|
|
|
<select id="selectMyIdByUser" resultMap="ChatMsgUserMap">
|
|
|
select x.user_id,b.name
|
|
|
from (select tolist user_id
|
|
|
- from chat_msg
|
|
|
- where from_id = #{userId} and type=0
|
|
|
- <if test="startTime != null and startTime != ''">
|
|
|
- and msgtime between #{startTime} and #{endTime}
|
|
|
- </if>
|
|
|
- union
|
|
|
- select from_id user_id
|
|
|
- from chat_msg
|
|
|
- where find_in_set(#{userId},tolist) and type=0
|
|
|
- <if test="startTime != null and startTime != ''">
|
|
|
- and msgtime between #{startTime} and #{endTime}
|
|
|
- </if>
|
|
|
- )x left join chat_msg_user b on x.user_id=b.user_id
|
|
|
+ from chat_msg
|
|
|
+ where from_id = #{userId} and type=0
|
|
|
+ <if test="startTime != null and startTime != ''">
|
|
|
+ and msgtime between #{startTime} and #{endTime}
|
|
|
+ </if>
|
|
|
+ union
|
|
|
+ select from_id user_id
|
|
|
+ from chat_msg
|
|
|
+ where find_in_set(#{userId},tolist) and type=0
|
|
|
+ <if test="startTime != null and startTime != ''">
|
|
|
+ and msgtime between #{startTime} and #{endTime}
|
|
|
+ </if>
|
|
|
+ )x left join chat_msg_user b on x.user_id=b.user_id
|
|
|
</select>
|
|
|
<select id="selectMyIdByRoom" resultType="com.kede.common.model.ChatMsgUser">
|
|
|
select x.roomid userId,b.name
|
|
|
from (select roomid
|
|
|
- from chat_msg
|
|
|
- where from_id = #{userId} and type=1
|
|
|
+ from chat_msg
|
|
|
+ where from_id = #{userId} and type=1
|
|
|
<if test="startTime != null and startTime != ''">
|
|
|
and msgtime between #{startTime} and #{endTime}
|
|
|
</if>
|
|
|
union
|
|
|
- select roomid
|
|
|
- from chat_msg
|
|
|
- where find_in_set(#{userId},tolist) and type=1
|
|
|
+ select roomid
|
|
|
+ from chat_msg
|
|
|
+ where find_in_set(#{userId},tolist) and type=1
|
|
|
<if test="startTime != null and startTime != ''">
|
|
|
and msgtime between #{startTime} and #{endTime}
|
|
|
</if>
|
|
|
- )x left join chat_msg_user b on x.roomid=b.user_id
|
|
|
+ )x left join chat_msg_user b on x.roomid=b.user_id
|
|
|
</select>
|
|
|
|
|
|
</mapper>
|
|
|
|
|
|
+
|
|
|
+
|