/* 任务总数getTotalTasks */
select count(distinct task_id) as '任务总数'
from tasks t
join (select * from papers where status = 2) p on t.id = p.task_id;
/*
papers表:
status = 2表示胜出;status = 1表示失败;
check_status=0表示不通过;check_status=1表示通过;check_status=2表示待评审;
*/
/* 取任务金额getTaskAmount */
select IFNULL(sum(t.bounty), 0) as '任务金额(元)'
from tasks t
join (select distinct task_id from papers where status = 2) p on t.id = p.task_id;
/* 获取转换成果任务金额getConvertedTaskAmount */
select IFNULL(sum(t.bounty), 0)
from tasks t
join (select * from papers where status = 2) p on t.id = p.task_id
join task_resource_library on t.id = task_resource_library.task_id
where is_transferred_to_results_library = 1;
/*获取任务转换成果数 getConvertedTasksCount */
select count(*)
from tasks t
join (select distinct task_id from papers where status = 2) p on t.id = p.task_id
join task_resource_library on t.id = task_resource_library.task_id
where is_transferred_to_results_library = 1;