linwe
2023-11-25 aa6df327e9c022e4a89baef1462f3f868dce1fd2
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
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
<?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="org.springblade.modules.discuss.mapper.UserTopicsMapper">
 
    <!-- 通用查询映射结果 -->
    <resultMap id="userTopicsResultMap" type="org.springblade.modules.discuss.entity.UserTopicsEntity">
        <result property="id"    column="id"    />
        <result property="userId"    column="user_id"    />
        <result property="topicsId"    column="topics_id"    />
        <result property="createTime"    column="create_time"    />
        <result property="updateTime"    column="update_time"    />
        <result property="deleteFlag"    column="delete_flag"    />
        <result property="publicDiscussId"    column="public_discuss_id"    />
    </resultMap>
 
    <sql id="selectUserTopics">
        select
            id,
            user_id,
            topics_id,
            create_time,
            update_time,
            delete_flag,
            public_discuss_id
        from
            jczz_user_topics
    </sql>
 
 
    <select id="selectUserTopicsPage" resultMap="userTopicsResultMap">
        select * from jczz_user_topics
        <where>
            <if test="userTopics.id != null "> and id = #{userTopics.id}</if>
            <if test="userTopics.userId != null "> and user_id = #{userTopics.userId}</if>
            <if test="userTopics.topicsId != null "> and topics_id = #{userTopics.topicsId}</if>
            <if test="userTopics.createTime != null "> and create_time = #{userTopics.createTime}</if>
            <if test="userTopics.updateTime != null "> and update_time = #{userTopics.updateTime}</if>
            <if test="userTopics.deleteFlag != null "> and delete_flag = #{userTopics.deleteFlag}</if>
            <if test="userTopics.publicDiscussId != null "> and public_discuss_id = #{userTopics.publicDiscussId}</if>
        </where>
    </select>
 
    <select id="selectUserTopicsList" parameterType="org.springblade.modules.discuss.dto.UserTopicsDTO" resultMap="userTopicsResultMap">
        <include refid="selectUserTopics"/>
        <where>
            <if test="id != null "> and id = #{id}</if>
            <if test="userId != null "> and user_id = #{userId}</if>
            <if test="topicsId != null "> and topics_id = #{topicsId}</if>
            <if test="createTime != null "> and create_time = #{createTime}</if>
            <if test="updateTime != null "> and update_time = #{updateTime}</if>
            <if test="deleteFlag != null "> and delete_flag = #{deleteFlag}</if>
            <if test="publicDiscussId != null "> and public_discuss_id = #{publicDiscussId}</if>
        </where>
    </select>
 
 
</mapper>