Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Contribute to GitLab
Sign in
Toggle navigation
H
huaxin-rq
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
耿迪迪
huaxin-rq
Commits
3710135e
Commit
3710135e
authored
Aug 19, 2026
by
耿迪迪
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
管线巡线任务统计及管线统计
parent
105f6f76
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
180 additions
and
52 deletions
+180
-52
TPipeTaskInspectMapper.xml
...c/main/resources/mapper/system/TPipeTaskInspectMapper.xml
+59
-16
TPipeTaskMapper.xml
...stem/src/main/resources/mapper/system/TPipeTaskMapper.xml
+121
-36
No files found.
huaxin-system/src/main/resources/mapper/system/TPipeTaskInspectMapper.xml
View file @
3710135e
...
@@ -66,22 +66,65 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
...
@@ -66,22 +66,65 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<!-- 需求变更修改 2025-10-30 -->
<!-- 需求变更修改 2025-10-30 -->
<select
id=
"selectTPipeTaskPointInspectList"
parameterType=
"TPipeTaskInspect"
resultMap=
"TPipeTaskInspectResult"
>
<select
id=
"selectTPipeTaskPointInspectList"
parameterType=
"TPipeTaskInspect"
resultMap=
"TPipeTaskInspectResult"
>
SELECT
SELECT
orderInspect.*
pipeInspect.id,
FROM(
pipeInspect.task_id,
<include
refid=
"selectTPipeTaskInspectVo"
/>
pipeInspect.user_id,
<where>
pipeInspect.point,
<if
test=
"taskId != null "
>
and pipeInspect.task_id = #{taskId}
</if>
pipeInspect.longitude,
<if
test=
"userId != null "
>
and pipeInspect.user_id = #{userId}
</if>
pipeInspect.latitude,
<if
test=
"pipeId != null "
>
and pipe.pipe_id = #{pipeId}
</if>
pipeInspect.STATUS,
<if
test=
"status != null "
>
and pipeInspect.status = #{status}
</if>
pipeInspect.create_time,
<if
test=
"point != null "
>
and pipeInspect.point = #{point}
</if>
pipeInspect.content,
<if
test=
"pipeName != null "
>
and pipe.pipe_name like concat('%',#{pipeName},'%')
</if>
pipeInspect.danger,
<if
test=
"pointTitle != null "
>
and point.title like concat('%',#{pointTitle},'%')
</if>
pipeInspect.imgurl,
<if
test=
"inspector != null "
>
and us.nick_name like concat('%',#{inspector},'%')
</if>
pipe.pipe_name,
<if
test=
"danger != null "
>
and pipeInspect.danger = #{danger}
</if>
point.title AS point_title,
</where>
point.longitude AS pointLongitude,
ORDER BY pipeInspect.create_time DESC
point.latitude AS pointLatitude,
)orderInspect GROUP BY orderInspect.point
us.nick_name AS inspector,
point.pipe_id
FROM
(SELECT t.*
FROM t_pipe_task_inspect t
JOIN (
SELECT `point`, MAX(create_time) AS max_time
FROM t_pipe_task_inspect
WHERE `task_id` = #{taskId} and create_time IS NOT NULL
GROUP BY `point`
) AS sub_t
ON t.`point` = sub_t.`point`
AND t.create_time = sub_t.max_time
WHERE t.`task_id` = #{taskId}
UNION ALL
SELECT t.*
FROM t_pipe_task_inspect t
WHERE t.create_time IS NULL
AND t.`point` NOT IN (
SELECT `point`
FROM t_pipe_task_inspect
WHERE `task_id` = #{taskId} AND create_time IS NOT NULL
GROUP BY `point`
)
AND t.`task_id` = #{taskId}
GROUP BY t.`point`
) pipeInspect
LEFT JOIN t_pipe_point `point` ON point.id = pipeInspect.point
LEFT JOIN t_pipe_info pipe ON pipe.pipe_id = point.pipe_id
LEFT JOIN sys_user us ON us.user_id = pipeInspect.user_id
<where>
<if
test=
"taskId != null "
>
and pipeInspect.task_id = #{taskId}
</if>
<if
test=
"userId != null "
>
and pipeInspect.user_id = #{userId}
</if>
<if
test=
"pipeId != null "
>
and pipe.pipe_id = #{pipeId}
</if>
<if
test=
"status != null "
>
and pipeInspect.status = #{status}
</if>
<if
test=
"point != null "
>
and pipeInspect.point = #{point}
</if>
<if
test=
"pipeName != null "
>
and pipe.pipe_name like concat('%',#{pipeName},'%')
</if>
<if
test=
"pointTitle != null "
>
and point.title like concat('%',#{pointTitle},'%')
</if>
<if
test=
"inspector != null "
>
and us.nick_name like concat('%',#{inspector},'%')
</if>
<if
test=
"danger != null "
>
and pipeInspect.danger = #{danger}
</if>
</where>
ORDER BY pipeInspect.create_time DESC
</select>
</select>
<select
id=
"selectPipeDistance"
parameterType=
"TPipeTaskInspect"
resultMap=
"TPipeTaskInspectResult"
>
<select
id=
"selectPipeDistance"
parameterType=
"TPipeTaskInspect"
resultMap=
"TPipeTaskInspectResult"
>
...
...
huaxin-system/src/main/resources/mapper/system/TPipeTaskMapper.xml
View file @
3710135e
...
@@ -12,6 +12,10 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
...
@@ -12,6 +12,10 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<result
property=
"adminId"
column=
"admin_id"
/>
<result
property=
"adminId"
column=
"admin_id"
/>
<result
property=
"createTime"
column=
"create_time"
/>
<result
property=
"createTime"
column=
"create_time"
/>
<result
property=
"taskEndTime"
column=
"task_end_time"
/>
<result
property=
"taskEndTime"
column=
"task_end_time"
/>
<association
property=
"finishRate"
column=
"id"
select=
"selectFinishRateByTaskId"
javaType=
"String"
/>
</resultMap>
</resultMap>
<sql
id=
"selectTPipeTaskVo"
>
<sql
id=
"selectTPipeTaskVo"
>
...
@@ -23,13 +27,61 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
...
@@ -23,13 +27,61 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
t.admin_id,
t.admin_id,
t.create_time,
t.create_time,
t.task_end_time,
t.task_end_time,
u.nick_name AS nickName,
u.nick_name AS nickName
(select CONCAT(ROUND(SUM(IF(pi.status = 1,1,0))/COUNT(1)*100),'%') from t_pipe_task_inspect pi where pi.task_id = t.id) as finishRate
FROM
FROM
t_pipe_task t
t_pipe_task t
LEFT JOIN sys_user u ON u.user_id = t.admin_id
LEFT JOIN sys_user u ON u.user_id = t.admin_id
</sql>
</sql>
<select
id=
"selectFinishRateByTaskId"
resultType=
"String"
>
SELECT
CONCAT(ROUND(SUM(IF(pipeInspect.status = 1, 1, 0))/COUNT(1)*100),'%')
FROM
(
SELECT
inspect.status,
inspect.task_id
FROM
t_pipe_task_inspect inspect
JOIN (
SELECT
`point`,
MAX(create_time) AS max_time
FROM
t_pipe_task_inspect
WHERE
`task_id` = #{taskId} and create_time IS NOT NULL
GROUP BY
`point`
) AS sub_t ON inspect.`point` = sub_t.`point`
AND inspect.create_time = sub_t.max_time
WHERE
inspect.`task_id` = #{taskId}
UNION ALL
SELECT
inspect.status,
inspect.task_id
FROM
t_pipe_task_inspect inspect
WHERE
inspect.create_time IS NULL
AND inspect.`point` NOT IN (
SELECT
`point`
FROM
t_pipe_task_inspect
WHERE
`task_id` = #{taskId} AND create_time IS NOT NULL
GROUP BY
`point`
)
AND inspect.`task_id` = #{taskId}
GROUP BY
inspect.`point`
) pipeInspect
GROUP BY pipeInspect.task_id
</select>
<select
id=
"selectTPipeTaskList"
parameterType=
"TPipeTask"
resultMap=
"TPipeTaskResult"
>
<select
id=
"selectTPipeTaskList"
parameterType=
"TPipeTask"
resultMap=
"TPipeTaskResult"
>
<include
refid=
"selectTPipeTaskVo"
/>
<include
refid=
"selectTPipeTaskVo"
/>
<where>
<where>
...
@@ -153,43 +205,76 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
...
@@ -153,43 +205,76 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<!-- 需求变更修改 2025-10-30 -->
<!-- 需求变更修改 2025-10-30 -->
<select
id=
"selectTaskInspectStatisticsByPipe"
parameterType=
"TaskInspectStatisticsByPipVo"
resultType=
"java.util.Map"
>
<select
id=
"selectTaskInspectStatisticsByPipe"
parameterType=
"TaskInspectStatisticsByPipVo"
resultType=
"java.util.Map"
>
SELECT
SELECT
SUM(IF(p
oin
t.status = 1, 1, 0)) AS finishPointNum,
SUM(IF(p
ipeInspec
t.status = 1, 1, 0)) AS finishPointNum,
COUNT(1) AS totalPointNum,
COUNT(1) AS totalPointNum,
point.userId,
(
point.taskId,
SELECT
point.inspector,
GROUP_CONCAT(DISTINCT pti.user_id)
point.pipeId,
FROM
point.pipeName
t_pipe_task_inspect pti
FROM(
WHERE
pti.task_id = #{taskId}
) AS userId,
pipeInspect.task_id as taskId,
(
SELECT
GROUP_CONCAT(DISTINCT sy.nick_name)
FROM
t_pipe_task_inspect pti
LEFT JOIN sys_user sy ON sy.user_id = pti.user_id
WHERE
pti.task_id = #{taskId}
) AS inspector,
point.pipe_id as pipeId,
pipe.pipe_name as pipeName
FROM
(
SELECT
SELECT
orderInspect.status,
t.*
GROUP_CONCAT(orderInspect.user_id)AS userId,
FROM
orderInspect.id AS taskId,
t_pipe_task_inspect t
GROUP_CONCAT(orderInspect.nick_name)AS inspector,
JOIN (
orderInspect.pipe_id AS pipeId,
orderInspect.pipe_name AS pipeName
FROM(
SELECT
SELECT
inspect.status,
`point`,
inspect.user_id,
MAX(create_time) AS max_time
inspect.point,
task.id,
us.nick_name,
point.pipe_id,
pipe.pipe_name
FROM
FROM
t_pipe_task task
t_pipe_task_inspect
LEFT JOIN t_pipe_task_inspect inspect ON inspect.task_id = task.id
WHERE
LEFT JOIN t_pipe_point point ON point.id = inspect.point
`task_id` = #{taskId} and create_time IS NOT NULL
LEFT JOIN t_pipe_info pipe ON pipe.pipe_id = point.pipe_id
GROUP BY
LEFT JOIN sys_user us ON us.user_id = inspect.user_id
`point`
<where>
) AS sub_t ON t.`point` = sub_t.`point`
task.id = #{taskId} AND inspect.status NOT IN (2)
AND t.create_time = sub_t.max_time
<if
test=
"inspector != null and inspector != ''"
>
and us.nick_name like concat('%',#{inspector},'%')
</if>
WHERE
<if
test=
"pipeName != null and pipeName != ''"
>
and pipe.pipe_name like concat('%',#{pipeName},'%')
</if>
t.`task_id` = #{taskId}
</where>
UNION ALL
ORDER BY inspect.create_time DESC
SELECT
)orderInspect GROUP BY orderInspect.point
t.*
)point GROUP BY point.pipeId
FROM
t_pipe_task_inspect t
WHERE
t.create_time IS NULL
AND t.`point` NOT IN (
SELECT
`point`
FROM
t_pipe_task_inspect
WHERE
`task_id` = #{taskId} AND create_time IS NOT NULL
GROUP BY
`point`
)
AND t.`task_id` = #{taskId}
GROUP BY
t.`point`
) pipeInspect
LEFT JOIN t_pipe_point `point` ON point.id = pipeInspect.point
LEFT JOIN t_pipe_info pipe ON pipe.pipe_id = point.pipe_id
LEFT JOIN sys_user us ON us.user_id = pipeInspect.user_id
<where>
<if
test=
"inspector != null and inspector != ''"
>
and us.nick_name like concat('%',#{inspector},'%')
</if>
<if
test=
"pipeName != null and pipeName != ''"
>
and pipe.pipe_name like concat('%',#{pipeName},'%')
</if>
</where>
GROUP BY point.pipe_id
</select>
</select>
</mapper>
</mapper>
\ No newline at end of file
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment