ProductDefaultImageMapper.xml 995 Bytes
<?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.yoho.search.dal.ProductDefaultImageMapper">
    <resultMap id="ProductDefaultImage" type="com.yoho.search.dal.model.ProductDefaultImage">
        <result column="product_id" property="productId" jdbcType="INTEGER"/>
        <result column="default_images" property="defaultImage" jdbcType="VARCHAR"/>
    </resultMap>
    <select id="selectProductDefaultImage" resultMap="ProductDefaultImage">
        <![CDATA[
    SELECT
		`t`.`product_id` AS `product_id`,
		`t`.`image_url` AS `default_images`
	FROM
		`goods_images` `t`
	WHERE
		(`t`.`is_default` = 'Y')
		and(`t`.`status` = 1)
    AND product_id in]]>
        <foreach item="item" index="index" collection="list"
                 open="(" separator="," close=")">
            #{item}
        </foreach>
        GROUP BY
        `t`.`product_id`
    </select>
</mapper>