| | |
| | | d.id, |
| | | d.`discuss_subject`, |
| | | d.type, |
| | | d.content_type, |
| | | COUNT( DISTINCT c.id ) commentNum, |
| | | u.NAME userName, |
| | | u.nick_name userNickName, |
| | |
| | | JOIN sys_user u ON d.user_id = u.user_id |
| | | LEFT JOIN com_act_discuss_comment c ON d.id = c.discuss_id |
| | | WHERE |
| | | d.community_id = #{pageComActDiscussDTO.communityId} and d.is_del = 2 |
| | | d.community_id = ${pageComActDiscussDTO.communityId} and d.is_del = 2 |
| | | <if test = 'pageComActDiscussDTO.subject != null and pageComActDiscussDTO.subject.trim() != ""' > |
| | | AND d.`discuss_subject` LIKE concat(#{pageComActDiscussDTO.subject}, '%' ) |
| | | </if> |
| | |
| | | </if> |
| | | <if test="pageComActDiscussDTO.status != null"> |
| | | and d.status = #{pageComActDiscussDTO.status} |
| | | </if> |
| | | <if test="pageComActDiscussDTO.contentType != null"> |
| | | and d.content_type = #{pageComActDiscussDTO.contentType} |
| | | </if> |
| | | GROUP BY d.id )t |
| | | order by t.create_at desc |
| | |
| | | d.fabulous_num as signNum, |
| | | d.views_num, |
| | | d.status, |
| | | d.content_type, |
| | | u.NAME userName, |
| | | u.nick_name userNickName, |
| | | d.create_at |
| | |
| | | com_act_discuss d |
| | | JOIN sys_user u ON d.user_id = u.user_id |
| | | WHERE |
| | | d.community_id = #{pageComActDiscussDTO.communityId} and d.is_del = 2 |
| | | d.community_id = ${pageComActDiscussDTO.communityId} and d.is_del = 2 |
| | | <if test = 'pageComActDiscussDTO.subject != null and pageComActDiscussDTO.subject.trim() != ""' > |
| | | AND d.`discuss_subject` LIKE concat(#{pageComActDiscussDTO.subject}, '%' ) |
| | | </if> |
| | |
| | | <if test="pageComActDiscussDTO.keyWord != null and pageComActDiscussDTO.keyWord != """> |
| | | and (d.`discuss_subject` LIKE concat(#{pageComActDiscussDTO.keyWord}, '%' ) or |
| | | u.`name` LIKE concat(#{pageComActDiscussDTO.keyWord}, '%' )) |
| | | </if> |
| | | <if test="pageComActDiscussDTO.contentType != null"> |
| | | and d.content_type = #{pageComActDiscussDTO.contentType} |
| | | </if> |
| | | order by d.create_at desc |
| | | </select> |
| | |
| | | </select> |
| | | <select id="pageDiscussApplets" resultType="com.panzhihua.common.model.vos.community.ComActDiscussVO"> |
| | | SELECT t.* FROM ( |
| | | SELECT d.id, d.vote_title, if(d.address IS NULL OR d.address='null',a.name,d.address )address, d.photo_pah, |
| | | SELECT d.id, d.vote_title, if(d.address IS NULL OR d.address='null',a.name,d.address )address, d.photo_pah,d.content_type, |
| | | d.`discuss_subject`, d.type, d.end_time, d.status, d.views_num, d.join_num, d.fabulous_num AS signNum, |
| | | d.comment_num AS commentNum, d.release_at, d.img_width, d.img_height, d.is_repeat, d.count, u.type AS userType, if(u.type=1,u.name,a.name) userName, |
| | | if(u.type=1,u.nick_name,a.name) userNickName, |
| | |
| | | <if test='pageComActDiscussDTO.loginUserId != null '> |
| | | LEFT JOIN com_act_discuss_option_user ou ON do.id=ou.discuss_option_id AND ou.user_id=#{pageComActDiscussDTO.loginUserId} |
| | | </if> |
| | | WHERE d.community_id=#{pageComActDiscussDTO.communityId} AND d.is_del = 2 AND d.status != 1 |
| | | WHERE d.community_id = ${pageComActDiscussDTO.communityId} AND d.is_del = 2 AND d.status != 1 |
| | | <if test='pageComActDiscussDTO.type != null '> |
| | | AND d.`type` = #{pageComActDiscussDTO.type} |
| | | </if> |
| | |
| | | </if> |
| | | <if test='pageComActDiscussDTO.displayStatus != null and pageComActDiscussDTO.displayStatus == 2'> |
| | | AND d.`end_time` < now() |
| | | </if> |
| | | <if test="pageComActDiscussDTO.contentType != null"> |
| | | and d.content_type = #{pageComActDiscussDTO.contentType} |
| | | </if> |
| | | GROUP BY d.id |
| | | ) t ORDER BY t.create_at DESC |
| | |
| | | SELECT t1.filed, t1.num, ROUND( t1.num / t2.sum * 100, 2 ) AS percent |
| | | FROM |
| | | (SELECT IF(`type` = 1,'议事','投票') AS filed, COUNT(id) AS num FROM com_act_discuss |
| | | WHERE community_id = #{communityId} AND is_del = 2 GROUP BY filed) t1, |
| | | (SELECT COUNT(id) AS sum FROM com_act_discuss WHERE community_id = #{communityId} AND is_del = 2) t2 |
| | | WHERE community_id = ${communityId} AND is_del = 2 GROUP BY filed) t1, |
| | | (SELECT COUNT(id) AS sum FROM com_act_discuss WHERE community_id = ${communityId} AND is_del = 2) t2 |
| | | </select> |
| | | <select id="getTitles" resultType="java.lang.String"> |
| | | SELECT discuss_subject FROM com_act_discuss WHERE community_id = #{communityId} AND `type` = #{type} AND is_del = 2 ORDER BY release_at DESC limit #{pageSize} |
| | | SELECT discuss_subject FROM com_act_discuss WHERE community_id = ${communityId} AND `type` = #{type} AND is_del = 2 ORDER BY release_at DESC limit #{pageSize} |
| | | </select> |
| | | <select id="countByCommunityId" resultType="Map"> |
| | | SELECT |
| | |
| | | FROM |
| | | com_act_discuss |
| | | WHERE |
| | | community_id = #{communityId} |
| | | community_id = ${communityId} |
| | | AND create_at BETWEEN DATE_ADD(curdate(),interval -day(curdate())+1 day) |
| | | AND now()) AS currentNum, |
| | | ( SELECT COUNT( id ) FROM com_act_discuss WHERE community_id = #{communityId} AND TYPE = 1 ) AS imgNum, |
| | | ( SELECT COUNT( id ) FROM com_act_discuss WHERE community_id = ${communityId} AND TYPE = 1 ) AS imgNum, |
| | | ( |
| | | SELECT |
| | | count( DISTINCT cadc.user_id ) |
| | |
| | | LEFT JOIN com_act_discuss AS cad ON cad.id = cadc.discuss_id |
| | | WHERE |
| | | cad.type = 1 |
| | | AND cad.community_id = #{communityId} |
| | | AND cad.community_id = ${communityId} |
| | | ) AS imgPeopleNum, |
| | | ( |
| | | SELECT |
| | |
| | | LEFT JOIN com_act_discuss AS cad ON cad.id = cadc.discuss_id |
| | | WHERE |
| | | cad.type = 2 |
| | | AND cad.community_id = #{communityId} UNION ALL |
| | | AND cad.community_id = ${communityId} UNION ALL |
| | | SELECT DISTINCT |
| | | cadou.user_id |
| | | FROM |
| | |
| | | LEFT JOIN com_act_discuss_option AS cado ON cado.id = cadou.discuss_option_id |
| | | LEFT JOIN com_act_discuss AS cad ON cad.id = cado.discuss_id |
| | | WHERE |
| | | cad.community_id = #{communityId} |
| | | cad.community_id = ${communityId} |
| | | ) t |
| | | ) AS votePeopleNum |
| | | FROM |
| | | com_act_discuss |
| | | WHERE |
| | | community_id = #{communityId} |
| | | community_id = ${communityId} |
| | | </select> |
| | | |
| | | </mapper> |