78 lines
2.5 KiB
XML
78 lines
2.5 KiB
XML
<?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.suisung.mall.search.dao.EsProductImageDao">
|
|
<resultMap id="shop_product_index" type="com.suisung.mall.search.domain.EsProductImage">
|
|
<result property="libId" column="id"/>
|
|
<result property="barcode" column="barcode"/>
|
|
<result property="category" column="category"/>
|
|
<result property="productName" column="name"/>
|
|
<result property="productShortName" column="product_short_name"/>
|
|
<result property="thumb" column="thumb"/>
|
|
<result property="imagesUrls" column="merged_image_url"/>
|
|
</resultMap>
|
|
|
|
<select id="getAllEsProductList" resultMap="shop_product_index">
|
|
SELECT
|
|
lp.id,
|
|
lp.barcode,
|
|
lp.name,
|
|
lp.product_short_name,
|
|
lp.category,
|
|
lp.thumb,
|
|
(
|
|
SELECT GROUP_CONCAT(image_url SEPARATOR ',')
|
|
FROM library_product_image
|
|
WHERE product_id = lp.id
|
|
) AS merged_image_url
|
|
FROM library_product lp
|
|
<where>
|
|
<if test="productId!=null">
|
|
lp.id=#{productId}
|
|
</if>
|
|
</where>
|
|
</select>
|
|
|
|
<select id="getPageEsProductList" resultMap="shop_product_index">
|
|
SELECT
|
|
lp.id,
|
|
lp.barcode,
|
|
lp.name,
|
|
lp.product_short_name,
|
|
lp.category,
|
|
lp.thumb,
|
|
(
|
|
SELECT GROUP_CONCAT(image_url SEPARATOR ',')
|
|
FROM library_product_image
|
|
WHERE product_id = lp.id
|
|
) AS merged_image_url
|
|
FROM library_product lp
|
|
<if test="updateTime!=null">
|
|
where lp.updated_at>=#{updateTime}
|
|
</if>
|
|
limit #{start},#{row}
|
|
</select>
|
|
|
|
<select id="getPageTotal" resultType="Integer">
|
|
select count(1)
|
|
from
|
|
(
|
|
SELECT
|
|
lp.id,
|
|
lp.barcode,
|
|
lp.name,
|
|
lp.product_short_name,
|
|
lp.category,
|
|
lp.thumb,
|
|
(
|
|
SELECT GROUP_CONCAT(image_url SEPARATOR ',')
|
|
FROM library_product_image
|
|
WHERE product_id = lp.id
|
|
) AS merged_image_url
|
|
FROM library_product lp
|
|
<if test="updateTime!=null">
|
|
where lp.updated_at>=#{updateTime}
|
|
</if>
|
|
)temp
|
|
|
|
</select>
|
|
</mapper> |