|
@@ -1,7 +1,7 @@
|
|
package com.galaxis.manatee.dao;
|
|
package com.galaxis.manatee.dao;
|
|
|
|
|
|
|
|
|
|
-import com.galaxis.capsule.util.GalaxisRepository;
|
|
|
|
|
|
+import com.galaxis.manatee.capsule.util.GalaxisRepository;
|
|
import com.galaxis.manatee.entity.chuanyun.data.object.ChuanyunWorkHourDO;
|
|
import com.galaxis.manatee.entity.chuanyun.data.object.ChuanyunWorkHourDO;
|
|
import org.springframework.data.jpa.repository.Query;
|
|
import org.springframework.data.jpa.repository.Query;
|
|
import org.springframework.data.repository.query.Param;
|
|
import org.springframework.data.repository.query.Param;
|
|
@@ -14,25 +14,27 @@ import java.util.List;
|
|
* @author kxuan
|
|
* @author kxuan
|
|
*/
|
|
*/
|
|
@Repository
|
|
@Repository
|
|
-public interface ChuanyunWorkHourDao extends GalaxisRepository<ChuanyunWorkHourDO,String> {
|
|
|
|
|
|
+public interface ChuanyunWorkHourDao extends GalaxisRepository<ChuanyunWorkHourDO, String> {
|
|
|
|
|
|
/**
|
|
/**
|
|
* 根据用户Id获取用户日志明细,并按日期拍
|
|
* 根据用户Id获取用户日志明细,并按日期拍
|
|
- * @param userId 用户Id
|
|
|
|
- * @return 日志数据
|
|
|
|
|
|
+ *
|
|
|
|
+ * @param userId 用户Id
|
|
|
|
+ * @return 日志数据
|
|
*/
|
|
*/
|
|
- @Query(value="SELECT chuanyun_day_log.object_id," +
|
|
|
|
|
|
+ @Query(value = "SELECT chuanyun_day_log.object_id," +
|
|
"SUM(chuanyun_day_log.hours_worked) AS hours_worked," +
|
|
"SUM(chuanyun_day_log.hours_worked) AS hours_worked," +
|
|
"chuanyun_day_log.project_id," +
|
|
"chuanyun_day_log.project_id," +
|
|
"chuanyun_day_log.project_type," +
|
|
"chuanyun_day_log.project_type," +
|
|
"chuanyun_log.user_id," +
|
|
"chuanyun_log.user_id," +
|
|
"chuanyun_log.department_name," +
|
|
"chuanyun_log.department_name," +
|
|
"chuanyun_log.status," +
|
|
"chuanyun_log.status," +
|
|
- "chuanyun_day_log.day_log_date " +
|
|
|
|
- "FROM chuanyun_day_log "+
|
|
|
|
- "LEFT JOIN chuanyun_log ON chuanyun_day_log.parent_object_id = chuanyun_log.object_id " +
|
|
|
|
|
|
+ "chuanyun_log.bg_name," +
|
|
|
|
+ "chuanyun_day_log.day_log_date," +
|
|
|
|
+ "chuanyun_day_log.work_group_id " +
|
|
|
|
+ "FROM manatee.chuanyun_day_log " +
|
|
|
|
+ "LEFT JOIN manatee.chuanyun_log ON chuanyun_day_log.parent_object_id = chuanyun_log.object_id " +
|
|
" WHERE chuanyun_log.user_id = ? " +
|
|
" WHERE chuanyun_log.user_id = ? " +
|
|
- " AND status!='3' " +
|
|
|
|
" GROUP BY chuanyun_day_log.project_id," +
|
|
" GROUP BY chuanyun_day_log.project_id," +
|
|
"chuanyun_log.user_id," +
|
|
"chuanyun_log.user_id," +
|
|
"chuanyun_day_log.project_type," +
|
|
"chuanyun_day_log.project_type," +
|
|
@@ -44,9 +46,10 @@ public interface ChuanyunWorkHourDao extends GalaxisRepository<ChuanyunWorkHourD
|
|
|
|
|
|
/**
|
|
/**
|
|
* 获取离职人员每天每个项目工时
|
|
* 获取离职人员每天每个项目工时
|
|
|
|
+ *
|
|
* @return
|
|
* @return
|
|
*/
|
|
*/
|
|
- @Query(value="SELECT\n" +
|
|
|
|
|
|
+ @Query(value = "SELECT\n" +
|
|
"\tchuanyun_day_log.project_id,\n" +
|
|
"\tchuanyun_day_log.project_id,\n" +
|
|
" chuanyun_day_log.project_type,\n" +
|
|
" chuanyun_day_log.project_type,\n" +
|
|
"chuanyun_log.department_name," +
|
|
"chuanyun_log.department_name," +
|
|
@@ -54,29 +57,34 @@ public interface ChuanyunWorkHourDao extends GalaxisRepository<ChuanyunWorkHourD
|
|
" chuanyun_day_log.day_log_date,\n" +
|
|
" chuanyun_day_log.day_log_date,\n" +
|
|
" chuanyun_day_log.hours_worked,\n" +
|
|
" chuanyun_day_log.hours_worked,\n" +
|
|
" chuanyun_log.`status`,\n" +
|
|
" chuanyun_log.`status`,\n" +
|
|
- " chuanyun_day_log.object_id\n" +
|
|
|
|
|
|
+ "chuanyun_log.bg_name," +
|
|
|
|
+ "chuanyun_day_log.object_id," +
|
|
|
|
+ "chuanyun_day_log.work_group_id \n" +
|
|
"FROM\n" +
|
|
"FROM\n" +
|
|
"\tchuanyun_log\n" +
|
|
"\tchuanyun_log\n" +
|
|
"LEFT JOIN chuanyun_day_log ON chuanyun_log.object_id = chuanyun_day_log.parent_object_id\n" +
|
|
"LEFT JOIN chuanyun_day_log ON chuanyun_log.object_id = chuanyun_day_log.parent_object_id\n" +
|
|
"WHERE\n" +
|
|
"WHERE\n" +
|
|
"\tLENGTH(chuanyun_log.user_id) != CHAR_LENGTH(chuanyun_log.user_id)\n" +
|
|
"\tLENGTH(chuanyun_log.user_id) != CHAR_LENGTH(chuanyun_log.user_id)\n" +
|
|
- " AND project_id!=''",nativeQuery = true)
|
|
|
|
|
|
+ " AND project_id!=''", nativeQuery = true)
|
|
List<ChuanyunWorkHourDO> getQuitSelfWorkHour();
|
|
List<ChuanyunWorkHourDO> getQuitSelfWorkHour();
|
|
|
|
|
|
/**
|
|
/**
|
|
* 根据用户Id获取用户最近一个月日志明细,并按日期拍
|
|
* 根据用户Id获取用户最近一个月日志明细,并按日期拍
|
|
|
|
+ *
|
|
* @param userId
|
|
* @param userId
|
|
* @return
|
|
* @return
|
|
*/
|
|
*/
|
|
- @Query(value="SELECT chuanyun_day_log.object_id," +
|
|
|
|
|
|
+ @Query(value = "SELECT chuanyun_day_log.object_id," +
|
|
"SUM(chuanyun_day_log.hours_worked) AS hours_worked," +
|
|
"SUM(chuanyun_day_log.hours_worked) AS hours_worked," +
|
|
"chuanyun_day_log.project_id," +
|
|
"chuanyun_day_log.project_id," +
|
|
"chuanyun_day_log.project_type," +
|
|
"chuanyun_day_log.project_type," +
|
|
"chuanyun_log.user_id," +
|
|
"chuanyun_log.user_id," +
|
|
"chuanyun_log.department_name," +
|
|
"chuanyun_log.department_name," +
|
|
"chuanyun_log.status," +
|
|
"chuanyun_log.status," +
|
|
- "chuanyun_day_log.day_log_date " +
|
|
|
|
- "FROM chuanyun_day_log "+
|
|
|
|
|
|
+ "chuanyun_log.bg_name," +
|
|
|
|
+ "chuanyun_day_log.day_log_date," +
|
|
|
|
+ "chuanyun_day_log.work_group_id " +
|
|
|
|
+ "FROM chuanyun_day_log " +
|
|
"LEFT JOIN chuanyun_log ON chuanyun_day_log.parent_object_id = chuanyun_log.object_id " +
|
|
"LEFT JOIN chuanyun_log ON chuanyun_day_log.parent_object_id = chuanyun_log.object_id " +
|
|
" WHERE chuanyun_log.user_id = ? " +
|
|
" WHERE chuanyun_log.user_id = ? " +
|
|
"AND DATE_SUB(CURDATE(), INTERVAL 1 MONTH) <= date(chuanyun_day_log.day_log_date)" +
|
|
"AND DATE_SUB(CURDATE(), INTERVAL 1 MONTH) <= date(chuanyun_day_log.day_log_date)" +
|
|
@@ -90,35 +98,39 @@ public interface ChuanyunWorkHourDao extends GalaxisRepository<ChuanyunWorkHourD
|
|
|
|
|
|
/**
|
|
/**
|
|
* 根据用户ID和日期筛选工时数据
|
|
* 根据用户ID和日期筛选工时数据
|
|
- * @param userId 用户Id
|
|
|
|
- * @param day 日期
|
|
|
|
- * @return 人员工时数据
|
|
|
|
|
|
+ *
|
|
|
|
+ * @param userId 用户Id
|
|
|
|
+ * @param day 日期
|
|
|
|
+ * @return 人员工时数据
|
|
*/
|
|
*/
|
|
- @Query(value="SELECT chuanyun_day_log.object_id," +
|
|
|
|
|
|
+ @Query(value = "SELECT chuanyun_day_log.object_id," +
|
|
"SUM(chuanyun_day_log.hours_worked) AS hours_worked," +
|
|
"SUM(chuanyun_day_log.hours_worked) AS hours_worked," +
|
|
"chuanyun_day_log.project_id," +
|
|
"chuanyun_day_log.project_id," +
|
|
"chuanyun_day_log.project_type," +
|
|
"chuanyun_day_log.project_type," +
|
|
"chuanyun_log.user_id," +
|
|
"chuanyun_log.user_id," +
|
|
"chuanyun_log.department_name," +
|
|
"chuanyun_log.department_name," +
|
|
"chuanyun_log.status," +
|
|
"chuanyun_log.status," +
|
|
- "chuanyun_day_log.day_log_date " +
|
|
|
|
- "FROM chuanyun_day_log "+
|
|
|
|
|
|
+ "chuanyun_log.bg_name," +
|
|
|
|
+ "chuanyun_day_log.day_log_date," +
|
|
|
|
+ "chuanyun_day_log.work_group_id " +
|
|
|
|
+ "FROM chuanyun_day_log " +
|
|
"LEFT JOIN chuanyun_log ON chuanyun_day_log.parent_object_id = chuanyun_log.object_id " +
|
|
"LEFT JOIN chuanyun_log ON chuanyun_day_log.parent_object_id = chuanyun_log.object_id " +
|
|
- "WHERE chuanyun_log.user_id = ? " +
|
|
|
|
- "AND chuanyun_day_log.day_log_date =? " +
|
|
|
|
|
|
+ "WHERE chuanyun_log.user_id = ?1 " +
|
|
|
|
+ "AND chuanyun_day_log.day_log_date =?2 " +
|
|
"AND status!=3 " +
|
|
"AND status!=3 " +
|
|
- "GROUP BY chuanyun_log.user_id," +
|
|
|
|
- "chuanyun_day_log.day_log_date",
|
|
|
|
|
|
+ "GROUP BY chuanyun_log.user_id, " +
|
|
|
|
+ "chuanyun_day_log.day_log_date ",
|
|
nativeQuery = true)
|
|
nativeQuery = true)
|
|
- ChuanyunWorkHourDO getDayWorkHour(String userId,LocalDateTime day);
|
|
|
|
|
|
+ ChuanyunWorkHourDO getDayWorkHour(@Param("userId") String userId, @Param("dayLogDate") LocalDateTime dayLogDate);
|
|
|
|
|
|
/**
|
|
/**
|
|
* 离职人员每天工时
|
|
* 离职人员每天工时
|
|
|
|
+ *
|
|
* @param userId
|
|
* @param userId
|
|
* @param dayLogDate
|
|
* @param dayLogDate
|
|
* @return
|
|
* @return
|
|
*/
|
|
*/
|
|
- @Query(value="SELECT\n" +
|
|
|
|
|
|
+ @Query(value = "SELECT\n" +
|
|
"\tchuanyun_day_log.project_id,\n" +
|
|
"\tchuanyun_day_log.project_id,\n" +
|
|
"\tchuanyun_day_log.project_type,\n" +
|
|
"\tchuanyun_day_log.project_type,\n" +
|
|
"\tchuanyun_log.user_id,\n" +
|
|
"\tchuanyun_log.user_id,\n" +
|
|
@@ -128,7 +140,9 @@ public interface ChuanyunWorkHourDao extends GalaxisRepository<ChuanyunWorkHourD
|
|
"\t\tchuanyun_day_log.hours_worked\n" +
|
|
"\t\tchuanyun_day_log.hours_worked\n" +
|
|
"\t) AS hours_worked,\n" +
|
|
"\t) AS hours_worked,\n" +
|
|
"\tchuanyun_log.`status`,\n" +
|
|
"\tchuanyun_log.`status`,\n" +
|
|
- "\tchuanyun_day_log.object_id\n" +
|
|
|
|
|
|
+ "chuanyun_log.bg_name," +
|
|
|
|
+ "\tchuanyun_day_log.object_id," +
|
|
|
|
+ "chuanyun_day_log.work_group_id \n" +
|
|
"FROM\n" +
|
|
"FROM\n" +
|
|
"\tchuanyun_log\n" +
|
|
"\tchuanyun_log\n" +
|
|
"LEFT JOIN chuanyun_day_log ON chuanyun_log.object_id = chuanyun_day_log.parent_object_id\n" +
|
|
"LEFT JOIN chuanyun_day_log ON chuanyun_log.object_id = chuanyun_day_log.parent_object_id\n" +
|
|
@@ -136,7 +150,34 @@ public interface ChuanyunWorkHourDao extends GalaxisRepository<ChuanyunWorkHourD
|
|
"chuanyun_log.user_id = ?1 AND chuanyun_day_log.day_log_date=?2 \n" +
|
|
"chuanyun_log.user_id = ?1 AND chuanyun_day_log.day_log_date=?2 \n" +
|
|
"GROUP BY\n" +
|
|
"GROUP BY\n" +
|
|
"\tchuanyun_log.user_id,\n" +
|
|
"\tchuanyun_log.user_id,\n" +
|
|
- "\tchuanyun_day_log.day_log_date",nativeQuery = true)
|
|
|
|
- ChuanyunWorkHourDO getQuitDayWorkHour(@Param("userId")String userId,@Param("dayLogDate")LocalDateTime dayLogDate);
|
|
|
|
|
|
+ "\tchuanyun_day_log.day_log_date", nativeQuery = true)
|
|
|
|
+ ChuanyunWorkHourDO getQuitDayWorkHour(@Param("userId") String userId, @Param("dayLogDate") LocalDateTime dayLogDate);
|
|
|
|
|
|
|
|
+ /**
|
|
|
|
+ * 获取半年内工时列表
|
|
|
|
+ *
|
|
|
|
+ * @param userId
|
|
|
|
+ * @return
|
|
|
|
+ */
|
|
|
|
+ @Query(value = "SELECT chuanyun_day_log.object_id," +
|
|
|
|
+ "SUM(chuanyun_day_log.hours_worked) AS hours_worked," +
|
|
|
|
+ "chuanyun_day_log.project_id," +
|
|
|
|
+ "chuanyun_day_log.project_type," +
|
|
|
|
+ "chuanyun_log.user_id," +
|
|
|
|
+ "chuanyun_log.department_name," +
|
|
|
|
+ "chuanyun_log.status," +
|
|
|
|
+ "chuanyun_log.bg_name," +
|
|
|
|
+ "chuanyun_day_log.day_log_date," +
|
|
|
|
+ "chuanyun_day_log.work_group_id " +
|
|
|
|
+ "FROM chuanyun_day_log " +
|
|
|
|
+ "LEFT JOIN chuanyun_log ON chuanyun_day_log.parent_object_id = chuanyun_log.object_id " +
|
|
|
|
+ " WHERE chuanyun_log.user_id = ? " +
|
|
|
|
+ "and DATEDIFF(chuanyun_day_log.day_log_date,NOW()) <= 0 " +
|
|
|
|
+ "and DATEDIFF(chuanyun_day_log.day_log_date,NOW()) > -90 " +
|
|
|
|
+ "GROUP BY chuanyun_day_log.project_id," +
|
|
|
|
+ "chuanyun_log.user_id," +
|
|
|
|
+ "chuanyun_day_log.project_type," +
|
|
|
|
+ "chuanyun_log.status," +
|
|
|
|
+ "chuanyun_day_log.day_log_date", nativeQuery = true)
|
|
|
|
+ List<ChuanyunWorkHourDO> getHalfYearSelfWorkHour(String userId);
|
|
}
|
|
}
|