79 lines
3.0 KiB
XML
79 lines
3.0 KiB
XML
<?xml version="1.0" encoding="UTF-8"?>
|
|
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
|
<mapper namespace="com.gxwebsoft.common.system.mapper.ChatMessageMapper">
|
|
|
|
<!-- 关联查询sql -->
|
|
<sql id="selectSql">
|
|
SELECT a.*,b.nickname as formUserName,b.avatar as formUserAvatar,c.nickname as toUserName,c.avatar as toUserAvatar
|
|
FROM sys_chat_message a
|
|
LEFT JOIN sys_user b ON a.form_user_id = b.user_id
|
|
LEFT JOIN sys_user c ON a.to_user_id = c.user_id
|
|
<where>
|
|
<if test="param.id != null">
|
|
AND a.id = #{param.id}
|
|
</if>
|
|
<if test="param.formUserId != null">
|
|
AND a.form_user_id = #{param.formUserId}
|
|
</if>
|
|
<if test="param.toUserId != null">
|
|
AND a.to_user_id = #{param.toUserId}
|
|
</if>
|
|
<if test="param.type != null">
|
|
AND a.type LIKE CONCAT('%', #{param.type}, '%')
|
|
</if>
|
|
<if test="param.content != null">
|
|
AND a.content LIKE CONCAT('%', #{param.content}, '%')
|
|
</if>
|
|
<if test="param.sideTo != null">
|
|
AND a.side_to = #{param.sideTo}
|
|
</if>
|
|
<if test="param.sideFrom != null">
|
|
AND a.side_from = #{param.sideFrom}
|
|
</if>
|
|
<if test="param.withdraw != null">
|
|
AND a.withdraw = #{param.withdraw}
|
|
</if>
|
|
<if test="param.fileInfo != null">
|
|
AND a.file_info LIKE CONCAT('%', #{param.fileInfo}, '%')
|
|
</if>
|
|
<if test="param.hasContact != null">
|
|
AND a.has_contact = #{param.hasContact}
|
|
</if>
|
|
<if test="param.status != null">
|
|
AND a.status = #{param.status}
|
|
</if>
|
|
<if test="param.deleted != null">
|
|
AND a.deleted = #{param.deleted}
|
|
</if>
|
|
<if test="param.deleted == null">
|
|
AND a.deleted = 0
|
|
</if>
|
|
<if test="param.createTimeStart != null">
|
|
AND a.create_time >= #{param.createTimeStart}
|
|
</if>
|
|
<if test="param.createTimeEnd != null">
|
|
AND a.create_time <= #{param.createTimeEnd}
|
|
</if>
|
|
<if test="param.keywords != null">
|
|
AND (
|
|
a.content LIKE CONCAT('%', #{param.keywords}, '%')
|
|
OR b.nickname LIKE CONCAT('%', #{param.keywords}, '%')
|
|
OR b.phone LIKE CONCAT('%', #{param.keywords}, '%')
|
|
OR b.real_name LIKE CONCAT('%', #{param.keywords}, '%')
|
|
)
|
|
</if>
|
|
</where>
|
|
</sql>
|
|
|
|
<!-- 分页查询 -->
|
|
<select id="selectPageRel" resultType="com.gxwebsoft.common.system.entity.ChatMessage">
|
|
<include refid="selectSql"></include>
|
|
</select>
|
|
|
|
<!-- 查询全部 -->
|
|
<select id="selectListRel" resultType="com.gxwebsoft.common.system.entity.ChatMessage">
|
|
<include refid="selectSql"></include>
|
|
</select>
|
|
|
|
</mapper>
|