|
@@ -172,7 +172,52 @@
|
|
|
<result property="financeSubmgrRemarks" column="finance_submgr_remarks"/>
|
|
|
</resultMap>
|
|
|
|
|
|
-<select id="selectTaskSupProcess" resultMap="wmTaskSupProcessMap">
|
|
|
+<select id="selectTaskSupProcess" resultMap="wmTaskSupProcessMap" timeout="1800">
|
|
|
+ WITH base_check_his AS (
|
|
|
+ SELECT
|
|
|
+ target_id,
|
|
|
+ node_id,
|
|
|
+ check_result,
|
|
|
+ check_msg,
|
|
|
+ update_time1,
|
|
|
+ create_by1
|
|
|
+ FROM sys_chain_node_check_his
|
|
|
+ WHERE create_time1 >= #{taskBeginTime}
|
|
|
+ ),
|
|
|
+ check_users AS (
|
|
|
+ SELECT DISTINCT username, realname FROM sys_user
|
|
|
+ ),
|
|
|
+ check_data AS (
|
|
|
+ SELECT
|
|
|
+ b.target_id,
|
|
|
+ b.node_id,
|
|
|
+ b.check_result,
|
|
|
+ b.check_msg,
|
|
|
+ b.update_time1,
|
|
|
+ u.realname
|
|
|
+ FROM base_check_his b
|
|
|
+ JOIN check_users u ON b.create_by1 = u.username
|
|
|
+ ),
|
|
|
+ sup_data AS (
|
|
|
+ select sup."task_id", u.realname, sup.create_time, sup.sup_res, sup."remarks", ur.role_id from wm_task_sup sup
|
|
|
+
|
|
|
+ join sys_user u on u."username" = sup."create_by"
|
|
|
+
|
|
|
+ join "sys_user_role" ur on u.user_id = ur."user_id"
|
|
|
+
|
|
|
+ where sup."create_time" >= #{taskBeginTime}
|
|
|
+ ),
|
|
|
+ adv_data AS (
|
|
|
+ select sup."task_id", u.realname, adv.create_time, adv.advice_result, adv.remarks, ur.role_id from wm_task_sup sup
|
|
|
+
|
|
|
+ join wm_task_sup_adv adv on adv.task_supervision_id = sup.sup_id
|
|
|
+
|
|
|
+ join sys_user u on u."username" = adv."create_by"
|
|
|
+
|
|
|
+ join "sys_user_role" ur on u.user_id = ur."user_id"
|
|
|
+
|
|
|
+ where sup."create_time" >= #{taskBeginTime} and adv.del_flag = '0'
|
|
|
+ )
|
|
|
select
|
|
|
|
|
|
t.id,
|
|
@@ -393,15 +438,11 @@
|
|
|
|
|
|
(
|
|
|
|
|
|
- select "target_id", "check_result", "check_msg", his."update_time1" update_time, u."realname"
|
|
|
-
|
|
|
- from "sys_chain_node_check_his" his
|
|
|
-
|
|
|
- join (select distinct username, realname from sys_user) u
|
|
|
+ select "target_id", "check_result", "check_msg", "update_time1" update_time, "realname"
|
|
|
|
|
|
- on u."username" = his."create_by1"
|
|
|
+ from check_data
|
|
|
|
|
|
- where "node_id" = 1 and create_time1 >= #{taskBeginTime} <!-- 服务商 -->
|
|
|
+ where "node_id" = 1 <!-- 服务商 -->
|
|
|
|
|
|
) t1
|
|
|
|
|
@@ -411,15 +452,11 @@
|
|
|
|
|
|
(
|
|
|
|
|
|
- select "target_id", "check_result", "check_msg", his."update_time1" update_time, u."realname"
|
|
|
+ select "target_id", "check_result", "check_msg", "update_time1" update_time, "realname"
|
|
|
|
|
|
- from "sys_chain_node_check_his" his
|
|
|
+ from check_data
|
|
|
|
|
|
- join (select distinct username, realname from sys_user) u
|
|
|
-
|
|
|
- on u."username" = his."create_by1"
|
|
|
-
|
|
|
- where "node_id" = 2 and create_time1 >= #{taskBeginTime} <!-- 地市 -->
|
|
|
+ where "node_id" = 2 <!-- 地市 -->
|
|
|
|
|
|
) t2
|
|
|
|
|
@@ -429,13 +466,11 @@
|
|
|
|
|
|
(
|
|
|
|
|
|
- select "target_id", "check_result", "check_msg", his."update_time1" update_time, u."realname"
|
|
|
-
|
|
|
- from "sys_chain_node_check_his" his join (select distinct username, realname from sys_user) u
|
|
|
+ select "target_id", "check_result", "check_msg", "update_time1" update_time, "realname"
|
|
|
|
|
|
- on u."username" = his."create_by1"
|
|
|
+ from check_data
|
|
|
|
|
|
- where "node_id" = 3 and create_time1 >= #{taskBeginTime} <!-- 区域 -->
|
|
|
+ where "node_id" = 3 <!-- 区域 -->
|
|
|
|
|
|
) t3
|
|
|
|
|
@@ -445,13 +480,11 @@
|
|
|
|
|
|
(
|
|
|
|
|
|
- select "target_id", "check_result", "check_msg", his."update_time1" update_time, u."realname"
|
|
|
+ select "target_id", "check_result", "check_msg", "update_time1" update_time, "realname"
|
|
|
|
|
|
- from "sys_chain_node_check_his" his join (select distinct username, realname from sys_user) u
|
|
|
+ from check_data
|
|
|
|
|
|
- on u."username" = his."create_by1"
|
|
|
-
|
|
|
- where "node_id" = 8 and create_time1 >= #{taskBeginTime} <!-- 市场 -->
|
|
|
+ where "node_id" = 8 <!-- 市场 -->
|
|
|
|
|
|
) t8
|
|
|
|
|
@@ -461,13 +494,11 @@
|
|
|
|
|
|
(
|
|
|
|
|
|
- select "target_id", "check_result", "check_msg", his."update_time1" update_time, u."realname"
|
|
|
-
|
|
|
- from "sys_chain_node_check_his" his join (select distinct username, realname from sys_user) u
|
|
|
+ select "target_id", "check_result", "check_msg", "update_time1" update_time, "realname"
|
|
|
|
|
|
- on u."username" = his."create_by1"
|
|
|
+ from check_data
|
|
|
|
|
|
- where "node_id" = 9 and create_time1 >= #{taskBeginTime} <!-- 商务 -->
|
|
|
+ where "node_id" = 9 <!-- 商务 -->
|
|
|
|
|
|
) t9
|
|
|
|
|
@@ -477,13 +508,11 @@
|
|
|
|
|
|
(
|
|
|
|
|
|
- select "target_id", "check_result", "check_msg", his."update_time1" update_time, u."realname"
|
|
|
-
|
|
|
- from "sys_chain_node_check_his" his join (select distinct username, realname from sys_user) u
|
|
|
+ select "target_id", "check_result", "check_msg", "update_time1" update_time, "realname"
|
|
|
|
|
|
- on u."username" = his."create_by1"
|
|
|
+ from check_data
|
|
|
|
|
|
- where "node_id" = 5 and create_time1 >= #{taskBeginTime} <!-- 分管领导 -->
|
|
|
+ where "node_id" = 5 <!-- 分管领导 -->
|
|
|
|
|
|
) t5
|
|
|
|
|
@@ -493,13 +522,11 @@
|
|
|
|
|
|
(
|
|
|
|
|
|
- select distinct "target_id", "check_result", "check_msg", his."update_time1" update_time, u."realname"
|
|
|
+ select "target_id", "check_result", "check_msg", "update_time1" update_time, "realname"
|
|
|
|
|
|
- from "sys_chain_node_check_his" his join (select distinct username, realname from sys_user) u
|
|
|
+ from check_data
|
|
|
|
|
|
- on u."username" = his."create_by1"
|
|
|
-
|
|
|
- where "node_id" = 6 and create_time1 >= #{taskBeginTime} <!-- 总经理 -->
|
|
|
+ where "node_id" = 6 <!-- 总经理 -->
|
|
|
|
|
|
) t6
|
|
|
|
|
@@ -509,15 +536,9 @@
|
|
|
|
|
|
(
|
|
|
|
|
|
- select sup."task_id", u.realname, sup.create_time, sup.sup_res, sup."remarks" from wm_task_sup sup
|
|
|
-
|
|
|
- join wm_task_sup_adv adv on adv.task_supervision_id = sup.sup_id
|
|
|
-
|
|
|
- join sys_user u on u."username" = sup."create_by"
|
|
|
+ select "task_id", realname, create_time, sup_res, "remarks" from sup_data
|
|
|
|
|
|
- join "sys_user_role" ur on u.user_id = ur."user_id"
|
|
|
-
|
|
|
- where ur."role_id" = 49 and sup."create_time" >= #{taskBeginTime} <!-- 厂家财务 -->
|
|
|
+ where "role_id" = 49 <!-- 厂家财务 -->
|
|
|
|
|
|
) sup1
|
|
|
|
|
@@ -527,15 +548,9 @@
|
|
|
|
|
|
(
|
|
|
|
|
|
- select sup."task_id", u.realname, adv.create_time, adv.advice_result, adv.remarks from wm_task_sup sup
|
|
|
-
|
|
|
- join wm_task_sup_adv adv on adv.task_supervision_id = sup.sup_id
|
|
|
-
|
|
|
- join sys_user u on u."username" = adv."create_by"
|
|
|
-
|
|
|
- join "sys_user_role" ur on u.user_id = ur."user_id"
|
|
|
+ select "task_id", realname, create_time, advice_result, remarks from adv_data
|
|
|
|
|
|
- where ur."role_id" = 57 and sup."create_time" >= #{taskBeginTime} and adv.del_flag = '0' <!-- 厂家财务负责人 -->
|
|
|
+ where "role_id" = 57 <!-- 厂家财务负责人 -->
|
|
|
|
|
|
) sup11
|
|
|
|
|
@@ -545,15 +560,9 @@
|
|
|
|
|
|
(
|
|
|
|
|
|
- select sup."task_id", u.realname, adv.create_time, adv.advice_result, adv.remarks from wm_task_sup sup
|
|
|
+ select "task_id", realname, create_time, advice_result, remarks from adv_data
|
|
|
|
|
|
- join wm_task_sup_adv adv on adv.task_supervision_id = sup.sup_id
|
|
|
-
|
|
|
- join sys_user u on u."username" = adv."create_by"
|
|
|
-
|
|
|
- join "sys_user_role" ur on u.user_id = ur."user_id"
|
|
|
-
|
|
|
- where ur."role_id" = 51 and sup."create_time" >= #{taskBeginTime} and adv.del_flag = '0' <!-- 厂家财务分管领导 -->
|
|
|
+ where "role_id" = 51 <!-- 厂家财务分管领导 -->
|
|
|
|
|
|
) sup12
|
|
|
|
|
@@ -563,13 +572,9 @@
|
|
|
|
|
|
(
|
|
|
|
|
|
- select sup."task_id", u.realname, sup.create_time, sup.sup_res, sup."remarks" from wm_task_sup sup
|
|
|
+ select "task_id", realname, create_time, sup_res, "remarks" from sup_data
|
|
|
|
|
|
- join sys_user u on u."username" = sup."create_by"
|
|
|
-
|
|
|
- join "sys_user_role" ur on u.user_id = ur."user_id"
|
|
|
-
|
|
|
- where ur."role_id" = 52 and sup."create_time" >= #{taskBeginTime} <!-- 厂家销售 -->
|
|
|
+ where "role_id" = 52 <!-- 厂家销售 -->
|
|
|
|
|
|
) sup2
|
|
|
|
|
@@ -579,15 +584,9 @@
|
|
|
|
|
|
(
|
|
|
|
|
|
- select sup."task_id", u.realname, adv.create_time, adv.advice_result, adv.remarks from wm_task_sup sup
|
|
|
+ select "task_id", realname, create_time, advice_result, remarks from adv_data
|
|
|
|
|
|
- join wm_task_sup_adv adv on adv.task_supervision_id = sup.sup_id
|
|
|
-
|
|
|
- join sys_user u on u."username" = adv."create_by"
|
|
|
-
|
|
|
- join "sys_user_role" ur on u.user_id = ur."user_id"
|
|
|
-
|
|
|
- where ur."role_id" = 58 and sup."create_time" >= #{taskBeginTime} and adv.del_flag = '0' <!-- 厂家销售负责人 -->
|
|
|
+ where "role_id" = 58 <!-- 厂家销售负责人 -->
|
|
|
|
|
|
) sup21
|
|
|
|
|
@@ -597,15 +596,9 @@
|
|
|
|
|
|
(
|
|
|
|
|
|
- select sup."task_id", u.realname, adv.create_time, adv.advice_result, adv.remarks from wm_task_sup sup
|
|
|
-
|
|
|
- join wm_task_sup_adv adv on adv.task_supervision_id = sup.sup_id
|
|
|
-
|
|
|
- join sys_user u on u."username" = adv."create_by"
|
|
|
-
|
|
|
- join "sys_user_role" ur on u.user_id = ur."user_id"
|
|
|
+ select "task_id", realname, create_time, advice_result, remarks from adv_data
|
|
|
|
|
|
- where ur."role_id" = 61 and sup."create_time" >= #{taskBeginTime} and adv.del_flag = '0' <!-- 厂家销售分管领导 -->
|
|
|
+ where "role_id" = 61 <!-- 厂家销售分管领导 -->
|
|
|
|
|
|
) sup22
|
|
|
|
|
@@ -615,13 +608,9 @@
|
|
|
|
|
|
(
|
|
|
|
|
|
- select sup."task_id", u.realname, sup.create_time, sup.sup_res, sup."remarks" from wm_task_sup sup
|
|
|
+ select "task_id", realname, create_time, sup_res, "remarks" from sup_data
|
|
|
|
|
|
- join sys_user u on u."username" = sup."create_by"
|
|
|
-
|
|
|
- join "sys_user_role" ur on u.user_id = ur."user_id"
|
|
|
-
|
|
|
- where ur."role_id" = 53 and sup."create_time" >= #{taskBeginTime} <!-- 营销合规 -->
|
|
|
+ where "role_id" = 53 <!-- 营销合规 -->
|
|
|
|
|
|
) sup3
|
|
|
|
|
@@ -631,15 +620,9 @@
|
|
|
|
|
|
(
|
|
|
|
|
|
- select sup."task_id", u.realname, adv.create_time, adv.advice_result, adv.remarks from wm_task_sup sup
|
|
|
+ select "task_id", realname, create_time, advice_result, remarks from adv_data
|
|
|
|
|
|
- join wm_task_sup_adv adv on adv.task_supervision_id = sup.sup_id
|
|
|
-
|
|
|
- join sys_user u on u."username" = adv."create_by"
|
|
|
-
|
|
|
- join "sys_user_role" ur on u.user_id = ur."user_id"
|
|
|
-
|
|
|
- where ur."role_id" = 60 and sup."create_time" >= #{taskBeginTime} and adv.del_flag = '0' <!-- 营销合规负责人 -->
|
|
|
+ where "role_id" = 60 <!-- 营销合规负责人 -->
|
|
|
|
|
|
) sup31
|
|
|
|
|
@@ -649,15 +632,9 @@
|
|
|
|
|
|
(
|
|
|
|
|
|
- select sup."task_id", u.realname, adv.create_time, adv.advice_result, adv.remarks from wm_task_sup sup
|
|
|
+ select "task_id", realname, create_time, advice_result, remarks from adv_data
|
|
|
|
|
|
- join wm_task_sup_adv adv on adv.task_supervision_id = sup.sup_id
|
|
|
-
|
|
|
- join sys_user u on u."username" = adv."create_by"
|
|
|
-
|
|
|
- join "sys_user_role" ur on u.user_id = ur."user_id"
|
|
|
-
|
|
|
- where ur."role_id" = 54 and sup."create_time" >= #{taskBeginTime} and adv.del_flag = '0' <!-- 营销合规分管领导 -->
|
|
|
+ where "role_id" = 54 <!-- 营销合规分管领导 -->
|
|
|
|
|
|
) sup32
|
|
|
|
|
@@ -667,13 +644,9 @@
|
|
|
|
|
|
(
|
|
|
|
|
|
- select sup."task_id", u.realname, sup.create_time, sup.sup_res, sup."remarks" from wm_task_sup sup
|
|
|
+ select "task_id", realname, create_time, sup_res, "remarks" from sup_data
|
|
|
|
|
|
- join sys_user u on u."username" = sup."create_by"
|
|
|
-
|
|
|
- join "sys_user_role" ur on u.user_id = ur."user_id"
|
|
|
-
|
|
|
- where ur."role_id" = 56 and sup."create_time" >= #{taskBeginTime} <!-- 营销财务 -->
|
|
|
+ where "role_id" = 56 <!-- 营销财务 -->
|
|
|
|
|
|
) sup4
|
|
|
|
|
@@ -683,15 +656,9 @@
|
|
|
|
|
|
(
|
|
|
|
|
|
- select sup."task_id", u.realname, adv.create_time, adv.advice_result, adv.remarks from wm_task_sup sup
|
|
|
+ select "task_id", realname, create_time, advice_result, remarks from adv_data
|
|
|
|
|
|
- join wm_task_sup_adv adv on adv.task_supervision_id = sup.sup_id
|
|
|
-
|
|
|
- join sys_user u on u."username" = adv."create_by"
|
|
|
-
|
|
|
- join "sys_user_role" ur on u.user_id = ur."user_id"
|
|
|
-
|
|
|
- where ur."role_id" = 59 and sup."create_time" >= #{taskBeginTime} and adv.del_flag = '0' <!-- 营销财务负责人 -->
|
|
|
+ where "role_id" = 59 <!-- 营销财务负责人 -->
|
|
|
|
|
|
) sup41
|
|
|
|
|
@@ -701,15 +668,9 @@
|
|
|
|
|
|
(
|
|
|
|
|
|
- select sup."task_id", u.realname, adv.create_time, adv.advice_result, adv.remarks from wm_task_sup sup
|
|
|
-
|
|
|
- join wm_task_sup_adv adv on adv.task_supervision_id = sup.sup_id
|
|
|
-
|
|
|
- join sys_user u on u."username" = adv."create_by"
|
|
|
-
|
|
|
- join "sys_user_role" ur on u.user_id = ur."user_id"
|
|
|
+ select "task_id", realname, create_time, advice_result, remarks from adv_data
|
|
|
|
|
|
- where ur."role_id" = 55 and sup."create_time" >= #{taskBeginTime} and adv.del_flag = '0' <!-- 营销财务分管领导 -->
|
|
|
+ where "role_id" = 55 <!-- 营销财务分管领导 -->
|
|
|
|
|
|
) sup42
|
|
|
|