<?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.community.huiju.dao.TpShopImgMapper" >
  <resultMap id="BaseResultMap" type="com.community.huiju.model.TpShopImg" >
    <id column="id" property="id" jdbcType="INTEGER" />
    <result column="community_id" property="communityId" jdbcType="INTEGER" />
    <result column="shop_id" property="shopId" jdbcType="INTEGER" />
    <result column="img_url" property="imgUrl" jdbcType="VARCHAR" />
    <result column="img_type" property="imgType" jdbcType="VARCHAR" />
    <result column="create_date" property="createDate" jdbcType="TIMESTAMP" />
  </resultMap>
  <sql id="Base_Column_List" >
    id, community_id, shop_id, img_url, img_type, create_date
  </sql>
  <select id="selectByPrimaryKey" resultMap="BaseResultMap" parameterType="java.lang.Integer" >
    select 
    <include refid="Base_Column_List" />
    from tp_shop_img
    where id = #{id,jdbcType=INTEGER}
  </select>

  <select id="selectShopIdCommunity" resultMap="BaseResultMap">
    select
    *
    from
    tp_shop_img
    where  community_id = #{communityId,jdbcType=INTEGER}
           and  shop_id = #{shopId,jdbcType=INTEGER}
           and img_type = #{imgType}
  </select>

  <delete id="deleteByPrimaryKey" parameterType="java.lang.Integer" >
    delete from tp_shop_img
    where id = #{id,jdbcType=INTEGER}
  </delete>
  <insert id="insert" parameterType="com.community.huiju.model.TpShopImg" >
    insert into tp_shop_img (id, community_id, shop_id, 
      img_url, img_type, create_date
      )
    values (#{id,jdbcType=INTEGER}, #{communityId,jdbcType=INTEGER}, #{shopId,jdbcType=INTEGER}, 
      #{imgUrl,jdbcType=VARCHAR}, #{imgType,jdbcType=VARCHAR}, #{createDate,jdbcType=TIMESTAMP}
      )
  </insert>
  <insert id="insertSelective" parameterType="com.community.huiju.model.TpShopImg" >
    insert into tp_shop_img
    <trim prefix="(" suffix=")" suffixOverrides="," >
      <if test="id != null" >
        id,
      </if>
      <if test="communityId != null" >
        community_id,
      </if>
      <if test="shopId != null" >
        shop_id,
      </if>
      <if test="imgUrl != null" >
        img_url,
      </if>
      <if test="imgType != null" >
        img_type,
      </if>
      <if test="createDate != null" >
        create_date,
      </if>
    </trim>
    <trim prefix="values (" suffix=")" suffixOverrides="," >
      <if test="id != null" >
        #{id,jdbcType=INTEGER},
      </if>
      <if test="communityId != null" >
        #{communityId,jdbcType=INTEGER},
      </if>
      <if test="shopId != null" >
        #{shopId,jdbcType=INTEGER},
      </if>
      <if test="imgUrl != null" >
        #{imgUrl,jdbcType=VARCHAR},
      </if>
      <if test="imgType != null" >
        #{imgType,jdbcType=VARCHAR},
      </if>
      <if test="createDate != null" >
        #{createDate,jdbcType=TIMESTAMP},
      </if>
    </trim>
  </insert>
  <update id="updateByPrimaryKeySelective" parameterType="com.community.huiju.model.TpShopImg" >
    update tp_shop_img
    <set >
      <if test="communityId != null" >
        community_id = #{communityId,jdbcType=INTEGER},
      </if>
      <if test="shopId != null" >
        shop_id = #{shopId,jdbcType=INTEGER},
      </if>
      <if test="imgUrl != null" >
        img_url = #{imgUrl,jdbcType=VARCHAR},
      </if>
      <if test="imgType != null" >
        img_type = #{imgType,jdbcType=VARCHAR},
      </if>
      <if test="createDate != null" >
        create_date = #{createDate,jdbcType=TIMESTAMP},
      </if>
    </set>
    where id = #{id,jdbcType=INTEGER}
  </update>
  <update id="updateByPrimaryKey" parameterType="com.community.huiju.model.TpShopImg" >
    update tp_shop_img
    set community_id = #{communityId,jdbcType=INTEGER},
      shop_id = #{shopId,jdbcType=INTEGER},
      img_url = #{imgUrl,jdbcType=VARCHAR},
      img_type = #{imgType,jdbcType=VARCHAR},
      create_date = #{createDate,jdbcType=TIMESTAMP}
    where id = #{id,jdbcType=INTEGER}
  </update>
</mapper>