<?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.ComActEasyPhotoDAO">
|
|
<!-- 通用查询映射结果 -->
|
<resultMap id="BaseResultMap" type="com.panzhihua.service_community.model.dos.ComActEasyPhotoDO">
|
<id column="id" property="id" />
|
<result column="sponsor_id" property="sponsorId" />
|
<result column="happen_addr" property="happenAddr" />
|
<result column="addr_remark" property="addrRemark" />
|
<result column="status" property="status" />
|
<result column="handler_id" property="handlerId" />
|
<result column="create_at" property="createAt" />
|
<result column="examine_at" property="examineAt" />
|
<result column="detail" property="detail" />
|
<result column="photo_path_list" property="photoPathList" />
|
<result column="handle_result" property="handleResult" />
|
<result column="handle_photo_list" property="handlePhotoList" />
|
<result column="community_id" property="communityId" />
|
<result column="is_hide" property="isHide" />
|
<result column="is_need_feed_back" property="isNeedFeedBack" />
|
<result column="feedback_at" property="feedbackAt" />
|
<result column="reject_reason" property="rejectReason" />
|
<result column="del_tag" property="delTag" />
|
<result column="is_report" property="isReport" />
|
<result column="is_publicity" property="isPublicity" />
|
<result column="handle_status" property="handleStatus" />
|
<result column="lng_lat" property="lngLat" />
|
<result column="activity_type" property="activityType" />
|
<result column="activity_amount" property="activityAmount" />
|
<result column="activity_id" property="activityId" />
|
<result column="img_width" property="imgWidth" />
|
<result column="img_height" property="imgHeight" />
|
</resultMap>
|
|
<!-- 通用查询结果列 -->
|
<sql id="Base_Column_List">
|
id, sponsor_id, happen_addr, addr_remark, status, handler_id, create_at, examine_at, detail, photo_path_list
|
, handle_result, handle_photo_list, community_id, is_hide, is_need_feed_back, feedback_at, reject_reason
|
, del_tag, is_report, is_publicity, handle_status, lng_lat, activity_type, activity_amount, activity_id
|
, img_width, img_height
|
</sql>
|
|
<select id="pageEasyPhotoAdmin" parameterType="com.panzhihua.common.model.vos.community.ComActEasyPhotoVO"
|
resultType="com.panzhihua.common.model.vos.community.ComActEasyPhotoVO">
|
SELECT
|
p.id,
|
u.`name` sponsor_name,
|
u.phone phone,
|
count( pu.id ) giveThumbsUpNum,
|
u.image_url,
|
p.happen_addr,
|
su.`name` handler_name,
|
p.`status`,
|
p.`detail`,
|
p.`is_need_feed_back`,
|
p.`photo_path_list`,
|
p.create_at,
|
p.feedback_at,
|
p.is_report,
|
p.is_publicity,
|
p.activity_type,
|
p.activity_amount,
|
p.activity_id,
|
p.is_report_urban,
|
p.classify_id,
|
ca.`name` as classifyName,
|
p.examine_at,
|
c.name communityName,
|
p.urban_status,
|
p.transfer_reason
|
FROM
|
com_act_easy_photo p
|
LEFT JOIN sys_user u ON p.sponsor_id = u.user_id
|
LEFT JOIN com_act_easy_photo_user pu ON p.id = pu.easy_photo_id
|
LEFT JOIN sys_user su ON p.handler_id = su.user_id
|
left join com_act c on p.community_id =c.community_id
|
left join com_act_easy_photo_classify ca on ca.id = p.classify_id
|
WHERE
|
p.del_tag = 0 and p.`status` != 3
|
<if test='comActEasyPhotoVO.communityId != null and comActEasyPhotoVO.communityId != 0'>
|
and p.community_id=#{comActEasyPhotoVO.communityId}
|
</if>
|
<if test='comActEasyPhotoVO.status != null and comActEasyPhotoVO.status!=0' >
|
AND p.`status` = #{comActEasyPhotoVO.status}
|
</if>
|
<if test='comActEasyPhotoVO.isPublicity != null' >
|
AND p.`is_publicity` = #{comActEasyPhotoVO.isPublicity}
|
</if>
|
<if test='comActEasyPhotoVO.isReportUrban != null' >
|
AND p.`is_report_urban` = #{comActEasyPhotoVO.isReportUrban}
|
</if>
|
<if test='comActEasyPhotoVO.classifyId != null' >
|
AND p.`classify_id` = #{comActEasyPhotoVO.classifyId}
|
</if>
|
<if test='comActEasyPhotoVO.urbanStatus != null' >
|
AND p.`urban_status` = #{comActEasyPhotoVO.urbanStatus}
|
</if>
|
<if test='comActEasyPhotoVO.createBegin != null '>
|
AND p.create_at BETWEEN #{comActEasyPhotoVO.createBegin}
|
AND #{comActEasyPhotoVO.createEnd}
|
</if>
|
<if test='comActEasyPhotoVO.activityType != null'>
|
AND p.activity_type =#{comActEasyPhotoVO.activityType}
|
</if>
|
|
<if test='comActEasyPhotoVO.keyWord != null and comActEasyPhotoVO.keyWord != ""'>
|
AND (u.`name` like concat(#{comActEasyPhotoVO.keyWord},'%') or
|
p.happen_addr like concat(#{comActEasyPhotoVO.keyWord},'%') or
|
su.`name` like concat(#{comActEasyPhotoVO.keyWord},'%') or
|
p.detail like concat(#{comActEasyPhotoVO.keyWord},'%') or u.phone like concat(#{comActEasyPhotoVO.keyWord},'%')
|
)
|
</if>
|
GROUP BY
|
p.id
|
ORDER BY
|
p.create_at DESC
|
|
</select>
|
|
<select id="getEasyPhotoStatistics" resultType="com.panzhihua.common.model.vos.community.easyPhoto.ComActEasyPhotoStatisticsVO">
|
SELECT
|
count( id ) AS examineNum,
|
( SELECT count( id ) FROM com_act_easy_photo WHERE `status` = 2 AND community_id = #{communityId} AND del_tag = 0 ) AS verificationNum,
|
( SELECT count( id ) FROM com_act_easy_photo WHERE `status` in (1,2,4) AND `is_publicity` = 1 AND community_id = #{communityId} AND del_tag = 0 ) AS rejectNum,
|
( SELECT count( id ) FROM com_act_easy_photo WHERE `status` = 4 AND community_id = #{communityId} AND del_tag = 0 ) AS completeNum,
|
(select count(id) from com_act_easy_photo where `status` in (2,4) AND community_id = #{communityId} and del_tag = 0 and activity_type = 1) as yzAllTotal,
|
(select count(id) from com_act_easy_photo where `status` in (2,4) AND community_id = #{communityId} and del_tag = 0 and activity_type = 1 and examine_at between timestamp(date_add(curdate(), interval - 0 day)) and now()) as yzDayTotal,
|
(select count(id) from com_act_easy_photo where `status` in (2,4) AND community_id = #{communityId} and del_tag = 0 and activity_type = 2) as jlAllTotal,
|
(select count(id) from com_act_easy_photo where `status` in (2,4) AND community_id = #{communityId} and del_tag = 0 and activity_type = 2 and examine_at between timestamp(date_add(curdate(), interval - 0 day)) and now()) as jlDayTotal,
|
(select count(id) from com_act_easy_photo where `status` in (2,4) AND community_id = #{communityId} and del_tag = 0 and activity_type = 3) as ptAllTotal,
|
(select count(id) from com_act_easy_photo where `status` in (2,4) AND community_id = #{communityId} and del_tag = 0 and activity_type = 3 and examine_at between timestamp(date_add(curdate(), interval - 0 day)) and now()) as ptDayTotal,
|
(select count(id) from com_act_easy_photo where `status` in (2,4) AND community_id = #{communityId} and del_tag = 0 and activity_type = 4) as ybAllTotal,
|
(select count(id) from com_act_easy_photo where `status` in (2,4) AND community_id = #{communityId} and del_tag = 0 and activity_type = 4 and examine_at between timestamp(date_add(curdate(), interval - 0 day)) and now()) as ybDayTotal,
|
(select IFNULL(sum(activity_amount),0) from com_act_easy_photo where `status` in (2,4) AND community_id = 2 and del_tag = 0) as allRewardAmount,
|
(select IFNULL(sum(activity_amount),0) from com_act_easy_photo where `status` in (2,4) AND community_id = 2 and del_tag = 0 and examine_at between timestamp(date_add(curdate(), interval - 0 day)) and now()) as dayRewardAmount
|
FROM
|
com_act_easy_photo
|
WHERE
|
`status` = 1
|
AND community_id = #{communityId}
|
AND del_tag = 0
|
</select>
|
|
<select id="easyPhotoCount" resultType="com.panzhihua.common.model.vos.community.easyPhoto.ComActEasyPhotoCountVO">
|
select count(*) total,(select count(*) today from com_act_easy_photo where transfer_time BETWEEN DATE_FORMAT(CURDATE(),'%Y-%m-%d %H:%i:%s') and DATE_ADD(CURRENT_DATE, INTERVAL 1 DAY)
|
<if test="urbanStatus !=null">
|
and urban_status=#{urbanStatus}
|
</if>)
|
today from com_act_easy_photo
|
<where>
|
1=1
|
<if test="urbanStatus !=null">
|
and urban_status=#{urbanStatus}
|
</if>
|
</where>
|
</select>
|
|
<select id="export" resultType="com.panzhihua.common.model.vos.community.ComActEasyPhotoVO">
|
SELECT
|
p.id,
|
u.`name` sponsor_name,
|
u.phone phone,
|
count( pu.id ) giveThumbsUpNum,
|
u.image_url,
|
p.happen_addr,
|
su.`name` handler_name,
|
p.`status`,
|
p.`detail`,
|
p.`is_need_feed_back`,
|
p.`photo_path_list`,
|
p.create_at,
|
p.feedback_at,
|
p.is_report,
|
p.is_publicity,
|
p.activity_type,
|
p.activity_amount,
|
p.activity_id,
|
p.examine_at,
|
c.name communityName,
|
p.is_report_urban,
|
p.urban_status,
|
ca.`name` as photoType
|
FROM
|
com_act_easy_photo p
|
LEFT JOIN sys_user u ON p.sponsor_id = u.user_id
|
LEFT JOIN com_act_easy_photo_user pu ON p.id = pu.easy_photo_id
|
LEFT JOIN sys_user su ON p.handler_id = su.user_id
|
left join com_act c on p.community_id =c.community_id
|
left join com_act_easy_photo_classify ca on ca.id = p.classify_id
|
WHERE
|
p.del_tag = 0 and p.`is_report_urban` =1
|
<if test='communityId != null and communityId != 0'>
|
and p.community_id=#{communityId}
|
</if>
|
<if test='urbanStatus != null ' >
|
AND p.`urban_status` = #{urbanStatus}
|
</if>
|
<if test='createBegin != null '>
|
AND p.create_at BETWEEN #{createBegin}
|
AND #{createEnd}
|
</if>
|
|
<if test='keyWord != null and keyWord != ""'>
|
AND (u.`name` like concat(#{keyWord},'%') or
|
p.happen_addr like concat(#{keyWord},'%') or
|
su.`name` like concat(#{keyWord},'%') or
|
p.detail like concat(#{keyWord},'%') or u.phone like concat(#{comActEasyPhotoVO.keyWord},'%')
|
)
|
</if>
|
GROUP BY
|
p.id
|
ORDER BY
|
p.create_at DESC
|
</select>
|
|
<select id="exportByIds" resultType="com.panzhihua.common.model.vos.community.easyPhoto.ExportEasyPhotoVO">
|
SELECT
|
p.id,
|
u.`name` sponsor_name,
|
u.phone phone,
|
count( pu.id ) giveThumbsUpNum,
|
u.image_url,
|
p.happen_addr,
|
su.`name` handler_name,
|
p.`status`,
|
p.`detail`,
|
p.`is_need_feed_back`,
|
p.`photo_path_list`,
|
p.create_at,
|
p.feedback_at,
|
p.is_report,
|
p.is_publicity,
|
p.activity_type,
|
p.activity_amount,
|
p.activity_id,
|
p.examine_at,
|
c.name communityName,
|
p.is_report_urban,
|
p.urban_status,
|
ca.`name` as photoType
|
FROM
|
com_act_easy_photo p
|
LEFT JOIN sys_user u ON p.sponsor_id = u.user_id
|
LEFT JOIN com_act_easy_photo_user pu ON p.id = pu.easy_photo_id
|
LEFT JOIN sys_user su ON p.handler_id = su.user_id
|
left join com_act c on p.community_id =c.community_id
|
left join com_act_easy_photo_classify ca on ca.id = p.classify_id
|
WHERE
|
p.id in
|
<foreach collection="list" item="ids" index="index"
|
open="(" close=")" separator=",">
|
#{ids}
|
</foreach>
|
GROUP BY
|
p.id
|
ORDER BY
|
p.create_at DESC
|
</select>
|
|
<select id="easyPhotoNoHandleIds" resultType="Long">
|
select id from com_act_easy_photo where `status` = 1 and community_id = #{communityId} and del_tag = 0
|
</select>
|
|
<select id="banner" resultType="com.panzhihua.common.model.vos.community.easyPhoto.BannerVO">
|
select id,cover,publish_at as show_time,1 as type,jump_url,jump_type from com_act_dyn where status =1 and cover is not null and community_id =#{communityId}
|
UNION ALL
|
select id,cover,publish_at as show_time,2 as type,"" as jump_url,"" as jump_type from com_act_activity where status =3 and cover is not null and community_id =#{communityId}
|
UNION ALL
|
select id,cover,release_time as show_time,3 as type,"" as jump_url,"" as jump_type from com_pb_activity where status =3 and cover is not null and community_id =#{communityId}
|
UNION ALL
|
select id,"" as cover,publish_time as show_time,4 as type,"" as jump_url,"" as jump_type from com_act_questnaire where state =2 and community_id =#{communityId}
|
UNION ALL
|
select id,cover,publish_at as show_time,5 as type,jump_url,jump_type from com_pb_dyn where status =2 and cover is not null and community_id =#{communityId}
|
UNION ALL
|
select id,img_url as cover,publish_time as show_time,6 as type,"" as jump_url,"" as jump_type from com_act_reserve where status =2 and community_id =#{communityId}
|
UNION ALL
|
select id,logo as cover,release_at as show_time,7 as type,"" as jump_url,"" as jump_type from com_act_easy_photo_activity where status =2 and community_id =#{communityId}
|
order by show_time desc limit 30
|
</select>
|
|
</mapper>
|