Вы не можете выбрать более 25 тем Темы должны начинаться с буквы или цифры, могут содержать дефисы(-) и должны содержать не более 35 символов.
 
 
 
 
 

120 строки
4.4 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.cover_img,a.title,a.activity_start_time,a.activity_end_time,aj.`status`
  77. from wx_activity_join aj left join wx_activity a on aj.activity_id=a.id
  78. where aj.user_id=#{userId}
  79. <if test=" null != tenantId and '' != tenantId">
  80. and aj.`tenant_id` = #{tenantId}
  81. </if>
  82. <if test=" null != parentTenantId and '' != parentTenantId">
  83. and aj.`parent_tenant_id` = #{parentTenantId}
  84. </if>
  85. <if test=" null != statusStr and ''!=statusStr">
  86. and aj.`status` in (${statusStr}) and a.`status`=2
  87. </if>
  88. <if test=" null != status">
  89. and a.`status`= 1
  90. </if>
  91. <if test=" null != sortColumns">order by aj.${sortColumns}</if>
  92. </select>
  93. <update id="updateSendMsg" parameterType="hashmap">
  94. update wx_activity_join set send_msg = #{send_msg} where id in
  95. <foreach collection="joinList" index="index" item="join" open="(" separator="," close=")">
  96. #{join.id}
  97. </foreach>
  98. </update>
  99. <update id="updateStatus" parameterType="java.util.List">
  100. update wx_activity_join set status = 3 where activity_id in
  101. <foreach collection="list" index="index" item="activity" open="(" separator="," close=")">
  102. #{activity.id}
  103. </foreach>
  104. </update>
  105. <update id="activityExpired">
  106. 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)
  107. </update>
  108. </mapper>