From 62cd133e894d8cc8d527d5e94a4310794e03f763 Mon Sep 17 00:00:00 2001
From: zhongrj <646384940@qq.com>
Date: Tue, 14 Nov 2023 14:12:20 +0800
Subject: [PATCH] 试用期校验去除

---
 src/main/java/org/springblade/modules/taskqd/mapper/TaskqdMapper.xml |  175 +++++++++++++++++++++++++++++++++++++++++++++++++++-------
 1 files changed, 154 insertions(+), 21 deletions(-)

diff --git a/src/main/java/org/springblade/modules/taskqd/mapper/TaskqdMapper.xml b/src/main/java/org/springblade/modules/taskqd/mapper/TaskqdMapper.xml
index 4b81f5d..7656e8d 100644
--- a/src/main/java/org/springblade/modules/taskqd/mapper/TaskqdMapper.xml
+++ b/src/main/java/org/springblade/modules/taskqd/mapper/TaskqdMapper.xml
@@ -10,7 +10,6 @@
         <result column="time" property="time"/>
         <result column="province" property="province"/>
         <result column="city" property="city"/>
-        <result column="county" property="county"/>
         <result column="jnum" property="jnum"/>
         <result column="line" property="line"/>
         <result column="rtype" property="rtype"/>
@@ -44,17 +43,66 @@
         where id = #{id}
     </update>
     <update id="updateRtype">
+        UPDATE sys_taskqd
+        <set>
+            <if test='type == "0" '>rtype=#{type},stime = now(),</if>
+            <if test='type == "1" '>rtype=#{type},sendtime = now(),</if>
+        </set>
+        WHERE id = #{rid}
+    </update>
+
+    <update id="updateSerid">
         update sys_taskqd
-        SET rtype=#{type}
+        SET serid=#{serid},team=#{newteam},num=#{newnum}
         where id = #{rid}
     </update>
 
-
     <!--日常任务列表-->
