Blame view

dal/src/main/resources/META-INF/mybatis/GoodsImagesMapper.xml 2.55 KB
Lixiaodi authored
1 2 3 4 5 6 7 8 9 10 11
<?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.ufo.dal.GoodsImagesMapper">
  <resultMap id="BaseResultMap" type="com.yoho.ufo.dal.model.GoodsImages">
    <id column="id" jdbcType="INTEGER" property="id" />
    <result column="goods_id" jdbcType="INTEGER" property="goodsId" />
    <result column="product_id" jdbcType="INTEGER" property="productId" />
    <result column="is_default" jdbcType="CHAR" property="isDefault" />
    <result column="image_url" jdbcType="VARCHAR" property="imageUrl" />
    <result column="order_by" jdbcType="INTEGER" property="orderBy" />
  </resultMap>
mali authored
12
Lixiaodi authored
13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47
  <insert id="insert" parameterType="com.yoho.ufo.dal.model.GoodsImages">
    insert into goods_images (id, goods_id, product_id, 
      is_default, image_url, order_by
      )
    values (#{id,jdbcType=INTEGER}, #{goodsId,jdbcType=INTEGER}, #{productId,jdbcType=INTEGER}, 
      #{isDefault,jdbcType=CHAR}, #{imageUrl,jdbcType=VARCHAR}, #{orderBy,jdbcType=INTEGER}
      )
  </insert>
  <update id="updateByPrimaryKey" parameterType="com.yoho.ufo.dal.model.GoodsImages">
    update goods_images
    set goods_id = #{goodsId,jdbcType=INTEGER},
      product_id = #{productId,jdbcType=INTEGER},
      is_default = #{isDefault,jdbcType=CHAR},
      image_url = #{imageUrl,jdbcType=VARCHAR},
      order_by = #{orderBy,jdbcType=INTEGER}
    where id = #{id,jdbcType=INTEGER}
  </update>
  <select id="selectByPrimaryKey" parameterType="java.lang.Integer" resultMap="BaseResultMap">
    select id, goods_id, product_id, is_default, image_url, order_by
    from goods_images
    where id = #{id,jdbcType=INTEGER}
  </select>
  <select id="selectAll" resultMap="BaseResultMap">
    select id, goods_id, product_id, is_default, image_url, order_by
    from goods_images
  </select>
  <delete id="deleteByGoodsId" parameterType="java.lang.Integer">
    delete from goods_images
    where goods_id = #{goodsId,jdbcType=INTEGER}
  </delete>
  <select id="selectByGoodsId" parameterType="java.lang.Integer" resultMap="BaseResultMap">
    select id, goods_id, product_id, is_default, image_url, order_by
    from goods_images
    where goods_id = #{goodsId,jdbcType=INTEGER}
  </select>
mali authored
48
    <select id="selectByProductIdList" resultMap="BaseResultMap">
caoyan authored
49 50
    select id, goods_id, product_id, is_default, image_url, order_by
    from goods_images
mali authored
51
    where product_id in
caoyan authored
52 53
    <foreach collection="list" item="productId" open="(" close=")" separator=",">
     #{productId}
caoyan authored
54 55 56
    </foreach>
  </select>
  
Lixiaodi authored
57
</mapper>