songhuangfeng123
2022-08-18 2b4afe24e1136e4eb25e37b7a76565603ddc1a85
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
package com.gkhy.safePlatform.equipment.repository;
 
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.gkhy.safePlatform.equipment.entity.EquipmentInfo;
import org.apache.ibatis.annotations.Select;
import org.springframework.stereotype.Repository;
 
/**
 * 设备设施详细信息(EquipmentInfo)表数据库访问层
 *
 * @author xurui
 * @since 2022-07-19 14:02:50
 */
@Repository
public interface EquipmentInfoRepository extends BaseMapper<EquipmentInfo> {
 
    @Select("<script> select count(1) from equipment_info m INNER JOIN \n" +
            "(select a.id,max(b.takecare_date) mdate from equipment_info a INNER JOIN equipment_takecare_detail b on a.id = b.equipment_id GROUP BY b.equipment_id) n \n" +
            "on m.id = n.id where DATEDIFF(NOW(),n.mdate) >m.takecare_cycle</script> ")
    Object countOverTime();
}