tangchuanxing_branch
CR7 9 months ago
parent 2eef085e09
commit 1f675f8fe7

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