gunshi-project-ss/src/main/java/com/gunshi/project/xyt/mapper/InspectTaskMapper.java

48 lines
1.9 KiB
Java
Raw Normal View History

2024-08-29 16:46:53 +08:00
package com.gunshi.project.xyt.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.gunshi.project.xyt.entity.so.InspectTaskPageSo;
2024-08-29 16:46:53 +08:00
import com.gunshi.project.xyt.model.InspectTask;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
2024-08-29 16:46:53 +08:00
/**
* :
* author: xusan
* date: 2024-08-29 14:21:15
*/
@Mapper
public interface InspectTaskMapper extends BaseMapper<InspectTask> {
@Select("""
<script>
with m1 as (
select t.* from public.inspect_task t
<where>
<if test="obj.status != null ">
t.status = #{obj.status}
</if>
<if test="obj.taskType != null ">
and t.task_type = #{obj.taskType}
</if>
<if test="obj.dateTimeRangeSo != null and obj.dateTimeRangeSo.start != null">
and t.create_time <![CDATA[>=]]> #{obj.dateTimeRangeSo.start}
</if>
<if test="obj.dateTimeRangeSo != null and obj.dateTimeRangeSo.end != null">
and t.create_time <![CDATA[<=]]> #{obj.dateTimeRangeSo.end}
</if>
</where>
),
m2 as (select task_id,count(is_normal) as problemNum from inspect_task_detail where is_normal = 0 GROUP BY task_id),
m3 as (select task_id,count(is_handle) as handleNum from inspect_task_detail where is_handle = 0 GROUP BY task_id)
select m1.*,m2.problemNum,m3.handleNum from m1
left join m2 on m1.id = m2.task_id
left join m3 on m1.id = m3.task_id
order by m1.create_time desc
</script>
""")
Page<InspectTask> pageQuery(Page<InspectTask> page,@Param("obj") InspectTaskPageSo pageSo);
2024-08-30 13:36:20 +08:00
2024-08-29 16:46:53 +08:00
}