admin
2019-05-16 6d58ee1f52f851a240e946ba863a23c0fd08c292
fanli/src/main/java/com/yeshi/fanli/mapping/activity/RecommendActivityMapper.xml
@@ -2,14 +2,17 @@
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.yeshi.fanli.dao.mybatis.activity.RecommendActivityMapper">
  <resultMap id="BaseResultMap" type="com.yeshi.fanli.entity.bus.activity.RecommendActivity">
   <resultMap id="BaseResultMap"
      type="com.yeshi.fanli.entity.bus.activity.RecommendActivity">
    <id column="ar_id" property="id" jdbcType="BIGINT"/>
    <result column="ar_title" property="title" jdbcType="VARCHAR"/>
    <result column="ar_type" property="type" jdbcType="INTEGER"/>
    <result column="ar_order_by" property="orderBy" jdbcType="INTEGER"/>
    <result column="ar_share_count" property="shareCount" jdbcType="INTEGER"/>
    <result column="ar_total_getmoney" property="totalGetMoney" jdbcType="VARCHAR"/>
    <result column="ar_video_post_picture" property="videoPostPictire" jdbcType="VARCHAR"/>
      <result column="ar_total_getmoney" property="totalGetMoney"
         jdbcType="VARCHAR" />
      <result column="ar_video_post_picture" property="videoPostPictire"
         jdbcType="VARCHAR" />
    <result column="ar_video_url" property="videoUrl" jdbcType="VARCHAR"/>
    <result column="ar_create_time" property="createTime" jdbcType="TIMESTAMP"/>
    <result column="ar_top" property="top" jdbcType="BOOLEAN"/>
@@ -33,32 +36,40 @@
   
  </resultMap>
  
   <sql id="Base_Column_List">ar_id,ar_title,ar_type,ar_order_by,ar_activity_uid,ar_share_count,ar_total_getmoney,ar_video_post_picture,ar_video_url,ar_create_time,ar_top,ar_start_time,ar_end_time,ar_state</sql>
   <sql id="Base_Column_List">ar_id,ar_title,ar_type,ar_order_by,ar_activity_uid,ar_share_count,ar_total_getmoney,ar_video_post_picture,ar_video_url,ar_create_time,ar_top,ar_start_time,ar_end_time,ar_state
   </sql>
 
   <select id="selectByPrimaryKey" resultMap="BaseResultMap" parameterType="java.lang.Long">
   <select id="selectByPrimaryKey" resultMap="BaseResultMap"
      parameterType="java.lang.Long">
       select  *,ar_activity_uid AS au_id  from yeshi_ec_activity_recommend
       where ar_id = #{id,jdbcType=BIGINT}
   </select>
   <select id="getRecommendActivityList" resultMap="BaseResultMap">
      SELECT   *,IF(ar_start_time IS NULL,ar_create_time,ar_start_time) AS orderbyTime FROM yeshi_ec_activity_recommend
      SELECT *,IF(ar_start_time IS NULL,ar_create_time,ar_start_time) AS
      orderbyTime FROM yeshi_ec_activity_recommend
      LEFT JOIN yeshi_ec_activity_user ON ar_activity_uid=au_id 
      WHERE IF(ar_start_time IS NULL,TRUE, ar_start_time<![CDATA[<=]]> NOW())
          AND IF(ar_end_time IS NULL,TRUE, ar_end_time <![CDATA[>=]]> NOW())
      WHERE IF(ar_start_time IS NULL,TRUE, ar_start_time<![CDATA[<=]]>
      NOW())
      AND IF(ar_end_time IS NULL,TRUE, ar_end_time <![CDATA[>=]]>
      NOW())
      ORDER BY ar_top DESC,ar_order_by ASC,orderbyTime  DESC 
      LIMIT #{start},#{count}
   </select>
   <select id="getRecommendActivityEffectiveCount" resultType="java.lang.Long">
      SELECT   count(ar_id) FROM yeshi_ec_activity_recommend 
      WHERE IF(ar_start_time IS NULL,TRUE, ar_start_time<![CDATA[<=]]> NOW())
          AND IF(ar_end_time IS NULL,TRUE, ar_end_time <![CDATA[>=]]> NOW())
      WHERE IF(ar_start_time IS NULL,TRUE, ar_start_time<![CDATA[<=]]>
      NOW())
      AND IF(ar_end_time IS NULL,TRUE, ar_end_time <![CDATA[>=]]>
      NOW())
   </select>
   <select id="queryRecommendActivityList" resultMap="BaseResultMap">
      SELECT * FROM yeshi_ec_activity_recommend t
      LEFT JOIN yeshi_ec_activity_user u ON t.ar_activity_uid=u.au_id
      LEFT JOIN
      yeshi_ec_activity_user u ON t.ar_activity_uid=u.au_id
      WHERE 1=1
          <if test="title != null and title != '' ">
              AND t.ar_title LIKE '%${title}%' 
