<?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.tmerclub.cloud.product.mapper.AttrValueMapper">
  <resultMap id="attrValueMap" type="com.tmerclub.cloud.product.model.AttrValue">
    <id column="attr_value_id" property="attrValueId" />
    <result column="create_time" property="createTime"/>
    <result column="update_time" property="updateTime"/>
    <result column="attr_id" property="attrId"/>
    <result column="value" property="value"/>
  </resultMap>
  <sql id="Vo_Column_List">
    `attr_value_id`,`create_time`,`update_time`,`attr_id`
  </sql>

  <delete id="deleteBatch">
    DELETE FROM attr_value WHERE attr_value_id  IN
    <foreach collection="attrValueIds" item="attrValueId" open="(" close=")" separator=",">
      #{attrValueId}
    </foreach>
  </delete>

  <insert id="save" useGeneratedKeys="true" keyProperty="attrValue.attrValueId">
    insert into attr_value (`attr_id`)
    values (#{attrValue.attrId})
  </insert>

  <delete id="deleteByAttrId">
    DELETE FROM attr_value WHERE attr_id = #{attrId}
  </delete>

  <select id="getAttrValueIdsByAttrId" resultType="java.lang.Long">
    select attr_value_id from attr_value where attr_id = #{attrId}
  </select>
</mapper>
