+ SELECT a.id, a.project_code as projectCode, a.project_name AS project, SUM(b.working_time) AS cost, SUM(b.cost) AS costMoney,a.category_name as categoryName,c.name as userName,d.department_name as departmentName
+ FROM project AS a
+ LEFT JOIN report AS b ON b.project_id = a.id
+ JOIN user AS c ON b.creator_id = c.id
+ JOIN department d on d.department_id=c.department_id
+ WHERE a.company_id = #{companyId}
+ <if test="startDate != null and endDate != null">
+ AND b.create_date between #{startDate} and #{endDate}