<?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() != ""'>
|
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 !=""">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() != ""'>
|
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 !=""">asc</if>
|
<if test='partyBuildingComPbDynVO.sort ==null'>desc</if>
|
</select>
|
|
|
</mapper>
|