+    <select id="getlist" resultMap="taskResultMap">
+        SELECT
+        *
+        FROM
+        sys_taskqd
+        WHERE
+        serid LIKE concat("%",#{id},"%")
+        <if test="type == 3">
+            and rtype = 1
+        </if>
+        <if test="type == 2">
+            AND ( rtype = "0" OR rtype = "2" )
+        </if>
+    </select>
+
+    <!--任务统计-->
     <select id="selectList" resultMap="taskResultMap">
-        select jnum, num, serid, team
+        select jnum, num, serid, team ,time,endtime
         from sys_taskqd
         where id = #{id}
+    </select>
+    <select id="taskCount" resultType="java.util.HashMap">
+        SELECT
+            count( * ) AS count
+        FROM
+            sys_taskqd
+        WHERE
+            serid LIKE  concat("%",#{id},"%")
+            AND rtype = "1" UNION ALL
+        SELECT
+            count( * ) AS count
+        FROM
+            sys_taskqd
+        WHERE
+            serid LIKE concat("%",#{id},"%")
+            AND ( rtype = "0" OR rtype = "2" )
+    </select>
+    <select id="allTask" resultType="java.util.HashMap">
+        SELECT
+        *
+        FROM
+        sys_taskqd
+        WHERE 1 = 1
+        AND ( rtype = "0" OR rtype = "2" )
+
     </select>
 
     <select id="queryReceiver" resultType="java.util.HashMap">
@@ -67,29 +115,55 @@
 
     <select id="selectLi" resultMap="taskResultMap">
         SELECT A.*,IFNULL(B.num,0) as nums FROM (
-        select qd.* from sys_taskqd qd LEFT JOIN sys_jurisdiction j ON j.id = qd.jurisdiction where 1=1 AND
+        select qd.* from sys_taskqd qd LEFT JOIN sys_jurisdiction j ON j.id = qd.jurisdiction where 1=1
         <if test="type==0">
-            find_in_set(#{serid}, serid) and qd.tasktype=#{tasktype}) A LEFT JOIN (SELECT COUNT(*) as num,hdid,serid FROM
-            sys_taskfk WHERE
-            serid=#{serid} AND qd.rtype = "0" GROUP BY hdid,serid) B ON A.id=B.hdid
+            <if test="serid != '1123598821738675201'">
+                AND find_in_set(#{serid}, serid)
+            </if>
+            AND (qd.rtype = "2" or qd.rtype = "0")
+            AND qd.tasktype=#{tasktype}
+            ) A LEFT JOIN (
+                SELECT COUNT(*) as num,hdid,serid
+                FROM
+                sys_taskfk WHERE 1 = 1
+                <if test="serid != '1123598821738675201'">
+                    and serid=#{serid}
+                </if>
+                GROUP BY hdid,serid
+            ) B ON A.id=B.hdid
         </if>
         <if test="type==2">
-            find_in_set(#{serid}, serid) and qd.tasktype=#{tasktype}) A LEFT JOIN (SELECT COUNT(*) as num,hdid,serid FROM
-            sys_taskfk WHERE
-            serid=#{serid} AND qd.rtype = "1" GROUP BY hdid,serid) B ON A.id=B.hdid
+            <if test="serid != '1123598821738675201'">
+                AND find_in_set(#{serid}, serid)
+            </if>
+            AND qd.rtype = "1"
+            and qd.tasktype=#{tasktype}
+            ) A LEFT JOIN (SELECT COUNT(*) as num,hdid,serid
+            FROM
+            sys_taskfk WHERE 1 = 1
+            <if test="serid != '1123598821738675201'">
+                and serid=#{serid}
+            </if>
+            GROUP BY hdid,serid) B ON A.id=B.hdid
         </if>
         <if test="type==1">
+            and qd.tasktype=#{tasktype}
             <if test="jurisdiction!='1372091709474910209'">
-                qd.jnum!=qd.num AND qd.rtype = "2"
-                and qd.tasktype=#{tasktype}
-                and (!find_in_set(#{serid}, serid) OR serid IS NULL )
-                and (j.id =#{jurisdiction} or
+                AND qd.rtype = "2"
+                <if test="tasktype !=2">
+                    AND qd.jnum!=qd.num
+                </if>
+                <if test="serid != '1123598821738675201'">
+                    and (!find_in_set(#{serid}, serid) OR serid IS NULL )
+                </if>
+                and
+                ((j.id =#{jurisdiction} or
                 j.parent_id = #{jurisdiction}) or (j.id =#{workjurisdiction} or
-                j.parent_id = #{workjurisdiction})
+                j.parent_id = #{workjurisdiction}))
             </if>
-            ) A LEFT JOIN (SELECT
-            COUNT(*)
-            as num,hdid FROM sys_taskfk GROUP BY hdid) B ON A.id=B.hdid
+            ) A LEFT JOIN (
+                SELECT COUNT(*) as num,hdid FROM sys_taskfk GROUP BY hdid
+            ) B ON A.id=B.hdid
         </if>
     </select>
 
@@ -101,10 +175,10 @@
            (!find_in_set(#{serid}
             , serid)
            OR serid IS NULL )
-          and (j.id =#{jurisdiction}
+          and ((j.id =#{jurisdiction}
            or j.parent_id = #{jurisdiction})
            or (j.id =#{workjurisdiction}
-           or j.parent_id = #{workjurisdiction})
+           or j.parent_id = #{workjurisdiction}))
         GROUP BY tasktype
     </select>
 
@@ -113,4 +187,63 @@
         from sys_taskqd
         where id = #{rid}
     </select>
+
+    <select id="countTaskByJur" resultType="org.springblade.modules.taskqd.entity.Taskqd">
+        SELECT *
+        FROM sys_taskqd qd
+        WHERE qd.jurisdiction = #{jurisdiction}
+        <choose>
+            <when test='period=="day" '>
+                AND TO_DAYS(qd.time) = TO_DAYS(#{startTime})
+            </when>
+            <when test='period == "week" '>
+                 AND YEARWEEK(DATE_FORMAT(qd.time,"%Y-%m-%d"),1) = YEARWEEK(#{startTime},1)
+             </when>
+            <when test='period == "month" '>
+                AND DATE_FORMAT(qd.time,"%Y-%m") = DATE_FORMAT(#{startTime},"%Y-%m")
+            </when>
+            <when test='period == "all" '></when>
+        </choose>
+        LIMIT 0,15
+    </select>
+
+    <select id="getRealTime" resultType="java.lang.Integer">
+        SELECT (UNIX_TIMESTAMP(sendtime)-UNIX_TIMESTAMP(stime))
+            subsecond
+        FROM sys_taskqd
+        WHERE id = #{hdid}
+    </select>
+
+    <!--自定义分页查询-->
+    <select id="selectTaskQdPage" resultType="org.springblade.modules.taskqd.vo.TaskqdVO">
+        select * from sys_taskqd where 1=1
+    </select>
+
+    <!--导出任务数据-->
+    <select id="selectTaskList" resultType="org.springblade.modules.taskqd.excel.TaskExcel">
+        select
+        st.id,st.rname,st.time,st.endtime,st.content,st.gathername,st.fname,st.integral,
+		sr.role_name as trainName,
+        case when rtype='0' then '正在进行'
+         when rtype='1' then '已结束'
+         when rtype='2' then '任务未开始'
+        end as rtypeName,
+        sj.dept_name as jurisdictionName
+        from sys_taskqd st
+        left join sys_jurisdiction sj on sj.id = st.jurisdiction
+        left join blade_role sr on sr.id = st.train
+        where 1=1
+        <if test="task.tasktype!=null and task.tasktype!=''">
+            and st.tasktype = #{task.tasktype}
+        </if>
+        <if test="task.rtype!=null and task.rtype!='' and task.rtype!='undefined'">
+            and st.rtype = #{task.rtype}
+        </if>
+        <if test="task.rname!=null and task.rname!='' and task.rname!='undefined'">
+            and st.rname like concat('%',#{task.rname},'%')
+        </if>
+        <if test="task.jurisdiction!=null and task.jurisdiction!='' and task.jurisdiction!='undefined'">
+            and st.jurisdiction = #{task.jurisdiction}
+        </if>
+    </select>
 </mapper>

--
Gitblit v1.9.3