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.
 
 
 
 
 

82 satır
3.1 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.WxTopicMapper">
  4. <resultMap id="BaseResultMap" type="com.iformall.domain.po.WxTopic">
  5. <id column="id" property="id" />
  6. <result column="tenant_id" property="tenantId" />
  7. <result column="name" property="name" />
  8. <result column="title" property="title" />
  9. <result column="content" property="content" />
  10. <result column="cover" property="cover" />
  11. <result column="cover_picture" property="coverPicture" />
  12. <result column="detail_picture" property="detailPicture" />
  13. <result column="advert" property="advert" />
  14. <result column="begin_time" property="beginTime" />
  15. <result column="end_time" property="endTime" />
  16. <result column="status" property="status" />
  17. <result column="createtime" property="createtime" />
  18. <result column="updatetime" property="updatetime" />
  19. <result column="bg_color" property="bgColor" />
  20. <result column="couponChannelId" property="couponChannelId" />
  21. </resultMap>
  22. <sql id="allColumns">
  23. `id`,`tenant_id`,`name`,`title`,`content`,`cover`,`cover_picture`,`detail_picture`,`advert`,`begin_time`,`end_time`,`createtime`,`updatetime`,`bg_color`
  24. </sql>
  25. <sql id="dynamicWhereConditions">
  26. where 1 = 1
  27. <if test=" null != id ">
  28. and `id` = #{id}
  29. </if>
  30. <if test=" null != tenantId ">
  31. and `tenant_id` = #{tenantId}
  32. </if>
  33. <if test=" null != beginTime ">
  34. and `begin_time` >= #{beginTime}
  35. </if>
  36. <if test=" null != endTime ">
  37. and `end_time` &lt;= #{endTime}
  38. </if>
  39. <if test=" null != status ">
  40. and `status` = #{status}
  41. </if>
  42. <if test=" null != name and ''!=name ">
  43. and `name` like concat('%',#{name},'%')
  44. </if>
  45. <if test=" null != statusList ">
  46. and status in
  47. <foreach collection="statusList" index="index" item="statusItem" open="(" separator="," close=")">
  48. #{statusItem}
  49. </foreach>
  50. </if>
  51. <if test=" null != sortColumns"> order by ${sortColumns} </if>
  52. <if test=" null == sortColumns"> order by begin_time desc,status asc </if>
  53. </sql>
  54. <select id="findList" parameterType="com.iformall.domain.po.WxTopic" resultMap="BaseResultMap">
  55. select * from wx_topic
  56. <include refid="dynamicWhereConditions" />
  57. </select>
  58. <select id="findExist" parameterType="com.iformall.domain.po.WxTopic" resultMap="BaseResultMap">
  59. SELECT * FROM wx_topic WHERE wx_topic.tenant_id = #{tenantId}
  60. AND (`begin_time` >= #{beginTime} and `end_time` &lt;= #{endTime}) AND `status` = 1
  61. </select>
  62. <select id="show" parameterType="com.iformall.domain.po.WxTopic" resultMap="BaseResultMap">
  63. select t.*,cc.id as couponChannelId from wx_topic t left join wx_coupon_channel cc on(cc.sub_target_id = t.id)
  64. where t.status = 1
  65. and now() >= t.begin_time and now() &lt;= t.end_time
  66. and t.tenant_id = #{tenantId}
  67. order by t.begin_time desc limit 1
  68. </select>
  69. <update id="updateStatus" parameterType="com.iformall.domain.po.WxTopic">
  70. update wx_topic set status = 3 where now() >= end_time and tenant_id = #{tenantId}
  71. </update>
  72. </mapper>