1、Dao层实现
(1) ProductDao
public interface ProductDao {
/**
* 添加商品
* @param product
* @return
*/
int insertProduct(Product product);
}
(2) ProductImgDao
public interface ProductImgDao {
List<ProductImg> queryProductImgList(long productId);
/**
* 批量添加商品详情图片
* @param productImgList
* @return
*/
int batchInsertProductImg(List<ProductImg> productImgList);
int deleteProductImgByProductId(long productId);
}
2、接口实现mapper
(1) ProductDao.xml
<?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.ProductDao">
<insert id="insertProduct" parameterType&#