wangqifan 3 years ago
parent
commit
a10f060a54

+ 1 - 1
src/main/java/com/izouma/nineth/repo/CollectionRepo.java

@@ -196,7 +196,7 @@ public interface CollectionRepo extends JpaRepository<Collection, Long>, JpaSpec
     @Query("select count(id) from Collection where source = 'TRANSFER' and name like ?1")
     int countAllByNameLike(String name);
 
-    @Query("select sum(c.total) from Collection c where c.source = 'OFFICIAL' and c.name like ?1")
+    @Query("select sum(c.total) from Collection c where c.source = 'OFFICIAL' and c.name like ?1 and c.type = 'DEFAULT'")
     Long sumAllByNameLike(String name);
 
     Collection findFirstByOnShelfAndAssetId(boolean onShelf, Long assetId);

+ 1 - 1
src/main/java/com/izouma/nineth/service/CollectionService.java

@@ -815,6 +815,6 @@ public class CollectionService {
     }
 
     public Long countDestroyAssets(String search) {
-        return assetRepo.countDestroyed(search, AssetStatus.DESTROYED);
+        return assetRepo.countDestroyed("%" + search + "%", AssetStatus.DESTROYED);
     }
 }

+ 1 - 1
src/main/java/com/izouma/nineth/web/CollectionController.java

@@ -236,7 +236,7 @@ public class CollectionController extends BaseController {
         pageQuery.getQuery().put("inPaying", true);
         long transactingNum = collectionService.all(pageQuery).getTotal();
         Long destroyedAssets = collectionService.countDestroyAssets(search);
-        Long total = collectionRepo.sumAllByNameLike(search);
+        Long total = collectionRepo.sumAllByNameLike("%" + search + "%");
         Long tranferCount = total - destroyedAssets;
         Map<String, String> map = new HashMap<>();
         map.put("onlyShowNum", String.valueOf(onlyShowNum));