|
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226 |
- <?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="count_class" jdbcType="INTEGER" property="countClass"/>
- <result column="video_id" jdbcType="VARCHAR" property="videoId"/>
- <result column="video_time" jdbcType="VARCHAR" property="videoTime"/>
- <result column="video_url" jdbcType="VARCHAR" property="videoUrl"/>
-
- <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="puton_date" jdbcType="TIMESTAMP" property="putonDate"/>
-
- <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="mark" jdbcType="INTEGER" property="mark"/>
- <result column="mark_time" jdbcType="INTEGER" property="markTime"/>
-
- <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"/>
-
- <result column="merchant_name" jdbcType="VARCHAR" property="merchantName"/>
- <result column="merchant_pic" jdbcType="VARCHAR" property="merchantPic"/>
-
- </resultMap>
-
- <sql id="allColumns">
- c.`id`, c.`tenant_id`, c.`parent_tenant_id`, c.`type`, c.`cover_img`, c.`cover_picture`, c.`detail_picture`,
- c.`title`, c.`sub_title`, c.`count_class`, c.`video_id`, c.`video_time`,c.`video_url`, c.`html`, c.`is_landscape`, c.`is_payment`,
- c.`sale_price`, c.`orig_price`, c.`is_preview`, c.`preview_duration`, c.`detail`, c.`false_sell_count`,
- c.`dy_title`, c.`inventory`, c.`remark`, c.`status`, c.`create_date`, c.`update_date`, c.`puton_date`,
- c.`see_count`, c.`sell_count`, c.`assess_count`, c.`collect_count`, c.`mark`,c.mark_time, c.`is_del`,
- c.`column_id`, c.`popularity`, c.`merchant_id`, c.`business_id`, c.`business_name`,
- m.name merchant_name, m.img_url merchant_pic
- </sql>
-
- <sql id="dynamicWhereConditions">
- where c.`is_del` = 0
- <if test=" null == type or type != 3">
- and c.`type` != 3
- </if>
-
- <if test=" null != id ">
- and c.`id` = #{id}
- </if>
-
- <if test=" null != tenantId and '' != tenantId">
- and c.`tenant_id` = #{tenantId}
- </if>
- <if test=" null != parentTenantId and '' != parentTenantId">
- and c.`parent_tenant_id` = #{parentTenantId}
- </if>
-
- <if test=" null != type ">
- and c.`type` = #{type}
- </if>
-
- <if test=" null != columnId ">
- and c.`column_id` = #{columnId}
- </if>
-
- <if test=" null != title and ''!=title">
- and c.`title` like concat('%', #{title},'%')
- </if>
-
- <if test=" null != isLandscape ">
- and c.`is_landscape` = #{isLandscape}
- </if>
-
- <if test=" null != isPayment ">
- and c.`is_payment` = #{isPayment}
- </if>
-
- <if test=" null != isPreview ">
- and c.`is_preview` = #{isPreview}
- </if>
-
- <if test=" null != status">
- and c.`status` = #{status}
- </if>
-
- <if test=" null != mark">
- <if test="mark == 0" >
- and (c.`mark` is null or c.`mark` <> 1)
- </if>
- <if test="mark == 1" >
- and c.`mark` = 1
- </if>
- </if>
-
- <if test="startdate != null">
- and c.`create_date` >= #{startdate}
- </if>
- <if test="enddate != null">
- and c.`create_date` <= #{enddate}
- </if>
-
- <if test=" null != businessId ">
- and c.`business_id` = #{businessId}
- </if>
-
- <if test=" null != merchantId ">
- and c.`merchant_id` = #{merchantId}
- </if>
- <if test=" null != merchantName and ''!=merchantName">
- and m.`name` like concat('%', #{merchantName},'%')
- </if>
-
- <if test=" null != ids ">
- and c.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 c
- left join wx_merchant m on m.id = c.merchant_id and m.status = 1
- <include refid="dynamicWhereConditions"/>
- </select>
-
- <select id="findCollectList" parameterType="com.iformall.domain.po.tt.TtCoupon" resultMap="BaseResultMap">
- select
- <include refid="allColumns"/>
- from tt_user_collect uc
- left join tt_coupon c on c.id = uc.coupon_id
- left join wx_merchant m on m.id = c.merchant_id
- where uc.`is_del` = 0 and uc.`user_id` = ${cUserId}
- and c.`is_del` = 0 and c.`type` != 3
- <if test=" null != type ">
- and c.`type` = #{type}
- </if>
- <if test=" null != title and ''!=title">
- and c.`title` like concat('%', #{title},'%')
- </if>
- <if test=" null != status">
- and c.`status` = #{status}
- </if>
- <if test=" null != mark">
- <if test="mark == 0" >
- and (c.`mark` is null or m.`mark` <> 1)
- </if>
- <if test="mark == 1" >
- and c.`mark` = 1
- </if>
- </if>
- <if test=" null != businessId ">
- and c.`business_id` = #{businessId}
- </if>
- order by uc.create_date desc
- </select>
-
- <select id="selectById" parameterType="Long" resultMap="BaseResultMap">
- select <include refid="allColumns"/>
- from tt_coupon c
- left join wx_merchant m on m.id = c.merchant_id
- where c.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,popularity = popularity+1 where id = #{id}
- </update>
-
- <update id="addSellCount" parameterType="Long">
- update tt_coupon SET sell_count = sell_count+1,popularity = popularity+20, false_sell_count = false_sell_count+1 where id = #{id}
- </update>
-
- <update id="reduceSellCount" parameterType="Long">
- update tt_coupon SET sell_count = sell_count-1,popularity = popularity-20, false_sell_count = false_sell_count-1 where id = #{id}
- </update>
-
- <update id="addAssessCount" parameterType="Long">
- update tt_coupon SET assess_count = assess_count+1,popularity = popularity+10 where id = #{id}
- </update>
-
- <update id="addCollectCount" parameterType="Long">
- update tt_coupon SET collect_count = collect_count+1,popularity = popularity+5 where id = #{id}
- </update>
-
- <update id="reduceCollectCount" parameterType="Long">
- update tt_coupon SET collect_count = collect_count-1,popularity = popularity-5 where id = #{id}
- </update>
-
- <update id="addPopularity" parameterType="java.util.HashMap">
- update tt_coupon SET popularity = popularity+#{popularity} where id = #{id}
- </update>
-
- </mapper>
|