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

140 строки
5.3 KiB

  1. <?xml version="1.0" encoding="UTF-8"?>
  2. <!DOCTYPE mapper
  3. PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
  4. "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
  5. <mapper namespace="com.iformall.mapper.WxOfflineActivityMapper">
  6. <resultMap id="BaseResultMap" type="com.iformall.domain.po.WxOfflineActivity">
  7. <id property="id" column="id" jdbcType="BIGINT"/>
  8. <result property="tenantId" column="tenant_id" jdbcType="VARCHAR"/>
  9. <result property="parentTenantId" column="parent_tenant_id" jdbcType="VARCHAR"/>
  10. <result property="name" column="name" jdbcType="VARCHAR"/>
  11. <result property="startTime" column="start_time" jdbcType="TIMESTAMP"/>
  12. <result property="endTime" column="end_time" jdbcType="TIMESTAMP"/>
  13. <result property="creditOnOff" column="credit_on_off" jdbcType="SMALLINT"/>
  14. <result property="creditConfig" column="credit_config" jdbcType="VARCHAR"/>
  15. <result property="status" column="status" jdbcType="SMALLINT"/>
  16. <result property="createDate" column="create_date" jdbcType="TIMESTAMP"/>
  17. <result property="updateDate" column="update_date" jdbcType="TIMESTAMP"/>
  18. <result property="allMerchant" column="all_merchant" jdbcType="SMALLINT"/>
  19. </resultMap>
  20. <sql id="allColumns">
  21. id,tenant_id,parent_tenant_id,
  22. `name`,start_time,end_time,
  23. credit_on_off,credit_config,
  24. status,create_date,update_date,
  25. all_merchant
  26. </sql>
  27. <sql id="dynamicWhereConditions">
  28. where 1 = 1
  29. <if test=" null != id ">
  30. and `id` = #{id}
  31. </if>
  32. <if test=" null != tenantId and '' != tenantId">
  33. and `tenant_id` = #{tenantId}
  34. </if>
  35. <if test=" null != parentTenantId and '' != parentTenantId">
  36. and `parent_tenant_id` = #{parentTenantId}
  37. </if>
  38. <if test=" null != begin">
  39. and `start_time` &gt;= #{begin}
  40. </if>
  41. <if test=" null != end">
  42. and `end_time` &lt;= #{end}
  43. </if>
  44. <if test=" null != allMerchant">
  45. and `all_merchant` = #{allMerchant}
  46. </if>
  47. <!-- 未过期 -->
  48. <if test=" 0 == validStatus">
  49. and end_time &gt;= now()
  50. </if>
  51. <!-- 已过期 -->
  52. <if test=" 1 == validStatus">
  53. and end_time &lt;= now()
  54. </if>
  55. <if test=" null != name and name != '' ">
  56. and `name` like concat('%', #{name},'%')
  57. </if>
  58. <if test=" null != status ">
  59. and `status` = #{status}
  60. </if>
  61. <if test=" null != ids ">
  62. and id in
  63. <foreach collection="ids" index="index" item="idItem" open="(" separator="," close=")">
  64. #{idItem}
  65. </foreach>
  66. </if>
  67. <if test=" null != sortColumns"> order by ${sortColumns} </if>
  68. </sql>
  69. <select id="selectById" parameterType="java.util.HashMap" resultMap="BaseResultMap">
  70. select <include refid="allColumns" /> from wx_offline_activity where id = #{id} and tenant_id=#{tenantId}
  71. </select>
  72. <select id="findList" parameterType="com.iformall.domain.po.WxOfflineActivity" resultMap="BaseResultMap">
  73. select <include refid="allColumns" /> from wx_offline_activity
  74. <include refid="dynamicWhereConditions" />
  75. </select>
  76. <select id="findIds" parameterType="com.iformall.domain.po.WxOfflineActivity" resultType="Long">
  77. select id from wx_offline_activity
  78. <include refid="dynamicWhereConditions" />
  79. </select>
  80. <update id="updateStatus" parameterType="com.iformall.domain.po.WxOfflineActivity">
  81. update wx_offline_activity
  82. set `status` = #{status},
  83. `update_date` = #{updateDate}
  84. where id=#{id}
  85. <if test=" null != tenantId and '' != tenantId">
  86. and `tenant_id` = #{tenantId}
  87. </if>
  88. <if test=" null != parentTenantId and '' != parentTenantId">
  89. and `parent_tenant_id` = #{parentTenantId}
  90. </if>
  91. </update>
  92. <select id="getCountWidthCredit" parameterType="com.iformall.domain.po.WxOfflineActivity" resultType="integer">
  93. select count(1) from wx_offline_activity
  94. where credit_on_off = #{creditOnOff}
  95. <if test=" null != tenantId and '' != tenantId">
  96. and `tenant_id` = #{tenantId}
  97. </if>
  98. <if test=" null != parentTenantId and '' != parentTenantId">
  99. and `parent_tenant_id` = #{parentTenantId}
  100. </if>
  101. <if test=" null != id">
  102. and `id` != #{id}
  103. </if>
  104. and ((`start_time` &lt;= #{startTime} and `end_time` &gt;= #{startTime})
  105. or (`start_time` &lt;= #{endTime} and `end_time` &gt;= #{endTime}))
  106. </select>
  107. <select id="selectCreditActivityOne" parameterType="com.iformall.domain.po.WxOfflineActivity" resultType="com.iformall.domain.po.WxOfflineActivity">
  108. select <include refid="allColumns" /> from wx_offline_activity
  109. where credit_on_off = #{creditOnOff}
  110. <if test=" null != tenantId and '' != tenantId">
  111. and `tenant_id` = #{tenantId}
  112. </if>
  113. <if test=" null != parentTenantId and '' != parentTenantId">
  114. and `parent_tenant_id` = #{parentTenantId}
  115. </if>
  116. and `start_time` &lt;= #{orderDate}
  117. and `end_time` &gt;= #{orderDate}
  118. limit 1
  119. </select>
  120. </mapper>