|
@@ -188,6 +188,52 @@ public interface StandardlyMapper {
|
|
|
@Select("select * from ${tableName} order by create_time desc limit 1")
|
|
|
JSONObject getNewest(@Param("tableName") String tableName);
|
|
|
|
|
|
+ /**
|
|
|
+ * 按月统计人员考勤信息
|
|
|
+ * @param date
|
|
|
+ * @return
|
|
|
+ */
|
|
|
+ @Select("<script>" +
|
|
|
+ "SELECT\n" +
|
|
|
+ "t.attendance_table_username as userName,\n" +
|
|
|
+ "d.dept_name as deptName,\n" +
|
|
|
+ "sum(if(attendance_table_leave_or = 'Y','1','0')) as attendanceTableLeaveOrSum,\n" +
|
|
|
+ "sum(if(attendance_table_late = 'Y','1','0')) as attendanceTableLateSum,\n" +
|
|
|
+ "sum(if(attendance_table_leave = 'Y','1','0')) as attendanceTableLeaveSum,\n" +
|
|
|
+ "DATE_FORMAT(t.create_time,'%Y-%m') as date\n" +
|
|
|
+ "FROM \n" +
|
|
|
+ "attendance_table t\n" +
|
|
|
+ "LEFT JOIN sys_dept d ON d.id = t.dept_id \n" +
|
|
|
+ "<where>" +
|
|
|
+ "1=1 " +
|
|
|
+ "<if test='date!=null'>"+
|
|
|
+ "DATE_FORMAT(t.create_time,'%Y-%m') = DATE_FORMAT(#{date},'%Y-%m') \n" +
|
|
|
+ "</if>"+
|
|
|
+ "</where>" +
|
|
|
+ "GROUP BY\n" +
|
|
|
+ "t.user_id" +
|
|
|
+ "</script>")
|
|
|
+ List<JSONObject> statisticsByMonth(@Param("date") String date);
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 查询用户某月的上班打卡时间
|
|
|
+ * @param date
|
|
|
+ * @param userId
|
|
|
+ * @return
|
|
|
+ */
|
|
|
+
|
|
|
+ @Select("SELECT\n" +
|
|
|
+ "\tattendance_table_work as attendanceTableWork,\n" +
|
|
|
+ "\tattendance_table_offwork AS attendanceTableOffwork,\n" +
|
|
|
+ "\tattendance_table_work_pm AS attendanceTableWorkPm,\n" +
|
|
|
+ "\tattendance_table_offwork_pm as attendanceTableOffworkPm\n" +
|
|
|
+ "FROM\n" +
|
|
|
+ "\tattendance_table \n" +
|
|
|
+ "WHERE\n" +
|
|
|
+ "\tDATE_FORMAT( create_time, '%Y-%m' ) = #{date} \n" +
|
|
|
+ "\tAND user_id = #{userId}")
|
|
|
+ List<JSONObject> findDate(@Param("date")String date, @Param("userId")Long userId);
|
|
|
+
|
|
|
@SuppressWarnings("unchecked")
|
|
|
class SqlProvider {
|
|
|
static final String[] READONLY_COLUMNS = new String[]{"OWNERID", "OWNERNAME", "OWNERENAME", "CREATIONDATE", "ID"};
|