<?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_community.dao.ComActActivityDAO">
|
|
<!-- 通用查询映射结果 -->
|
<resultMap id="BaseResultMap" type="com.panzhihua.service_community.model.dos.ComActActivityDO">
|
<id column="id" property="id" />
|
<result column="activity_name" property="activityName" />
|
<result column="sponsor_id" property="sponsorId" />
|
<result column="activity_addr" property="activityAddr" />
|
<result column="lat" property="lat" />
|
<result column="lng" property="lng" />
|
<result column="status" property="status" />
|
<result column="publish_at" property="publishAt" />
|
<result column="end_at" property="endAt" />
|
<result column="begin_at" property="beginAt" />
|
<result column="sign_up_begin" property="signUpBegin" />
|
<result column="sign_up_end" property="signUpEnd" />
|
<result column="aattend_people" property="aattendPeople" />
|
<result column="volunteer_min" property="volunteerMin" />
|
<result column="volunteer_max" property="volunteerMax" />
|
<result column="participant_min" property="participantMin" />
|
<result column="participant_max" property="participantMax" />
|
<result column="cover" property="cover" />
|
<result column="has_prize" property="hasPrize" />
|
<result column="is_qr_code" property="isQrCode" />
|
<result column="contact_name" property="contactName" />
|
<result column="contact_phone" property="contactPhone" />
|
<result column="is_regist" property="isRegist" />
|
<result column="is_top" property="isTop" />
|
<result column="prize_remark" property="prizeRemark" />
|
<result column="reward_desc" property="rewardDesc" />
|
<result column="content" property="content" />
|
<result column="community_id" property="communityId" />
|
<result column="create_at" property="createAt" />
|
<result column="cancel_reason" property="cancelReason" />
|
<result column="range" property="range" />
|
<result column="have_integral_reward" property="haveIntegralReward" />
|
<result column="participant_reward_way" property="participantRewardWay" />
|
<result column="participant_reward_integral" property="participantRewardIntegral" />
|
<result column="volunteer_reward_way" property="volunteerRewardWay" />
|
<result column="volunteer_reward_integral" property="volunteerRewardIntegral" />
|
<result column="pb_reward_way" property="pbRewardWay" />
|
<result column="pb_reward_integral" property="pbRewardIntegral" />
|
<result column="limit" property="limit" />
|
<result column="can_cancel" property="canCancel" />
|
<result column="cancel_deduct" property="cancelDeduct" />
|
<result column="activity_type" property="activityType" />
|
</resultMap>
|
|
<!-- 通用查询结果列 -->
|
<sql id="Base_Column_List">
|
id, activity_name, sponsor_id, activity_addr, lat, lng, status, publish_at, end_at, begin_at, sign_up_begin, sign_up_end, aattend_people, volunteer_min, volunteer_max, participant_min, participant_max, cover, has_prize, is_qr_code, contact_name, contact_phone, is_regist, is_top, prize_remark, reward_desc, content, community_id, create_at, cancel_reason
|
</sql>
|
<insert id="addActivityType">
|
INSERT INTO com_act_activity_type (id,`name`, `type`, community_id)
|
VALUES (#{comActActivityTypeVO.id},#{comActActivityTypeVO.name}, #{comActActivityTypeVO.type}, #{comActActivityTypeVO.communityId})
|
</insert>
|
|
<select id="activityStatistics" resultType="com.panzhihua.common.model.vos.community.ComActActivityStatisticsVO">
|
SELECT IFNULL(volunteer_max,0) + IFNULL(participant_max,0) as signTotal
|
,(SELECT count(id) FROM com_act_act_sign WHERE activity_id = #{activityId} AND `status` = 1) as reallySignTotal
|
,(SELECT count(id) FROM com_act_act_sign WHERE activity_id = #{activityId} AND `status` = 1) as registTotal
|
,(SELECT count(id) FROM com_act_act_regist WHERE activity_id = #{activityId}) as reallyRegistTotal
|
,((SELECT count(id) FROM com_act_act_sign WHERE activity_id = #{activityId} AND `status` = 1) - (SELECT count(id) FROM com_act_act_regist WHERE activity_id = #{activityId})) as noRegistTotal
|
,(SELECT count(id) FROM com_act_act_sign WHERE activity_id = #{activityId} AND `status` = 1) as evaluateTotal
|
,(SELECT count(id) FROM com_act_act_evaluate WHERE activity_id = #{activityId}) as reallyEvaluateTotal
|
,((SELECT count(id) FROM com_act_act_sign WHERE activity_id = #{activityId} AND `status` = 1) - (SELECT count(id) FROM com_act_act_evaluate WHERE activity_id = #{activityId})) as noEvaluateTotal
|
FROM com_act_activity where id = #{activityId}
|
</select>
|
<select id="getIndexTopActivityList" resultMap="BaseResultMap">
|
SELECT * FROM `com_act_activity`
|
WHERE community_id = ${communityId} and is_top = 1 and sign_up_end >= now()
|
</select>
|
<select id="pageActivityCommunityBack"
|
resultType="com.panzhihua.common.model.vos.community.ComActActivityVO">
|
SELECT a.id, a.activity_name, u.`name` sponsorName, a.activity_addr, a.participant_max, a.contact_name,
|
count(IF( s.sign_identity = 1, s.id, NULL )) participant_now,
|
count(IF( s.sign_identity = 2, s.id, NULL )) partyMemberNow,
|
count(IF( s.sign_identity = 3, s.id, NULL )) volunteer_now, a.volunteer_max, a.`status`, a.publish_at,
|
a.is_qr_code, a.begin_at, a.end_at, a.sign_up_begin, a.sign_up_end, a.participant_reward_way,
|
a.volunteer_reward_way,a.pb_reward_way,
|
a.activity_type, a.have_integral_reward ,a.participant_reward_integral,a.volunteer_reward_integral,a.pb_reward_integral,
|
a.party_member_max,a.party_member_min,a.cover,a.type,a.duration<if test='comActActivityVO.type != null and comActActivityVO.type == 4'>,so.socialCount</if>
|
FROM com_act_activity a
|
LEFT JOIN sys_user u ON a.sponsor_id=u.user_id
|
LEFT JOIN (SELECT * FROM com_act_act_sign WHERE `status` = 1) s ON a.id=s.activity_id
|
<if test='comActActivityVO.type != null and comActActivityVO.type == 4'>
|
left join (select count(t.id) as socialCount,activity_id from com_act_act_regist t LEFT JOIN sys_user t1 on t.user_id = t1.user_id LEFT JOIN com_act_social_worker t2 on t1.phone = t2.telephone where t2.id is not null GROUP BY t.activity_id) so on a.id = so.activity_id
|
</if>
|
WHERE 1=1
|
<if test="comActActivityVO.communityIds != null and comActActivityVO.communityIds.size() != 0">
|
and a.community_id in
|
<foreach collection="comActActivityVO.communityIds" item="item" open="(" separator="," close=")">
|
#{item}
|
</foreach>
|
</if>
|
<if test='comActActivityVO.type != null'>
|
AND a.type = #{comActActivityVO.type}
|
</if>
|
<if test='comActActivityVO.activityType != null and comActActivityVO.activityType !=""'>
|
AND a.activity_type = #{comActActivityVO.activityType}
|
</if>
|
<if test='comActActivityVO.activityName != null and comActActivityVO.activityName !=""'>
|
AND a.activity_name LIKE concat( #{comActActivityVO.activityName}, '%' )
|
</if>
|
<if test='comActActivityVO.projectId != null'>
|
AND a.project_id = #{comActActivityVO.projectId}
|
</if>
|
<if test='comActActivityVO.status != null and comActActivityVO.status !=0 '>
|
AND a.`status` = #{comActActivityVO.status}
|
</if>
|
<if test='comActActivityVO.beginAt != null '>
|
AND a.begin_at <![CDATA[ >= ]]> #{comActActivityVO.beginAt} AND a.end_at <![CDATA[ <= ]]> #{comActActivityVO.endAt}
|
</if>
|
GROUP BY a.id ORDER BY a.status = 99 desc,a.publish_at DESC
|
</select>
|
<select id="inforActivity" resultType="com.panzhihua.common.model.vos.community.ComActActivityVO">
|
SELECT u.name sponsorName, ca.name communityName,
|
count(IF( s.sign_identity = 1, s.id, NULL )) participant_now,
|
count(IF( s.sign_identity = 2, s.id, NULL )) partyMemberNow,
|
count(IF( s.sign_identity = 3, s.id, NULL )) volunteer_now, a.*,t1.name as projectName
|
FROM com_act_activity a
|
left join sys_user u on a.sponsor_id=u.user_id
|
left join (select * from com_act_act_sign where `status` = 1) s on a.id=s.activity_id
|
left join com_act ca on a.community_id=ca.community_id left join com_act_social_project t1 on a.project_id = t1.id where a.id = #{id} group by a.id
|
|
</select>
|
<select id="listActivityType" resultType="com.panzhihua.common.model.vos.community.ComActActivityTypeVO">
|
SELECT * FROM com_act_activity_type WHERE `type` = #{type} AND community_id = ${communityId} ORDER BY id ASC
|
</select>
|
<!-- <select id="selectResidentActHistogramData"-->
|
<!-- resultType="com.panzhihua.common.model.vos.community.StatisticsCommVO">-->
|
<!-- SELECT activity_type AS filed, COUNT(id) AS num-->
|
<!-- FROM com_act_activity-->
|
<!-- WHERE community_id = ${communityId} AND `status` IN(2,3,4,5)-->
|
<!-- <if test="isResidentAct">-->
|
<!-- AND `type` = 2-->
|
<!-- </if>-->
|
<!-- <if test="!isResidentAct">-->
|
<!-- AND `type` = 1-->
|
<!-- </if>-->
|
<!-- GROUP BY filed-->
|
<!-- </select>-->
|
|
<select id="selectResidentActHistogramData"
|
resultType="com.panzhihua.common.model.vos.community.StatisticsCommVO">
|
SELECT activity_type AS filed, COUNT(id) AS num
|
FROM com_act_activity
|
WHERE community_id = ${communityId} AND `status` IN(2,3,4,5)
|
GROUP BY filed
|
</select>
|
|
<select id="getIndexResidentActBaseData"
|
resultType="com.panzhihua.common.model.vos.community.StatisticsCommVO">
|
SELECT filed, num, IF(total = 0,0,ROUND(num/total,2)) AS percent FROM
|
(SELECT t1.activity_type AS filed, COUNT(t2.id) AS num
|
FROM com_act_activity t1
|
LEFT JOIN (SELECT * FROM com_act_act_sign WHERE `status` = 1) t2 ON t1.id = t2.activity_id
|
WHERE t1.community_id = ${communityId}
|
<if test="isResidentAct">
|
AND t1.`type` = 2
|
</if>
|
<if test="!isResidentAct">
|
AND t1.`type` = 1
|
</if>
|
GROUP BY filed) temp1,
|
(SELECT COUNT(t2.id) AS total
|
FROM com_act_activity t1
|
LEFT JOIN (SELECT * FROM com_act_act_sign WHERE `status` = 1) t2 ON t1.id = t2.activity_id
|
WHERE t1.community_id = ${communityId}
|
<if test="isResidentAct">
|
AND t1.`type` = 2
|
</if>
|
<if test="!isResidentAct">
|
AND t1.`type` = 1
|
</if>
|
) temp2
|
</select>
|
<!-- <select id="getActAddPolylineData" resultType="com.panzhihua.common.model.vos.community.StatisticsCommVO">-->
|
<!-- SELECT filed, SUM(num) AS num FROM (-->
|
<!-- SELECT DATE_FORMAT( create_at, '%Y-%m' ) AS filed, COUNT(id) AS num-->
|
<!-- FROM com_act_activity-->
|
<!-- WHERE community_id = ${communityId} AND `status` IN(2,3,4,5)-->
|
<!-- <if test="isResidentAct">-->
|
<!-- AND `type` = 2-->
|
<!-- </if>-->
|
<!-- <if test="!isResidentAct">-->
|
<!-- AND `type` = 1-->
|
<!-- </if>-->
|
<!-- AND DATE_FORMAT( create_at, '%Y-%m' ) > DATE_FORMAT(date_sub(curdate(), interval 12 month),'%Y-%m') GROUP BY filed-->
|
<!-- UNION ALL SELECT * FROM-->
|
<!-- (-->
|
<!-- SELECT DATE_FORMAT(curdate(),'%Y-%m') AS filed, 0 AS num union-->
|
<!-- SELECT DATE_FORMAT(date_sub(curdate(), interval 1 month),'%Y-%m') AS filed, 0 AS num union-->
|
<!-- SELECT DATE_FORMAT(date_sub(curdate(), interval 2 month),'%Y-%m') AS filed, 0 AS num union-->
|
<!-- SELECT DATE_FORMAT(date_sub(curdate(), interval 3 month),'%Y-%m') AS filed, 0 AS num union-->
|
<!-- SELECT DATE_FORMAT(date_sub(curdate(), interval 4 month),'%Y-%m') AS filed, 0 AS num union-->
|
<!-- SELECT DATE_FORMAT(date_sub(curdate(), interval 5 month),'%Y-%m') AS filed, 0 AS num union-->
|
<!-- SELECT DATE_FORMAT(date_sub(curdate(), interval 6 month),'%Y-%m') AS filed, 0 AS num union-->
|
<!-- SELECT DATE_FORMAT(date_sub(curdate(), interval 7 month),'%Y-%m') AS filed, 0 AS num union-->
|
<!-- SELECT DATE_FORMAT(date_sub(curdate(), interval 8 month),'%Y-%m') AS filed, 0 AS num union-->
|
<!-- SELECT DATE_FORMAT(date_sub(curdate(), interval 9 month),'%Y-%m') AS filed, 0 AS num union-->
|
<!-- SELECT DATE_FORMAT(date_sub(curdate(), interval 10 month),'%Y-%m') AS filed, 0 AS num union-->
|
<!-- SELECT DATE_FORMAT(date_sub(curdate(), interval 11 month),'%Y-%m') AS filed, 0 AS num-->
|
<!-- ) temT-->
|
<!-- ) temp GROUP BY filed ORDER BY filed ASC-->
|
<!-- </select>-->
|
|
|
<select id="getActAddPolylineData" resultType="com.panzhihua.common.model.vos.community.StatisticsCommVO">
|
SELECT filed, SUM(num) AS num FROM (
|
SELECT DATE_FORMAT( create_at, '%Y-%m' ) AS filed, COUNT(id) AS num
|
FROM com_act_activity
|
WHERE community_id = ${communityId} AND `status` IN(2,3,4,5)
|
AND DATE_FORMAT( create_at, '%Y-%m' ) > DATE_FORMAT(date_sub(curdate(), interval 12 month),'%Y-%m') GROUP BY filed
|
UNION ALL SELECT * FROM
|
(
|
SELECT DATE_FORMAT(curdate(),'%Y-%m') AS filed, 0 AS num union
|
SELECT DATE_FORMAT(date_sub(curdate(), interval 1 month),'%Y-%m') AS filed, 0 AS num union
|
SELECT DATE_FORMAT(date_sub(curdate(), interval 2 month),'%Y-%m') AS filed, 0 AS num union
|
SELECT DATE_FORMAT(date_sub(curdate(), interval 3 month),'%Y-%m') AS filed, 0 AS num union
|
SELECT DATE_FORMAT(date_sub(curdate(), interval 4 month),'%Y-%m') AS filed, 0 AS num union
|
SELECT DATE_FORMAT(date_sub(curdate(), interval 5 month),'%Y-%m') AS filed, 0 AS num union
|
SELECT DATE_FORMAT(date_sub(curdate(), interval 6 month),'%Y-%m') AS filed, 0 AS num union
|
SELECT DATE_FORMAT(date_sub(curdate(), interval 7 month),'%Y-%m') AS filed, 0 AS num union
|
SELECT DATE_FORMAT(date_sub(curdate(), interval 8 month),'%Y-%m') AS filed, 0 AS num union
|
SELECT DATE_FORMAT(date_sub(curdate(), interval 9 month),'%Y-%m') AS filed, 0 AS num union
|
SELECT DATE_FORMAT(date_sub(curdate(), interval 10 month),'%Y-%m') AS filed, 0 AS num union
|
SELECT DATE_FORMAT(date_sub(curdate(), interval 11 month),'%Y-%m') AS filed, 0 AS num
|
) temT
|
) temp GROUP BY filed ORDER BY filed ASC
|
</select>
|
|
|
|
<select id="getActTotalPolylineData"
|
resultType="com.panzhihua.common.model.vos.community.StatisticsCommVO">
|
SELECT COUNT(id) AS num
|
FROM com_act_activity
|
WHERE community_id = ${communityId} AND `status` IN(2,3,4,5)
|
<if test="isResidentAct">
|
AND `type` = 2
|
</if>
|
<if test="!isResidentAct">
|
AND `type` = 1
|
</if>
|
AND DATE_FORMAT( create_at, '%Y-%m' ) <= #{date}
|
</select>
|
<select id="indexActList" resultType="com.panzhihua.common.model.vos.community.ComActActivityVO">
|
SELECT id, `status`, activity_type, activity_name, cover
|
FROM com_act_activity
|
WHERE 1=1
|
<if test="pageBaseDTO.communityIds != null and pageBaseDTO.communityIds.size > 0">
|
AND community_id IN
|
<foreach collection="pageBaseDTO.communityIds" item="item" open="(" separator="," close=")">
|
#{item}
|
</foreach>
|
</if>
|
<if test="pageBaseDTO.communityIds == null">
|
AND community_id = ${pageBaseDTO.communityId}
|
</if>
|
<if test="isResidentAct">
|
AND `type` = 2
|
</if>
|
<if test="!isResidentAct">
|
AND `type` = 1
|
</if>
|
<if test="pageBaseDTO.param2 != null and pageBaseDTO.param2 != """>
|
AND activity_type = #{pageBaseDTO.param2}
|
</if>
|
ORDER BY id DESC
|
</select>
|
|
<select id="selectProjectActivity" resultType="com.panzhihua.common.model.vos.community.ComActActivityVO">
|
SELECT a.id, a.activity_name, u.`name` sponsorName, a.activity_addr, a.participant_max, a.contact_name,
|
count(IF( s.sign_identity = 1, s.id, NULL )) participant_now,
|
count(IF( s.sign_identity = 2, s.id, NULL )) partyMemberNow,
|
count(IF( s.sign_identity = 3, s.id, NULL )) volunteer_now, a.volunteer_max,a.`status`, a.publish_at, a.is_qr_code,
|
a.begin_at, a.end_at, a.sign_up_begin, a.sign_up_end, a.participant_reward_way,
|
a.volunteer_reward_way,a.pb_reward_way, a.activity_type, a.have_integral_reward , a.cover , t1.evaluateLevel
|
FROM com_act_activity a
|
LEFT JOIN sys_user u ON a.sponsor_id=u.user_id
|
LEFT JOIN (SELECT * FROM com_act_act_sign WHERE `status` = 1) s ON a.id=s.activity_id
|
LEFT JOIN (select AVG(star_level) as evaluateLevel,activity_id from com_act_act_evaluate GROUP BY activity_id) t1 on a.id = t1.activity_id
|
WHERE is_project=1 order by t1.evaluateLevel desc
|
</select>
|
|
<select id="selectActivityBySocialWorker" resultType="com.panzhihua.common.model.vos.community.ComActActivityVO">
|
select t.* from com_act_activity t left join com_act_act_regist t1 on t.id=t1.activity_id where t1.user_id =
|
(select t1.user_id from com_act_social_worker t LEFT JOIN sys_user t1 on t.telephone = t1.phone where t.id = #{id})
|
</select>
|
|
<select id="getActBelongRegionCode" resultType="java.lang.String">
|
SELECT district_adcode FROM com_mng_struct_area_district WHERE district_adcode = ( SELECT area_code FROM com_street WHERE street_id =( SELECT street_id FROM com_act WHERE community_id = #{communityId} ))
|
</select>
|
|
<select id="selectActivityStatics" resultType="com.panzhihua.common.model.vos.community.PartyActivityStatics">
|
select (select count(*) from com_act_activity where type = 3
|
<if test="communityIds != null and communityIds.size() != 0">
|
and community_id in
|
<foreach collection="communityIds" item="item" open="(" separator="," close=")">
|
#{item}
|
</foreach>
|
</if>
|
) activityCount,
|
(select count(*) from com_pb_member where audit_result=1
|
<if test="communityIds != null and communityIds.size() != 0">
|
and community_id in
|
<foreach collection="communityIds" item="item" open="(" separator="," close=")">
|
#{item}
|
</foreach>
|
</if>
|
) memberCount
|
</select>
|
|
<select id="selectActivityChart" resultType="com.panzhihua.common.model.vos.community.PartyActivityTypeChart">
|
select count(*) as count,activity_type as name from com_act_activity where type = 3
|
<if test="communityIds != null and communityIds.size() != 0">
|
and community_id in
|
<foreach collection="communityIds" item="item" open="(" separator="," close=")">
|
#{item}
|
</foreach>
|
</if>
|
GROUP BY activity_type
|
</select>
|
|
<select id="selectActivityLine" resultType="integer">
|
select count(*) from com_act_activity where type = 3 and publish_at >= DATE_FORMAT( CONCAT(#{year},'-',#{date},'-00'), '%Y-%m-00 00:00:00') and DATE_FORMAT( LAST_DAY(CONCAT(#{year},'-',#{date},'-00')), '%Y-%m-%d 23:59:59') >=publish_at
|
<if test="communityIds != null and communityIds.size() != 0">
|
and community_id in
|
<foreach collection="communityIds" item="item" open="(" separator="," close=")">
|
#{item}
|
</foreach>
|
</if>
|
</select>
|
|
<select id="partyMemberDetail" resultType="com.panzhihua.common.model.vos.community.PartyMemberDetailVO">
|
select t.activity_name,t.activity_addr,t.begin_at,t1.position,t1.start_time,t1.end_time,t.duration,t.participant_reward_integral,t.volunteer_reward_integral,t.pb_reward_integral from com_act_activity t LEFT JOIN com_act_act_regist t1 on t.id = t1.activity_id
|
where t.type = 3 and t1.user_id = #{commonPage.userId}
|
<if test="commonPage.beginTime !=null">
|
and t.begin_at between #{commonPage.beginTime} and #{commonPage.endTime}
|
</if>
|
order by t.begin_at desc
|
</select>
|
|
<select id="exportPartyMemberDetail" resultType="com.panzhihua.common.model.vos.community.PartyMemberDetailVO">
|
select t.activity_name,t.activity_addr,t.begin_at,t1.position,t1.start_time,t1.end_time,t.duration,t.participant_reward_integral,t.volunteer_reward_integral,t.pb_reward_integral from com_act_activity t LEFT JOIN com_act_act_regist t1 on t.id = t1.activity_id
|
where t.type = 3 and t1.user_id = #{commonPage.userId}
|
<if test="commonPage.beginTime !=null">
|
and t.begin_at between #{commonPage.beginTime} and #{commonPage.endTime}
|
</if>
|
order by t.begin_at desc
|
</select>
|
|
<select id="selectListByRelationId" resultType="com.panzhihua.common.model.vos.community.ComActActivityVO">
|
SELECT a.id, a.activity_name, u.`name` sponsorName, a.activity_addr, a.participant_max, a.contact_name,
|
a.volunteer_max,
|
a.`status`, a.publish_at,
|
a.is_qr_code, a.begin_at, a.end_at, a.sign_up_begin, a.sign_up_end, a.participant_reward_way,
|
a.volunteer_reward_way,a.pb_reward_way, a.activity_type, a.have_integral_reward ,a.participant_reward_integral,a.volunteer_reward_integral,a.pb_reward_integral,a.party_member_max,a.party_member_min,a.cover,a.type,a.duration
|
FROM com_act_activity a
|
LEFT JOIN sys_user u ON a.sponsor_id=u.user_id
|
LEFT JOIN com_act_act_regist s ON a.id=s.activity_id
|
where s.end_time is not null and a.check_unit_id = #{relationId} and publish_at between concat(#{date},'-01-01 00:00:00') and concat(#{date},'-12-31 23:59:59') group by a.id
|
</select>
|
|
<select id="selectListByCommunityId" resultType="com.panzhihua.common.model.vos.community.ComActActivityVO">
|
SELECT t.* FROM `com_act_activity` t left join com_act_act_regist t1 on t.id = t1.activity_id left join sys_user t2 on t1.user_id = t2.user_id
|
WHERE t1.end_time is not null and t.community_id = #{communityId} and t.type = 3 and publish_at between concat(#{date},'-01-01 00:00:00') and concat(#{date},'-12-31 23:59:59') group by t.id
|
</select>
|
<!-- <select id="pageProjectActivity" resultType="com.panzhihua.common.model.vos.community.ComActActivityVO">-->
|
<!-- SELECT-->
|
<!-- a.id,-->
|
<!-- a.activity_name,-->
|
<!-- u.`name` sponsorName,-->
|
<!-- a.activity_addr,-->
|
<!-- a.aattend_people,-->
|
<!-- a.`status`,-->
|
<!-- a.is_qr_code,-->
|
<!-- a.publish_at,-->
|
<!-- a.begin_at,-->
|
<!-- a.cover,-->
|
<!-- a.end_at,-->
|
<!-- a.volunteer_max,-->
|
<!-- count(IF( s.sign_identity = 1, s.id, NULL )) participant_now,-->
|
<!-- count(IF( s.sign_identity = 2, s.id, NULL )) partyMemberNow,-->
|
<!-- count(IF( s.sign_identity = 3, s.id, NULL )) volunteer_now,-->
|
<!-- a.participant_max,-->
|
<!-- a.sign_up_begin,-->
|
<!-- a.sign_up_end,-->
|
<!-- ca.NAME AS communityName,-->
|
<!-- a.type,-->
|
<!-- a.party_member_max,-->
|
<!-- a.topic_id-->
|
<!-- FROM-->
|
<!-- com_act_activity a-->
|
<!-- LEFT JOIN sys_user u ON a.sponsor_id = u.user_id-->
|
<!-- LEFT JOIN ( SELECT * FROM com_act_act_sign WHERE `status` = 1 ) s ON a.id = s.activity_id-->
|
<!-- LEFT JOIN com_act ca ON a.community_id = ca.community_id-->
|
<!-- JOIN (SELECT * FROM com_act_social_project WHERE (street_id = #{comActActivityVO.streetId} OR community_id = #{comActActivityVO.communityId}) AND `status` =3) t ON a.project_id = t.id-->
|
<!-- GROUP BY a.id ORDER BY a.status = 99 desc,a.publish_at DESC-->
|
<!-- </select>-->
|
|
|
|
<select id="pageProjectActivity" resultType="com.panzhihua.common.model.vos.community.ComActActivityVO">
|
SELECT
|
a.id,
|
a.activity_name,
|
u.`name` sponsorName,
|
a.activity_addr,
|
a.aattend_people,
|
a.`status`,
|
a.is_qr_code,
|
a.publish_at,
|
a.begin_at,
|
a.cover,
|
a.end_at,
|
a.volunteer_max,
|
count(IF( s.sign_identity = 1, s.id, NULL )) participant_now,
|
count(IF( s.sign_identity = 2, s.id, NULL )) partyMemberNow,
|
count(IF( s.sign_identity = 3, s.id, NULL )) volunteer_now,
|
a.participant_max,
|
a.sign_up_begin,
|
a.sign_up_end,
|
ca.NAME AS communityName,
|
(SELECT responsibility FROM com_act_social_project casp WHERE a.project_id = casp.id) AS responsibilityName,
|
a.type,
|
a.party_member_max,
|
a.topic_id,
|
a.jinhui_coin_award,
|
a.jinhui_coin_punishment
|
FROM
|
com_act_activity a
|
LEFT JOIN sys_user u ON a.sponsor_id = u.user_id
|
LEFT JOIN ( SELECT * FROM com_act_act_sign WHERE `status` = 1 ) s ON a.id = s.activity_id
|
LEFT JOIN com_act ca ON a.community_id = ca.community_id
|
JOIN (SELECT * FROM com_act_social_project WHERE (street_id = #{comActActivityVO.streetId}
|
OR community_id = #{comActActivityVO.communityId})) t ON a.project_id = t.id
|
<where>
|
<if test="comActActivityVO.aattendPeople != null and comActActivityVO.aattendPeople != '' ">
|
a.aattend_people = #{comActActivityVO.aattendPeople}
|
</if>
|
</where>
|
GROUP BY a.id ORDER BY a.status = 99 desc,a.publish_at DESC
|
|
</select>
|
|
<select id="pageActivity" resultType="com.panzhihua.common.model.vos.community.ComActActivityVO">
|
SELECT
|
a.id,
|
a.activity_name,
|
u.`name` sponsorName,
|
a.activity_addr,
|
a.aattend_people,
|
a.`status`,
|
a.is_qr_code,
|
a.publish_at,
|
a.begin_at,
|
a.cover,
|
a.end_at,
|
a.volunteer_max,
|
count(IF( s.sign_identity = 1, s.id, NULL )) participant_now,
|
count(IF( s.sign_identity = 2, s.id, NULL )) partyMemberNow,
|
count(IF( s.sign_identity = 3, s.id, NULL )) volunteer_now,
|
a.participant_max,
|
a.sign_up_begin,
|
a.sign_up_end,
|
ca.NAME AS communityName,
|
a.type,
|
a.party_member_max,
|
a.topic_id,
|
a.jinhui_coin_award,
|
a.jinhui_coin_punishment
|
FROM
|
com_act_activity a
|
LEFT JOIN sys_user u ON a.sponsor_id = u.user_id
|
LEFT JOIN ( SELECT * FROM com_act_act_sign WHERE `status` = 1 ) s ON a.id = s.activity_id
|
LEFT JOIN com_act ca ON a.community_id = ca.community_id
|
WHERE 1 = 1
|
<if test ="comActActivityVO.communityIds != null and comActActivityVO.communityIds.size() != 0">
|
<if test="comActActivityVO.checkUnitId != null">
|
AND (a.community_id in
|
<foreach collection="comActActivityVO.communityIds" item="item" open="(" separator="," close=")">
|
#{item}
|
</foreach>
|
OR a.check_unit_id = #{comActActivityVO.checkUnitId})
|
</if>
|
<if test="comActActivityVO.checkUnitId == null">
|
AND a.community_id in
|
<foreach collection="comActActivityVO.communityIds" item="item" open="(" separator="," close=")">
|
#{item}
|
</foreach>
|
<if test="comActActivityVO.type == null">
|
AND a.`type` != 5
|
</if>
|
</if>
|
</if>
|
<if test ="comActActivityVO.phone != null and comActActivityVO.phone != """>
|
AND a.phone = ${comActActivityVO.phone}
|
</if>
|
<if test ="comActActivityVO.areaCode != null">
|
AND ca.area_code = ${comActActivityVO.areaCode}
|
</if>
|
<if test ="comActActivityVO.checkUnitId != null and comActActivityVO.communityId == null">
|
AND a.check_unit_id = #{comActActivityVO.checkUnitId}
|
</if>
|
<if test="comActActivityVO.activityName != null and comActActivityVO.activityName.trim() != """>
|
AND a.activity_name LIKE concat(#{comActActivityVO.activityName},'%')
|
</if>
|
<if test="comActActivityVO.status != null and comActActivityVO.status != 0 and comActActivityVO.isIng == null">
|
AND a.`status` = #{comActActivityVO.status}
|
</if>
|
<if test="comActActivityVO.status != null and comActActivityVO.status != 0 and comActActivityVO.isIng != null and comActActivityVO.isIng == 1">
|
AND a.`status` IN (3,4)
|
</if>
|
<if test="comActActivityVO.isApplets != null and comActActivityVO.isApplets == 1">
|
AND a.`status` != 1 AND a.`status` != 6
|
</if>
|
<if test="comActActivityVO.beginAt != null">
|
AND a.begin_at >= #{comActActivityVO.beginAt} AND a.end_at <= #{comActActivityVO.endAt}
|
</if>
|
<if test="comActActivityVO.type != null">
|
AND a.type = #{comActActivityVO.type}
|
</if>
|
<if test="comActActivityVO.aattendPeople != null and comActActivityVO.aattendPeople != '' ">
|
AND a.aattend_people = #{comActActivityVO.aattendPeople}
|
</if>
|
GROUP BY a.id
|
ORDER BY a.status = 99 DESC,a.publish_at DESC
|
</select>
|
|
<select id="selectOpenIdByActivityId" resultType="String">
|
select distinct openid from com_act_act_sign t LEFT JOIN sys_user t1 on t.user_id = t1.user_id where t.activity_id =#{id} and t.status = 1
|
</select>
|
|
|
<select id="pageActivityBigScreen"
|
resultType="com.panzhihua.common.model.vos.community.ComActActivityBigScreenVO">
|
SELECT a.id,a.cover,a.activity_type,a.activity_name,a.`status`,a.begin_at,a.end_at,a.publish_at,
|
(SELECT count(1) FROM com_act_act_sign s WHERE s.activity_id = a.id) as person_num
|
FROM com_act_activity a
|
WHERE a.type = 1 ORDER BY a.create_at desc
|
</select>
|
</mapper>
|