| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153 |
- <?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.poyee.mapper.BlowoutRecordMapper">
- <resultMap id="BlowoutRecordResultMap" type="com.poyee.dto.BlowoutRecordDto">
- <!-- BlowoutDetailRecord 表映射 -->
- <id property="blowoutDetailRecord.id" column="t1_id"/>
- <result property="blowoutDetailRecord.url" column="t1_url"/>
- <result property="blowoutDetailRecord.images" column="t1_images"/>
- <result property="blowoutDetailRecord.configuration" column="t1_configuration"/>
- <result property="blowoutDetailRecord.productHighlights" column="t1_product_highlights"/>
- <result property="blowoutDetailRecord.boxBreak" column="t1_box_break"/>
- <result property="blowoutDetailRecord.releaseDate" column="t1_release_date"/>
- <result property="blowoutDetailRecord.productYear" column="t1_product_year"/>
- <result property="blowoutDetailRecord.brand" column="t1_brand"/>
- <result property="blowoutDetailRecord.sport" column="t1_sport"/>
- <result property="blowoutDetailRecord.boxStyle" column="t1_box_style"/>
- <result property="blowoutDetailRecord.promo" column="t1_promo"/>
- <result property="blowoutDetailRecord.gmtCreateTime" column="t1_gmt_create_time"/>
- <result property="blowoutDetailRecord.imageUri" column="t1_image_uri"/>
- <result property="blowoutDetailRecord.imageStat" column="t1_image_stat"/>
- <result property="blowoutDetailRecord.gmtModifiedTime" column="t1_gmt_modified_time"/>
- <!-- BlowoutRecordNewDailyNew 表映射 -->
- <result property="blowoutRecordNewDailyNew.id" column="t2_id"/>
- <result property="blowoutRecordNewDailyNew.img" column="t2_img"/>
- <result property="blowoutRecordNewDailyNew.title" column="t2_title"/>
- <result property="blowoutRecordNewDailyNew.price" column="t2_price"/>
- <result property="blowoutRecordNewDailyNew.suggestedPrice" column="t2_suggestedPrice"/>
- <result property="blowoutRecordNewDailyNew.href" column="t2_href"/>
- <result property="blowoutRecordNewDailyNew.category" column="t2_category"/>
- <result property="blowoutRecordNewDailyNew.preorder" column="t2_preorder"/>
- <result property="blowoutRecordNewDailyNew.newField" column="t2_newField"/>
- <result property="blowoutRecordNewDailyNew.detailState" column="t2_detailState"/>
- <result property="blowoutRecordNewDailyNew.lowState" column="t2_lowState"/>
- <result property="blowoutRecordNewDailyNew.firstCreateTime" column="t2_firstCreateTime"/>
- <result property="blowoutRecordNewDailyNew.gmtCreateTime" column="t2_gmtCreateTime"/>
- <result property="blowoutRecordNewDailyNew.gmtModifiedTime" column="t2_gmtModifiedTime"/>
- </resultMap>
- <resultMap id="BlowoutRecordGroupResultMap" type="com.poyee.dto.BlowoutRecordGroupDto">
- <result property="releaseDate" column="t1_release_date"/>
- <result property="productYear" column="t1_product_year"/>
- <result property="brand" column="t1_brand"/>
- <result property="sport" column="t1_sport"/>
- <result property="boxStyle" column="t1_box_style"/>
- <result property="title" column="t2_title"/>
- <result property="price" column="t2_price"/>
- <result property="suggestedPrice" column="t2_suggestedPrice"/>
- <result property="category" column="t2_category"/>
- </resultMap>
- <select id="getBlowoutRecordsByPage" resultMap="BlowoutRecordResultMap">
- SELECT
- t1.id as t1_id,
- t1.url as t1_url,
- t1.images as t1_images,
- t1.configuration as t1_configuration,
- t1.product_highlights as t1_product_highlights,
- t1.box_break as t1_box_break,
- t1.release_date as t1_release_date,
- t1.product_year as t1_product_year,
- t1.brand as t1_brand,
- t1.sport as t1_sport,
- t1.box_style as t1_box_style,
- t1.promo as t1_promo,
- t1.gmt_create_time as t1_gmt_create_time,
- t1.image_uri as t1_image_uri,
- t1.image_stat as t1_image_stat,
- t1.gmt_modified_time as t1_gmt_modified_time,
- t2.id as t2_id,
- t2.img as t2_img,
- t2.title as t2_title,
- t2.price as t2_price,
- t2.suggested_Price as t2_suggestedPrice,
- t2.href as t2_href,
- t2.category as t2_category,
- t2.preorder as t2_preorder,
- t2.new as t2_newField,
- t2.detail_State as t2_detailState,
- t2.low_State as t2_lowState,
- t2.first_Create_Time as t2_firstCreateTime,
- t2.gmt_Create_Time as t2_gmtCreateTime,
- t2.gmt_Modified_Time as t2_gmtModifiedTime
- FROM blowout_detail_record t1
- INNER JOIN blowout_record_new_daily_new t2 ON t1.url = 'https://www.blowoutcards.com' || t2.href
- <where>
- <if test="releaseDatePattern != null and releaseDatePattern != ''">
- t1.release_date LIKE CONCAT(#{releaseDatePattern}, '%')
- </if>
- <if test="productYear != null and productYear != ''">
- AND t1.product_year = #{productYear}
- </if>
- <if test="brand != null and brand != ''">
- AND LOWER(t1.brand) = LOWER(#{brand})
- </if>
- <if test="category != null and category != ''">
- AND LOWER(t2.category) = LOWER(#{category})
- </if>
- </where>
- ORDER BY t1.id DESC
- LIMIT #{limit} OFFSET #{offset};
- </select>
- <select id="getLatestBlowoutRecordsByGroup" resultMap="BlowoutRecordGroupResultMap">
- SELECT
- t1_release_date,
- t1_product_year,
- t1_brand,
- t1_sport,
- t1_box_style,
- t2_title,
- t2_price,
- t2_suggestedPrice,
- t2_category
- FROM (
- SELECT
- t1.release_date as t1_release_date,
- t1.product_year as t1_product_year,
- t1.brand as t1_brand,
- t1.sport as t1_sport,
- t1.box_style as t1_box_style,
- t2.title as t2_title,
- t2.price as t2_price,
- t2.suggested_Price as t2_suggestedPrice,
- t2.category as t2_category,
- ROW_NUMBER() OVER (
- PARTITION BY t1.product_year, t1.brand, t1.sport, t1.box_style, t2.title, t2.category
- ORDER BY t1.gmt_create_time DESC
- ) as rn
- FROM blowout_detail_record t1
- left JOIN blowout_record_new_daily_new t2 ON t1.url = 'https://www.blowoutcards.com' || t2.href
- <where>
- <if test="releaseDatePattern != null and releaseDatePattern != ''">
- t1.release_date LIKE CONCAT(#{releaseDatePattern}, '%')
- </if>
- <if test="productYear != null and productYear != ''">
- AND t1.product_year = #{productYear}
- </if>
- <if test="brand != null and brand != ''">
- AND LOWER(t1.brand) = LOWER(#{brand})
- </if>
- <if test="category != null and category != ''">
- AND LOWER(t1.sport) = LOWER(#{category})
- </if>
- </where>
- ) subquery
- WHERE rn = 1
- ORDER BY to_date(t1_release_date, 'Mon DD, YYYY') ASC;
- </select>
- </mapper>
|