package org.jeecg.modules.arj.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.jeecg.modules.arj.entity.FeipinZhijian;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;
import org.springframework.stereotype.Repository;
import java.util.List;
/**
*
* 废品质检 前端控制器
*
*
* @author hyy
* @since 2022-12-02
*/
@Mapper
@Repository
public interface FeipinZhijianMapper extends BaseMapper{
@Select("select * from feipin_zhijian 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_zhijian a, head b where a.head_id = b.id and head_id in (select id from head where week(reportTime) = week(now()))")
List queryWeek();
@Select("select * from feipin_zhijian a, head b where a.head_id = b.id and head_id in (select id from head where month(reportTime) = month(now()))")
List queryMonth();
@Select("select * from feipin_zhijian a, head b where a.head_id = b.id and head_id in (select id from head where month(reportTime) = #{n})")
List queryMonthN(int n);
}