HelpInitiateRecordMapper.xml 3.5KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101
  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.HelpInitiateRecordMapper">
  4. <update id="updateHelpActivityProcessToEnd">
  5. update ta_help_initiate_record a
  6. left join ta_help_activity b on a.help_activity_id = b.help_activity_id
  7. set a.status = '2'
  8. where (NOW() > b.end_date or b.activity_status = '2') and a.`status` = '1' and a.status != '0'
  9. </update>
  10. <select id="selectPageList" resultType="com.huiju.estateagents.entity.HelpInitiateRecord">
  11. SELECT
  12. hi.*
  13. FROM
  14. ta_help_initiate_record as hi
  15. LEFT JOIN ta_help_activity ha ON hi.help_activity_id = ha.help_activity_id
  16. <where>
  17. hi.help_activity_id = #{helpActivityId}
  18. <if test="status == 'helpSucceed'">
  19. AND hi.verification !='null'
  20. AND hi.verification !=''
  21. </if>
  22. <if test="status == 'helpUnderway'">
  23. and (hi.verification is null OR hi.verification = '')
  24. AND hi.`status` = 1
  25. </if>
  26. <if test="status == 'helpUnfinished'">
  27. and (hi.verification is null
  28. OR hi.verification = '')
  29. AND hi.`status` = 2
  30. </if>
  31. <if test="tel != null and tel != ''">
  32. and hi.phone like concat('%',#{tel},'%')
  33. </if>
  34. </where>
  35. </select>
  36. <select id="getHelpInitiateRecordSucceedExportList" resultType="com.huiju.estateagents.excel.HelpInitiateRecordSucceed">
  37. SELECT
  38. b.name as name,
  39. b.create_date as createDate,
  40. b.phone as phone,
  41. b.succeed_date as succeedDate,
  42. if(b.verification_status = 0, '未核销', if(b.verification_status = 1, '已核销', '未知')) as verificationStatus
  43. from ta_help_initiate_record b
  44. where b.help_activity_id = #{helpActivityId}
  45. AND b.verification !='null'
  46. AND b.verification !=''
  47. <if test="tel != null and tel != ''">
  48. and b.phone like concat('%',#{tel},'%')
  49. </if>
  50. order by b.create_date desc
  51. limit #{pageCode}, #{pageSize}
  52. </select>
  53. <select id="getHelpProceedAndFinishExportList" resultType="com.huiju.estateagents.excel.HelpProceedAndFinish">
  54. SELECT
  55. b.name as name,
  56. b.create_date as createDate,
  57. b.phone as phone
  58. from ta_help_initiate_record b
  59. where b.help_activity_id = #{helpActivityId}
  60. <if test="condition == 'helpSucceed'">
  61. AND b.verification !='null'
  62. AND b.verification !=''
  63. </if>
  64. <if test="condition == 'helpUnderway'">
  65. and (b.verification is null OR b.verification = '')
  66. AND b.`status` = 1
  67. </if>
  68. <if test="condition == 'helpUnfinished'">
  69. and (b.verification is null
  70. OR b.verification = '')
  71. AND b.`status` = 2
  72. </if>
  73. <if test="tel != null and tel != ''">
  74. and b.phone like concat('%',#{tel},'%')
  75. </if>
  76. order by b.create_date desc
  77. limit #{pageCode}, #{pageSize}
  78. </select>
  79. <select id="getInitiateRecordList" resultType="com.huiju.estateagents.entity.HelpInitiateRecord">
  80. SELECT
  81. t.*,
  82. a.title,
  83. a.list_img as img,
  84. a.activity_status,
  85. a.end_date
  86. FROM
  87. ta_help_initiate_record t
  88. LEFT JOIN ta_help_activity a ON t.help_activity_id = a.help_activity_id
  89. WHERE
  90. t.org_id = #{orgId}
  91. AND t.person_id = #{personId}
  92. ORDER BY t.status, t.create_date desc
  93. </select>
  94. </mapper>