package com.gunshi.project.ss.mapper; import com.baomidou.mybatisplus.core.mapper.BaseMapper; import com.gunshi.db.dto.MonthRangeSo; import com.gunshi.project.ss.entity.vo.MentenceInfoCount12Vo; import com.gunshi.project.ss.entity.vo.StatusCountVo; import com.gunshi.project.ss.model.HiddenInfo; import org.apache.ibatis.annotations.MapKey; import org.apache.ibatis.annotations.Mapper; import org.apache.ibatis.annotations.Param; import org.apache.ibatis.annotations.Select; import java.util.List; @Mapper public interface HiddenInfoMapper extends BaseMapper { @Select(""" """) List selectCount12(@Param("dto") MonthRangeSo monthRangeSo); @Select(""" """) @MapKey("status") List selectCountType(@Param("dto") MonthRangeSo monthRangeSo); @Select(""" WITH all_status AS ( SELECT 0 AS status UNION SELECT 1 AS status ) SELECT a.status, COALESCE(COUNT(h.id), 0) AS count FROM all_status a LEFT JOIN hidden_info h ON a.status = h.status AND TO_CHAR(h.found_time, 'YYYY') = #{year} GROUP BY a.status ORDER BY a.status; """) @MapKey("status") List countYear(@Param("year") String year); }