You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 

162 lines
6.3 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.WxActivityMapper">
  4. <resultMap id="BaseResultMap" type="com.iformall.domain.po.WxActivity">
  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="cover_img" jdbcType="VARCHAR" property="coverImg"/>
  9. <result column="title" jdbcType="VARCHAR" property="title"/>
  10. <result column="sub_title" jdbcType="VARCHAR" property="subTitle"/>
  11. <result column="detail" jdbcType="VARCHAR" property="detail"/>
  12. <result column="start_time" jdbcType="TIMESTAMP" property="startTime"/>
  13. <result column="end_time" jdbcType="TIMESTAMP" property="endTime"/>
  14. <result column="type" jdbcType="INTEGER" property="type"/>
  15. <result column="status" jdbcType="INTEGER" property="status"/>
  16. <result column="create_time" jdbcType="TIMESTAMP" property="createTime"/>
  17. <result column="update_time" jdbcType="TIMESTAMP" property="updateTime"/>
  18. <result column="html" jdbcType="VARCHAR" property="html"/>
  19. <result column="person_limit" jdbcType="INTEGER" property="personLimit"/>
  20. <result column="activity_type" jdbcType="INTEGER" property="activityType"/>
  21. <result column="signup_examine" jdbcType="INTEGER" property="signupExamine"/>
  22. <result column="activity_start_time" jdbcType="TIMESTAMP" property="activityStartTime"/>
  23. <result column="activity_end_time" jdbcType="TIMESTAMP" property="activityEndTime"/>
  24. <result column="use_credit" jdbcType="INTEGER" property="useCredit"/>
  25. <result column="credit" jdbcType="INTEGER" property="credit"/>
  26. <result column="question" jdbcType="VARCHAR" property="question"/>
  27. <result column="is_expired" jdbcType="INTEGER" property="isExpired"/>
  28. <result column="use_img" jdbcType="INTEGER" property="useImg"/>
  29. <result column="img_detail" jdbcType="VARCHAR" property="imgDetail"/>
  30. <result column="send_msg" jdbcType="INTEGER" property="sendMsg"/>
  31. <result column="selectques" jdbcType="VARCHAR" property="selectques"/>
  32. <result column="is_gain_credit" jdbcType="INTEGER" property="isGainCredit"/>
  33. <result column="gain_credit" jdbcType="INTEGER" property="gainCredit"/>
  34. <result column="is_score" jdbcType="INTEGER" property="isScore"/>
  35. <result column="score" jdbcType="INTEGER" property="score"/>
  36. </resultMap>
  37. <sql id="allColumns">
  38. `id`,`tenant_id`,`parent_tenant_id`,`cover_img`,`title`,`sub_title`,`detail`,`html`,`activity_type`,`signup_examine`,`person_limit`,`activity_start_time`,`activity_end_time`,
  39. `use_credit`,`credit`,`type`,`status`,`start_time`,`end_time`,`question`,`is_expired`,`create_time`,`update_time`,`use_img`,
  40. `img_detail`,`send_msg`,`selectques`,`is_gain_credit`,`gain_credit`,`is_score`,`score`
  41. </sql>
  42. <sql id="dynamicWhereConditions">
  43. where `is_del` = 0
  44. <if test=" null != id ">
  45. and `id` = #{id}
  46. </if>
  47. <if test=" null != tenantId and '' != tenantId">
  48. and `tenant_id` = #{tenantId}
  49. </if>
  50. <if test=" null != parentTenantId and '' != parentTenantId">
  51. and `parent_tenant_id` = #{parentTenantId}
  52. </if>
  53. <if test=" null != title ">
  54. and `title` like concat('%', #{title},'%')
  55. </if>
  56. <if test=" null != subTitle ">
  57. and `sub_title` like concat('%', #{subTitle},'%')
  58. </if>
  59. <if test=" null != detail ">
  60. and `detail` like concat('%', #{detail},'%')
  61. </if>
  62. <if test=" null != type ">
  63. and `type` = #{type}
  64. </if>
  65. <if test=" null != activityType ">
  66. and `activity_type` = #{activityType}
  67. </if>
  68. <if test=" null != signupExamine ">
  69. and `signup_examine` = #{signupExamine}
  70. </if>
  71. <if test=" null != status and status lt 3">
  72. and `status` = #{status}
  73. </if>
  74. <if test=" null != status and status == 3">
  75. and `status` &gt;= 2 and `status` &lt;= 3
  76. </if>
  77. <if test=" null != status and status == 4">
  78. and `status` &gt; 0
  79. </if>
  80. <if test=" null != createTime ">
  81. and `create_time` = #{createTime}
  82. </if>
  83. <if test=" null != updateTime ">
  84. and `update_time` = #{updateTime}
  85. </if>
  86. <if test=" null != useCredit ">
  87. and `use_credit` = #{useCredit}
  88. </if>
  89. <if test=" null != isExpired ">
  90. and `is_expired` = #{isExpired}
  91. </if>
  92. <!-- <if test=" null != startDate and null != endDate ">-->
  93. <!-- and `create_time` between #{starttime} and #{endtime}-->
  94. <!-- </if>-->
  95. <if test=" null != startDate and null != endDate ">
  96. and not(`activity_end_time` &lt; #{startDate, jdbcType=TIMESTAMP} or `activity_start_time` &gt; #{endDate, jdbcType=TIMESTAMP})
  97. <!-- and ((`activity_start_time` &gt;= #{startDate} and `activity_start_time` &lt;= #{endDate})
  98. or (`activity_end_time` &gt;= #{startDate} and `activity_end_time` &lt;= #{endDate})
  99. or (`activity_start_time` &lt;= #{startDate} and `activity_end_time` &gt;= #{endDate}))-->
  100. </if>
  101. <if test=" null != sendMsg ">
  102. and `send_msg` = #{sendMsg}
  103. </if>
  104. <if test=" null != ids ">
  105. and id in
  106. <foreach collection="ids" index="index" item="idItem" open="(" separator="," close=")">
  107. #{idItem}
  108. </foreach>
  109. </if>
  110. <if test=" null != sortColumns">order by ${sortColumns}</if>
  111. </sql>
  112. <select id="findList" parameterType="com.iformall.domain.po.WxActivity" resultMap="BaseResultMap">
  113. select
  114. <include refid="allColumns"/>
  115. from wx_activity
  116. <include refid="dynamicWhereConditions"/>
  117. </select>
  118. <select id="queryNotify" parameterType="com.iformall.domain.po.WxActivity"
  119. resultType="com.iformall.domain.po.WxActivity">
  120. select id,title,activity_start_time,tenant_id from wx_activity
  121. where status=${status}
  122. and DATEDIFF(activity_start_time,now())=3
  123. </select>
  124. <update id="activityExipred" parameterType="com.iformall.domain.po.WxActivity">
  125. update wx_activity set is_expired=${isExpired},update_time=#{updateTime} where status &gt; 0 and now()>end_time
  126. </update>
  127. <update id="activityCompletion" parameterType="com.iformall.domain.po.WxActivity">
  128. update wx_activity set status=#{status},update_time=#{updateTime} where status!=${status} and now()>activity_end_time
  129. </update>
  130. <delete id="deleteById" parameterType="Long">
  131. update wx_activity set is_del = 1, update_time=now() where id = #{id}
  132. </delete>
  133. </mapper>