|
@@ -32,6 +32,7 @@
|
|
|
<result column="task_count" property="taskCount" jdbcType="VARCHAR" />
|
|
|
<result column="finished_count" property="finishedCount" jdbcType="VARCHAR" />
|
|
|
<result column="in_process_status" property="inProcessStatus" jdbcType="INTEGER" />
|
|
|
+ <result column="interval_count" property="intervalCount" jdbcType="INTEGER" />
|
|
|
</resultMap>
|
|
|
|
|
|
<resultMap id="workFlowLogResultMap" type="com.huaxu.order.entity.WorkFlowLog">
|
|
@@ -544,4 +545,228 @@
|
|
|
group by task_type
|
|
|
</select>
|
|
|
|
|
|
+ <select id="selectTaskFinishedByDate" resultMap="BaseResultMap" >
|
|
|
+ select task_type,sum(task_count) task_count,sum(case when plan_status=2 or plan_status=3 then task_count else 0 end) finished_count
|
|
|
+ from(
|
|
|
+ select task_type,plan_status,count(1) task_count
|
|
|
+ from sc_plan_manage t1
|
|
|
+ where
|
|
|
+ <if test="statsType == 0">
|
|
|
+ t1.date_create >= concat(#{startDate}, '-1') and t1.date_create < concat(#{startDate}, '-1') + INTERVAL 1 MONTH
|
|
|
+ </if>
|
|
|
+ <if test="statsType == 1">
|
|
|
+ t1.date_create >= concat(#{startDate}, '-1-1') and t1.date_create < concat(#{startDate}, '-1-1') + INTERVAL 1 YEAR
|
|
|
+ </if>
|
|
|
+ <if test="statsType == 2">
|
|
|
+ t1.date_create >= concat(#{startDate}, '-1') and t1.date_create < concat(#{endDate}, '-1') + INTERVAL 1 MONTH
|
|
|
+ </if>
|
|
|
+ <if test="tenantId != null and tenantId != ''">
|
|
|
+ and t1.tenant_id=#{tenantId}
|
|
|
+ </if>
|
|
|
+ <if test="userType!=null and userType!=-999 and userType!=-9999 and programItems != null and programItems.size() > 0">
|
|
|
+ <if test="permissonType == 5 or permissonType == 2">
|
|
|
+ and ( t1.department_org_id in
|
|
|
+ <foreach collection="programItems" item="item" open="(" close=")" separator=",">
|
|
|
+ #{item.orgId}
|
|
|
+ </foreach>
|
|
|
+ or
|
|
|
+ t1.COMPANY_ORG_ID in
|
|
|
+ <foreach collection="programItems" item="item" open="(" close=")" separator=",">
|
|
|
+ #{item.orgId}
|
|
|
+ </foreach>
|
|
|
+ )
|
|
|
+ </if>
|
|
|
+ <if test="permissonType == 4 or permissonType == 3">
|
|
|
+ and t1.department_org_id in
|
|
|
+ <foreach collection="programItems" item="item" open="(" close=")" separator=",">
|
|
|
+ #{item.orgId}
|
|
|
+ </foreach>
|
|
|
+ </if>
|
|
|
+ <if test="permissonType == 1">
|
|
|
+ and t1.COMPANY_ORG_ID in
|
|
|
+ <foreach collection="programItems" item="item" open="(" close=")" separator=",">
|
|
|
+ #{item.orgId}
|
|
|
+ </foreach>
|
|
|
+ and (t1.department_org_id is null or t1.department_org_id =0)
|
|
|
+ </if>
|
|
|
+ </if>
|
|
|
+ group by task_type,plan_status
|
|
|
+ )tab1
|
|
|
+ group by task_type
|
|
|
+ </select>
|
|
|
+
|
|
|
+ <select id="selectTaskCondition" resultMap="BaseResultMap" >
|
|
|
+ select count(1) task_count,ifnull(sum(case when plan_status=2 or plan_status=3 then 1 else 0 end),0) finished_count
|
|
|
+ from sc_plan_manage t1
|
|
|
+ where
|
|
|
+ <if test="statsType == 0">
|
|
|
+ t1.date_create >= concat(#{startDate}, '-1') and t1.date_create < concat(#{startDate}, '-1') + interval 1 month
|
|
|
+ </if>
|
|
|
+ <if test="statsType == 1">
|
|
|
+ t1.date_create >= concat(#{startDate}, '-1-1') and t1.date_create < concat(#{startDate}, '-1-1') + interval 1 year
|
|
|
+ </if>
|
|
|
+ <if test="statsType == 2">
|
|
|
+ t1.date_create >= concat(#{startDate}, '-1') and t1.date_create < concat(#{endDate}, '-1') + interval 1 month
|
|
|
+ </if>
|
|
|
+ <if test="tenantId != null and tenantId != ''">
|
|
|
+ and t1.tenant_id=#{tenantId}
|
|
|
+ </if>
|
|
|
+ <if test="userType!=null and userType!=-999 and userType!=-9999 and programItems != null and programItems.size() > 0">
|
|
|
+ <if test="permissonType == 5 or permissonType == 2">
|
|
|
+ and ( t1.department_org_id in
|
|
|
+ <foreach collection="programItems" item="item" open="(" close=")" separator=",">
|
|
|
+ #{item.orgId}
|
|
|
+ </foreach>
|
|
|
+ or
|
|
|
+ t1.COMPANY_ORG_ID in
|
|
|
+ <foreach collection="programItems" item="item" open="(" close=")" separator=",">
|
|
|
+ #{item.orgId}
|
|
|
+ </foreach>
|
|
|
+ )
|
|
|
+ </if>
|
|
|
+ <if test="permissonType == 4 or permissonType == 3">
|
|
|
+ and t1.department_org_id in
|
|
|
+ <foreach collection="programItems" item="item" open="(" close=")" separator=",">
|
|
|
+ #{item.orgId}
|
|
|
+ </foreach>
|
|
|
+ </if>
|
|
|
+ <if test="permissonType == 1">
|
|
|
+ and t1.COMPANY_ORG_ID in
|
|
|
+ <foreach collection="programItems" item="item" open="(" close=")" separator=",">
|
|
|
+ #{item.orgId}
|
|
|
+ </foreach>
|
|
|
+ and (t1.department_org_id is null or t1.department_org_id =0)
|
|
|
+ </if>
|
|
|
+ </if>
|
|
|
+ </select>
|
|
|
+
|
|
|
+ <select id="selectTaskChangeTrend" resultType="com.huaxu.task.dto.TaskChangeTendDto" >
|
|
|
+ select
|
|
|
+ tab1.dateCreate,
|
|
|
+ ifnull(TaskCount, 0) TaskCount
|
|
|
+ <if test="maintainerCount != 0">
|
|
|
+ ,ifnull(TaskCount, 0) / #{maintainerCount} taskCountAvg
|
|
|
+ </if>
|
|
|
+ from(
|
|
|
+ select
|
|
|
+ <if test="statsType == 0 or statsType == 2">
|
|
|
+ date_format(date_add(concat(#{startDate}, '-1'),interval rownum day),'%Y-%m-%d') dateCreate
|
|
|
+ </if>
|
|
|
+ <if test="statsType == 1">
|
|
|
+ date_format(date_add(concat(#{startDate}, '-1-1'),interval rownum month),'%Y-%m') dateCreate
|
|
|
+ </if>
|
|
|
+ from(
|
|
|
+ select @rowNum :=@rowNum + 1 rownum
|
|
|
+ from sc_gps_data_his a,(select @rowNum :=- 1) b limit #{intervalCount}
|
|
|
+ ) duration
|
|
|
+ ) tab1
|
|
|
+ left join (
|
|
|
+ select
|
|
|
+ <if test="statsType == 0 or statsType == 2">
|
|
|
+ date_format(t1.date_create, '%Y-%m-%d') dateCreate
|
|
|
+ </if>
|
|
|
+ <if test="statsType == 1">
|
|
|
+ date_format(t1.date_create, '%Y-%m') dateCreate
|
|
|
+ </if>,count(1) TaskCount
|
|
|
+ from sc_plan_manage t1
|
|
|
+ where
|
|
|
+ <if test="statsType == 0">
|
|
|
+ t1.date_create >= concat(#{startDate}, '-1') and t1.date_create < concat(#{startDate}, '-1') + interval 1 month
|
|
|
+ </if>
|
|
|
+ <if test="statsType == 1">
|
|
|
+ t1.date_create >= concat(#{startDate}, '-1-1') and t1.date_create < concat(#{startDate}, '-1-1') + interval 1 year
|
|
|
+ </if>
|
|
|
+ <if test="statsType == 2">
|
|
|
+ t1.date_create >= concat(#{startDate}, '-1') and t1.date_create < concat(#{endDate}, '-1') + interval 1 month
|
|
|
+ </if>
|
|
|
+ <if test="tenantId != null and tenantId != ''">
|
|
|
+ and t1.tenant_id=#{tenantId}
|
|
|
+ </if>
|
|
|
+ <if test="userType!=null and userType!=-999 and userType!=-9999 and programItems != null and programItems.size() > 0">
|
|
|
+ <if test="permissonType == 5 or permissonType == 2">
|
|
|
+ and ( t1.department_org_id in
|
|
|
+ <foreach collection="programItems" item="item" open="(" close=")" separator=",">
|
|
|
+ #{item.orgId}
|
|
|
+ </foreach>
|
|
|
+ or
|
|
|
+ t1.COMPANY_ORG_ID in
|
|
|
+ <foreach collection="programItems" item="item" open="(" close=")" separator=",">
|
|
|
+ #{item.orgId}
|
|
|
+ </foreach>
|
|
|
+ )
|
|
|
+ </if>
|
|
|
+ <if test="permissonType == 4 or permissonType == 3">
|
|
|
+ and t1.department_org_id in
|
|
|
+ <foreach collection="programItems" item="item" open="(" close=")" separator=",">
|
|
|
+ #{item.orgId}
|
|
|
+ </foreach>
|
|
|
+ </if>
|
|
|
+ <if test="permissonType == 1">
|
|
|
+ and t1.COMPANY_ORG_ID in
|
|
|
+ <foreach collection="programItems" item="item" open="(" close=")" separator=",">
|
|
|
+ #{item.orgId}
|
|
|
+ </foreach>
|
|
|
+ and (t1.department_org_id is null or t1.department_org_id =0)
|
|
|
+ </if>
|
|
|
+ </if>
|
|
|
+ <if test="statsType == 0 or statsType == 2">
|
|
|
+ group by date_format(t1.date_create, '%Y-%m-%d')
|
|
|
+ </if>
|
|
|
+ <if test="statsType == 1">
|
|
|
+ group by date_format(t1.date_create, '%Y-%m')
|
|
|
+ </if>
|
|
|
+ ) tab2 on tab1.dateCreate = tab2.dateCreate
|
|
|
+ <if test="statsType == 0 or statsType == 2">
|
|
|
+ where tab1.dateCreate <=date_format(now(),'%Y-%m-%d')
|
|
|
+ </if>
|
|
|
+ <if test="statsType == 1">
|
|
|
+ where tab1.dateCreate <=date_format(now(),'%Y-%m')
|
|
|
+ </if>
|
|
|
+ </select>
|
|
|
+
|
|
|
+ <select id="selectTaskDuration" resultMap="BaseResultMap" >
|
|
|
+ SELECT timestampdiff(day,date_create,finish_date) interval_count,count(1) finished_count
|
|
|
+ FROM sc_plan_manage t1
|
|
|
+ where (plan_status=2 or plan_status=3) and
|
|
|
+ <if test="statsType == 0">
|
|
|
+ t1.date_create >= concat(#{startDate}, '-1') and t1.date_create < concat(#{startDate}, '-1') + interval 1 month
|
|
|
+ </if>
|
|
|
+ <if test="statsType == 1">
|
|
|
+ t1.date_create >= concat(#{startDate}, '-1-1') and t1.date_create < concat(#{startDate}, '-1-1') + interval 1 year
|
|
|
+ </if>
|
|
|
+ <if test="statsType == 2">
|
|
|
+ t1.date_create >= concat(#{startDate}, '-1') and t1.date_create < concat(#{endDate}, '-1') + interval 1 month
|
|
|
+ </if>
|
|
|
+ <if test="tenantId != null and tenantId != ''">
|
|
|
+ and t1.tenant_id=#{tenantId}
|
|
|
+ </if>
|
|
|
+ <if test="userType!=null and userType!=-999 and userType!=-9999 and programItems != null and programItems.size() > 0">
|
|
|
+ <if test="permissonType == 5 or permissonType == 2">
|
|
|
+ and ( t1.department_org_id in
|
|
|
+ <foreach collection="programItems" item="item" open="(" close=")" separator=",">
|
|
|
+ #{item.orgId}
|
|
|
+ </foreach>
|
|
|
+ or
|
|
|
+ t1.COMPANY_ORG_ID in
|
|
|
+ <foreach collection="programItems" item="item" open="(" close=")" separator=",">
|
|
|
+ #{item.orgId}
|
|
|
+ </foreach>
|
|
|
+ )
|
|
|
+ </if>
|
|
|
+ <if test="permissonType == 4 or permissonType == 3">
|
|
|
+ and t1.department_org_id in
|
|
|
+ <foreach collection="programItems" item="item" open="(" close=")" separator=",">
|
|
|
+ #{item.orgId}
|
|
|
+ </foreach>
|
|
|
+ </if>
|
|
|
+ <if test="permissonType == 1">
|
|
|
+ and t1.COMPANY_ORG_ID in
|
|
|
+ <foreach collection="programItems" item="item" open="(" close=")" separator=",">
|
|
|
+ #{item.orgId}
|
|
|
+ </foreach>
|
|
|
+ and (t1.department_org_id is null or t1.department_org_id =0)
|
|
|
+ </if>
|
|
|
+ </if>
|
|
|
+ group by timestampdiff(day,date_create,finish_date)
|
|
|
+ </select>
|
|
|
</mapper>
|