admin
2018-12-26 e633a09a6e03ef22314699acf4fd5d9ab42a07ca
fanli/src/main/java/com/yeshi/fanli/mapping/order/HongBaoOrderMapper.xml
@@ -2,47 +2,67 @@
<!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.order.HongBaoOrderMapper">
  <resultMap id="BaseResultMap" type="com.yeshi.fanli.entity.order.HongBaoOrder">
    <id column="ho_id" property="id" jdbcType="BIGINT"/>
    <result column="cog_create_time" property="createTime" jdbcType="TIMESTAMP"/>
    <association property="hongBaoV2" column="ho_hongbao_id"
      javaType="com.yeshi.fanli.entity.bus.user.HongBaoV2">
      <id column="ho_hongbao_id" property="id" jdbcType="BIGINT" />
   </association>
   <association property="commonOrderGoods" column="ho_order_id"
      javaType="com.yeshi.fanli.entity.order.CommonOrder">
      <id column="ho_order_id" property="id" jdbcType="BIGINT" />
   </association>
  </resultMap>
  <sql id="Base_Column_List">ho_id,ho_hongbao_id,ho_order_id,cog_create_time</sql>
  <select id="selectByPrimaryKey" resultMap="BaseResultMap" parameterType="java.lang.Long">select
    <include refid="Base_Column_List"/>from yeshi_ec_hongbao_order where ho_id = #{id,jdbcType=BIGINT}
  </select>
  <delete id="deleteByPrimaryKey" parameterType="java.lang.Long">delete from yeshi_ec_hongbao_order where ho_id = #{id,jdbcType=BIGINT}</delete>
  <insert id="insert" parameterType="com.yeshi.fanli.entity.order.HongBaoOrder" useGeneratedKeys="true" keyProperty="id">insert into yeshi_ec_hongbao_order (ho_id,ho_hongbao_id,ho_order_id,cog_create_time) values (#{id,jdbcType=BIGINT},#{hongBaoV2.id,jdbcType=BIGINT},#{commonOrder.id,jdbcType=BIGINT},#{createTime,jdbcType=TIMESTAMP})</insert>
  <insert id="insertSelective" parameterType="com.yeshi.fanli.entity.order.HongBaoOrder" useGeneratedKeys="true" keyProperty="id">insert into yeshi_ec_hongbao_order
    <trim prefix="(" suffix=")" suffixOverrides=",">
      <if test="id != null">ho_id,</if>
      <if test="hongBaoV2 != null">ho_hongbao_id,</if>
      <if test="commonOrder != null">ho_order_id,</if>
      <if test="createTime != null">cog_create_time,</if>
    </trim>values
    <trim prefix="(" suffix=")" suffixOverrides=",">
      <if test="id != null">#{id,jdbcType=BIGINT},</if>
      <if test="hongBaoV2 != null">#{hongBaoV2.id,jdbcType=BIGINT},</if>
      <if test="commonOrder != null">#{commonOrder.id,jdbcType=BIGINT},</if>
      <if test="createTime != null">#{createTime,jdbcType=TIMESTAMP},</if>
    </trim>
  </insert>
  <update id="updateByPrimaryKey" parameterType="com.yeshi.fanli.entity.order.HongBaoOrder">update yeshi_ec_hongbao_order set ho_hongbao_id = #{hongBaoV2.id,jdbcType=BIGINT},ho_order_id = #{commonOrder.id,jdbcType=BIGINT},cog_create_time = #{createTime,jdbcType=TIMESTAMP} where ho_id = #{id,jdbcType=BIGINT}</update>
  <update id="updateByPrimaryKeySelective" parameterType="com.yeshi.fanli.entity.order.HongBaoOrder">update yeshi_ec_hongbao_order
    <set>
      <if test="hongBaoV2 != null">ho_hongbao_id=#{hongBaoV2.id,jdbcType=BIGINT},</if>
      <if test="commonOrder != null">ho_order_id=#{commonOrder.id,jdbcType=BIGINT},</if>
      <if test="createTime != null">cog_create_time=#{createTime,jdbcType=TIMESTAMP},</if>
    </set> where ho_id = #{id,jdbcType=BIGINT}
  </update>
   <resultMap id="BaseResultMap" type="com.yeshi.fanli.entity.order.HongBaoOrder">
      <id column="ho_id" property="id" jdbcType="BIGINT" />
      <result column="ho_create_time" property="createTime" jdbcType="TIMESTAMP" />
      <association property="hongBaoV2" column="ho_hongbao_id"
         javaType="com.yeshi.fanli.entity.bus.user.HongBaoV2">
         <id column="ho_hongbao_id" property="id" jdbcType="BIGINT" />
      </association>
      <association property="commonOrderGoods" column="ho_order_id"
         javaType="com.yeshi.fanli.entity.order.CommonOrder">
         <id column="ho_order_id" property="id" jdbcType="BIGINT" />
      </association>
   </resultMap>
   <sql id="Base_Column_List">
      ho_id,ho_hongbao_id,ho_order_id,ho_create_time
   </sql>
   <select id="selectByPrimaryKey" resultMap="BaseResultMap"
      parameterType="java.lang.Long">
      select
      <include refid="Base_Column_List" />
      from yeshi_ec_hongbao_order where ho_id = #{id,jdbcType=BIGINT}
   </select>
   <delete id="deleteByPrimaryKey" parameterType="java.lang.Long">delete from
      yeshi_ec_hongbao_order where ho_id = #{id,jdbcType=BIGINT}</delete>
   <insert id="insert" parameterType="com.yeshi.fanli.entity.order.HongBaoOrder"
      useGeneratedKeys="true" keyProperty="id">insert into yeshi_ec_hongbao_order
      (ho_id,ho_hongbao_id,ho_order_id,ho_create_time) values
      (#{id,jdbcType=BIGINT},#{hongBaoV2.id,jdbcType=BIGINT},#{commonOrder.id,jdbcType=BIGINT},#{createTime,jdbcType=TIMESTAMP})
   </insert>
   <insert id="insertSelective" parameterType="com.yeshi.fanli.entity.order.HongBaoOrder"
      useGeneratedKeys="true" keyProperty="id">
      insert into yeshi_ec_hongbao_order
      <trim prefix="(" suffix=")" suffixOverrides=",">
         <if test="id != null">ho_id,</if>
         <if test="hongBaoV2 != null">ho_hongbao_id,</if>
         <if test="commonOrder != null">ho_order_id,</if>
         <if test="createTime != null">ho_create_time,</if>
      </trim>
      values
      <trim prefix="(" suffix=")" suffixOverrides=",">
         <if test="id != null">#{id,jdbcType=BIGINT},</if>
         <if test="hongBaoV2 != null">#{hongBaoV2.id,jdbcType=BIGINT},</if>
         <if test="commonOrder != null">#{commonOrder.id,jdbcType=BIGINT},</if>
         <if test="createTime != null">#{createTime,jdbcType=TIMESTAMP},</if>
      </trim>
   </insert>
   <update id="updateByPrimaryKey" parameterType="com.yeshi.fanli.entity.order.HongBaoOrder">update
      yeshi_ec_hongbao_order set ho_hongbao_id =
      #{hongBaoV2.id,jdbcType=BIGINT},ho_order_id =
      #{commonOrder.id,jdbcType=BIGINT},ho_create_time =
      #{createTime,jdbcType=TIMESTAMP} where ho_id = #{id,jdbcType=BIGINT}
   </update>
   <update id="updateByPrimaryKeySelective" parameterType="com.yeshi.fanli.entity.order.HongBaoOrder">
      update yeshi_ec_hongbao_order
      <set>
         <if test="hongBaoV2 != null">ho_hongbao_id=#{hongBaoV2.id,jdbcType=BIGINT},</if>
         <if test="commonOrder != null">ho_order_id=#{commonOrder.id,jdbcType=BIGINT},</if>
         <if test="createTime != null">ho_create_time=#{createTime,jdbcType=TIMESTAMP},</if>
      </set>
      where ho_id = #{id,jdbcType=BIGINT}
   </update>
</mapper>