From e818e3f0bf621d5f86d9adb92dc0a237d74ab596 Mon Sep 17 00:00:00 2001
From: 钟日健 <5689795+arsn@user.noreply.gitee.com>
Date: Thu, 17 Mar 2022 11:54:35 +0800
Subject: [PATCH] 定时任务查询接口修改

---
 deploy/deploy.yml                                                          |    2 
 src/main/java/org/springblade/modules/quartz/mapper/ScheduledJobMapper.xml |   89 ++++++++++++++++++++++++++++++++++++++++++++
 src/main/java/org/springblade/modules/quartz/vo/ScheduledJobVO.java        |   10 +++++
 3 files changed, 100 insertions(+), 1 deletions(-)

diff --git a/deploy/deploy.yml b/deploy/deploy.yml
index 71545da..2e2caea 100644
--- a/deploy/deploy.yml
+++ b/deploy/deploy.yml
@@ -25,7 +25,7 @@
       imagePullSecrets:
         - name: aliyun  #提前在项目下配置访问阿里云的账号密码
       containers:
-        - image: registry.cn-hangzhou.aliyuncs.com/arsn/zhbaw:SNAPSHOT-4
+        - image: registry.cn-hangzhou.aliyuncs.com/arsn/zhbaw:SNAPSHOT-5
 #        - image: $REGISTRY/$DOCKERHUB_NAMESPACE/zhba:SNAPSHOT-$BUILD_NUMBER
           imagePullPolicy: Always
           name: zhbaw
diff --git a/src/main/java/org/springblade/modules/quartz/mapper/ScheduledJobMapper.xml b/src/main/java/org/springblade/modules/quartz/mapper/ScheduledJobMapper.xml
new file mode 100644
index 0000000..ee015e5
--- /dev/null
+++ b/src/main/java/org/springblade/modules/quartz/mapper/ScheduledJobMapper.xml
@@ -0,0 +1,89 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
+<mapper namespace="org.springblade.modules.quartz.mapper.ScheduledJobMapper">
+
+    <!--自定义查询任务分页数据-->
+    <select id="selectPageScheduledJobPage" resultType="org.springblade.modules.quartz.vo.ScheduledJobVO">
+        select * from sys_scheduled_job
+        where 1=1
+        <if test="scheduledJob.name!=null and scheduledJob.name!=''">
+            and name like concat('%',#{scheduledJob.name},'%')
+        </if>
+        <if test="scheduledJob.methodName!=null and scheduledJob.methodName!=''">
+            and method_name like concat('%',#{scheduledJob.methodName},'%')
+        </if>
+        <if test="scheduledJob.beanName!=null and scheduledJob.beanName!=''">
+            and bean_name like concat('%',#{scheduledJob.beanName},'%')
+        </if>
+        <if test="scheduledJob.params!=null and scheduledJob.params!=''">
+            and params like concat('%',#{scheduledJob.params},'%')
+        </if>
+        <if test="scheduledJob.cronExpression!=null and scheduledJob.cronExpression!=''">
+            and cron_expression like concat('%',#{scheduledJob.cronExpression},'%')
+        </if>
+        <if test="scheduledJob.status!=null">
+            and status = #{scheduledJob.status}
+        </if>
+        order by id desc
+    </select>
+
+    <select id="exportAttendane" resultType="org.springblade.modules.scheduledJob.excel.AttendanceExcel">
+        select
+        sa.clock_time clockTime,
+        bu.real_name realName,
+        bd.dept_name deptName,
+        if(sa.clock_type=1,'上班','下班') clockType,
+        case when sa.scheduledJob_type=1 then '正常'
+        when sa.scheduledJob_type=2 then '迟到'
+        when sa.scheduledJob_type=3 then '早退'
+        else '无效打卡' end as scheduledJobType
+         from sys_scheduledJob sa
+        left join blade_user bu on bu.id = sa.user_id
+        left join blade_dept bd on bd.id = sa.dept_id
+        where 1=1
+        <if test="scheduledJob.realName!=null and scheduledJob.realName!=''">
+            and bu.real_name like concat('%',#{scheduledJob.realName},'%')
+        </if>
+        <if test="scheduledJob.deptId!=null">
+            and sa.dept_id = #{scheduledJob.deptId}
+        </if>
+        <if test="scheduledJob.userId!=null">
+            and sa.user_id = #{scheduledJob.userId}
+        </if>
+        <if test="scheduledJob.clockType!=null">
+            and sa.clock_type = #{scheduledJob.clockType}
+        </if>
+        <if test="scheduledJob.scheduledJobType!=null">
+            and sa.scheduledJob_type = #{scheduledJob.scheduledJobType}
+        </if>
+        <if test="scheduledJob.beginTime!=null and scheduledJob.beginTime!=''">
+            and sa.clock_time&gt;=#{scheduledJob.beginTime}
+        </if>
+        <if test="scheduledJob.endTime!=null and scheduledJob.endTime!=''">
+            and sa.clock_time&lt;=#{scheduledJob.endTime}
+        </if>
+        order by sa.id desc
+    </select>
+
+    <!--查询当前考勤人员当天的考勤信息-->
+    <select id="selAttendanceListNow" resultType="org.springblade.modules.scheduledJob.entity.Attendance">
+        select * from sys_scheduledJob
+            where
+        number = #{number}
+            and
+        to_days(now())=to_days(clock_time)
+    </select>
+
+    <!--查询当前时间之前最新的一条数据-->
+    <select id="selAttendanceNewNow" resultType="org.springblade.modules.scheduledJob.entity.Attendance">
+        select * from sys_scheduledJob
+        where
+        user_id = #{userId}
+        and
+        to_days(now())=to_days(clock_time)
+		order by clock_time desc
+		limit 1
+    </select>
+
+
+</mapper>
diff --git a/src/main/java/org/springblade/modules/quartz/vo/ScheduledJobVO.java b/src/main/java/org/springblade/modules/quartz/vo/ScheduledJobVO.java
index c94765d..b72cac2 100644
--- a/src/main/java/org/springblade/modules/quartz/vo/ScheduledJobVO.java
+++ b/src/main/java/org/springblade/modules/quartz/vo/ScheduledJobVO.java
@@ -10,4 +10,14 @@
  */
 @Data
 public class ScheduledJobVO extends ScheduledJob {
+
+	/**
+	 * 开始时间
+	 */
+	private String beginTime;
+
+	/**
+	 * 结束时间
+	 */
+	private String endTime;
 }

--
Gitblit v1.9.3