<?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.wsk.travelf.mapper.ProductMapper">
    
    <resultMap id="productMap" type="com.wsk.travelf.pojo.Product">
        <id property="pid" column="pid"></id>
        <result property="productName" column="productName"></result>
        <result property="price" column="price"></result>
        <result property="status" column="status"></result>
        <result property="hotline" column="hotline"></result>
        <result property="productDesc" column="productDesc"></result>
        <result property="pImage" column="pImage"></result>
        <result property="cid" column="cid"></result>
        <association property="category" column="cid" javaType="com.wsk.travelf.pojo.Category">
            <id property="cid" column="cid"></id>
            <result property="cname" column="cname"></result>
        </association>
    </resultMap>

    <select id="findProductPage" resultMap="productMap">
        select * from product
            left join category on product.cid = category.cid
        order by product.pid desc
    </select>
    
</mapper>