@@ -107,14 +118,34 @@
     <select id="getNeedPublish" resultMap="BaseResultMap">
      SELECT * FROM yeshi_ec_activity_recommend 
      LEFT JOIN yeshi_ec_activity_user ON ar_activity_uid= au_id 
      WHERE ar_state = 0 AND IF(ar_start_time IS NULL,TRUE, ar_start_time<![CDATA[<=]]> NOW())
          AND IF(ar_end_time IS NULL,TRUE, ar_end_time <![CDATA[>=]]> NOW())
      WHERE ar_state = 0 AND IF(ar_start_time IS NULL,TRUE, ar_start_time<![CDATA[<=]]>
      NOW())
      AND IF(ar_end_time IS NULL,TRUE, ar_end_time <![CDATA[>=]]>
      NOW())
   </select>
  
   <update id="addShareCount">
      update yeshi_ec_activity_recommend r set
      r.ar_share_count=ar_share_count+#{count} where ar_id=#{id}
   </update>
  
  <delete id="deleteByPrimaryKey" parameterType="java.lang.Long">delete from yeshi_ec_activity_recommend where ar_id = #{id,jdbcType=BIGINT}</delete>
  <insert id="insert" parameterType="com.yeshi.fanli.entity.bus.activity.RecommendActivity" useGeneratedKeys="true" keyProperty="id">insert into yeshi_ec_activity_recommend (ar_id,ar_title,ar_type,ar_order_by,ar_activity_uid,ar_share_count,ar_total_getmoney,ar_video_post_picture,ar_video_url,ar_create_time,ar_top,ar_start_time,ar_end_time,ar_state) values (#{id,jdbcType=BIGINT},#{title,jdbcType=VARCHAR},#{type,jdbcType=INTEGER},#{orderBy,jdbcType=INTEGER},#{activityUser.id,jdbcType=BIGINT},#{shareCount,jdbcType=INTEGER},#{totalGetMoney,jdbcType=VARCHAR},#{videoPostPictire,jdbcType=VARCHAR},#{videoUrl,jdbcType=VARCHAR},#{createTime,jdbcType=TIMESTAMP},#{top,jdbcType=BOOLEAN},#{startTime,jdbcType=TIMESTAMP},#{endTime,jdbcType=TIMESTAMP},#{state,jdbcType=INTEGER})</insert>
  <insert id="insertSelective" parameterType="com.yeshi.fanli.entity.bus.activity.RecommendActivity" useGeneratedKeys="true" keyProperty="id">insert into yeshi_ec_activity_recommend
   <delete id="deleteByPrimaryKey" parameterType="java.lang.Long">delete from
      yeshi_ec_activity_recommend where ar_id = #{id,jdbcType=BIGINT}
   </delete>
   <insert id="insert"
      parameterType="com.yeshi.fanli.entity.bus.activity.RecommendActivity"
      useGeneratedKeys="true" keyProperty="id">insert into
      yeshi_ec_activity_recommend
      (ar_id,ar_title,ar_type,ar_order_by,ar_activity_uid,ar_share_count,ar_total_getmoney,ar_video_post_picture,ar_video_url,ar_create_time,ar_top,ar_start_time,ar_end_time,ar_state)
      values
      (#{id,jdbcType=BIGINT},#{title,jdbcType=VARCHAR},#{type,jdbcType=INTEGER},#{orderBy,jdbcType=INTEGER},#{activityUser.id,jdbcType=BIGINT},#{shareCount,jdbcType=INTEGER},#{totalGetMoney,jdbcType=VARCHAR},#{videoPostPictire,jdbcType=VARCHAR},#{videoUrl,jdbcType=VARCHAR},#{createTime,jdbcType=TIMESTAMP},#{top,jdbcType=BOOLEAN},#{startTime,jdbcType=TIMESTAMP},#{endTime,jdbcType=TIMESTAMP},#{state,jdbcType=INTEGER})
   </insert>
   <insert id="insertSelective"
      parameterType="com.yeshi.fanli.entity.bus.activity.RecommendActivity"
      useGeneratedKeys="true" keyProperty="id">
      insert into yeshi_ec_activity_recommend
    <trim prefix="(" suffix=")" suffixOverrides=",">
      <if test="id != null">ar_id,</if>
      <if test="title != null">ar_title,</if>
@@ -130,7 +161,8 @@
      <if test="startTime != null">ar_start_time,</if>
      <if test="endTime != null">ar_end_time,</if>
      <if test="state != null">ar_state,</if>
    </trim>values
      </trim>
      values
    <trim prefix="(" suffix=")" suffixOverrides=",">
      <if test="id != null">#{id,jdbcType=BIGINT},</if>
      <if test="title != null">#{title,jdbcType=VARCHAR},</if>
@@ -148,8 +180,24 @@
      <if test="state != null">#{state,jdbcType=INTEGER},</if>
    </trim>
  </insert>
  <update id="updateByPrimaryKey" parameterType="com.yeshi.fanli.entity.bus.activity.RecommendActivity">update yeshi_ec_activity_recommend set ar_title = #{title,jdbcType=VARCHAR},ar_type = #{type,jdbcType=INTEGER},ar_order_by = #{orderBy,jdbcType=INTEGER},ar_activity_uid = #{activityUser.id,jdbcType=BIGINT},ar_share_count = #{shareCount,jdbcType=INTEGER},ar_total_getmoney = #{totalGetMoney,jdbcType=VARCHAR},ar_video_post_picture = #{videoPostPictire,jdbcType=VARCHAR},ar_video_url = #{videoUrl,jdbcType=VARCHAR},ar_create_time = #{createTime,jdbcType=TIMESTAMP},ar_top = #{top,jdbcType=BOOLEAN},ar_start_time = #{startTime,jdbcType=TIMESTAMP},ar_end_time = #{endTime,jdbcType=TIMESTAMP},ar_state = #{state,jdbcType=INTEGER} where ar_id = #{id,jdbcType=BIGINT}</update>
  <update id="updateByPrimaryKeySelective" parameterType="com.yeshi.fanli.entity.bus.activity.RecommendActivity">update yeshi_ec_activity_recommend
   <update id="updateByPrimaryKey"
      parameterType="com.yeshi.fanli.entity.bus.activity.RecommendActivity">update yeshi_ec_activity_recommend set ar_title =
      #{title,jdbcType=VARCHAR},ar_type =
      #{type,jdbcType=INTEGER},ar_order_by =
      #{orderBy,jdbcType=INTEGER},ar_activity_uid =
      #{activityUser.id,jdbcType=BIGINT},ar_share_count =
      #{shareCount,jdbcType=INTEGER},ar_total_getmoney =
      #{totalGetMoney,jdbcType=VARCHAR},ar_video_post_picture =
      #{videoPostPictire,jdbcType=VARCHAR},ar_video_url =
      #{videoUrl,jdbcType=VARCHAR},ar_create_time =
      #{createTime,jdbcType=TIMESTAMP},ar_top =
      #{top,jdbcType=BOOLEAN},ar_start_time =
      #{startTime,jdbcType=TIMESTAMP},ar_end_time =
      #{endTime,jdbcType=TIMESTAMP},ar_state = #{state,jdbcType=INTEGER}
      where ar_id = #{id,jdbcType=BIGINT}</update>
   <update id="updateByPrimaryKeySelective"
      parameterType="com.yeshi.fanli.entity.bus.activity.RecommendActivity">
      update yeshi_ec_activity_recommend
    <set>
      <if test="title != null">ar_title=#{title,jdbcType=VARCHAR},</if>
      <if test="type != null">ar_type=#{type,jdbcType=INTEGER},</if>
@@ -157,12 +205,14 @@
      <if test="activityUser != null">ar_activity_uid=#{activityUser.id,jdbcType=BIGINT},</if>
      <if test="shareCount != null">ar_share_count=#{shareCount,jdbcType=INTEGER},</if>
      <if test="totalGetMoney != null">ar_total_getmoney=#{totalGetMoney,jdbcType=VARCHAR},</if>
      <if test="videoPostPictire != null">ar_video_post_picture=#{videoPostPictire,jdbcType=VARCHAR},</if>
         <if test="videoPostPictire != null">ar_video_post_picture=#{videoPostPictire,jdbcType=VARCHAR},
         </if>
      <if test="videoUrl != null">ar_video_url=#{videoUrl,jdbcType=VARCHAR},</if>
      <if test="createTime != null">ar_create_time=#{createTime,jdbcType=TIMESTAMP},</if>
      <if test="top != null">ar_top=#{top,jdbcType=BOOLEAN},</if>
      <if test="startTime != null">ar_start_time=#{startTime,jdbcType=TIMESTAMP},</if>
      <if test="state != null">ar_state=#{state,jdbcType=INTEGER},</if>
    </set> where ar_id = #{id,jdbcType=BIGINT}
      </set>
      where ar_id = #{id,jdbcType=BIGINT}
  </update>
</mapper>