Você não pode selecionar mais de 25 tópicos Os tópicos devem começar com uma letra ou um número, podem incluir traços ('-') e podem ter até 35 caracteres.
 
 
 
 
 

114 linhas
3.7 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.WxCashBackActivityMapper">
  4. <resultMap id="BaseResultMap" type="com.iformall.domain.po.WxCashBackActivity">
  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="status" jdbcType="INTEGER" property="status" />
  9. <result column="name" jdbcType="VARCHAR" property="name" />
  10. <result column="create_date" jdbcType="TIMESTAMP" property="createDate" />
  11. <result column="update_date" jdbcType="TIMESTAMP" property="updateDate" />
  12. <result column="start_time" jdbcType="TIMESTAMP" property="startTime" />
  13. <result column="end_time" jdbcType="TIMESTAMP" property="endTime" />
  14. <result column="limit_money" jdbcType="DECIMAL" property="limitMoney" />
  15. <result column="all_merchant" jdbcType="INTEGER" property="allMerchant" />
  16. </resultMap>
  17. <sql id="allColumns">
  18. `id`,`tenant_id`,`parent_tenant_id`,`status`,`name`,`create_date`,`update_date`,`start_time`,`end_time`,`limit_money`,`all_merchant`
  19. </sql>
  20. <sql id="dynamicWhereConditions">
  21. where 1 = 1
  22. <if test=" null != id ">
  23. and `id` = #{id}
  24. </if>
  25. <if test=" null != tenantId and '' != tenantId">
  26. and `tenant_id` = #{tenantId}
  27. </if>
  28. <if test=" null != parentTenantId and '' != parentTenantId">
  29. and `parent_tenant_id` = #{parentTenantId}
  30. </if>
  31. <if test=" null != begin">
  32. and `start_time` &gt;= #{begin}
  33. </if>
  34. <if test=" null != end">
  35. and `end_time` &lt;= #{end}
  36. </if>
  37. <if test=" null != allMerchant">
  38. and `all_merchant` = #{allMerchant}
  39. </if>
  40. <!-- 未过期 -->
  41. <if test=" 1 == validTime">
  42. and end_time &gt;= now()
  43. </if>
  44. <!-- 已过期 -->
  45. <if test=" 0 == validTime">
  46. and end_time &lt;= now()
  47. </if>
  48. <!-- 未开始 -->
  49. <if test=" 4 == validTime">
  50. and start_time &gt;= now()
  51. </if>
  52. <if test=" null != name and name != '' ">
  53. and `name` like concat('%', #{name},'%')
  54. </if>
  55. <if test=" null != status ">
  56. and `status` = #{status}
  57. </if>
  58. <if test=" null != statusList ">
  59. and status in
  60. <foreach collection="statusList" index="index" item="statusItem" open="(" separator="," close=")">
  61. #{statusItem}
  62. </foreach>
  63. </if>
  64. <if test=" null != ids ">
  65. and id in
  66. <foreach collection="ids" index="index" item="idItem" open="(" separator="," close=")">
  67. #{idItem}
  68. </foreach>
  69. </if>
  70. <if test=" null != sortColumns"> order by ${sortColumns} </if>
  71. </sql>
  72. <select id="selectById" parameterType="java.util.HashMap" resultMap="BaseResultMap">
  73. select <include refid="allColumns" /> from wx_cash_back_activity where id = #{id} and tenant_id=#{tenantId}
  74. </select>
  75. <select id="findList" parameterType="com.iformall.domain.po.WxCashBackActivity" resultMap="BaseResultMap">
  76. select <include refid="allColumns" /> from wx_cash_back_activity
  77. <include refid="dynamicWhereConditions" />
  78. </select>
  79. <select id="findIds" parameterType="com.iformall.domain.po.WxCashBackActivity" resultType="Long">
  80. select id from wx_cash_back_activity
  81. <include refid="dynamicWhereConditions" />
  82. </select>
  83. <update id="updateStatus" parameterType="com.iformall.domain.po.WxCashBackActivity">
  84. update wx_cash_back_activity
  85. set `status` = #{status},
  86. `update_date` = #{updateDate}
  87. where id=#{id}
  88. <if test=" null != tenantId and '' != tenantId">
  89. and `tenant_id` = #{tenantId}
  90. </if>
  91. <if test=" null != parentTenantId and '' != parentTenantId">
  92. and `parent_tenant_id` = #{parentTenantId}
  93. </if>
  94. </update>
  95. </mapper>