Vous ne pouvez pas sélectionner plus de 25 sujets Les noms de sujets doivent commencer par une lettre ou un nombre, peuvent contenir des tirets ('-') et peuvent comporter jusqu'à 35 caractères.
 
 
 
 
 

130 lignes
5.0 KiB

  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.iformall.mapper.WxActivityJoinMapper">
  4. <resultMap id="BaseResultMap" type="com.iformall.domain.po.WxActivityJoin">
  5. <id column="id" jdbcType="BIGINT" property="id"/>
  6. <result column="tenant_id" jdbcType="VARCHAR" property="tenantId"/>
  7. <result column="parent_tenant_id" jdbcType="VARCHAR" property="parentTenantId" />
  8. <result column="user_id" jdbcType="BIGINT" property="userId"/>
  9. <result column="activity_id" jdbcType="BIGINT" property="activityId"/>
  10. <result column="name" jdbcType="VARCHAR" property="name"/>
  11. <result column="nick_name" jdbcType="VARCHAR" property="nickName"/>
  12. <result column="birthday" jdbcType="TIMESTAMP" property="birthday"/>
  13. <result column="sex" jdbcType="INTEGER" property="sex"/>
  14. <result column="phone" jdbcType="VARCHAR" property="phone"/>
  15. <result column="address" jdbcType="VARCHAR" property="address"/>
  16. <result column="answer" jdbcType="VARCHAR" property="answer"/>
  17. <result column="sign_in" jdbcType="INTEGER" property="signIn"/>
  18. <result column="status" jdbcType="INTEGER" property="status"/>
  19. <result column="create_time" jdbcType="TIMESTAMP" property="createTime"/>
  20. <result column="update_time" jdbcType="TIMESTAMP" property="updateTime"/>
  21. <result column="img_url" jdbcType="VARCHAR" property="imgUrl"/>
  22. <result column="send_msg" jdbcType="INTEGER" property="sendMsg"/>
  23. </resultMap>
  24. <sql id="allColumns">
  25. `id`,`tenant_id`,`parent_tenant_id`,`user_id`,`activity_id`,`name`,`nick_name`,`birthday`,`sex`,`phone`,
  26. `address`,`answer`,`sign_in`,`status`,`create_time`,`update_time`,`img_url`,`send_msg`
  27. </sql>
  28. <sql id="dynamicWhereConditions">
  29. where 1 = 1
  30. <if test=" null != id ">
  31. and `id` = #{id}
  32. </if>
  33. <if test=" null != tenantId and '' != tenantId">
  34. and `tenant_id` = #{tenantId}
  35. </if>
  36. <if test=" null != parentTenantId and '' != parentTenantId">
  37. and `parent_tenant_id` = #{parentTenantId}
  38. </if>
  39. <if test=" null != name and ''!=name">
  40. and `name` like concat('%', #{name},'%')
  41. </if>
  42. <if test=" null != phone and ''!=phone">
  43. and `phone` = #{phone}
  44. </if>
  45. <if test=" null != sex ">
  46. and `sex` = #{sex}
  47. </if>
  48. <if test=" null != signIn ">
  49. and `sign_in` = #{signIn}
  50. </if>
  51. <if test=" null != status ">
  52. and `status` = #{status}
  53. </if>
  54. <if test=" null != activityId ">
  55. and `activity_id` = #{activityId}
  56. </if>
  57. <if test=" null != sendMsg ">
  58. and `send_msg` = #{sendMsg}
  59. </if>
  60. <if test=" null != ids ">
  61. and id in
  62. <foreach collection="ids" index="index" item="idItem" open="(" separator="," close=")">
  63. #{idItem}
  64. </foreach>
  65. </if>
  66. <if test=" null != sortColumns">order by ${sortColumns}</if>
  67. </sql>
  68. <select id="findList" parameterType="com.iformall.domain.po.WxActivityJoin" resultMap="BaseResultMap">
  69. select
  70. <include refid="allColumns"/>
  71. from wx_activity_join
  72. <include refid="dynamicWhereConditions"/>
  73. </select>
  74. <select id="cfindList" parameterType="com.iformall.domain.po.WxActivityJoin"
  75. resultType="com.iformall.domain.po.WxActivity">
  76. select a.`id`,a.`tenant_id`,a.`parent_tenant_id`,a.`cover_img`,a.`title`,a.`sub_title`,a.`detail`,a.`html`,a.`activity_type`,a.`signup_examine`,a.`person_limit`,a.`activity_start_time`,a.`activity_end_time`,
  77. a.`use_credit`,a.`credit`,a.`type`,a.`status`,a.`start_time`,a.`end_time`,a.`question`,a.`is_expired`,a.`create_time`,a.`update_time`,a.`use_img`,
  78. a.`img_detail`,a.`send_msg`,a.`selectques`,aj.`status` join_status
  79. from wx_activity_join aj
  80. left join wx_activity a on aj.activity_id=a.id
  81. where aj.user_id=#{userId}
  82. <if test=" null != tenantId and '' != tenantId">
  83. and aj.`tenant_id` = #{tenantId}
  84. </if>
  85. <if test=" null != parentTenantId and '' != parentTenantId">
  86. and aj.`parent_tenant_id` = #{parentTenantId}
  87. </if>
  88. <if test=" null != statusStr and '' != statusStr">
  89. and a.`status` in (${statusStr})
  90. </if>
  91. <!-- <if test=" null != statusStr and ''!=statusStr">-->
  92. <!-- and aj.`status` in (${statusStr}) and a.`status`=2-->
  93. <!-- </if>-->
  94. <!-- <if test=" null != status">-->
  95. <!-- and a.`status`= 1-->
  96. <!-- </if>-->
  97. <if test=" null != status">
  98. and aj.`status`= #{status}
  99. </if>
  100. <if test=" null != sortColumns">order by aj.${sortColumns}</if>
  101. </select>
  102. <update id="updateSendMsg" parameterType="hashmap">
  103. update wx_activity_join set send_msg = #{send_msg} where id in
  104. <foreach collection="joinList" index="index" item="join" open="(" separator="," close=")">
  105. #{join.id}
  106. </foreach>
  107. </update>
  108. <update id="updateStatus" parameterType="java.util.List">
  109. update wx_activity_join set status = 3 where activity_id in
  110. <foreach collection="list" index="index" item="activity" open="(" separator="," close=")">
  111. #{activity.id}
  112. </foreach>
  113. </update>
  114. <update id="activityExpired">
  115. update wx_activity_join set `status`=2,update_time=now() where `status`= 0 and activity_id in (select id from wx_activity where is_expired=1)
  116. </update>
  117. </mapper>