|
- <?xml version="1.0" encoding="UTF-8"?>
- <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
- <mapper namespace="com.iformall.mapper.TtPoiTakeRateMapper">
- <resultMap id="BaseResultMap" type="com.iformall.domain.po.TtPoiTakeRate">
- <id column="id" jdbcType="BIGINT" property="id"/>
- <result column="tenant_id" jdbcType="VARCHAR" property="tenantId"/>
- <result column="parent_tenant_id" jdbcType="VARCHAR" property="parentTenantId"/>
- <result column="coupon_id" jdbcType="BIGINT" property="couponId"/>
- <result column="type" jdbcType="INTEGER" property="type"/>
- <result column="name" jdbcType="VARCHAR" property="name"/>
- <result column="merchant_phone" jdbcType="VARCHAR" property="merchantPhone"/>
- <result column="content_type" jdbcType="INTEGER" property="contentType"/>
- <result column="douyin_id" jdbcType="VARCHAR" property="douyinId" />
- <result column="douyin_id_status" jdbcType="VARCHAR" property="douyinIdStatus" />
- <result column="take_rate" jdbcType="INTEGER" property="takeRate"/>
- <result column="status" jdbcType="INTEGER" property="status"/>
- <result column="start_time" jdbcType="TIMESTAMP" property="startTime"/>
- <result column="end_time" jdbcType="TIMESTAMP" property="endTime"/>
- <result column="commission_duration" jdbcType="BIGINT" property="commissionDuration"/>
- <result column="create_date" jdbcType="TIMESTAMP" property="createDate"/>
- <result column="update_date" jdbcType="TIMESTAMP" property="updateDate"/>
- </resultMap>
-
- <sql id="allColumns">
- `id`,`tenant_id`,`parent_tenant_id`,`coupon_id`,
- `type`,`name`,`merchant_phone`,`content_type`,
- `douyin_id`,`douyin_id_status`,`take_rate`,`status`,
- `start_time`,`end_time`,`commission_duration`,`create_date`,`update_date`
- </sql>
-
- <sql id="dynamicWhereConditions">
- where 1 = 1
-
- <if test=" null != id ">
- and `id` = #{id}
- </if>
-
- <if test=" null != tenantId and '' != tenantId">
- and `tenant_id` = #{tenantId}
- </if>
- <if test=" null != parentTenantId and '' != parentTenantId">
- and `parent_tenant_id` = #{parentTenantId}
- </if>
-
- <if test=" null != couponId ">
- and `coupon_id` = #{couponId}
- </if>
-
- <if test=" null != type ">
- and `type` = #{type}
- </if>
-
- <if test=" null != name and '' != name">
- and `name` = #{name}
- </if>
-
- <if test=" null != douyinId and '' != douyinId">
- and `douyin_id` = #{douyinId}
- </if>
-
- <if test=" null != contentType ">
- and `content_type` = #{contentType}
- </if>
-
- <if test=" null != status ">
- and `status` = #{status}
- </if>
-
- <if test=" null != ids ">
- and id in
- <foreach collection="ids" index="index" item="idItem" open="(" separator="," close=")">
- #{idItem}
- </foreach>
- </if>
- <if test=" null != sortColumns">order by ${sortColumns}</if>
- </sql>
-
- <select id="selectByCoupon" parameterType="java.util.HashMap" resultMap="BaseResultMap">
- select <include refid="allColumns"/>
- from tt_poi_take_rate
- where tenant_id = #{tenantId}
- and `coupon_id` = #{couponId}
- and `type` = #{type}
- </select>
-
- <select id="findList" parameterType="com.iformall.domain.po.TtPoiTakeRate" resultMap="BaseResultMap">
- select
- <include refid="allColumns"/>
- from tt_poi_take_rate
- <include refid="dynamicWhereConditions"/>
- </select>
-
- <select id="selectById" parameterType="java.util.HashMap" resultMap="BaseResultMap">
- select <include refid="allColumns" /> from tt_poi_take_rate where id = #{id} and tenant_id=#{tenantId}
- </select>
-
- <select id="getMaxTakeRate" parameterType="java.util.HashMap" resultType="Integer">
- select max(take_rate)
- from tt_poi_take_rate
- where tenant_id = #{tenantId}
- and `coupon_id` = #{couponId}
- and `type` > 0
- and `status` in (1,2)
- </select>
-
- </mapper>
|