This commit is contained in:
zt
2025-02-28 17:15:33 +08:00
parent b32a787f5f
commit 23bf1f46ee
19 changed files with 175 additions and 90 deletions

View File

@ -30,56 +30,64 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<select id="appQueryPageList" resultType="com.ruoyi.fbs.domain.vo.AppTaskVO">
select fpt.id,
fpt.project_id,
fpt.section_id,
fpt.sub_id,
fpt.task_name,
fpt.task_staff_num,
fpt.task_amount,
fpt.task_begin_time,
fpt.task_end_time,
zp.project_name,
fpt.task_describe,
fpt.task_address,
fpt.create_time,
(select count(task_id) from fbs_project_task_apply where task_id = fpt.id) as applyNum,
(select sum(applicant_amount) from bgt_wage_application where audit_status = '2'and task_id = fpt.id) as taskReceiveAmount
from fbs_project_task fpt
left join zbf_project zp on fpt.project_id = zp.id
SELECT
fpt.id,
fpt.project_id,
fpt.section_id,
fpt.sub_id,
fpt.task_name,
fpt.task_staff_num,
fpt.task_amount,
fpt.task_begin_time,
fpt.task_end_time,
zp.project_name,
fpt.task_describe,
fpt.task_address,
fpt.create_time,
#{dto.myTask} as myTask,
COALESCE(apply.applyNum, 0) as applyNum,
COALESCE(wage.taskReceiveAmount, 0) as taskReceiveAmount
FROM fbs_project_task fpt
LEFT JOIN zbf_project zp ON fpt.project_id = zp.id
LEFT JOIN (
SELECT task_id, COUNT(*) as applyNum
FROM fbs_project_task_apply
GROUP BY task_id
) apply ON fpt.id = apply.task_id
LEFT JOIN (
SELECT task_id, SUM(applicant_amount) as taskReceiveAmount
FROM bgt_wage_application
WHERE audit_status = '2'
GROUP BY task_id
) wage ON fpt.id = wage.task_id
<where>
<choose>
<when test="dto.myTask">
<if test="dto.taskIds != null and dto.taskIds.size() > 0">
and fpt.id IN
<foreach item="item" index="index" collection="dto.taskIds"
open="(" separator="," close=")">
#{item}
</foreach>
</if>
</when>
<otherwise>
<if test="dto.taskIds != null and dto.taskIds.size() > 0">
and fpt.id not IN
<foreach item="item" index="index" collection="dto.taskIds"
open="(" separator="," close=")">
#{item}
</foreach>
</if>
</otherwise>
</choose>
<if test="dto.taskName != null and dto.taskName != '' ">
and fpt.task_name like concat('%', #{dto.taskName}, '%')
</if>
<if test="dto.userId != null ">
and fpt.user_id = #{dto.userId}
</if>
<if test="dto.status != null and dto.status != '' ">
and fpt.status = #{dto.status}
</if>
<if test='!dto.myTask and dto.status != null and dto.status == "0"'>
AND NOT EXISTS (
SELECT 1
FROM fbs_project_task_apply
WHERE task_id = fpt.id
AND user_id = #{dto.userId}
)
</if>
<if test='dto.myTask and dto.status != null and dto.status == "0"'>
AND EXISTS (
SELECT 1
FROM fbs_project_task_apply
WHERE task_id = fpt.id
AND user_id = #{dto.userId}
)
</if>
<if test="dto.taskName != null and dto.taskName != '' ">
AND fpt.task_name LIKE CONCAT('%', #{dto.taskName}, '%')
</if>
<if test='dto.myTask and dto.status != null and dto.status != "0"'>
AND fpt.user_id = #{dto.userId}
</if>
<if test="dto.status != null and dto.status != '' ">
AND fpt.status = #{dto.status}
</if>
</where>
order by fpt.create_time desc
ORDER BY fpt.create_time DESC
</select>
</mapper>