xuhy
2025-01-02 b94fffb01c94100b34e2908b4fe79c1c554b0912
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
<?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.ruoyi.system.mapper.TConsultationMessageMapper">
 
    <!-- 通用查询映射结果 -->
    <resultMap id="BaseResultMap" type="com.ruoyi.system.domain.TConsultationMessage">
        <id column="id" property="id" />
        <result column="consultation_id" property="consultationId" />
        <result column="consultation_content" property="consultationContent" />
        <result column="user_id" property="userId" />
        <result column="create_by" property="createBy" />
        <result column="create_time" property="createTime" />
        <result column="is_delete" property="isDelete" />
    </resultMap>
 
    <!-- 通用查询结果列 -->
    <sql id="Base_Column_List">
        id, consultation_id, consultation_content, user_id, create_by, create_time, is_delete
    </sql>
    <select id="pageQuery" resultType="com.ruoyi.system.domain.TConsultationMessage">
        select tcm.*,tu.avatar from t_consultation_message tcm
            left join t_app_user tu on tcm.user_id = tu.id
            left join t_consultation tc on tcm.consultation_id = tc.id
        where tcm.is_delete = 0
        <if test="messageQuery.name != null and messageQuery.name != ''">
            and tc.classification_name like concat('%',#{messageQuery.name},'%')
        </if>
        <if test="messageQuery.userName != null and messageQuery.userName != ''">
            and tu.name like concat('%',#{messageQuery.userName},'%')
        </if>
        order by tcm.create_time desc
 
    </select>
 
</mapper>