zhongrj
2023-12-28 daef9edffb73d542ff1eba4beb215ffc7b306254
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
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
<?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.PublicDiscussMapper">
 
    <!-- 通用查询映射结果 -->
    <resultMap id="publicDiscussResultMap" type="org.springblade.modules.discuss.vo.PublicDiscussVO">
        <result property="id"                   column="id"    />
        <result property="title"                column="title"    />
        <result property="openFlag"             column="open_flag"    />
        <result property="numberRestrictions"    column="number_restrictions"    />
        <result property="voteRestrictions"     column="vote_restrictions"    />
        <result property="userRestrictions"    column="user_restrictions"    />
        <result property="endTime"              column="end_time"    />
        <result property="articleId"            column="article_id"    />
        <result property="createTime"            column="create_time"    />
        <result property="updateTime"            column="update_time"    />
        <result property="deletedFlag"            column="deleted_flag"    />
        <result property="repeatVote"            column="repeat_vote"    />
        <result property="voteNumberPublic"    column="vote_number_public"    />
        <result property="appointUser"           column="appoint_user"    />
        <result property="userIds"               column="user_ids"    />
        <result property="eventType"             column="event_type"    />
    </resultMap>
 
 
    <sql id="selectPublicDiscuss">
        select
            id,
            title,
            open_flag,
            number_restrictions,
            vote_restrictions,
            user_restrictions,
            end_time,
            article_id,
            create_time,
            update_time,
            deleted_flag,
            repeat_vote,
            vote_number_public,
            appoint_user,
            user_ids,
            event_type
        from
            jczz_public_discuss
    </sql>
 
 
    <select id="selectPublicDiscussPage" resultMap="publicDiscussResultMap">
        select  jpd.id,
        jpd.title,
        jpd.open_flag,
        jpd.number_restrictions,
        jpd.vote_restrictions,
        jpd.user_restrictions,
        jpd.end_time,
        jpd.article_id,
        jpd.create_time,
        jpd.update_time,
        jpd.deleted_flag,
        jpd.repeat_vote,
        jpd.vote_number_public,
        jpd.appoint_user,
        jpd.user_ids,
        jpd.event_type
        from jczz_public_discuss jpd
        <where>
            <if test="publicDiscuss.id != null "> and id = #{publicDiscuss.id}</if>
            <if test="publicDiscuss.title != null  and publicDiscuss.title != ''"> and title = #{publicDiscuss.title}</if>
            <if test="publicDiscuss.openFlag != null "> and open_flag = #{publicDiscuss.openFlag}</if>
            <if test="publicDiscuss.numberRestrictions != null "> and number_restrictions = #{publicDiscuss.numberRestrictions}</if>
            <if test="publicDiscuss.voteRestrictions != null "> and vote_restrictions = #{publicDiscuss.voteRestrictions}</if>
            <if test="publicDiscuss.userRestrictions != null "> and user_restrictions = #{publicDiscuss.userRestrictions}</if>
            <if test="publicDiscuss.endTime != null "> and end_time = #{publicDiscuss.endTime}</if>
            <if test="publicDiscuss.articleId != null "> and article_id = #{publicDiscuss.articleId}</if>
            <if test="publicDiscuss.createTime != null "> and create_time = #{publicDiscuss.createTime}</if>
            <if test="publicDiscuss.updateTime != null "> and update_time = #{publicDiscuss.updateTime}</if>
            <if test="publicDiscuss.deletedFlag != null "> and deleted_flag = #{publicDiscuss.deletedFlag}</if>
            <if test="publicDiscuss.repeatVote != null "> and repeat_vote = #{publicDiscuss.repeatVote}</if>
            <if test="publicDiscuss.voteNumberPublic != null "> and vote_number_public = #{publicDiscuss.voteNumberPublic}</if>
            <if test="publicDiscuss.appointUser != null "> and appoint_user = #{publicDiscuss.appointUser}</if>
            <if test="publicDiscuss.userIds != null  and publicDiscuss.userIds != ''"> and user_ids = #{publicDiscuss.userIds}</if>
            <if test="publicDiscuss.eventType != null "> and event_type = #{publicDiscuss.eventType}</if>
        </where>
    </select>
 
    <select id="selectPublicDiscussList" parameterType="org.springblade.modules.discuss.dto.PublicDiscussDTO" resultMap="publicDiscussResultMap">
        <include refid="selectPublicDiscuss"/>
        <where>
            <if test="id != null "> and id = #{id}</if>
            <if test="title != null  and title != ''"> and title = #{title}</if>
            <if test="openFlag != null "> and open_flag = #{openFlag}</if>
            <if test="numberRestrictions != null "> and number_restrictions = #{numberRestrictions}</if>
            <if test="voteRestrictions != null "> and vote_restrictions = #{voteRestrictions}</if>
            <if test="userRestrictions != null "> and user_restrictions = #{userRestrictions}</if>
            <if test="endTime != null "> and end_time = #{endTime}</if>
            <if test="articleId != null "> and article_id = #{articleId}</if>
            <if test="createTime != null "> and create_time = #{createTime}</if>
            <if test="updateTime != null "> and update_time = #{updateTime}</if>
            <if test="deletedFlag != null "> and deleted_flag = #{deletedFlag}</if>
            <if test="repeatVote != null "> and repeat_vote = #{repeatVote}</if>
            <if test="voteNumberPublic != null "> and vote_number_public = #{voteNumberPublic}</if>
            <if test="appointUser != null "> and appoint_user = #{appointUser}</if>
            <if test="userIds != null  and userIds != ''"> and user_ids = #{userIds}</if>
            <if test="eventType != null "> and event_type = #{eventType}</if>
        </where>
    </select>
 
 
    <select id="selectPublicDiscuss" parameterType="org.springblade.modules.discuss.vo.PublicDiscussVO" resultMap="publicDiscussResultMap">
        select
        jpd.id,
        jpd.title,
        jpd.open_flag,
        jpd.number_restrictions,
        jpd.vote_restrictions,
        jpd.user_restrictions,
        jpd.end_time,
        jpd.article_id,
        jpd.create_time,
        jpd.update_time,
        jpd.deleted_flag,
        jpd.repeat_vote,
        jpd.vote_number_public,
        jpd.appoint_user,
        jpd.user_ids,
        jpd.event_type,
        jpd.signature_flag,
        (SELECT user_id from jczz_user_public_enroll where user_id = #{userId} and public_discuss_id = jpd.id)userId
        from
        jczz_public_discuss jpd
        <where>
            <if test="id != null "> and jpd.id = #{id}</if>
        </where>
    </select>
 
 
</mapper>