DiscountProductMapper.xml 1.09 KB
<?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.DiscountProductSknMapper">

    <resultMap id="BaseResultMap" type="com.yoho.search.dal.model.DiscountProductSkn">
        <result column="product_skn" property="productSkn" jdbcType="INTEGER"/>
        <result column="pool_id" property="poolId" jdbcType="VARCHAR"/>
        <result column="score" property="score" jdbcType="DOUBLE"/>
    </resultMap>

    <select id="selectDiscountProductSkn" resultMap="BaseResultMap" timeout="20000">
        <![CDATA[
          SELECT
		      `dp`.`product_skn` AS `product_skn`,
		      group_concat(`dp`.`pool_id` SEPARATOR ',') AS `pool_id`,
		      `dp`.`score` AS `score`
	      FROM
		      `discount_product` `dp`
		  where
              product_skn
        in]]>
        <foreach item="item" index="index" collection="list"
                 open="(" separator="," close=")">
            #{item}
        </foreach>
        GROUP BY
        `dp`.`product_skn`
    </select>

</mapper>