<?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.ai.da.mapper.primary.UserLikeMapper">
    <select id="getHistoryLikeWithoutGradient" resultType="java.util.Map">
        /* 逻辑修改前
        SELECT
            a.id,
            a.design_item_id,
            a.design_outfit_id,
            b.account_id
        FROM
            t_user_like a
                INNER JOIN
            t_design_item_detail b
            ON
                a.design_item_id = b.design_item_id
        WHERE
            b.gradient_string IS NULL
          AND b.is_deleted = 0
          AND b.account_id = 87
          AND a.converted = 0
        GROUP BY
            a.design_item_id,
            a.design_outfit_id,
            b.account_id;*/
        SELECT
            a.id,
            a.design_item_id,
            a.design_outfit_id,
            b.account_id
        FROM
            t_user_like a
                INNER JOIN
            t_design_item_detail b
            ON
                a.design_item_id = b.design_item_id
        WHERE
            b.is_deleted = 0
          AND NOT EXISTS (
            SELECT 1
            FROM t_design_item_detail b2
            WHERE
                b2.design_item_id = a.design_item_id
              AND b2.gradient_string IS NOT NULL
              AND b2.is_deleted = 0
        )
        GROUP BY
            a.design_item_id,
            a.design_outfit_id,
            b.account_id
        ORDER BY
            a.design_item_id,
            a.design_outfit_id;
    </select>

    <select id="getHistoryLikeWithGradient" resultType="java.util.Map">
        /*SELECT
            a.id,
            a.design_item_id,
            a.design_outfit_id,
            b.account_id
        FROM
            t_user_like a
                INNER JOIN
            t_design_item_detail b
            ON
                a.design_item_id = b.design_item_id
        WHERE
            b.gradient_string IS NOT NULL
          AND b.is_deleted = 0
          AND a.converted = 0
        GROUP BY
            a.design_item_id,
            a.design_outfit_id,
            b.account_id;*/
        SELECT
            a.id,
            a.design_item_id,
            a.design_outfit_id,
            b.account_id
        FROM
            t_user_like a
                INNER JOIN
            t_design_item_detail b
            ON
                a.design_item_id = b.design_item_id
        WHERE
            b.is_deleted = 0
          AND EXISTS (
            SELECT 1
            FROM t_design_item_detail b2
            WHERE
                b2.design_item_id = a.design_item_id
              AND b2.gradient_string IS NOT NULL
              AND b2.is_deleted = 0
        )
        GROUP BY
            a.design_item_id,
            a.design_outfit_id,
            b.account_id
        ORDER BY
            a.design_item_id,
            a.design_outfit_id;
    </select>

    <select id="getHistoryLikeWithoutModel" resultType="java.util.Map">
        select b.design_item_id designItemId, b.design_outfit_id designOutfitId
        from t_design_item_detail a
                 inner join t_user_like b on a.design_item_id = b.design_item_id
        where a.path IN (
                         /*'aida-sys-image/models/Female/8ecbbec3-1a17-4b61-9d34-3f60acf66a85.png',
                         'aida-sys-image/models/male/d90ea1e0-dac4-4356-87b8-4b8d5d7b97fe.png',
                         'aida-sys-image/models/female/068c8165-d134-4fbd-a323-cd26846d3343.png',
                         'aida-sys-image/models/female/5ae883b9-914e-4a02-b5c1-14d424b7c721.png',
                         'aida-users/6/models/female/cd049392-75f8-46bb-b1b9-bc8822a63a70.png',
                         'aida-users/42/models/female/2380166a-c46e-4fe0-85ab-62f735a58b79.png',
                         'aida-users/6/models/female/2e4efb1e-b86b-4056-8367-cfca039707db.png',
                         'aida-users/6/models/female/e7450044-bf85-4d33-adb2-aedfe11b1d40.png',
                         'aida-users/6/models/female/5c43a00d-aeb0-4877-85ba-3ec15c3c9262.png',
                         'aida-users/6/models/female/2e2e5f52-50af-413b-be2c-9f030a62ec61.png',
                         'aida-users/6/models/female/114c9388-06f9-42a6-beeb-212afc9a06eb.png',
                         'aida-users/11484/models/female/1ebe8690-2cd3-4235-a5f7-136fe42e8a41.png',
                         'aida-users/6/models/female/834acb3a-f9c1-464c-b455-5d35c35515b7.png',*/
                        'aida-users/83/models/female/f5734e63-5293-4f62-a7e3-daa03ed6ad8c.png')
        GROUP BY b.design_item_id, b.design_outfit_id
    </select>





</mapper>
