后台服务
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.

107 line
4.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.TtPoiTakeRateMapper">
  4. <resultMap id="BaseResultMap" type="com.iformall.domain.po.TtPoiTakeRate">
  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="coupon_id" jdbcType="BIGINT" property="couponId"/>
  9. <result column="type" jdbcType="INTEGER" property="type"/>
  10. <result column="name" jdbcType="VARCHAR" property="name"/>
  11. <result column="merchant_phone" jdbcType="VARCHAR" property="merchantPhone"/>
  12. <result column="content_type" jdbcType="INTEGER" property="contentType"/>
  13. <result column="douyin_id" jdbcType="VARCHAR" property="douyinId" />
  14. <result column="douyin_id_status" jdbcType="VARCHAR" property="douyinIdStatus" />
  15. <result column="take_rate" jdbcType="INTEGER" property="takeRate"/>
  16. <result column="status" jdbcType="INTEGER" property="status"/>
  17. <result column="start_time" jdbcType="TIMESTAMP" property="startTime"/>
  18. <result column="end_time" jdbcType="TIMESTAMP" property="endTime"/>
  19. <result column="commission_duration" jdbcType="BIGINT" property="commissionDuration"/>
  20. <result column="create_date" jdbcType="TIMESTAMP" property="createDate"/>
  21. <result column="update_date" jdbcType="TIMESTAMP" property="updateDate"/>
  22. </resultMap>
  23. <sql id="allColumns">
  24. `id`,`tenant_id`,`parent_tenant_id`,`coupon_id`,
  25. `type`,`name`,`merchant_phone`,`content_type`,
  26. `douyin_id`,`douyin_id_status`,`take_rate`,`status`,
  27. `start_time`,`end_time`,`commission_duration`,`create_date`,`update_date`
  28. </sql>
  29. <sql id="dynamicWhereConditions">
  30. where 1 = 1
  31. <if test=" null != id ">
  32. and `id` = #{id}
  33. </if>
  34. <if test=" null != tenantId and '' != tenantId">
  35. and `tenant_id` = #{tenantId}
  36. </if>
  37. <if test=" null != parentTenantId and '' != parentTenantId">
  38. and `parent_tenant_id` = #{parentTenantId}
  39. </if>
  40. <if test=" null != couponId ">
  41. and `coupon_id` = #{couponId}
  42. </if>
  43. <if test=" null != type ">
  44. and `type` = #{type}
  45. </if>
  46. <if test=" null != name and '' != name">
  47. and `name` = #{name}
  48. </if>
  49. <if test=" null != douyinId and '' != douyinId">
  50. and `douyin_id` = #{douyinId}
  51. </if>
  52. <if test=" null != contentType ">
  53. and `content_type` = #{contentType}
  54. </if>
  55. <if test=" null != status ">
  56. and `status` = #{status}
  57. </if>
  58. <if test=" null != ids ">
  59. and id in
  60. <foreach collection="ids" index="index" item="idItem" open="(" separator="," close=")">
  61. #{idItem}
  62. </foreach>
  63. </if>
  64. <if test=" null != sortColumns">order by ${sortColumns}</if>
  65. </sql>
  66. <select id="selectByCoupon" parameterType="java.util.HashMap" resultMap="BaseResultMap">
  67. select <include refid="allColumns"/>
  68. from tt_poi_take_rate
  69. where tenant_id = #{tenantId}
  70. and `coupon_id` = #{couponId}
  71. and `type` = #{type}
  72. </select>
  73. <select id="findList" parameterType="com.iformall.domain.po.TtPoiTakeRate" resultMap="BaseResultMap">
  74. select
  75. <include refid="allColumns"/>
  76. from tt_poi_take_rate
  77. <include refid="dynamicWhereConditions"/>
  78. </select>
  79. <select id="selectById" parameterType="java.util.HashMap" resultMap="BaseResultMap">
  80. select <include refid="allColumns" /> from tt_poi_take_rate where id = #{id} and tenant_id=#{tenantId}
  81. </select>
  82. <select id="getMaxTakeRate" parameterType="java.util.HashMap" resultType="Integer">
  83. select max(take_rate)
  84. from tt_poi_take_rate
  85. where tenant_id = #{tenantId}
  86. and `coupon_id` = #{couponId}
  87. and `type` > 0
  88. and `status` in (1,2)
  89. </select>
  90. </mapper>