<?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.ComActMicroWishDAO">
|
|
<!-- 通用查询映射结果 -->
|
<resultMap id="BaseResultMap" type="com.panzhihua.service_community.model.dos.ComActMicroWishDO">
|
<id column="id" property="id" />
|
<result column="sponsor_id" property="sponsorId" />
|
<result column="sponsor_phone" property="sponsorPhone" />
|
<result column="wish_name" property="wishName" />
|
<result column="status" property="status" />
|
<result column="form" property="form" />
|
<result column="responsible_id" property="responsibleId" />
|
<result column="create_at" property="createAt" />
|
<result column="examine_at" property="examineAt" />
|
<result column="distribution_at" property="distributionAt" />
|
<result column="feedback_at" property="feedbackAt" />
|
<result column="evaluate_at" property="evaluateAt" />
|
<result column="score" property="score" />
|
<result column="detail" property="detail" />
|
<result column="photo_path_list" property="photoPathList" />
|
<result column="community_id" property="communityId" />
|
<result column="evaluate" property="evaluate" />
|
<result column="finish_at" property="finishAt" />
|
<result column="finish_photo_path_list" property="finishPhotoPathList" />
|
<result column="finish" property="finish" />
|
<result column="reject_reason" property="rejectReason" />
|
<result column="feedback" property="feedback" />
|
<result column="feedback_photo_path_list" property="feedbackPhotoPathList" />
|
<result column="aim_num" property="aimNum" />
|
<result column="img_width" property="imgWidth" />
|
<result column="img_height" property="imgHeight" />
|
</resultMap>
|
|
<!-- 通用查询结果列 -->
|
<sql id="Base_Column_List">
|
id, sponsor_id, sponsor_phone, wish_name, status, form, responsible_id, create_at, examine_at, distribution_at, feedback_at, evaluate_at, score, detail, photo_path_list, community_id, evaluate, finish_at, finish_photo_path_list, finish, reject_reason, feedback, feedback_photo_path_list, aim_num, img_width, img_height
|
</sql>
|
|
<select id="pageMicroWishApplets" parameterType="com.panzhihua.common.model.vos.community.ComActMicroWishVO"
|
resultType="com.panzhihua.common.model.vos.community.ComActMicroWishVO">
|
SELECT
|
w.id,
|
u.name sponsor_name,
|
u.nick_name userNickName,
|
u.image_url ,
|
w.sponsor_phone,
|
w.wish_name,
|
w.`status`,
|
w.`feedback_at`,
|
w.`examine_at`,
|
w.`distribution_at`,
|
w.`evaluate_at`,
|
w.`photo_path_list`,
|
count(wu.id)star_num,
|
w.`detail`,
|
w.form,
|
w.reject_reason,
|
su.`name` responsible_name,
|
w.score,
|
w.img_width,
|
w.finish_at,
|
w.aim_num,
|
w.img_height,
|
w.create_at
|
FROM
|
com_act_micro_wish w
|
left join com_act_micro_wish_user wu on w.id=wu.micro_wish_id
|
left JOIN sys_user u ON w.sponsor_id = u.user_id
|
left JOIN com_pb_service_team su ON w.responsible_id = su.id
|
<where>
|
<if test='comActMicroWishVO.communityId != null and comActMicroWishVO.communityId != 0'>
|
and w.community_id = ${comActMicroWishVO.communityId}
|
</if>
|
<if test='comActMicroWishVO.status == 3 and comActMicroWishVO.isApplets != null and comActMicroWishVO.isApplets != 0'>
|
AND w.`status` in (3)
|
</if>
|
<if test='comActMicroWishVO.status == 6 and comActMicroWishVO.isApplets != null and comActMicroWishVO.isApplets != 0'>
|
AND w.`status` in (5,6)
|
</if>
|
<if test='comActMicroWishVO.status == 7 and comActMicroWishVO.isApplets != null and comActMicroWishVO.isApplets != 0'>
|
AND w.`status` in (2,7)
|
</if>
|
<if test='comActMicroWishVO.isApplets != null and comActMicroWishVO.isApplets != 0 and comActMicroWishVO.status != null and comActMicroWishVO.status != 7 and comActMicroWishVO.status != 6 and comActMicroWishVO.status != 3'>
|
AND w.status in (3, 5, 6)
|
</if>
|
<if test='comActMicroWishVO.userId != null and comActMicroWishVO.userId != 0'>
|
AND w.sponsor_id =#{comActMicroWishVO.userId}
|
</if>
|
<if test='comActMicroWishVO.sponsorId != null and comActMicroWishVO.sponsorId != 0'>
|
AND w.sponsor_id =#{comActMicroWishVO.sponsorId}
|
</if>
|
<if test='comActMicroWishVO.handleId != null and comActMicroWishVO.handleId != 0'>
|
AND FIND_IN_SET(#{comActMicroWishVO.handleId},w.handle_id) > 0
|
</if>
|
</where>
|
group by w.id
|
ORDER BY w.create_at desc
|
</select>
|
|
<select id="getWishHandleListAdmin" resultType="com.panzhihua.common.model.vos.user.SysUserVO">
|
<if test="type != null and type == 1">
|
select user_id,`name` as `name` from sys_user where `type` = 3 and community_id = ${communityId} and status = 1
|
</if>
|
<if test="type != null and type == 2">
|
select user_id,IFNULL(`name`,nick_name) as `name` from sys_user where `type` = 1 and user_id IN (select user_id from com_pb_member where community_id = ${communityId} AND audit_result = 1) and status = 1 and is_partymember = 1
|
</if>
|
<if test="type != null and type == 3">
|
select user_id,IFNULL(`name`,nick_name) as `name` from sys_user where `type` = 1 and user_id IN (select user_id from com_mng_volunteer_mng where community_id = ${communityId} AND state = 2) and status = 1 and is_volunteer = 1
|
</if>
|
<if test="type != null and type == 4">
|
select user_id,IFNULL(`name`,nick_name) as `name` from sys_user where `type` = 1 AND phone in (select DISTINCT(telephone) from com_act_social_worker where community_id = ${communityId}) and status = 1
|
</if>
|
<if test="type != null and type == 5">
|
select user_id,IFNULL(`name`,nick_name) as `name` from sys_user where `type` = 1 AND id_card in (select id_card from com_act_four_member where community_id = ${communityId}) and status = 1
|
</if>
|
</select>
|
|
<select id="getUserByUserId" resultType="com.panzhihua.common.model.vos.user.SysUserVO">
|
select user_id,IFNULL(`name`,nick_name) as `name`,`type`,is_volunteer,is_partymember from sys_user where user_id = #{userId}
|
</select>
|
|
<select id="pageMicroWishAdmin" resultType="com.panzhihua.common.model.vos.community.ComActMicroWishVO">
|
SELECT
|
w.id,
|
u.`name` sponsor_name,
|
u.nick_name userNickName,
|
u.image_url ,
|
w.sponsor_phone,
|
w.wish_name,
|
w.`status`,
|
w.`feedback_at`,
|
w.`examine_at`,
|
w.`distribution_at`,
|
w.`evaluate_at`,
|
w.`photo_path_list`,
|
count(wu.id)star_num,
|
w.`detail`,
|
w.form,
|
w.reject_reason,
|
w.score,
|
w.img_width,
|
w.finish_at,
|
w.aim_num,
|
w.img_height,
|
w.handle_id,
|
w.create_at
|
FROM
|
com_act_micro_wish w
|
left join com_act_micro_wish_user wu on w.id=wu.micro_wish_id
|
left JOIN sys_user u ON w.sponsor_id = u.user_id
|
LEFT JOIN (SELECT * FROM com_act_easy_photo_handler WHERE service_type = 2) ch ON w.id = ch.service_id
|
LEFT JOIN sys_user u2 ON ch.user_id = u2.user_id
|
<where>
|
<if test='comActMicroWishVO.communityId != null and comActMicroWishVO.communityId != 0'>
|
and w.community_id = ${comActMicroWishVO.communityId}
|
</if>
|
<if test='comActMicroWishVO.createBegin != null '>
|
AND w.create_at BETWEEN #{comActMicroWishVO.createBegin}
|
AND #{comActMicroWishVO.createEnd}
|
</if>
|
<if test='comActMicroWishVO.sponsorPhone != null and comActMicroWishVO.sponsorPhone != ""'>
|
AND u.`phone` like concat(#{comActMicroWishVO.sponsorPhone},'%')
|
</if>
|
<if test='comActMicroWishVO.sponsorName != null and comActMicroWishVO.sponsorName != ""'>
|
AND u.`name` like concat(#{comActMicroWishVO.sponsorName},'%')
|
</if>
|
<if test='comActMicroWishVO.responsibleName != null and comActMicroWishVO.responsibleName != ""'>
|
AND u2.`name` like concat(#{comActMicroWishVO.responsibleName},'%')
|
</if>
|
<if test='comActMicroWishVO.status != null'>
|
AND w.`status` = #{comActMicroWishVO.status}
|
</if>
|
</where>
|
group by w.id
|
|
ORDER BY w.create_at desc
|
</select>
|
|
|
<select id="detailMicroWish" resultType="com.panzhihua.common.model.vos.community.ComActMicroWishVO">
|
SELECT
|
w.id,
|
u.name sponsor_name,
|
u.nick_name userNickName,
|
w.create_at,
|
w.aim_num,
|
u.image_url,
|
w.sponsor_phone,
|
w.`status`,
|
w.`sponsor_id`,
|
w.wish_name,
|
count(wu.id)starNum,
|
w.detail,
|
w.photo_path_list,
|
su.`name` responsible_name,
|
w.form,
|
w.reject_reason,
|
w.community_id,
|
w.examine_at,
|
w.finish,
|
w.finish_photo_path_list,
|
w.finish_at,
|
w.score,
|
w.feedback,
|
w.feedback_at,
|
w.feedback_photo_path_list,
|
w.distribution_at,
|
w.evaluate_at,
|
w.img_width,
|
w.img_height,
|
w.handle_id,
|
w.evaluate
|
FROM
|
com_act_micro_wish w
|
LEFT JOIN sys_user u ON w.sponsor_id = u.user_id
|
LEFT JOIN com_pb_service_team su ON w.responsible_id = su.id
|
LEFT JOIN com_act_micro_wish_user wu ON w.id = wu.micro_wish_id
|
LEFT JOIN (SELECT * FROM com_act_easy_photo_handler WHERE service_type = 2) ch ON w.id = ch.service_id
|
LEFT JOIN sys_user u2 ON ch.user_id = u2.user_id
|
WHERE
|
w.id =#{id}
|
</select>
|
|
|
|
|
<!-- <select id="selectRealizePercent" resultType="com.panzhihua.common.model.vos.community.StatisticsCommVO">-->
|
<!-- SELECT t1.filed, t1.num, ROUND( t1.num / t2.sum * 100, 2 ) AS percent-->
|
<!-- FROM-->
|
<!-- (SELECT IF(`status` = 6,'已实现','待实现') AS filed, COUNT(`status`) AS num FROM com_act_micro_wish-->
|
<!-- WHERE community_id = ${communityId} AND `status` NOT IN(1,4) GROUP BY filed) t1,-->
|
<!-- (SELECT COUNT(id) AS sum FROM com_act_micro_wish WHERE community_id = ${communityId} AND `status` NOT IN(1,4)) t2-->
|
<!-- </select>-->
|
|
<select id="selectRealizePercent" resultType="com.panzhihua.common.model.vos.community.StatisticsCommVO">
|
SELECT t1.filed, t1.num, ROUND( t1.num / t2.sum * 100, 2 ) AS percent
|
FROM
|
(SELECT IF(`state` = 2,'已实现','待实现') AS filed, COUNT(`state`) AS num FROM jinhui_micro_volunteering
|
GROUP BY filed) t1,
|
(SELECT COUNT(id) AS sum FROM jinhui_micro_volunteering) t2
|
</select>
|
<!-- <select id="getPassedAllImages" resultType="java.lang.String">-->
|
<!-- SELECT photo_path_list FROM com_act_micro_wish-->
|
<!-- WHERE community_id = ${communityId} AND (`status` =2 OR `status` = 3 OR `status` = 5 OR `status` = 6 OR `status` = 7)-->
|
<!-- AND photo_path_list IS NOT NULL AND photo_path_list != ''-->
|
<!-- ORDER BY create_at DESC limit #{pageSize}-->
|
<!-- </select>-->
|
|
<select id="getPassedAllImages" resultType="java.lang.String">
|
SELECT img_url as photoPathList FROM jinhui_micro_volunteering
|
WHERE img_url IS NOT NULL AND img_url != ''
|
ORDER BY creation_time DESC limit #{pageSize}
|
</select>
|
|
<select id="selectIndexMicroWishBaseData"
|
resultType="com.panzhihua.common.model.vos.community.bigscreen.BigScreenMicroWishStatisticsInfo">
|
SELECT
|
(SELECT COUNT(id) FROM com_act_micro_wish WHERE community_id = ${communityId} AND `status` NOT IN(1,4)) AS microWishTotal,
|
(SELECT COUNT(id) FROM com_act_micro_wish WHERE community_id = ${communityId} AND `status` = 6) AS microWishRealized,
|
(SELECT COUNT(id) FROM com_act_micro_wish WHERE community_id = ${communityId} AND `status` NOT IN(1,4,6)) AS microWishUnrealized
|
</select>
|
<select id="getMicroWishAddPolylineData"
|
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_micro_wish
|
WHERE community_id = ${communityId} AND `status` NOT IN(1,4) 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="getMicroWishTotalPolylineDate"
|
resultType="com.panzhihua.common.model.vos.community.StatisticsCommVO">
|
SELECT COUNT(id) AS num FROM com_act_micro_wish
|
WHERE community_id = ${communityId} AND `status` NOT IN(1,4) AND DATE_FORMAT( create_at, '%Y-%m' ) <= #{date}
|
</select>
|
<select id="selectScreenDisplayList"
|
resultType="com.panzhihua.common.model.vos.community.ComActMicroWishVO">
|
SELECT id, `status`, detail, photo_path_list
|
FROM com_act_micro_wish
|
WHERE community_id = ${pageBaseDTO.communityId} AND `status` NOT IN(1,4) ORDER BY create_at DESC
|
</select>
|
<select id="pagePartyBuildIngMicroWish"
|
resultType="com.panzhihua.common.model.vos.community.ComActMicroWishVO">
|
SELECT t2.id, t2.photo_path_list
|
FROM com_act_easy_photo_handler t1
|
INNER JOIN com_act_micro_wish t2 ON t1.service_id = t2.id
|
WHERE t1.community_id = #{pageBaseDTO.communityId} AND t1.`type` = 2 AND t1.service_type = 2 AND t2.`status` = 6 AND t2.photo_path_list IS NOT NULL
|
</select>
|
<select id="pageFourMemberResolve" resultType="com.panzhihua.common.model.vos.community.ComActMicroWishVO">
|
SELECT * FROM(
|
SELECT t2.id, t2.photo_path_list
|
FROM com_act_easy_photo_handler t1
|
INNER JOIN com_act_micro_wish t2 ON t1.service_id = t2.id
|
WHERE t1.community_id = #{pageBaseDTO.communityId} AND t1.`type` = 5 AND t1.service_type = 2 AND t2.`status` = 6 AND t2.photo_path_list IS NOT NULL
|
UNION ALL
|
SELECT t2.id, t2.photo_path_list
|
FROM com_act_easy_photo_handler t1
|
INNER JOIN com_act_easy_photo t2 ON t1.service_id = t2.id
|
WHERE t1.community_id = #{pageBaseDTO.communityId} AND t1.`type` = 5 AND t1.service_type = 1 AND t2.`status` = 5 AND t2.photo_path_list IS NOT NULL
|
) temp
|
</select>
|
|
</mapper>
|