| | |
| | | """) |
| | | TicketPackageCode selectAvailableCodeForUpdate(@Param("packageId") Long packageId); |
| | | |
| | | @Select(""" |
| | | select c.* |
| | | from ticket_package_code c |
| | | join ticket_package p on p.id = c.package_id and p.deleted = 0 and p.status = 1 |
| | | where c.deleted = 0 |
| | | and c.status = 'AVAILABLE' |
| | | and p.merchant_id = #{merchantId} |
| | | and (p.valid_start is null or p.valid_start <= current_date) |
| | | and (p.valid_end is null or p.valid_end >= current_date) |
| | | order by c.id asc |
| | | limit 1 |
| | | for update |
| | | """) |
| | | TicketPackageCode selectAvailableByMerchantForUpdate(@Param("merchantId") Long merchantId); |
| | | |
| | | @Update(""" |
| | | update ticket_package_code |
| | | set status = 'LOCKED', |