@ -30,20 +30,24 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
</if>
</sql>
<!-- w_dk_business -->
<select id= "pageBusinessAlert" resultType= "org.dromara.business.domain.BusinessAlert" >
select t.* from (select
ba.*
from dk_business .business_alert ba) t
from ${tbPrefix.tableBusiness} .business_alert ba) t
${ew.getCustomSqlSegment}
</select>
<!-- w_dk_business -->
<select id= "pageBusinessAlertFinish" resultType= "org.dromara.business.domain.BusinessAlert" >
select t.* from (select
ba.*
from dk_business .business_alert ba) t
from ${tbPrefix.tableBusiness} .business_alert ba) t
${ew.getCustomSqlSegment}
</select>
<!-- w_dk_business -->
<!-- w_dk_workflow -->
<select id= "pageBusinessAlertCancel" resultType= "org.dromara.business.domain.BusinessAlert" >
select t.* from (
select
@ -51,12 +55,14 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
b.flow_status flowStatus,
b.business_id businessId,
b.id instanceId
from dk_business .business_alert ba
inner join dk_workflow .flow_instance b on ba.id = b.business_id
from ${tbPrefix.tableBusiness} .business_alert ba
inner join ${tbPrefix.tableWorkflow} .flow_instance b on ba.id = b.business_id
) t
${ew.getCustomSqlSegment}
</select>
<!-- w_dk_business -->
<!-- w_dk_workflow -->
<select id= "pageBusinessAlertHandle" resultType= "org.dromara.business.domain.BusinessAlert" >
select t.* from (
select
@ -64,15 +70,16 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
b.flow_status flowStatus,
b.business_id businessId,
b.id instanceId
from dk_business .business_alert ba
inner join dk_workflow .flow_instance b on ba.id = b.business_id
from ${tbPrefix.tableBusiness} .business_alert ba
inner join ${tbPrefix.tableWorkflow} .flow_instance b on ba.id = b.business_id
where
b.del_flag = '0'
) t
${ew.getCustomSqlSegment}
</select>
<!-- w_dk_business -->
<!-- w_dk_workflow -->
<select id= "pageAlertTodo" resultType= "org.dromara.business.domain.BusinessAlert" >
select t.* from (
select
@ -85,16 +92,16 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
a.node_type,
fnData.buttonPermission,
fnData.permissions
from dk_business .business_alert ba
inner join dk_workflow .flow_instance b on ba.id = b.business_id
left join dk_workflow .flow_task a on a.instance_id = b.id
left join dk_workflow .flow_user uu on uu.associated = a.id
left join dk_workflow .flow_definition c on a.definition_id = c.id
from ${tbPrefix.tableBusiness} .business_alert ba
inner join ${tbPrefix.tableWorkflow} .flow_instance b on ba.id = b.business_id
left join ${tbPrefix.tableWorkflow} .flow_task a on a.instance_id = b.id
left join ${tbPrefix.tableWorkflow} .flow_user uu on uu.associated = a.id
left join ${tbPrefix.tableWorkflow} .flow_definition c on a.definition_id = c.id
LEFT JOIN LATERAL (
SELECT
JSON_UNQUOTE(JSON_EXTRACT(fn.ext, '$[0].value')) AS buttonPermission,
fn.permissions
FROM dk_workflow .flow_node fn
FROM ${tbPrefix.tableWorkflow} .flow_node fn
WHERE
fn.node_code = b.node_code
and fn.definition_id = c.id
@ -159,6 +166,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<include refid= "searchSql" > </include>
</select>
<!-- w_dk_cloud -->
<select id= "listDepartAlert" resultType= "java.util.Map" >
WITH RECURSIVE sub_depts AS (
SELECT
@ -167,13 +175,13 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
parent_id,
tenant_id
FROM
dk_cloud .sys_dept
${tbPrefix.tableCloud} .sys_dept
<where >
<if test= "param.deptId != null and param.deptId != ''" >
parent_id = #{param.deptId}
</if>
<if test= "param.deptId == null or param.deptId == ''" >
parent_id in (select dsd.dept_id from dk_cloud .sys_dept dsd where dsd.parent_id = '0')
parent_id in (select dsd.dept_id from ${tbPrefix.tableCloud} .sys_dept dsd where dsd.parent_id = '0')
</if>
</where>
UNION ALL
@ -184,7 +192,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
d.parent_id,
d.tenant_id
FROM
dk_cloud .sys_dept d
${tbPrefix.tableCloud} .sys_dept d
INNER JOIN sub_depts st ON d.parent_id = st.dept_id
),
-- 获取直接子部门(用于最终显示)
@ -195,13 +203,13 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
parent_id,
tenant_id
FROM
dk_cloud .sys_dept
${tbPrefix.tableCloud} .sys_dept
<where >
<if test= "param.deptId != null and param.deptId != ''" >
parent_id = #{param.deptId}
</if>
<if test= "param.deptId == null or param.deptId == ''" >
parent_id in (select dsd.dept_id from dk_cloud .sys_dept dsd where dsd.parent_id = '0')
parent_id in (select dsd.dept_id from ${tbPrefix.tableCloud} .sys_dept dsd where dsd.parent_id = '0')
</if>
</where>
),
@ -248,6 +256,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
ORDER BY m.dateMonth
</select>
<!-- w_dk_cloud -->
<select id= "listDepartAlertStatus" resultType= "java.util.Map" >
WITH RECURSIVE sub_depts AS (
SELECT
@ -256,13 +265,13 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
parent_id,
tenant_id
FROM
dk_cloud .sys_dept
${tbPrefix.tableCloud} .sys_dept
<where >
<if test= "param.deptId != null and param.deptId != ''" >
parent_id = #{param.deptId}
</if>
<if test= "param.deptId == null or param.deptId == ''" >
parent_id in (select dsd.dept_id from dk_cloud .sys_dept dsd where dsd.parent_id = '0')
parent_id in (select dsd.dept_id from ${tbPrefix.tableCloud} .sys_dept dsd where dsd.parent_id = '0')
</if>
</where>
UNION ALL
@ -273,7 +282,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
d.parent_id,
d.tenant_id
FROM
dk_cloud .sys_dept d
${tbPrefix.tableCloud} .sys_dept d
INNER JOIN sub_depts st ON d.parent_id = st.dept_id
),
-- 获取直接子部门(用于最终显示)
@ -284,13 +293,13 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
parent_id,
tenant_id
FROM
dk_cloud .sys_dept
${tbPrefix.tableCloud} .sys_dept
<where >
<if test= "param.deptId != null and param.deptId != ''" >
parent_id = #{param.deptId}
</if>
<if test= "param.deptId == null or param.deptId == ''" >
parent_id in (select dsd.dept_id from dk_cloud .sys_dept dsd where dsd.parent_id = '0')
parent_id in (select dsd.dept_id from ${tbPrefix.tableCloud} .sys_dept dsd where dsd.parent_id = '0')
</if>
</where>
),
@ -515,10 +524,20 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<include refid= "searchSql" > </include>
</select>
<select id= "countTotalAlert" resultType= "java.util.Map" >
select
IFNULL(SUM( ba.handle_type = 'waiting' ),0) AS todoCount,
IFNULL(SUM( ba.handle_type = 'finish' ),0) AS finishCount
from business_alert ba
where 1=1
<include refid= "searchSql" > </include>
</select>
<!-- w_dk_cloud -->
<select id= "countAiLabel" resultType= "java.util.Map" >
WITH warning_summary AS (
SELECT al.label_cn, al.label_en
FROM dk_cloud.ai_label al where al.label_en in
FROM ${tbPrefix.tableCloud} .ai_label al where al.label_en in
<foreach collection= "param.aiLabelEnList" item= "item" open= "(" close= ")" separator= "," >
#{item}
</foreach>
@ -543,6 +562,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
ws.label_en
</select>
<!-- w_dk_cloud -->
<select id= "countStreetAlert" resultType= "java.util.Map" >
WITH RECURSIVE warning_summary AS (
SELECT
@ -551,7 +571,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
dept_id,
dept_name
FROM
dk_cloud .sys_dept
${tbPrefix.tableCloud} .sys_dept
WHERE dept_id IN
<foreach collection= "deptIdList" item= "deptId" open= "(" separator= "," close= ")" >
#{deptId}
@ -563,7 +583,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
d.dept_id,
d.dept_name
FROM
dk_cloud .sys_dept d
${tbPrefix.tableCloud} .sys_dept d
JOIN warning_summary dt ON d.parent_id = dt.dept_id
WHERE
d.del_flag = '0'
@ -586,6 +606,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
LIMIT 5
</select>
<!-- w_dk_business -->
<select id= "listAlert" resultType= "org.dromara.business.domain.BusinessAlert" >
select
ba.label_en labelEn,
@ -596,7 +617,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
ba.business_type businessType,
ba.lat,
ba.lng
from dk_business .business_alert ba
from ${tbPrefix.tableBusiness} .business_alert ba
where 1=1
and <![CDATA[ DATE_FORMAT(ba.create_time, '%Y-%m-%d') >= #{startTime} ]]>
and <![CDATA[ DATE_FORMAT(ba.create_time, '%Y-%m-%d') <= #{endTime} ]]>
@ -604,6 +625,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
order by ba.create_time desc
</select>
<!-- w_dk_cloud -->
<select id= "countStreetRateAlert" resultType= "java.util.Map" >
WITH RECURSIVE warning_summary AS (
SELECT
@ -612,7 +634,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
dept_id,
dept_name
FROM
dk_cloud .sys_dept
${tbPrefix.tableCloud} .sys_dept
WHERE dept_id IN
<foreach collection= "deptIdList" item= "deptId" open= "(" separator= "," close= ")" >
#{deptId}
@ -624,7 +646,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
d.dept_id,
d.dept_name
FROM
dk_cloud .sys_dept d
${tbPrefix.tableCloud} .sys_dept d
JOIN warning_summary dt ON d.parent_id = dt.dept_id
WHERE
d.del_flag = '0'
@ -652,6 +674,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
LIMIT 5
</select>
<!-- w_dk_cloud -->
<select id= "streetRateTopAlert" resultType= "java.util.Map" >
WITH RECURSIVE warning_summary AS (
SELECT
@ -659,7 +682,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
dept_name AS root_dept_name,
dept_id,
dept_name
FROM dk_cloud .sys_dept
FROM ${tbPrefix.tableCloud} .sys_dept
WHERE dept_id IN
<foreach collection= "deptIdList" item= "deptId" open= "(" separator= "," close= ")" >
#{deptId}
@ -670,7 +693,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
dt.root_dept_name,
d.dept_id,
d.dept_name
FROM dk_cloud .sys_dept d
FROM ${tbPrefix.tableCloud} .sys_dept d
JOIN warning_summary dt
ON d.parent_id = dt.dept_id
WHERE d.del_flag = '0'
@ -702,6 +725,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
LIMIT 1
</select>
<!-- w_dk_cloud -->
<select id= "streetTopAlert" resultType= "java.util.Map" >
WITH RECURSIVE warning_summary AS (
SELECT
@ -709,7 +733,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
dept_name AS root_dept_name,
dept_id,
dept_name
FROM dk_cloud .sys_dept
FROM ${tbPrefix.tableCloud} .sys_dept
WHERE dept_id IN
<foreach collection= "deptIdList" item= "deptId" open= "(" separator= "," close= ")" >
#{deptId}
@ -720,7 +744,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
dt.root_dept_name,
d.dept_id,
d.dept_name
FROM dk_cloud .sys_dept d
FROM ${tbPrefix.tableCloud} .sys_dept d
JOIN warning_summary dt
ON d.parent_id = dt.dept_id
WHERE d.del_flag = '0'
@ -748,14 +772,14 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
LIMIT 1;
</select>
<!-- w_dk_cloud -->
<select id= "countLabelRateAlert" resultType= "java.util.Map" >
WITH warning_summary AS (
SELECT
al.label_cn,
al.label_en
FROM
dk_cloud .ai_label al
${tbPrefix.tableCloud} .ai_label al
WHERE
al.label_en IN
<foreach collection= "param.aiLabelEnList" item= "item" open= "(" close= ")" separator= "," >
@ -812,6 +836,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<include refid= "searchSql" > </include>
</select>
<!-- w_dk_business -->
<!-- w_dk_workflow -->
<select id= "listTodoAlert" resultType= "org.dromara.business.domain.BusinessAlert" >
select t.* from (
select
@ -824,16 +850,16 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
a.node_type,
fnData.buttonPermission,
fnData.permissions
from dk_business .business_alert ba
inner join dk_workflow .flow_instance b on ba.id = b.business_id
left join dk_workflow .flow_task a on a.instance_id = b.id
left join dk_workflow .flow_user uu on uu.associated = a.id
left join dk_workflow .flow_definition c on a.definition_id = c.id
from ${tbPrefix.tableBusiness} .business_alert ba
inner join ${tbPrefix.tableWorkflow} .flow_instance b on ba.id = b.business_id
left join ${tbPrefix.tableWorkflow} .flow_task a on a.instance_id = b.id
left join ${tbPrefix.tableWorkflow} .flow_user uu on uu.associated = a.id
left join ${tbPrefix.tableWorkflow} .flow_definition c on a.definition_id = c.id
LEFT JOIN LATERAL (
SELECT
JSON_UNQUOTE(JSON_EXTRACT(fn.ext, '$[0].value')) AS buttonPermission,
fn.permissions
FROM dk_workflow .flow_node fn
FROM ${tbPrefix.tableWorkflow} .flow_node fn
WHERE
fn.node_code = b.node_code
and fn.definition_id = c.id
@ -858,19 +884,21 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
ORDER BY create_time desc
</select>
<!-- w_dk_cloud -->
<select id= "listOneDepartAlert" resultType= "java.util.Map" >
SELECT
dc.dept_id AS deptId,
dc.dept_name AS deptName,
COALESCE(COUNT(ba.id), 0) AS total
FROM
(select dept_id,dept_name from dk_cloud .sys_dept sd where sd.dept_id = #{param.deptId}) dc
(select dept_id,dept_name from ${tbPrefix.tableCloud} .sys_dept sd where sd.dept_id = #{param.deptId}) dc
LEFT JOIN business_alert ba ON ba.dept_id = dc.dept_id
<include refid= "searchSql" > </include>
GROUP BY
dc.dept_id,dc.dept_name
</select>
<!-- w_dk_cloud -->
<select id= "listOneDepartAlertStatus" resultType= "java.util.Map" >
SELECT
dc.dept_id AS deptId,
@ -880,12 +908,14 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
IFNULL(SUM(ba.handle_type = 'finish'), 0) AS finishCount,
IFNULL(SUM(ba.handle_type = 'cancel'), 0) AS cancelCount
FROM
(select dept_id,dept_name from dk_cloud .sys_dept sd where sd.dept_id = #{param.deptId}) dc
(select dept_id,dept_name from ${tbPrefix.tableCloud} .sys_dept sd where sd.dept_id = #{param.deptId}) dc
LEFT JOIN business_alert ba ON ba.dept_id = dc.dept_id
<include refid= "searchSql" > </include>
GROUP BY
dc.dept_id,dc.dept_name
</select>
<!-- w_dk_business -->
<select id= "heatList" resultType= "org.dromara.business.domain.vo.BusinessAlertVo" >
SELECT
temp.label_en AS labelEn,
@ -899,7 +929,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
ba.label_en,
ba.label_cn
FROM
dk_business .business_alert ba
${tbPrefix.tableBusiness} .business_alert ba
GROUP BY
ba.label_en, ba.label_cn
) temp