<?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.imooc.o2o.dao.ProductCategoryDao">
<!-- 目的:为dao接口方法提供sql语句配置 -->
<select id="queryProductCategoryList" resultType="com.imooc.o2o.entity.ProductCategory"
parameterType="Long">
<!-- 具体的sql -->
SELECT
product_category_id,
product_category_name,
priority,
create_time,
shop_id
FROM
tb_product_category
WHERE
shop_id = #{shopId}
ORDER BY
priority DESC
</select>
<insert id="batchInsertProductCategory" parameterType="java.util.List">
INSERT INTO
tb_product_category(product_category_name, priority,
create_time, shop_id)
VALUES
<foreach collection="list" item="productCategory" index="index"
separator=",">
(
#{productCategory.productCategoryName},
#{productCategory.priority},
#{productCategory.createTime},
#{productCategory.shopId}
)
</foreach>
</insert>
<delete id="deleteProductCategory">
DELETE FROM
tb_product_category
WHERE
product_category_id = #{productCategoryId}
AND shop_id = #{shopId}
</delete>
</mapper>
网友评论