HelpActivityMapper.xml 2.7KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778
  1. <?xml version="1.0" encoding="UTF-8"?>
  2. <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
  3. <mapper namespace="com.huiju.estateagents.mapper.HelpActivityMapper">
  4. <select id="helpActivityListPage" resultType="com.huiju.estateagents.entity.HelpActivity">
  5. SELECT
  6. COUNT(hir.verification) as succeedCount,
  7. ha.*
  8. FROM
  9. ta_help_activity ha
  10. LEFT JOIN ta_help_initiate_record hir ON ha.help_activity_id = hir.help_activity_id
  11. AND (hir.verification is NULL or hir.verification != '')
  12. <where>
  13. <if test="cityId != null and cityId != ''">
  14. and ha.city_id = #{cityId}
  15. </if>
  16. <if test="buildingId != null and buildingId != ''">
  17. and ha.building_id = #{buildingId}
  18. </if>
  19. <if test="title != null and title != ''">
  20. and ha.title like CONCAT('%',#{title}, '%')
  21. </if>
  22. <if test="startDate != null and startDate != ''and startDate!='Invalid date'">
  23. and date_format(ha.start_date,'%Y-%m-%d') = date_format( #{startDate}, '%Y-%m-%d' )
  24. </if>
  25. <if test="endDate != null and endDate != ''and endDate!='Invalid date'">
  26. and date_format(ha.end_date,'%Y-%m-%d') = date_format( #{endDate}, '%Y-%m-%d' )
  27. </if>
  28. <if test="activityStatus != null and activityStatus != null">
  29. and ha.activity_status = #{activityStatus}
  30. </if>
  31. and ha.org_id=#{orgId}
  32. </where>
  33. GROUP BY ha.help_activity_id
  34. order by ha.activity_status = 0 desc,
  35. ha.activity_status = 1 desc,
  36. ha.activity_status = 2 desc,
  37. ha.start_date asc
  38. </select>
  39. <update id="updateUnStartHelpActivity">
  40. update ta_help_activity t set t.activity_status = 0
  41. where t.help_activity_id in
  42. <foreach collection="list" item="item" open="(" close=")" separator=",">
  43. #{item}
  44. </foreach>
  45. </update>
  46. <update id="updateEndHelpActivity">
  47. update ta_help_activity t set t.activity_status = 2
  48. where t.help_activity_id in
  49. <foreach collection="list" item="item" open="(" close=")" separator=",">
  50. #{item}
  51. </foreach>
  52. </update>
  53. <select id="selectWxhelpActivityAndGroup" resultType="com.huiju.estateagents.entity.HelpActivity">
  54. (
  55. SELECT
  56. a.help_activity_id as activityId,
  57. a.img as img,
  58. 1 AS type
  59. FROM
  60. ta_help_activity a
  61. WHERE a.is_main = 1
  62. and org_id =#{orgId}
  63. )
  64. UNION ALL
  65. (
  66. SELECT
  67. s.group_activity_id as activityId,
  68. s.main_img as img,
  69. 2 AS type
  70. FROM
  71. ta_share_activity s
  72. WHERE s.sort = 1
  73. and org_id =#{orgId}
  74. )
  75. </select>
  76. </mapper>