<?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.ComActReserveRecordMapper">
|
|
<!-- 通用查询映射结果 -->
|
<resultMap id="BaseResultMap" type="com.panzhihua.service_community.model.dos.ComActReserveRecordDO">
|
<id column="id" property="id"/>
|
<result column="user_id" property="userId"/>
|
<result column="reserve_id" property="reserveId"/>
|
<result column="community_id" property="communityId"/>
|
<result column="type" property="type"/>
|
<result column="name" property="name"/>
|
<result column="phone" property="phone"/>
|
<result column="status" property="status"/>
|
<result column="content" property="content"/>
|
<result column="remark" property="remark"/>
|
<result column="act_remark" property="actRemark"/>
|
<result column="reserve_time" property="reserveTime"/>
|
<result column="json_object" property="jsonObject"/>
|
<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="handle_id" property="handleId"/>
|
</resultMap>
|
|
<!-- 通用查询结果列 -->
|
<sql id="Base_Column_List">
|
id, user_id, reserve_id, community_id, type, name, phone, status, content, remark, act_remark, reserve_time, json_object, create_at, create_by, update_at, update_by, handle_id
|
</sql>
|
|
<select id="pageReserveList" resultType="com.panzhihua.common.model.vos.community.reserve.ComActReserveAppletsVO">
|
select t.*,t1.title from com_act_reserve_record t left join com_act_reserve t1 on t.reserve_id = t1.id
|
<where>
|
1=1
|
<if test="pageUserReserveDTO.type !=null">
|
and t.type =#{pageUserReserveDTO.type}
|
</if>
|
<if test="pageUserReserveDTO.status !=null">
|
and t.status =#{pageUserReserveDTO.status}
|
</if>
|
<if test="pageUserReserveDTO.userId !=null">
|
and t.user_id =#{pageUserReserveDTO.userId}
|
</if>
|
</where>
|
order by t.create_at desc
|
</select>
|
|
<select id="pageMakeAdmin" parameterType="com.panzhihua.common.model.dtos.community.reserve.PageReserveMakeAdminDTO"
|
resultType="com.panzhihua.common.model.vos.community.reserve.ComActReserveMakeListAdminVO">
|
SELECT
|
carr.id,
|
su.nick_name,
|
su1.`name` as handleName,
|
carr.`name`,
|
carr.phone,
|
carr.reserve_time,
|
carr.`content`,
|
carr.remark,
|
carr.act_remark,
|
carr.create_at
|
FROM
|
com_act_reserve_record AS carr
|
LEFT JOIN sys_user AS su ON su.user_id = carr.user_id
|
LEFT JOIN sys_user AS su1 ON su1.user_id = carr.handle_id
|
where carr.status = 2 and carr.`type` = 1 and carr.reserve_id = #{pageMakeDTO.reserveId}
|
<if test="pageMakeDTO.startTime != null and pageMakeDTO.startTime != """>
|
AND carr.reserve_time <![CDATA[ >= ]]> #{pageMakeDTO.startTime}
|
</if>
|
<if test="pageMakeDTO.endTime != null and pageMakeDTO.endTime != """>
|
AND carr.reserve_time <![CDATA[ <= ]]> #{pageMakeDTO.endTime}
|
</if>
|
order by carr.create_at desc
|
</select>
|
|
<select id="getMakeDetailAdmin" resultType="com.panzhihua.common.model.vos.community.reserve.ComActReserveMakeDetailAdminVO">
|
SELECT
|
carr.id,
|
su.nick_name,
|
su1.`name` as handleName,
|
carr.`name`,
|
carr.phone,
|
carr.reserve_time,
|
carr.`content`,
|
carr.remark,
|
carr.act_remark,
|
carr.create_at
|
FROM
|
com_act_reserve_record AS carr
|
LEFT JOIN sys_user AS su ON su.user_id = carr.user_id
|
LEFT JOIN sys_user AS su1 ON su1.user_id = carr.handle_id
|
where carr.id = #{reserveRecordId}
|
</select>
|
|
<select id="getReserveStatusById" resultType="integer">
|
select count(id) from com_act_reserve_record where `status` in (3,4) and id in
|
<foreach collection='ids' item='id' index='index' open='(' close=')' separator=',' >
|
#{id}
|
</foreach>
|
</select>
|
|
<update id="editReserveStatusById">
|
update com_act_reserve_record set `status` = 4 where id in
|
<foreach collection='ids' item='id' index='index' open='(' close=')' separator=',' >
|
#{id}
|
</foreach>
|
</update>
|
|
<select id="exportMakeAdmin" parameterType="com.panzhihua.common.model.dtos.community.reserve.PageReserveMakeAdminDTO"
|
resultType="com.panzhihua.common.model.vos.community.reserve.ComActReserveMakeListAdminVO">
|
SELECT
|
carr.id,
|
su.nick_name,
|
su.`name` as handleName,
|
carr.`name`,
|
carr.phone,
|
carr.reserve_time,
|
carr.`content`,
|
carr.remark,
|
carr.act_remark,
|
carr.create_at
|
FROM
|
com_act_reserve_record AS carr
|
LEFT JOIN sys_user AS su ON su.user_id = carr.user_id
|
LEFT JOIN sys_user AS su1 ON su1.user_id = carr.handle_id
|
where carr.status = 2 and carr.`type` = 1 and carr.reserve_id = #{pageMakeDTO.reserveId}
|
<if test="pageMakeDTO.startTime != null and pageMakeDTO.startTime != """>
|
AND carr.reserve_time <![CDATA[ >= ]]> #{pageMakeDTO.startTime}
|
</if>
|
<if test="pageMakeDTO.endTime != null and pageMakeDTO.endTime != """>
|
AND carr.reserve_time <![CDATA[ <= ]]> #{pageMakeDTO.endTime}
|
</if>
|
<if test="pageMakeDTO.ids != null and pageMakeDTO.ids.size > 0">
|
AND carr.id in
|
<foreach collection='pageMakeDTO.ids' item='id' index='index' open='(' close=')' separator=',' >
|
#{id}
|
</foreach>
|
</if>
|
order by carr.create_at desc
|
</select>
|
|
<select id="registerStatisticsAdmin" parameterType="com.panzhihua.common.model.dtos.community.reserve.ComActReserveRegisterStatisticsDTO"
|
resultType="com.panzhihua.common.model.vos.community.reserve.ComActReserveRegisterStatisticsAdminVO">
|
SELECT
|
car.title,
|
count( carr.id ) AS count,
|
( SELECT count( id ) FROM com_act_reserve_record WHERE `type` = 2 AND community_id = ${registerStatisticsDTO.communityId} AND `status` = 2 ) AS allCount
|
FROM
|
com_act_reserve_record AS carr
|
LEFT JOIN com_act_reserve AS car ON car.id = carr.reserve_id
|
WHERE
|
carr.type = 2
|
AND carr.community_id = ${registerStatisticsDTO.communityId}
|
AND carr.`status` = 2
|
<if test="registerStatisticsDTO.startTime != null and registerStatisticsDTO.startTime != """>
|
AND DATE_FORMAT(carr.create_at,'%Y-%m-%d %H:%i:%s') <![CDATA[ >= ]]> #{registerStatisticsDTO.startTime}
|
</if>
|
<if test="registerStatisticsDTO.endTime != null and registerStatisticsDTO.endTime != """>
|
AND DATE_FORMAT(carr.create_at,'%Y-%m-%d %H:%i:%s') <![CDATA[ <= ]]> #{registerStatisticsDTO.endTime}
|
</if>
|
GROUP BY
|
car.id
|
</select>
|
|
<select id="registerStatisticsExportAdmin" parameterType="com.panzhihua.common.model.dtos.community.reserve.ComActReserveRegisterStatisticsDTO"
|
resultType="com.panzhihua.common.model.vos.community.reserve.ComActReserveRegisterStatisticsAdminVO">
|
SELECT
|
car.title,
|
count( carr.id ) AS count,
|
( SELECT count( id ) FROM com_act_reserve_record WHERE `type` = 2 AND community_id = ${registerStatisticsDTO.communityId} AND `status` = 2 ) AS allCount
|
FROM
|
com_act_reserve_record AS carr
|
LEFT JOIN com_act_reserve AS car ON car.id = carr.reserve_id
|
WHERE
|
carr.type = 2
|
AND carr.community_id = ${registerStatisticsDTO.communityId}
|
AND carr.`status` = 2
|
<if test="registerStatisticsDTO.startTime != null and registerStatisticsDTO.startTime != """>
|
AND DATE_FORMAT(carr.create_at,'%Y-%m-%d %H:%i:%s') <![CDATA[ >= ]]> #{registerStatisticsDTO.startTime}
|
</if>
|
<if test="registerStatisticsDTO.endTime != null and registerStatisticsDTO.endTime != """>
|
AND DATE_FORMAT(carr.create_at,'%Y-%m-%d %H:%i:%s') <![CDATA[ <= ]]> #{registerStatisticsDTO.endTime}
|
</if>
|
GROUP BY
|
car.id
|
</select>
|
|
<select id="pageMakeHandleAdmin" parameterType="com.panzhihua.common.model.dtos.community.reserve.PageReserveMakeHandleAdminDTO"
|
resultType="com.panzhihua.common.model.vos.community.reserve.ComActReserveMakeHandleListAdminVO">
|
SELECT
|
carr.id,
|
su.nick_name,
|
carr.`name`,
|
carr.phone,
|
carr.reserve_time,
|
carr.`content`,
|
su1.`name` as remark,
|
carr.act_remark,
|
carr.`status`,
|
car.`title`,
|
carr.create_at
|
FROM
|
com_act_reserve_record AS carr
|
LEFT JOIN sys_user AS su ON su.user_id = carr.user_id
|
LEFT JOIN sys_user AS su1 ON su1.user_id = carr.handle_id
|
LEFT JOIN com_act_reserve AS car ON car.id = carr.reserve_id
|
WHERE
|
carr.`type` = 1
|
<if test="pageMakeHandleDTO.keyWord != null and pageMakeHandleDTO.keyWord != """>
|
and (car.`title` like concat (#{pageMakeHandleDTO.keyWord},'%')
|
or carr.`name` like concat (#{pageMakeHandleDTO.keyWord},'%')
|
or su.nick_name like concat (#{pageMakeHandleDTO.keyWord},'%'))
|
</if>
|
<if test="pageMakeHandleDTO.status != null and pageMakeHandleDTO.status.size > 0">
|
and carr.`status` in
|
<foreach collection='pageMakeHandleDTO.status' item='id' index='index' open='(' close=')' separator=',' >
|
#{id}
|
</foreach>
|
</if>
|
<if test="pageMakeHandleDTO.reserveId != null ">
|
and carr.reserve_id = #{pageMakeHandleDTO.reserveId}
|
</if>
|
<if test="pageMakeHandleDTO.communityId != null ">
|
and carr.community_id = ${pageMakeHandleDTO.communityId}
|
</if>
|
<if test="pageMakeHandleDTO.startTime != null and pageMakeHandleDTO.startTime != """>
|
AND DATE_FORMAT(carr.reserve_time,'%Y-%m-%d %H:%i:%s') <![CDATA[ >= ]]> #{pageMakeHandleDTO.startTime}
|
</if>
|
<if test="pageMakeHandleDTO.endTime != null and pageMakeHandleDTO.endTime != """>
|
AND DATE_FORMAT(carr.reserve_time,'%Y-%m-%d %H:%i:%s') <![CDATA[ <= ]]> #{pageMakeHandleDTO.endTime}
|
</if>
|
order by carr.create_at desc
|
</select>
|
|
<select id="getReserveListCountByIds" resultType="integer">
|
select count(id) from com_act_reserve_record where `status` != 1 and `type` = 1 and id in
|
<foreach collection='ids' item='id' index='index' open='(' close=')' separator=',' >
|
#{id}
|
</foreach>
|
</select>
|
|
<select id="exportMakeHandleAdmin" parameterType="com.panzhihua.common.model.dtos.community.reserve.PageReserveMakeHandleAdminDTO"
|
resultType="com.panzhihua.common.model.vos.community.reserve.ComActReserveMakeHandleListAdminVO">
|
SELECT
|
carr.id,
|
su.nick_name,
|
su1.`name` as handleName,
|
carr.`name`,
|
carr.phone,
|
carr.reserve_time,
|
carr.`content`,
|
carr.remark,
|
carr.act_remark,
|
carr.`status`,
|
car.`title`,
|
carr.create_at
|
FROM
|
com_act_reserve_record AS carr
|
LEFT JOIN sys_user AS su ON su.user_id = carr.user_id
|
LEFT JOIN sys_user AS su1 ON su1.user_id = carr.handle_id
|
LEFT JOIN com_act_reserve AS car ON car.id = carr.reserve_id
|
WHERE
|
carr.`type` = 1
|
<if test="pageMakeHandleDTO.keyWord != null and pageMakeHandleDTO.keyWord != """>
|
and (car.`title` like concat (#{pageMakeHandleDTO.keyWord},'%')
|
or carr.`name` like concat (#{pageMakeHandleDTO.keyWord},'%')
|
or su.nick_name like concat (#{pageMakeHandleDTO.keyWord},'%'))
|
</if>
|
<if test="pageMakeHandleDTO.status != null and pageMakeHandleDTO.status.size > 0">
|
and carr.`status` in
|
<foreach collection='pageMakeHandleDTO.status' item='id' index='index' open='(' close=')' separator=',' >
|
#{id}
|
</foreach>
|
</if>
|
<if test="pageMakeHandleDTO.reserveId != null ">
|
and carr.reserve_id = #{pageMakeHandleDTO.reserveId}
|
</if>
|
<if test="pageMakeHandleDTO.communityId != null ">
|
and carr.community_id = ${pageMakeHandleDTO.communityId}
|
</if>
|
<if test="pageMakeHandleDTO.startTime != null and pageMakeHandleDTO.startTime != """>
|
AND DATE_FORMAT(carr.reserve_time,'%Y-%m-%d %H:%i:%s') <![CDATA[ >= ]]> #{pageMakeHandleDTO.startTime}
|
</if>
|
<if test="pageMakeHandleDTO.endTime != null and pageMakeHandleDTO.endTime != """>
|
AND DATE_FORMAT(carr.reserve_time,'%Y-%m-%d %H:%i:%s') <![CDATA[ <= ]]> #{pageMakeHandleDTO.endTime}
|
</if>
|
<if test="pageMakeHandleDTO.ids != null and pageMakeHandleDTO.ids.size > 0">
|
and carr.id in
|
<foreach collection='pageMakeHandleDTO.ids' item='id' index='index' open='(' close=')' separator=',' >
|
#{id}
|
</foreach>
|
</if>
|
order by carr.create_at desc
|
</select>
|
|
<select id="getRegisterDetailedByRecordId" resultType="com.panzhihua.common.model.vos.community.reserve.ComActReserveRegisterDetailedVO">
|
SELECT
|
carr.create_at,
|
carr.id,
|
su.nick_name,
|
su.is_partymember,
|
su.is_volunteer
|
FROM
|
com_act_reserve_record AS carr
|
LEFT JOIN sys_user AS su ON su.user_id = carr.user_id
|
where carr.id = #{reserveRecordId}
|
</select>
|
|
<select id="queryAll" resultType="com.panzhihua.common.model.vos.community.reserve.ComOperationListVO" parameterType="com.panzhihua.common.model.dtos.community.OperationDetailDTO">
|
select * from com_act_reserve_operation_record
|
<where>
|
<if test="reserveRecordId!=null">
|
and reserve_record_id =#{reserveRecordId}
|
</if>
|
<if test="type!=null">
|
and type =#{type}
|
</if>
|
</where>
|
order by create_at desc
|
</select>
|
|
<select id="biggestScreen" resultType="com.panzhihua.common.model.vos.community.bigscreen.BigScreenStaticsReserve">
|
select (select count(*) from com_act_reserve_record t LEFT JOIN com_act_reserve t1 on t.reserve_id = t1.id where (t1.title like '%居家%' or t1.title like '%返攀%' or t1.title like '%来攀%' or t1.title like '%燃气%' or t1.title like '%防火%') and t1.community_id = ${communityId}) count,
|
(select count(*) from com_act_reserve_record t LEFT JOIN com_act_reserve t1 on t.reserve_id = t1.id where (t1.title like '%居家%' or t1.title like '%返攀%' or t1.title like '%来攀%' ) and t1.community_id = ${communityId}) epidemicCount,
|
(select count(*) from com_act_reserve_record t LEFT JOIN com_act_reserve t1 on t.reserve_id = t1.id where (t1.title like '%燃气%' ) and t1.community_id = ${communityId}) gasCount,
|
(select count(*) from com_act_reserve_record t LEFT JOIN com_act_reserve t1 on t.reserve_id = t1.id where (t1.title like '%防火%' ) and t1.community_id = ${communityId}) fireCount,
|
(select count(*) from com_act_reserve_record t LEFT JOIN com_act_reserve t1 on t.reserve_id = t1.id where (t1.title like '%居家%' ) and t1.community_id = ${communityId}) homeCount,
|
(select count(*) from com_act_reserve_record t LEFT JOIN com_act_reserve t1 on t.reserve_id = t1.id where (t1.title like '%返攀%' or t1.title like '%来攀%' ) and t1.community_id = ${communityId}) reserveCount
|
</select>
|
|
<select id="biggestScreenMonth" resultType="com.panzhihua.common.model.vos.community.bigscreen.BigScreenStaticsReserveMonth">
|
select (select count(*) from com_act_reserve_record t LEFT JOIN com_act_reserve t1 on t.reserve_id = t1.id where (t1.title like '%居家%' or t1.title like '%返攀%' or t1.title like '%来攀%' or t1.title like '%燃气%' or t1.title like '%防火%') and t1.community_id = ${communityId} and t.create_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') >=t.create_at ) count,
|
(select count(*) from com_act_reserve_record t LEFT JOIN com_act_reserve t1 on t.reserve_id = t1.id where (t1.title like '%燃气%' ) and t1.community_id = ${communityId} and t.create_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') >=t.create_at) gasCount,
|
(select count(*) from com_act_reserve_record t LEFT JOIN com_act_reserve t1 on t.reserve_id = t1.id where (t1.title like '%防火%' ) and t1.community_id = ${communityId} and t.create_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') >=t.create_at) fireCount,
|
(select count(*) from com_act_reserve_record t LEFT JOIN com_act_reserve t1 on t.reserve_id = t1.id where (t1.title like '%居家%' ) and t1.community_id = ${communityId} and t.create_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') >=t.create_at) homeCount,
|
(select count(*) from com_act_reserve_record t LEFT JOIN com_act_reserve t1 on t.reserve_id = t1.id where (t1.title like '%返攀%' or t1.title like '%来攀%' ) and t1.community_id = ${communityId} and t.create_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') >=t.create_at) reserveCount
|
</select>
|
</mapper>
|