| | |
| | | @Param("cardLevel") String cardLevel, |
| | | @Param("claimedStart") LocalDate claimedStart, |
| | | @Param("claimedEnd") LocalDate claimedEnd); |
| | | |
| | | /** |
| | | * 后台「核销记录」:只列已核销(status = USED)的领取记录。 |
| | | * |
| | | * <p>核销商家就是领取记录上的 merchant_id——核销接口要求核销方必须等于该商户,所以不需要再关联 |
| | | * benefit_verify_record。 |
| | | */ |
| | | @Select(""" |
| | | select cl.id, |
| | | cl.claim_no as claimNo, |
| | | cl.package_id as packageId, |
| | | p.package_name as packageName, |
| | | coalesce(( |
| | | select group_concat(m1.merchant_name order by pm1.sort_no asc, pm1.id asc separator '、') |
| | | from ticket_package_merchant pm1 |
| | | join merchant m1 on m1.id = pm1.merchant_id and m1.deleted = 0 |
| | | where pm1.package_id = p.id and pm1.deleted = 0 |
| | | ), m.merchant_name) as merchantNames, |
| | | m.merchant_name as verifyMerchantName, |
| | | cl.talent_id as talentId, |
| | | cl.card_id as cardId, |
| | | cl.card_no as cardNo, |
| | | cl.card_level as cardLevel, |
| | | cl.talent_name as talentName, |
| | | cl.talent_mobile as talentMobile, |
| | | cl.status, |
| | | cl.created_at as createdAt, |
| | | cl.used_at as usedAt |
| | | from ticket_package_claim cl |
| | | join ticket_package p on p.id = cl.package_id and p.deleted = 0 |
| | | left join merchant m on m.id = cl.merchant_id and m.deleted = 0 |
| | | where cl.deleted = 0 |
| | | and cl.status = 'USED' |
| | | and (#{packageId} is null or cl.package_id = #{packageId}) |
| | | and (#{talentKeyword} is null or #{talentKeyword} = '' or cl.talent_name like concat('%', #{talentKeyword}, '%') or cl.talent_mobile like concat('%', #{talentKeyword}, '%') or cl.card_no like concat('%', #{talentKeyword}, '%')) |
| | | and (#{cardLevel} is null or #{cardLevel} = '' or cl.card_level = #{cardLevel} or cl.card_level like concat('%', #{cardLevel}, '%')) |
| | | and (#{claimedStart} is null or cl.created_at >= #{claimedStart}) |
| | | and (#{claimedEnd} is null or cl.created_at < date_add(cast(#{claimedEnd} as date), interval 1 day)) |
| | | and (#{verifiedStart} is null or cl.used_at >= #{verifiedStart}) |
| | | and (#{verifiedEnd} is null or cl.used_at < date_add(cast(#{verifiedEnd} as date), interval 1 day)) |
| | | and (#{merchantKeyword} is null or #{merchantKeyword} = '' or m.merchant_name like concat('%', #{merchantKeyword}, '%')) |
| | | order by cl.used_at desc, cl.id desc |
| | | limit #{size} offset #{offset} |
| | | """) |
| | | List<Map<String, Object>> selectAdminVerificationPage(@Param("packageId") Long packageId, |
| | | @Param("talentKeyword") String talentKeyword, |
| | | @Param("cardLevel") String cardLevel, |
| | | @Param("claimedStart") LocalDate claimedStart, |
| | | @Param("claimedEnd") LocalDate claimedEnd, |
| | | @Param("verifiedStart") LocalDate verifiedStart, |
| | | @Param("verifiedEnd") LocalDate verifiedEnd, |
| | | @Param("merchantKeyword") String merchantKeyword, |
| | | @Param("size") int size, |
| | | @Param("offset") int offset); |
| | | |
| | | @Select(""" |
| | | select count(*) |
| | | from ticket_package_claim cl |
| | | join ticket_package p on p.id = cl.package_id and p.deleted = 0 |
| | | left join merchant m on m.id = cl.merchant_id and m.deleted = 0 |
| | | where cl.deleted = 0 |
| | | and cl.status = 'USED' |
| | | and (#{packageId} is null or cl.package_id = #{packageId}) |
| | | and (#{talentKeyword} is null or #{talentKeyword} = '' or cl.talent_name like concat('%', #{talentKeyword}, '%') or cl.talent_mobile like concat('%', #{talentKeyword}, '%') or cl.card_no like concat('%', #{talentKeyword}, '%')) |
| | | and (#{cardLevel} is null or #{cardLevel} = '' or cl.card_level = #{cardLevel} or cl.card_level like concat('%', #{cardLevel}, '%')) |
| | | and (#{claimedStart} is null or cl.created_at >= #{claimedStart}) |
| | | and (#{claimedEnd} is null or cl.created_at < date_add(cast(#{claimedEnd} as date), interval 1 day)) |
| | | and (#{verifiedStart} is null or cl.used_at >= #{verifiedStart}) |
| | | and (#{verifiedEnd} is null or cl.used_at < date_add(cast(#{verifiedEnd} as date), interval 1 day)) |
| | | and (#{merchantKeyword} is null or #{merchantKeyword} = '' or m.merchant_name like concat('%', #{merchantKeyword}, '%')) |
| | | """) |
| | | Long countAdminVerificationPage(@Param("packageId") Long packageId, |
| | | @Param("talentKeyword") String talentKeyword, |
| | | @Param("cardLevel") String cardLevel, |
| | | @Param("claimedStart") LocalDate claimedStart, |
| | | @Param("claimedEnd") LocalDate claimedEnd, |
| | | @Param("verifiedStart") LocalDate verifiedStart, |
| | | @Param("verifiedEnd") LocalDate verifiedEnd, |
| | | @Param("merchantKeyword") String merchantKeyword); |
| | | } |