123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109 |
- <?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.huiju.estateagents.mapper.HelpActivityMapper">
- <select id="helpActivityListPage" resultType="com.huiju.estateagents.entity.HelpActivity">
- SELECT
- COUNT(hir.verification) as succeedCount,
- ha.*
- FROM
- ta_help_activity ha
- LEFT JOIN ta_help_initiate_record hir ON ha.help_activity_id = hir.help_activity_id
- AND (hir.verification is NULL or hir.verification != '')
- <where>
- <if test="cityId != null and cityId != ''">
- and ha.city_id = #{cityId}
- </if>
- <if test="buildingId != null and buildingId != ''">
- and ha.building_id = #{buildingId}
- </if>
- <if test="title != null and title != ''">
- and ha.title like CONCAT('%',#{title}, '%')
- </if>
- <if test="startDate != null and startDate != ''and startDate!='Invalid date'">
- and date_format(ha.start_date,'%Y-%m-%d') = date_format( #{startDate}, '%Y-%m-%d' )
- </if>
- <if test="endDate != null and endDate != ''and endDate!='Invalid date'">
- and date_format(ha.end_date,'%Y-%m-%d') = date_format( #{endDate}, '%Y-%m-%d' )
- </if>
- <if test="activityStatus != null and activityStatus != null">
- and ha.activity_status = #{activityStatus}
- </if>
- and ha.org_id=#{orgId}
- </where>
- GROUP BY ha.help_activity_id
- order by ha.activity_status = 0 desc,
- ha.activity_status = 1 desc,
- ha.activity_status = 2 desc,
- ha.start_date asc
- </select>
-
- <update id="updateUnStartHelpActivity">
- update ta_help_activity t
- set activity_status = 0
- where
- t.activity_status != '2' and NOW() BETWEEN t.start_date and t.end_date
- </update>
-
- <update id="updateProcessingHelpActivity">
- update ta_help_activity t
- set activity_status = 2
- where
- t.activity_status != '2'
- and NOW() > t.end_date
- </update>
-
- <select id="selectWxhelpActivityAndGroup" resultType="com.huiju.estateagents.entity.HelpActivity">
- (
- SELECT
- a.city_id as cityId,
- a.help_activity_id as activityId,
- a.img as img,
- 1 AS type
- FROM
- ta_help_activity a
- WHERE
- a.org_id =#{orgId}
- and a.is_main = 1
- and a.city_id = #{cityID}
- <if test="buildingId != null and buildingId != ''">
- and a.building_id = #{buildingId}
- </if>
- )
- UNION ALL
- (
- SELECT
- s.city_id as cityId,
- s.group_activity_id as activityId,
- s.main_img as img,
- 2 AS type
- FROM
- ta_share_activity s
- WHERE
- s.org_id =#{orgId}
- and s.sort = 1
- and s.city_id = #{cityID}
- <if test="buildingId != null and buildingId != ''">
- and s.building_id = #{buildingId}
- </if>
- )
- </select>
-
- <select id="helpActivityListEffectivePage" resultType="com.huiju.estateagents.entity.HelpActivity">
- SELECT
- ha.*
- FROM
- ta_help_activity ha
- <where>
- <if test="cityId != null and cityId != ''">
- and ha.city_id = #{cityId}
- </if>
- and ha.org_id=#{orgId}
- and ha.activity_status in (0, 1)
- </where>
- GROUP BY ha.help_activity_id
- order by ha.activity_status = 0 desc,
- ha.activity_status = 1 desc,
- ha.activity_status = 2 desc,
- ha.start_date asc
- </select>
- </mapper>
|