AssoProductCategoryPictureMapper.xml 2.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263
  1. <?xml version="1.0" encoding="UTF-8" ?>
  2. <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
  3. <mapper namespace="cn.cslg.pas.mapper.asso.AssoProductCategoryPictureMapper">
  4. <!--插入数据-->
  5. <!--int insert(AssoProductCategoryPicture assoProductCategoryPicture);-->
  6. <insert id="insert" useGeneratedKeys="true" keyProperty="id">
  7. insert into asso_product_category_picture (product_category_id, name, suffix, url)
  8. values (#{productCategoryId}, #{name}, #{suffix}, #{url})
  9. </insert>
  10. <!--批量插入数据-->
  11. <!--int insertBatch(List<AssoProductCategoryPicture> assoProductCategoryPictures);-->
  12. <insert id="insertBatch" useGeneratedKeys="true" keyProperty="id">
  13. insert into asso_product_category_picture (product_category_id, name, suffix, url)
  14. values
  15. <foreach collection="list" item="n" separator=",">
  16. (#{n.productCategoryId}, #{n.name}, #{n.suffix}, #{n.url})
  17. </foreach>
  18. </insert>
  19. <!--根据产品类别productCategoryId删除数据-->
  20. <!--int deleteByProductCategoryId(Integer productCategoryId);-->
  21. <delete id="deleteByProductCategoryId">
  22. delete
  23. from asso_product_category_picture
  24. where product_category_id = #{productCategoryId}
  25. </delete>
  26. <!--根据id集合批量删除数据-->
  27. <!--int deleteByIds(List<Integer> ids);-->
  28. <delete id="deleteByIds">
  29. delete
  30. from asso_product_category_picture
  31. where id in (
  32. <foreach collection="list" item="n" separator=",">
  33. #{n}
  34. </foreach>
  35. )
  36. </delete>
  37. <!--根据产品类别id查询数据-->
  38. <!--List<ProductCategoryPictureVO> selectByProductCategoryId(Integer productCategoryId);-->
  39. <select id="selectByProductCategoryId" resultMap="getStandardByProductCategoryIdMap">
  40. select id, product_category_id, name, suffix, url
  41. from asso_product_category_picture
  42. where product_category_id = #{productCategoryId}
  43. </select>
  44. <resultMap id="getStandardByProductCategoryIdMap" type="cn.cslg.pas.common.model.vo.ProductCategoryPictureVO">
  45. <id column="id" property="id"/>
  46. <result column="picture" property="picture"/>
  47. </resultMap>
  48. <!--根据产品类别id统计数量-->
  49. <!--int countByProductCategoryId(Integer productCategoryId);-->
  50. <select id="countByProductCategoryId" resultType="int">
  51. select count(*)
  52. from asso_product_category_picture
  53. where product_category_id = #{productCategoryId}
  54. </select>
  55. </mapper>