|
|
|
@ -0,0 +1,31 @@
|
|
|
|
|
<?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.yami.shop.dao.CategoryBrandMapper">
|
|
|
|
|
<!-- resultMap定义了数据库表字段与Java对象属性之间的映射关系 -->
|
|
|
|
|
<resultMap id="BaseResultMap" type="com.yami.shop.bean.model.CategoryBrand">
|
|
|
|
|
<!--
|
|
|
|
|
@mbg.generated 表示这个注释是由MyBatis Generator自动生成的,用于警告不要手动编辑
|
|
|
|
|
-->
|
|
|
|
|
<id column="id" jdbcType="BIGINT" property="id" />
|
|
|
|
|
<result column="category_id" jdbcType="BIGINT" property="categoryId" />
|
|
|
|
|
<result column="brand_id" jdbcType="BIGINT" property="brandId" />
|
|
|
|
|
</resultMap>
|
|
|
|
|
|
|
|
|
|
<!-- 插入语句,批量插入分类品牌关系 -->
|
|
|
|
|
<insert id="insertCategoryBrand">
|
|
|
|
|
insert into tz_category_brand (category_id,brand_id) values
|
|
|
|
|
<!-- foreach循环遍历brandIds列表,为每个品牌ID生成一个插入语句 -->
|
|
|
|
|
<foreach collection="brandIds" item="brandId" separator=",">
|
|
|
|
|
(#{categoryId},#{brandId})
|
|
|
|
|
</foreach>
|
|
|
|
|
</insert>
|
|
|
|
|
<!-- 删除语句,根据分类ID删除分类品牌关系 -->
|
|
|
|
|
<delete id="deleteByCategoryId">
|
|
|
|
|
delete from tz_category_brand where category_id = #{categoryId}
|
|
|
|
|
</delete>
|
|
|
|
|
|
|
|
|
|
<!-- 删除语句,根据品牌ID删除分类品牌关系 -->
|
|
|
|
|
<delete id="deleteByBrandId">
|
|
|
|
|
delete from tz_category_brand where brand_id = #{brandId}
|
|
|
|
|
</delete>
|
|
|
|
|
</mapper>
|