SizePoolDetailMapper.xml 2.33 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.ufo.dal.SizePoolDetailMapper">
    <resultMap id="BaseResultMap" type="com.yoho.ufo.dal.model.SizePoolDetail">
      <result column="id" property="id" jdbcType="INTEGER" />
      <result column="size_pool_id" property="sizePoolId" jdbcType="INTEGER" />
      <result column="is_include" property="isInclude" jdbcType="INTEGER" />
      <result column="item_id" property="itemId" jdbcType="INTEGER" />
      <result column="item_type" property="itemType" jdbcType="INTEGER" />
    </resultMap>

    <sql id="Base_Column_List">
        id, size_pool_id, is_include, item_id, item_type
    </sql>

    <insert id="insert" parameterType="com.yoho.ufo.dal.model.SizePoolDetail">
        insert into size_pool_detail(id, size_pool_id, is_include, item_id, item_type)
        values (#{id}, #{sizePoolId}, #{isInclude}, {itemIdd}, #{itemType})
    </insert>
    
    <insert id="batchInsert" parameterType="java.util.List" >
        insert into size_pool_detail (size_pool_id, is_include, item_id, item_type) values
       <foreach collection="list" item="item" index="index" separator="," >  
        ( #{item.sizePoolId,jdbcType=INTEGER}, #{item.isInclude,jdbcType=INTEGER}, 
         #{item.itemId,jdbcType=INTEGER}, #{item.itemType,jdbcType=INTEGER})
       </foreach>  
    </insert>
  
  <delete id="deleteBySizePoolId" parameterType="java.lang.Integer">
    delete from size_pool_detail
    where size_pool_id = #{sizePoolId,jdbcType=INTEGER}
  </delete>
  
  <select id="queryBySizePoolId" resultMap="BaseResultMap">
    select 
    <include refid="Base_Column_List" />
    from size_pool_detail 
    where size_pool_id = #{sizePoolId, jdbcType=INTEGER}
  </select>
  
  <select id="queryByBrandId" resultMap="BaseResultMap">
    select 
    <include refid="Base_Column_List" />
    from size_pool_detail 
    where is_include=1 and item_type=1 and item_id=#{brandId}
  </select>
  
    <select id="queryBySizePoolIds" resultMap="BaseResultMap">
    select 
    <include refid="Base_Column_List" />
    from size_pool_detail 
    where size_pool_id in 
    <foreach collection="sizePoolIdList" item="sizePoolId" open="(" close=")" separator=",">
        #{sizePoolId}
    </foreach>
  </select>
</mapper>