ProductActivityMapper.xml 1.05 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.ProductActivityMapper">
    <resultMap id="ProductActivity" type="com.yoho.search.dal.model.ProductActivity">
        <result column="product_skn" property="productSkn" jdbcType="INTEGER"/>
        <result column="activity" property="activity" jdbcType="VARCHAR"/>
    </resultMap>
    <select id="getProductActivity" resultMap="ProductActivity">
        <![CDATA[
        SELECT
		`ap`.`product_skn` AS `product_skn`,
		concat(
			'{"activity_id":',
			`ap`.`id`,
			',"template_id":',
			`ap`.`template_id`,
			',"order_by":',
			`ap`.`order_by`,
			',"is_recommend":',
			`ap`.`is_recommend`,
			',"status":',
			`ap`.`status`,
			'}'
		) AS `activity`
	    FROM
		`activity_product` `ap`
		where product_skn in]]>
        <foreach item="item" index="index" collection="list"
                 open="(" separator="," close=")">
            #{item}
        </foreach>
    </select>
</mapper>