| 1234567891011121314151617181920212223242526272829303132333435363738394041424344 |
- package com.uas.service.donate.dao;
- import com.uas.service.donate.model.ProjectRecode;
- import org.springframework.data.jpa.repository.JpaRepository;
- import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
- import org.springframework.data.jpa.repository.Query;
- import org.springframework.data.repository.query.Param;
- import org.springframework.stereotype.Repository;
- import java.util.List;
- @Repository
- public interface ProjectRecodeDao extends JpaRepository<ProjectRecode,Long>,JpaSpecificationExecutor<ProjectRecode>{
- //查询某人参加过捐款的所有项目
- @Query("from ProjectRecode where uuid=:uuid")
- List<ProjectRecode> findByuuid(@Param("uuid") Long uuid);
- //计算某人参与项目的次数
- @Query("select count(*) from ProjectRecode where uuid=:uuid")
- Long sumJoin(@Param("uuid")Long uuid);
- //计算某人捐赠的总善款
- @Query("select sum(amount) from ProjectRecode where uuid=:uuid")
- Double sumMoney(@Param("uuid")Long uuid);
- //查询所有项目已筹集金额
- @Query("select sum(amount) from ProjectRecode where status=2")
- Double totality();
- //查询所有的项目历史总参与人数
- @Query("select count(*) from ProjectRecode where status=2")
- Long historyPerson();
- //查询某项目参与总人数
- @Query("select count(*) from ProjectRecode where proId=:proId")
- Long sumPerson(@Param("proId")Long proId);
- //查询某项目已筹集金额
- @Query("select sum(amount) from ProjectRecode where proId=:proId")
- Double sumamount(@Param("proId")Long proId);
- List<ProjectRecode> findByProId(Long proId);
- }
|