UnionShareOrdersActivityLogsMapper.xml 9.35 KB
<?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.yoho.unions.dal.UnionShareOrdersActivityLogsMapper" >
  <resultMap id="BaseResultMap" type="com.yoho.unions.dal.model.UnionShareOrdersActivityLogs" >
    <id column="id" property="id" jdbcType="INTEGER" />
    <result column="activity_id" property="activityId" jdbcType="INTEGER" />
    <result column="activity_type" property="activityType" jdbcType="INTEGER" />
    <result column="activity_name" property="activityName" jdbcType="INTEGER" />
    <result column="activity_item_id" property="activityItemId" jdbcType="INTEGER" />
    <result column="promote_uid" property="promoteUid" jdbcType="INTEGER" />
    <result column="order_uid" property="orderUid" jdbcType="INTEGER" />
    <result column="order_id" property="orderId" jdbcType="INTEGER" />
    <result column="amount" property="amount" jdbcType="DECIMAL" />
    <result column="status" property="status" jdbcType="INTEGER" />
    <result column="orders" property="orders" jdbcType="VARCHAR" />
    <result column="remarks" property="remarks" jdbcType="VARCHAR" />
    <result column="create_time" property="createTime" jdbcType="INTEGER" />
    <result column="update_time" property="updateTime" jdbcType="INTEGER" />
  </resultMap>
  <sql id="Base_Column_List" >
    id, activity_id, activity_type, activity_name, activity_item_id, promote_uid,order_uid, order_id, amount, status, orders, create_time,
    update_time
  </sql>
  <select id="selectByPrimaryKey" resultMap="BaseResultMap" parameterType="java.lang.Integer" >
    select 
    <include refid="Base_Column_List" />
    from union_share_orders_activity_logs
    where id = #{id,jdbcType=INTEGER}
  </select>
  <select id="selectByOrderIds" resultMap="BaseResultMap"  >
    select
    <include refid="Base_Column_List" />
    from union_share_orders_activity_logs
    where order_id IN
    <foreach collection="orderIds" item="item" separator="," index="index" open="(" close=")">
      #{item}
    </foreach>
  </select>
  <select id="selectByOrderId" resultMap="BaseResultMap"  >
    select
    <include refid="Base_Column_List" />,remarks
    from union_share_orders_activity_logs
    where order_id = #{orderId,jdbcType=INTEGER}
  </select>
  <select id="selectByOrderCode" resultMap="BaseResultMap"  >
    select
    <include refid="Base_Column_List" />
    from union_share_orders_activity_logs
    where status=1 and orders like CONCAT('%', #{orderCode}, '%')
  </select>
  <select id="selectByPrimaryKeySelective" resultMap="BaseResultMap"  >
    select
    <include refid="Base_Column_List" />
    from union_share_orders_activity_logs
    where 1=1
    <if test="status != null" >
      and status=#{status,jdbcType=INTEGER}
    </if>
    <if test="orderUid != null" >
      and order_uid=##{orderUid,jdbcType=INTEGER}
    </if>
    <if test="promoteUid != null" >
      and promote_uid=#{promoteUid,jdbcType=INTEGER}
    </if>
    <if test="activityId != null" >
      and activity_id=#{activityId,jdbcType=INTEGER}
    </if>
    <if test="id != null" >
      and id = #{id,jdbcType=INTEGER}
    </if>
  </select>
  <delete id="deleteByPrimaryKey" parameterType="java.lang.Integer" >
    delete from union_share_orders_activity_logs
    where id = #{id,jdbcType=INTEGER}
  </delete>
  <insert id="insert" parameterType="com.yoho.unions.dal.model.UnionShareOrdersActivityLogs" >
    insert into union_share_orders_activity_logs (id, activity_id,activity_type, activity_name, activity_item_id,
      promote_uid, order_uid, order_id, amount,
      status, orders, create_time, 
      update_time)
    values (#{id,jdbcType=INTEGER}, #{activityId,jdbcType=INTEGER},#{activityType,jdbcType=INTEGER}, #{activityName,jdbcType=INTEGER},  #{activityItemId,jdbcType=INTEGER},
      #{promoteUid,jdbcType=INTEGER},#{orderUid,jdbcType=INTEGER}, #{orderId,jdbcType=INTEGER}, #{amount,jdbcType=DECIMAL},
      #{status,jdbcType=INTEGER}, #{orders,jdbcType=VARCHAR}, #{createTime,jdbcType=INTEGER}, 
      #{updateTime,jdbcType=INTEGER})
  </insert>
  <insert id="insertSelective" parameterType="com.yoho.unions.dal.model.UnionShareOrdersActivityLogs" >
    insert into union_share_orders_activity_logs
    <trim prefix="(" suffix=")" suffixOverrides="," >
      <if test="id != null" >
        id,
      </if>
      <if test="activityId != null" >
        activity_id,
      </if>
      <if test="activityType != null" >
        activity_type,
      </if>
      <if test="activityName != null" >
        activity_name,
      </if>
      <if test="activityItemId != null" >
        activity_item_id,
      </if>
      <if test="promoteUid != null" >
        promote_uid,
      </if>
      <if test="orderUid != null" >
        order_uid,
      </if>
      <if test="orderId != null" >
        order_id,
      </if>
      <if test="amount != null" >
        amount,
      </if>
      <if test="status != null" >
        status,
      </if>
      <if test="orders != null" >
        orders,
      </if>
      <if test="remarks != null" >
        remarks,
      </if>
      <if test="createTime != null" >
        create_time,
      </if>
      <if test="updateTime != null" >
        update_time,
      </if>
    </trim>
    <trim prefix="values (" suffix=")" suffixOverrides="," >
      <if test="id != null" >
        #{id,jdbcType=INTEGER},
      </if>
      <if test="activityId != null" >
        #{activityId,jdbcType=INTEGER},
      </if>
      <if test="activityType != null" >
        #{activityType,jdbcType=INTEGER},
      </if>
      <if test="activityName != null" >
        #{activityName,jdbcType=INTEGER},
      </if>
      <if test="activityItemId != null" >
        #{activityItemId,jdbcType=INTEGER},
      </if>
      <if test="promoteUid != null" >
        #{promoteUid,jdbcType=INTEGER},
      </if>
      <if test="orderUid != null" >
        #{orderUid,jdbcType=INTEGER},
      </if>
      <if test="orderId != null" >
        #{orderId,jdbcType=INTEGER},
      </if>
      <if test="amount != null" >
        #{amount,jdbcType=DECIMAL},
      </if>
      <if test="status != null" >
        #{status,jdbcType=INTEGER},
      </if>
      <if test="orders != null" >
        #{orders,jdbcType=VARCHAR},
      </if>
      <if test="remarks != null" >
        #{remarks,jdbcType=VARCHAR},
      </if>
      <if test="createTime != null" >
        #{createTime,jdbcType=INTEGER},
      </if>
      <if test="updateTime != null" >
        #{updateTime,jdbcType=INTEGER},
      </if>
    </trim>
  </insert>
  <update id="updateByPrimaryKeySelective" parameterType="com.yoho.unions.dal.model.UnionShareOrdersActivityLogs" >
    update union_share_orders_activity_logs
    <set >
      <if test="activityId != null" >
        activity_id = #{activityId,jdbcType=INTEGER},
      </if>
      <if test="activityType != null" >
        activity_type = #{activityType,jdbcType=INTEGER},
      </if>
      <if test="activityName != null" >
        activity_name = #{activityName,jdbcType=INTEGER},
      </if>
      <if test="activityItemId != null" >
        activity_item_id = #{activityItemId,jdbcType=INTEGER},
      </if>
      <if test="promoteUid != null" >
        promote_uid = #{promoteUid,jdbcType=INTEGER},
      </if>
      <if test="orderUid != null" >
        order_uid = #{orderUid,jdbcType=INTEGER},
      </if>
      <if test="orderId != null" >
        order_id = #{orderId,jdbcType=INTEGER},
      </if>
      <if test="amount != null" >
        amount = #{amount,jdbcType=DECIMAL},
      </if>
      <if test="status != null" >
        status = #{status,jdbcType=INTEGER},
      </if>
      <if test="orders != null" >
        orders = #{orders,jdbcType=VARCHAR},
      </if>
      <if test="createTime != null" >
        create_time = #{createTime,jdbcType=INTEGER},
      </if>
      <if test="updateTime != null" >
        update_time = #{updateTime,jdbcType=INTEGER},
      </if>
    </set>
    where id = #{id,jdbcType=INTEGER}
  </update>
  <update id="updateStatusByOrderId" parameterType="com.yoho.unions.dal.model.UnionShareOrdersActivityLogs" >
    update union_share_orders_activity_logs
    set status = #{status,jdbcType=INTEGER},
    update_time = #{updateTime,jdbcType=INTEGER}
    where order_id = #{orderId,jdbcType=INTEGER}
  </update>
  <update id="updateStatusByOrderIds" parameterType="com.yoho.unions.dal.model.UnionShareOrdersActivityLogs" >
    update union_share_orders_activity_logs
    set status = 0,
    update_time = #{updateTime,jdbcType=INTEGER}
    where order_id in
    <foreach collection="orderIds" item="item" separator="," index="index" open="(" close=")">
      #{item}
    </foreach>
  </update>
  <update id="updateByPrimaryKey" parameterType="com.yoho.unions.dal.model.UnionShareOrdersActivityLogs" >
    update union_share_orders_activity_logs
    set activity_id = #{activityId,jdbcType=INTEGER},
      activity_type = #{activityType,jdbcType=INTEGER},
      activity_name = #{activityName,jdbcType=INTEGER},
      activity_item_id = #{activityItemId,jdbcType=INTEGER},
      promote_uid = #{promoteUid,jdbcType=INTEGER},
      order_uid = #{orderUid,jdbcType=INTEGER},
      order_id = #{orderId,jdbcType=INTEGER},
      amount = #{amount,jdbcType=DECIMAL},
      status = #{status,jdbcType=INTEGER},
      orders = #{orders,jdbcType=VARCHAR},
      create_time = #{createTime,jdbcType=INTEGER},
      update_time = #{updateTime,jdbcType=INTEGER}
    where id = #{id,jdbcType=INTEGER}
  </update>
</mapper>