Showing
1 changed file
with
26 additions
and
0 deletions
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="com.yoho.search.dal.ProductColorsMapper"> | ||
4 | + <resultMap id="ProductColors" type="com.yoho.search.dal.model.ProductColors"> | ||
5 | + <result column="product_id" property="productId" jdbcType="INTEGER"/> | ||
6 | + <result column="color_ids" property="colorIds" jdbcType="VARCHAR"/> | ||
7 | + <result column="color_names" property="colorNames" jdbcType="VARCHAR"/> | ||
8 | + </resultMap> | ||
9 | + <select id="getProductColors" resultMap="ProductColors" timeout="20000"> | ||
10 | + <![CDATA[ | ||
11 | + SELECT | ||
12 | + `a`.`product_id` AS `product_id`, | ||
13 | + group_concat(`a`.`color_id` SEPARATOR ',') AS `color_ids`, | ||
14 | + group_concat( | ||
15 | + `a`.`color_name` SEPARATOR ',' | ||
16 | + ) AS `color_names` | ||
17 | + FROM | ||
18 | + `goods` `a` where product_id in]]> | ||
19 | + <foreach item="item" index="index" collection="list" | ||
20 | + open="(" separator="," close=")"> | ||
21 | + #{item} | ||
22 | + </foreach> | ||
23 | + GROUP BY | ||
24 | + `a`.`product_id` | ||
25 | + </select> | ||
26 | +</mapper> |
-
Please register or login to post a comment