| 12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879 |
- package com.izouma.nineth.repo;
- import com.izouma.nineth.domain.Asset;
- import com.izouma.nineth.enums.AssetStatus;
- import org.springframework.data.jpa.repository.JpaRepository;
- import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
- import org.springframework.data.jpa.repository.Modifying;
- import org.springframework.data.jpa.repository.Query;
- import javax.transaction.Transactional;
- import java.time.LocalDateTime;
- import java.util.Collection;
- import java.util.List;
- import java.util.Optional;
- import java.util.Set;
- public interface AssetRepo extends JpaRepository<Asset, Long>, JpaSpecificationExecutor<Asset> {
- @Query("update Asset t set t.del = true where t.id = ?1")
- @Modifying
- @Transactional
- void softDelete(Long id);
- long countByIpfsUrlAndStatusNot(String ipfsUrl, AssetStatus status);
- List<Asset> findByCollectionId(Long collectionId);
- List<Asset> findByCollectionIdAndStatusIn(Long collectionId, Iterable<AssetStatus> statuses);
- List<Asset> findAllByCollectionIdInAndStatusIn(List<Long> collectionId, Iterable<AssetStatus> statuses);
- List<Asset> findByCreatedAtBefore(LocalDateTime localDateTime);
- List<Asset> findByConsignmentTrue();
- List<Asset> findByTokenIdIn(Iterable<String> tokenId);
- List<Asset> findByTokenIdOrderByCreatedAt(String tokenId);
- List<Asset> findByOrderId(Long orderId);
- @Query("select a from Asset a join Order o on o.assetId = a.id join Asset aa on aa.orderId = o.id where a.id = ?1")
- Optional<Asset> findChild(Long id);
- @Query("select a from Asset a join User u on a.userId = u.id where a.consignment = true and u.settleAccountId is null")
- List<Asset> findNoAccount();
- Set<Asset> findAllByUserIdInAndCollectionId(List<Long> ids, Long collectionId);
- List<Asset> findByTxHash(String hash);
- List<Asset> findByIdIn(Iterable<Long> ids);
- @Query("select a from Asset a left join TokenHistory t on a.tokenId = t.tokenId where t.id is null")
- List<Asset> findByNoHistory();
- List<Asset> findByTokenIdAndCreatedAtBetween(String tokenId, LocalDateTime start, LocalDateTime end);
- Asset findFirstByTokenId(String tokenId);
- Asset findFirstByTxHashIsNullAndTokenIdNotNullAndStatusOrderByCreatedAt(AssetStatus status);
- @Query("select a from Asset a where a.txHash is null and a.tokenId is not null " +
- "and a.status = com.izouma.nineth.enums.AssetStatus.NORMAL and a.createdAt < ?1 " +
- "order by a.createdAt desc")
- List<Asset> toMint(LocalDateTime time);
- List<Asset> findAllByIdInAndUserId(Collection<Long> id, Long userId);
- @Query(value = "select c.id, c.pic, c.model3d, c.minter_avatar, c.owner_avatar, c.detail from asset c", nativeQuery = true)
- List<List<String>> selectResource();
- @Modifying
- @Transactional
- @Query(value = "update asset c set c.pic = ?2, c.model3d = ?3, c.minter_avatar = ?4, " +
- "c.owner_avatar = ?5, c.detail = ?6 where c.id = ?1", nativeQuery = true)
- int updateCDN(Long id, String pic, String model3d, String minterAvatar,
- String ownerAvatar, String detail);
- }
|