mitao
2025-02-21 31573d6180d15ef65ed0df9c2732495f40b12663
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
<?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.panzhihua.service_dangjian.dao.ComPbDynDAO">
 
    <resultMap type="com.panzhihua.service_dangjian.model.dos.ComPbDynDO" id="ComPbOrgMap">
        <result property="id" column="id" jdbcType="INTEGER"/>
        <result property="title" column="title"/>
        <result property="status" column="status"/>
        <result property="publishAt" column="publish_at"/>
        <result property="cover" column="cover"/>
        <result property="createAt" column="create_at"/>
        <result property="content" column="content"/>
        <result property="createBy" column="create_by"/>
        <result property="type" column="type"/>
        <result property="communityId" column="community_id"/>
        <result property="dynType" column="dyn_type"/>
        <result property="coverMode" column="cover_mode"/>
        <result property="jumpUrl" column="jump_url"/>
        <result property="jumpType" column="jump_type"/>
        <result property="policyType" column="policy_type"/>
    </resultMap>
    <select id="pageYnamic" resultType="com.panzhihua.common.model.vos.partybuilding.west.PartyBuildingComPbDynVO">
        SELECT
        d.id,
        d.title, d.jump_url, d.jump_type,
        COUNT( u.id ) readingVolume,
        d.`status`,
        d.publish_at,
        d.content,
        d.cover,
        d.cover_mode,
        d.dyn_type,
        d.create_at,t.name as communityName,d.policy_type
        FROM
        com_pb_dyn d
        LEFT JOIN com_pb_dyn_user u ON d.id = u.dyn_id left join com_act t on d.community_id = t.community_id
        where d.type=#{partyBuildingComPbDynVO.type}
        <if test='partyBuildingComPbDynVO.communityIds != null and partyBuildingComPbDynVO.communityIds.size() > 0 '>
            and d.community_id in
            <foreach item="item" collection="partyBuildingComPbDynVO.communityIds" separator="," open="(" close=")"
                     index="index">
                #{item}
            </foreach>
        </if>
        <if test='partyBuildingComPbDynVO.dynType != null and partyBuildingComPbDynVO.dynType != 0'>
            and d.dyn_type = #{partyBuildingComPbDynVO.dynType}
        </if>
        <if test='partyBuildingComPbDynVO.policyType != null and partyBuildingComPbDynVO.policyType != 0'>
            and d.policy_type = #{partyBuildingComPbDynVO.policyType}
        </if>
        <if test='partyBuildingComPbDynVO.policyType == 0'>
            and d.policy_type is not null
        </if>
        <if test='partyBuildingComPbDynVO.title != null and partyBuildingComPbDynVO.title.trim() != &quot;&quot;'>
            and d.title like concat(#{partyBuildingComPbDynVO.title},'%')
        </if>
        <if test='partyBuildingComPbDynVO.status != null and partyBuildingComPbDynVO.status != 0'>
            AND d.`status` = #{partyBuildingComPbDynVO.status}
        </if>
        <if test='partyBuildingComPbDynVO.publishAtBegin != null '>
            AND d.publish_at BETWEEN #{partyBuildingComPbDynVO.publishAtBegin} AND #{partyBuildingComPbDynVO.publishAtEnd}
        </if>
            GROUP BY d.id
            ORDER BY d.publish_at
        <if test="partyBuildingComPbDynVO.sort !=null and partyBuildingComPbDynVO.sort !=&quot;&quot;">asc</if>
        <if test='partyBuildingComPbDynVO.sort ==null'>desc</if>
    </select>
 
 
 
    <select id="pageYnamics" resultType="com.panzhihua.common.model.vos.partybuilding.PartyBuildingComPbDynVO">
        SELECT
        d.id,
        d.title, d.jump_url, d.jump_type,
        COUNT( u.id ) readingVolume,
        d.`status`,
        d.publish_at,
        d.content,
        d.cover,
        d.cover_mode,
        d.dyn_type,
        d.create_at,t.name as communityName,d.policy_type
        FROM
        com_pb_dyn d
        LEFT JOIN com_pb_dyn_user u ON d.id = u.dyn_id left join com_act t on d.community_id = t.community_id
        where d.type=#{partyBuildingComPbDynVO.type}
        <if test='partyBuildingComPbDynVO.communityIds != null and partyBuildingComPbDynVO.communityIds.size() > 0 '>
            and d.community_id in
            <foreach item="item" collection="partyBuildingComPbDynVO.communityIds" separator="," open="(" close=")"
                     index="index">
                #{item}
            </foreach>
        </if>
        <if test='partyBuildingComPbDynVO.dynType != null and partyBuildingComPbDynVO.dynType != 0'>
            and d.dyn_type = #{partyBuildingComPbDynVO.dynType}
        </if>
        <if test='partyBuildingComPbDynVO.policyType != null and partyBuildingComPbDynVO.policyType != 0'>
            and d.policy_type = #{partyBuildingComPbDynVO.policyType}
        </if>
        <if test='partyBuildingComPbDynVO.policyType == 0'>
            and d.policy_type is not null
        </if>
        <if test='partyBuildingComPbDynVO.title != null and partyBuildingComPbDynVO.title.trim() != &quot;&quot;'>
            and d.title like concat(#{partyBuildingComPbDynVO.title},'%')
        </if>
        <if test='partyBuildingComPbDynVO.status != null and partyBuildingComPbDynVO.status != 0'>
            AND d.`status` = #{partyBuildingComPbDynVO.status}
        </if>
        <if test='partyBuildingComPbDynVO.publishAtBegin != null '>
            AND d.publish_at BETWEEN #{partyBuildingComPbDynVO.publishAtBegin} AND #{partyBuildingComPbDynVO.publishAtEnd}
        </if>
        GROUP BY d.id
        ORDER BY d.publish_at
        <if test="partyBuildingComPbDynVO.sort !=null and partyBuildingComPbDynVO.sort !=&quot;&quot;">asc</if>
        <if test='partyBuildingComPbDynVO.sort ==null'>desc</if>
    </select>
 
 
</mapper>