|
@@ -0,0 +1,40 @@
|
|
|
+package com.galaxis.manatee.dao;
|
|
|
+
|
|
|
+import com.galaxis.capsule.util.GalaxisRepository;
|
|
|
+import com.galaxis.manatee.entity.chuanyun.data.object.ChuanyunDayWorkAbcDO;
|
|
|
+import com.galaxis.manatee.entity.chuanyun.data.object.ChuanyunUserCompanyDO;
|
|
|
+import org.springframework.data.jpa.repository.Query;
|
|
|
+import org.springframework.stereotype.Repository;
|
|
|
+
|
|
|
+import java.util.List;
|
|
|
+
|
|
|
+/**
|
|
|
+ * Created by IntelliJ IDEA.
|
|
|
+ * author: xuj
|
|
|
+ * Date: 2020/8/7
|
|
|
+ * description: 项目工时ABC分析
|
|
|
+ */
|
|
|
+@Repository
|
|
|
+public interface ChuanyunDayWorkAbcDao extends GalaxisRepository<ChuanyunDayWorkAbcDO,String> {
|
|
|
+
|
|
|
+ @Query(value = "select d.project_code,d.project_name,a.object_id,a.project_id,sum(a.standard_work_hour) as total_time,r.plan_time,p.sell_time,q.other_time from chuanyun_self_work_hour a " +
|
|
|
+ " left join (select c.project_id,c.user_type,sum(c.standard_work_hour) as plan_time from (select a.*,b.user_type from chuanyun_self_work_hour a " +
|
|
|
+ " left join chuanyun_user_company b on a.user_id = b.user_id) c " +
|
|
|
+ "where c.user_type = 0 " +
|
|
|
+ "group by c.project_id) r on a.project_id = r.project_id " +
|
|
|
+ "left join( select c.project_id,c.user_type,sum(c.standard_work_hour) as sell_time from (select a.*,b.user_type from chuanyun_self_work_hour a " +
|
|
|
+ "left join chuanyun_user_company b on a.user_id = b.user_id) c " +
|
|
|
+ "where c.user_type = 1" +
|
|
|
+ " group by c.project_id) p on a.project_id = p.project_id " +
|
|
|
+ " left join (select c.project_id,c.user_type,sum(c.standard_work_hour) as other_time from (select a.*,b.user_type from chuanyun_self_work_hour a " +
|
|
|
+ " left join chuanyun_user_company b on a.user_id = b.user_id) c " +
|
|
|
+ " where c.user_type = 2 " +
|
|
|
+ " group by c.project_id) q on a.project_id = q.project_id " +
|
|
|
+ " left join chuanyun_project d on a.project_id = d.object_id " +
|
|
|
+ " group by a.project_id" ,
|
|
|
+ nativeQuery = true)
|
|
|
+ List<ChuanyunDayWorkAbcDO> queryDayWorkAbc();
|
|
|
+
|
|
|
+ ChuanyunDayWorkAbcDO findByProjectId(String projectId);
|
|
|
+
|
|
|
+}
|