<?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.ComActReserveMapper">
|
|
<!-- 通用查询映射结果 -->
|
<resultMap id="BaseResultMap" type="com.panzhihua.service_community.model.dos.ComActReserveDO">
|
<id column="id" property="id"/>
|
<result column="community_id" property="communityId"/>
|
<result column="type" property="type"/>
|
<result column="title" property="title"/>
|
<result column="view_num" property="viewNum"/>
|
<result column="join_all_count" property="joinAllCount"/>
|
<result column="join_count" property="joinCount"/>
|
<result column="img_type" property="imgType"/>
|
<result column="img_url" property="imgUrl"/>
|
<result column="status" property="status"/>
|
<result column="publish_time" property="publishTime"/>
|
<result column="is_repeat" property="isRepeat"/>
|
<result column="remark" property="remark"/>
|
<result column="json_object" property="jsonObject"/>
|
<result column="adver_position_top" property="adverPositionTop"/>
|
<result column="adver_position_application" property="adverPositionApplication"/>
|
<result column="create_at" property="createAt"/>
|
<result column="create_by" property="createBy"/>
|
<result column="update_at" property="updateAt"/>
|
<result column="update_by" property="updateBy"/>
|
<result column="end_time" property="endTime"/>
|
<result column="is_del" property="isDel"/>
|
</resultMap>
|
|
<!-- 通用查询结果列 -->
|
<sql id="Base_Column_List">
|
id, community_id, type, title, view_num, join_all_count, join_count, img_type, img_url, status, publish_time, is_repeat, remark, json_object, adver_position_top, adver_position_application, create_at, create_by, update_at, update_by, end_time, is_del
|
</sql>
|
|
<select id="indexBanner" resultType="com.panzhihua.common.model.vos.community.ComActReserveIndexVo">
|
select id,title,type,img_type, img_url,adver_position_top, adver_position_application from com_act_reserve
|
where
|
status = 2 and adver_position_top = 1
|
<if test="communityId !=null">
|
and community_id = ${communityId}
|
</if>
|
|
</select>
|
|
<select id="indexApplication" resultType="com.panzhihua.common.model.vos.community.ComActReserveIndexVo">
|
select id,title,type,img_type, img_url,adver_position_top, adver_position_application from com_act_reserve
|
<where>
|
status = 2 and adver_position_application = 1
|
<if test="communityId !=null">
|
and community_id = ${communityId}
|
</if>
|
</where>
|
order by create_at desc
|
</select>
|
|
|
|
<select id="pageReserveAdmin" parameterType="com.panzhihua.common.model.dtos.community.reserve.PageReserveAdminDTO"
|
resultType="com.panzhihua.common.model.vos.community.reserve.ComActReserveListAdminVO">
|
SELECT
|
t.id,
|
t.community_id,
|
t.`type`,
|
t.title,
|
view_num,
|
join_all_count,
|
join_count,
|
t.`status`,
|
publish_time,
|
t.create_at,
|
end_time,
|
adver_position_top,
|
adver_position_application,
|
t1.`name` as community_name
|
FROM
|
com_act_reserve t left join com_act t1 on t.community_id = t1.community_id
|
<where>
|
and t.is_del = 2
|
<if test="pageReserveDTO.communityId != null and pageReserveDTO.communityId !=0">
|
and t.community_id = ${pageReserveDTO.communityId}
|
</if>
|
<if test="pageReserveDTO.areaCode !=null">
|
and t1.area_code = #{pageReserveDTO.areaCode}
|
</if>
|
<if test="pageReserveDTO.type != null and pageReserveDTO.type.size > 0">
|
and t.`type` in
|
<foreach collection='pageReserveDTO.type' item='id' index='index' open='(' close=')' separator=',' >
|
#{id}
|
</foreach>
|
</if>
|
<if test="pageReserveDTO.status != null">
|
and t.status = #{pageReserveDTO.status}
|
</if>
|
<if test="pageReserveDTO.advertType != null and pageReserveDTO.advertType == 1">
|
and adver_position_top = 2 and adver_position_application = 2
|
</if>
|
<if test="pageReserveDTO.advertType != null and pageReserveDTO.advertType == 2">
|
and adver_position_top = 1
|
</if>
|
<if test="pageReserveDTO.advertType != null and pageReserveDTO.advertType == 3">
|
and adver_position_application = 1
|
</if>
|
<if test="pageReserveDTO.keyWord != null and pageReserveDTO.keyWord != """>
|
and title like concat (#{pageReserveDTO.keyWord},'%')
|
</if>
|
<if test="pageReserveDTO.startTime != null and pageReserveDTO.startTime != """>
|
AND DATE_FORMAT(t.create_at,'%Y-%m-%d %H:%i:%s') <![CDATA[ >= ]]> #{pageReserveDTO.startTime}
|
</if>
|
<if test="pageReserveDTO.endTime != null and pageReserveDTO.endTime != """>
|
AND DATE_FORMAT(t.create_at,'%Y-%m-%d %H:%i:%s') <![CDATA[ <= ]]> #{pageReserveDTO.endTime}
|
</if>
|
<if test="pageReserveDTO.isWjw !=null">
|
AND (title like '%返攀%' or title like '%居家%')
|
</if>
|
</where>
|
order by t.create_at desc
|
</select>
|
|
<delete id="deleteReserveSubAll">
|
delete from com_act_reserve_sub where reserve_id = #{reserveId};
|
delete from com_act_reserve_sub_selection where reserve_id = #{reserveId};
|
</delete>
|
|
<select id="getReserveMakeLeftStatistics" resultType="com.panzhihua.common.model.vos.community.reserve.ComActReserveMakeLeftStatisticsAdminVO">
|
SELECT
|
date_format( reserve_time, '%Y-%m-%d' ) AS reserveTime,
|
count( id ) AS count
|
FROM
|
com_act_reserve_record
|
WHERE
|
`status` = 2
|
AND type = 1
|
AND community_id = ${communityId}
|
|
group by reserveTime
|
</select>
|
|
<select id="getReserveMakeRightStatistics" parameterType="com.panzhihua.common.model.dtos.community.reserve.ComActReserveMakeStatisticsDTO"
|
resultType="com.panzhihua.common.model.vos.community.reserve.ComActReserveMakeRightStatisticsAdminVO">
|
SELECT
|
date_format( carr.reserve_time, '%Y-%m-%d' ) AS reserveTime,
|
car.title AS title,
|
count( carr.id ) AS count
|
FROM
|
com_act_reserve_record AS carr
|
LEFT JOIN com_act_reserve AS car ON car.id = carr.reserve_id
|
WHERE
|
carr.`status` = 2
|
AND carr.type = 1
|
AND carr.community_id = ${makeStatisticsDTO.communityId}
|
<if test="makeStatisticsDTO.startTime != null and makeStatisticsDTO.startTime != """>
|
AND carr.reserve_time <![CDATA[ >= ]]> #{makeStatisticsDTO.startTime}
|
</if>
|
<if test="makeStatisticsDTO.endTime != null and makeStatisticsDTO.endTime != """>
|
AND carr.reserve_time <![CDATA[ <= ]]> #{makeStatisticsDTO.endTime}
|
</if>
|
GROUP BY
|
reserveTime,
|
car.id
|
</select>
|
|
<select id="getReserveRecordCount" resultType="integer">
|
select count(id) from com_act_reserve_record
|
where `status` = 2 and `type` = 1 and community_id = ${communityId}
|
and reserve_time <![CDATA[ >= ]]> #{startTime}
|
and reserve_time <![CDATA[ <= ]]> #{endTime}
|
</select>
|
|
<select id="listReserveAdmin" parameterType="com.panzhihua.common.model.dtos.community.reserve.PageReserveAdminDTO"
|
resultType="com.panzhihua.common.model.vos.community.reserve.ComActReserveListAdminVO">
|
SELECT
|
id,
|
community_id,
|
`type`,
|
title,
|
view_num,
|
join_all_count,
|
join_count,
|
`status`,
|
publish_time,
|
create_at,
|
end_time,
|
adver_position_top,
|
adver_position_application
|
FROM
|
com_act_reserve
|
where is_del = 2 and `type` = 1 and community_id = ${communityId}
|
</select>
|
|
<update id="addReserveCountById">
|
update com_act_reserve set join_count = join_count - 1 where id = #{reserveId}
|
</update>
|
|
<select id="getReserveIndexList" resultType="com.panzhihua.common.model.vos.community.ComActReserveIndexVo">
|
select id,title,type,img_type,img_url,adver_position_top,adver_position_application from com_act_reserve where `status` = 2 and is_del = 2
|
and community_id = ${communityId}
|
order by create_at desc
|
</select>
|
|
<select id="indexBackReserve" resultType="Integer">
|
select count(*) from com_act_reserve t LEFT JOIN com_act_reserve_record t3 on t.id=t3.reserve_id where t.community_id = ${communityId} and ( t.title like '%返攀登记%' or t.title like '%来攀登记%')
|
</select>
|
|
<select id="indexHomeQuarantine" resultType="Integer">
|
select count(*) from com_act_reserve t LEFT JOIN com_act_reserve_record t3 on t.id=t3.reserve_id where t.community_id = ${communityId} and t.title like '%居家隔离%'
|
</select>
|
|
<select id="indexBackReserveSub" resultType="com.panzhihua.common.model.vos.community.bigscreen.IndexReserveSub">
|
select a.*,IFNULL(b.num,0) num from (select count(t2.id) as allCount,t1.key from com_act_reserve t
|
LEFT JOIN com_act_reserve_sub t1 on t.id = t1.reserve_id
|
LEFT JOIN com_act_reserve_answer_content t2 on t1.id = t2.reserve_sub_id
|
where t.community_id = ${communityId} and ( t.title like '%返攀登记%' or t.title like '%来攀登记%') and t1.`key` in (1,2,3,17,19,26) group by t1.key) a LEFT JOIN
|
(select count(t2.id) as num,t1.key from com_act_reserve t
|
LEFT JOIN com_act_reserve_sub t1 on t.id = t1.reserve_id
|
LEFT JOIN com_act_reserve_answer_content t2 on t1.id = t2.reserve_sub_id
|
where t.community_id = ${communityId} and ( t.title like '%返攀登记%' or t.title like '%来攀登记%') and t1.`key` in (1,2,3,17,19,26) and t2.answer_content = '是' group by t1.key) b on a.key = b.key
|
</select>
|
|
<select id="IndexHomeQuarantineSub" resultType="com.panzhihua.common.model.vos.community.bigscreen.IndexReserveSub">
|
select a.*,IFNULL(b.num,0) num from (select count(t2.id) as allCount,t1.key from com_act_reserve t
|
LEFT JOIN com_act_reserve_sub t1 on t.id = t1.reserve_id
|
LEFT JOIN com_act_reserve_answer_content t2 on t1.id = t2.reserve_sub_id
|
where t.community_id = ${communityId} and t.title like '%居家隔离%' and t1.`key` in (12,14,16) group by t1.key) a LEFT JOIN
|
(select count(t2.id) as num,t1.key from com_act_reserve t
|
LEFT JOIN com_act_reserve_sub t1 on t.id = t1.reserve_id
|
LEFT JOIN com_act_reserve_answer_content t2 on t1.id = t2.reserve_sub_id
|
where t.community_id = ${communityId} and t.title like '%居家隔离%' and t1.`key` in (12,14,16) and t2.answer_content = '是' group by t1.key) b on a.key = b.key
|
</select>
|
|
<select id="selectCommunityPhoneByReserveId" resultType="string">
|
select contacts_phone from com_act_reserve t left join com_act t1 on t.community_id = t1.community_id where t.id = #{reserveId}
|
</select>
|
</mapper>
|