41 lines
1.8 KiB
Java
41 lines
1.8 KiB
Java
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.RescueTeamPageSo;
|
|
import com.gunshi.project.xyt.entity.vo.RescueTeamVo;
|
|
import com.gunshi.project.xyt.model.RescueTeamB;
|
|
import org.apache.ibatis.annotations.Mapper;
|
|
import org.apache.ibatis.annotations.Param;
|
|
import org.apache.ibatis.annotations.Select;
|
|
|
|
/**
|
|
* 描述: 抢险队伍
|
|
* author: xusan
|
|
* date: 2024-07-08 15:44:08
|
|
*/
|
|
@Mapper
|
|
public interface RescueTeamBMapper extends BaseMapper<RescueTeamB> {
|
|
@Select("""
|
|
<script>
|
|
with m1 as (
|
|
select distinct t2.* from public.rescue_team_b t2
|
|
<where>
|
|
<if test="obj.teamName != null and obj.teamName !=''">
|
|
t2.team_name LIKE concat('%',#{obj.teamName}::text,'%')
|
|
</if>
|
|
<if test="obj.dateSo != null and obj.dateSo.start != null">
|
|
and t2.valid_end_date <![CDATA[>=]]> #{obj.dateSo.start}
|
|
</if>
|
|
<if test="obj.dateSo != null and obj.dateSo.end != null">
|
|
and t2.valid_end_date <![CDATA[<=]]> #{obj.dateSo.end}
|
|
</if>
|
|
</where>
|
|
),
|
|
m2 as (select team_id,count(team_id) as personCount from rescue_team_detail GROUP BY team_id)
|
|
select m1.*,m2.personCount,case when m1.valid_end_date <![CDATA[<]]> now() then 0 else 1 end as isValid from m1 left join m2 on m1.team_id = m2.team_id
|
|
order by m1.register_date desc
|
|
</script>
|
|
""")
|
|
Page<RescueTeamVo> pageQuery(@Param("page") Page<RescueTeamVo> page, @Param("obj") RescueTeamPageSo rescueTeamPageSo);
|
|
} |