后台服务
25'ten fazla konu seçemezsiniz Konular bir harf veya rakamla başlamalı, kısa çizgiler ('-') içerebilir ve en fazla 35 karakter uzunluğunda olabilir.

158 satır
5.9 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. </resultMap>
  33. <sql id="allColumns">
  34. `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`,
  35. `use_credit`,`credit`,`type`,`status`,`start_time`,`end_time`,`question`,`is_expired`,`create_time`,`update_time`,`use_img`,
  36. `img_detail`,`send_msg`,`selectques`
  37. </sql>
  38. <sql id="dynamicWhereConditions">
  39. where `is_del` = 0
  40. <if test=" null != id ">
  41. and `id` = #{id}
  42. </if>
  43. <if test=" null != tenantId and '' != tenantId">
  44. and `tenant_id` = #{tenantId}
  45. </if>
  46. <if test=" null != parentTenantId and '' != parentTenantId">
  47. and `parent_tenant_id` = #{parentTenantId}
  48. </if>
  49. <if test=" null != title ">
  50. and `title` like concat('%', #{title},'%')
  51. </if>
  52. <if test=" null != subTitle ">
  53. and `sub_title` like concat('%', #{subTitle},'%')
  54. </if>
  55. <if test=" null != detail ">
  56. and `detail` like concat('%', #{detail},'%')
  57. </if>
  58. <if test=" null != type ">
  59. and `type` = #{type}
  60. </if>
  61. <if test=" null != activityType ">
  62. and `activity_type` = #{activityType}
  63. </if>
  64. <if test=" null != signupExamine ">
  65. and `signup_examine` = #{signupExamine}
  66. </if>
  67. <if test=" null != status and status lt 3">
  68. and `status` = #{status}
  69. </if>
  70. <if test=" null != status and status == 3">
  71. and `status` &gt;= 2 and `status` &lt;= 3
  72. </if>
  73. <if test=" null != status and status == 4">
  74. and `status` &gt; 0
  75. </if>
  76. <if test=" null != createTime ">
  77. and `create_time` = #{createTime}
  78. </if>
  79. <if test=" null != updateTime ">
  80. and `update_time` = #{updateTime}
  81. </if>
  82. <if test=" null != useCredit ">
  83. and `use_credit` = #{useCredit}
  84. </if>
  85. <if test=" null != isExpired ">
  86. and `is_expired` = #{isExpired}
  87. </if>
  88. <!-- <if test=" null != startDate and null != endDate ">-->
  89. <!-- and `create_time` between #{starttime} and #{endtime}-->
  90. <!-- </if>-->
  91. <if test=" null != startDate and null != endDate ">
  92. and not(`activity_end_time` &lt; #{startDate, jdbcType=TIMESTAMP} or `activity_start_time` &gt; #{endDate, jdbcType=TIMESTAMP})
  93. <!-- and ((`activity_start_time` &gt;= #{startDate} and `activity_start_time` &lt;= #{endDate})
  94. or (`activity_end_time` &gt;= #{startDate} and `activity_end_time` &lt;= #{endDate})
  95. or (`activity_start_time` &lt;= #{startDate} and `activity_end_time` &gt;= #{endDate}))-->
  96. </if>
  97. <if test=" null != sendMsg ">
  98. and `send_msg` = #{sendMsg}
  99. </if>
  100. <if test=" null != ids ">
  101. and id in
  102. <foreach collection="ids" index="index" item="idItem" open="(" separator="," close=")">
  103. #{idItem}
  104. </foreach>
  105. </if>
  106. <if test=" null != sortColumns">order by ${sortColumns}</if>
  107. </sql>
  108. <select id="findList" parameterType="com.iformall.domain.po.WxActivity" resultMap="BaseResultMap">
  109. select
  110. <include refid="allColumns"/>
  111. from wx_activity
  112. <include refid="dynamicWhereConditions"/>
  113. </select>
  114. <select id="queryNotify" parameterType="com.iformall.domain.po.WxActivity"
  115. resultType="com.iformall.domain.po.WxActivity">
  116. select id,title,activity_start_time,tenant_id from wx_activity
  117. where status=${status}
  118. and DATEDIFF(activity_start_time,now())=3
  119. </select>
  120. <update id="activityExipred" parameterType="com.iformall.domain.po.WxActivity">
  121. update wx_activity set is_expired=${isExpired},update_time=#{updateTime} where status &gt; 0 and now()>end_time
  122. </update>
  123. <update id="activityCompletion" parameterType="com.iformall.domain.po.WxActivity">
  124. update wx_activity set status=#{status},update_time=#{updateTime} where status!=${status} and now()>activity_end_time
  125. </update>
  126. <delete id="deleteById" parameterType="Long">
  127. update wx_activity set is_del = 1, update_time=now() where id = #{id}
  128. </delete>
  129. </mapper>