|
- <?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.TtCouponMapper">
- <resultMap id="BaseResultMap" type="com.iformall.domain.po.tt.TtCoupon">
- <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="type" jdbcType="INTEGER" property="type"/>
- <result column="cover_img" jdbcType="VARCHAR" property="coverImg"/>
- <result column="cover_picture" jdbcType="VARCHAR" property="coverPicture"/>
- <result column="detail_picture" jdbcType="VARCHAR" property="detailPicture"/>
- <result column="title" jdbcType="VARCHAR" property="title"/>
- <result column="sub_title" jdbcType="VARCHAR" property="subTitle"/>
- <result column="video_id" jdbcType="VARCHAR" property="videoId"/>
- <result column="video_time" jdbcType="VARCHAR" property="videoTime"/>
- <result column="html" jdbcType="VARCHAR" property="html"/>
- <result column="is_landscape" jdbcType="INTEGER" property="isLandscape"/>
- <result column="is_payment" jdbcType="INTEGER" property="isPayment"/>
- <result column="sale_price" jdbcType="INTEGER" property="salePrice"/>
- <result column="orig_price" jdbcType="INTEGER" property="origPrice"/>
- <result column="is_preview" jdbcType="INTEGER" property="isPreview"/>
- <result column="preview_duration" jdbcType="INTEGER" property="previewDuration"/>
- <result column="detail" jdbcType="VARCHAR" property="detail"/>
- <result column="false_sell_count" jdbcType="INTEGER" property="falseSellCount"/>
- <result column="dy_title" jdbcType="VARCHAR" property="dyTitle"/>
- <result column="inventory" jdbcType="INTEGER" property="inventory"/>
- <result column="remark" jdbcType="VARCHAR" property="remark"/>
- <result column="status" jdbcType="INTEGER" property="status"/>
- <result column="create_date" jdbcType="TIMESTAMP" property="createDate"/>
- <result column="update_date" jdbcType="TIMESTAMP" property="updateDate"/>
- <result column="see_count" jdbcType="INTEGER" property="seeCount"/>
- <result column="sell_count" jdbcType="INTEGER" property="sellCount"/>
- <result column="assess_count" jdbcType="INTEGER" property="assessCount"/>
- <result column="collect_count" jdbcType="INTEGER" property="collectCount"/>
- <result column="is_del" jdbcType="INTEGER" property="isDel"/>
- <result column="column_id" jdbcType="BIGINT" property="columnId"/>
- <result column="popularity" jdbcType="INTEGER" property="popularity"/>
- <result column="merchant_id" jdbcType="BIGINT" property="merchantId"/>
- <result column="business_id" jdbcType="BIGINT" property="businessId"/>
- <result column="business_name" jdbcType="VARCHAR" property="businessName"/>
-
-
- </resultMap>
-
- <sql id="allColumns">
- `id`, `tenant_id`, `parent_tenant_id`, `type`, `cover_img`, `cover_picture`, `detail_picture`,
- `title`, `sub_title`, `video_id`, `video_time`, `html`, `is_landscape`, `is_payment`,
- `sale_price`, `orig_price`, `is_preview`, `preview_duration`, `detail`, `false_sell_count`,
- `dy_title`, `inventory`, `remark`, `status`, `create_date`, `update_date`,
- `see_count`, `sell_count`, `assess_count`, `collect_count`, `is_del`,
- `column_id`, `popularity`, `merchant_id`, `business_id`, `business_name`
- </sql>
-
- <sql id="dynamicWhereConditions">
- where `is_del` = 0
-
- <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 != type ">
- and `type` = #{type}
- </if>
-
- <if test=" null != title and ''!=title">
- and `title` like concat('%', #{title},'%')
- </if>
-
- <if test=" null != isLandscape ">
- and `is_landscape` = #{isLandscape}
- </if>
-
- <if test=" null != isPayment ">
- and `is_payment` = #{isPayment}
- </if>
-
- <if test=" null != isPreview ">
- and `is_preview` = #{isPreview}
- </if>
-
- <if test=" null != status">
- and `status` = #{status}
- </if>
-
- <if test="startdate != null">
- and `create_date` >= #{startdate}
- </if>
- <if test="enddate != null">
- and `create_date` <= #{enddate}
- </if>
-
- <if test=" null != businessId ">
- and `business_id` = #{businessId}
- </if>
-
- <if test=" null != merchantId ">
- and `merchant_id` = #{merchantId}
- </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="findList" parameterType="com.iformall.domain.po.tt.TtCoupon" resultMap="BaseResultMap">
- select
- <include refid="allColumns"/>
- from tt_coupon
- <include refid="dynamicWhereConditions"/>
- </select>
-
- <select id="selectById" parameterType="Long" resultMap="BaseResultMap">
- select <include refid="allColumns"/> from tt_coupon where id = #{id}
- </select>
-
- <delete id="deleteById" parameterType="Long">
- update tt_coupon set is_del = 1, update_date=now() where id = #{id}
- </delete>
-
- <update id="addSeeCount" parameterType="Long">
- update tt_coupon SET see_count = see_count+1, update_date=now() where id = #{id}
- </update>
-
- <update id="addSellCount" parameterType="Long">
- update tt_coupon SET sell_count = sell_count+1, false_sell_count = false_sell_count+1, update_date=now() where id = #{id}
- </update>
-
- <update id="reduceSellCount" parameterType="Long">
- update tt_coupon SET sell_count = sell_count-1, false_sell_count = false_sell_count-1, update_date=now() where id = #{id}
- </update>
-
- <update id="addAssessCount" parameterType="Long">
- update tt_coupon SET assess_count = assess_count+1, update_date=now() where id = #{id}
- </update>
-
- <update id="addCollectCount" parameterType="Long">
- update tt_coupon SET collect_count = collect_count+1, update_date=now() where id = #{id}
- </update>
-
- <update id="reduceCollectCount" parameterType="Long">
- update tt_coupon SET collect_count = collect_count-1, update_date=now() where id = #{id}
- </update>
-
- <update id="addPopularity" parameterType="java.util.HashMap">
- update tt_coupon SET popularity = popularity+#{popularity}, update_date=now() where id = #{id}
- </update>
-
- </mapper>
|