AdaKing88
2023-08-23 ae35159387a55199e8ab150ebb97d89d68a235bd
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
package org.jeecg.modules.arj.mapper;
 
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.jeecg.modules.arj.entity.FeipinYintie;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;
import org.springframework.stereotype.Repository;
 
import java.util.List;
 
 
/**
 * <p>
 * 印铁废品 前端控制器
 * </p>
 *
 * @author hyy
 * @since 2022-11-24
 */
@Mapper
@Repository
public interface FeipinYintieMapper extends BaseMapper<FeipinYintie>{
 
    @Select("select * from feipin_yintie a, head b where   a.head_id = b.id and head_id in (select id " +
            "from (select d.*," +
            "             row_number() over (partition by date(reportTime) order by reportTime desc) as seqnum " +
            "      from head d  where DATE_SUB(CURDATE(), INTERVAL 7 DAY) <= date(reportTime)" +
            "     ) d " +
            "where seqnum = 1)  order by reportTime ")
   // @Select("select * from feipin_yintie a, head b where a.head_id = b.id and head_id in (select id from head where week(reportTime) = week(now()))")
    List<FeipinYintie> queryWeek();
 
    @Select("select * from feipin_yintie a, head b where a.head_id = b.id and head_id in (select id from head where month(reportTime) = month(now()))")
    List<FeipinYintie> queryMonth();
 
    @Select("select * from feipin_yintie a, head b where a.head_id = b.id and head_id in (select id from head where month(reportTime) = #{n})")
    List<FeipinYintie> queryMonthN(int n);
}