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
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
package com.dy.pipIrrTemp.delSome;
 
import com.dy.pipIrrGlobal.daoBa.AreaCode2023Mapper;
import com.dy.pipIrrGlobal.daoBa.BaDistrictMapper;
import com.dy.pipIrrGlobal.daoTmp.DeleteMapper;
import com.dy.pipIrrGlobal.voTmp.VoStLossMonth;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
 
import java.util.List;
 
/**
 * @Author: liurunyu
 * @Date: 2024/12/11 10:54
 * @Description
 */
 
@Slf4j
@Service
public class DelSomeSv {
 
    private DeleteMapper dao;
 
    @Autowired
    private void setDao(DeleteMapper dao){
        this.dao = dao;
    }
 
    public void delStLossMonth(){
        VoStLossMonth first = null ;
        List<VoStLossMonth> list = dao.selectAllStLossMonth() ;
        if(list != null && list.size() > 0){
            for(VoStLossMonth vo : list){
                if(first == null){
                    first = vo ;
                }else{
                    if(first.intakeId != vo.intakeId){
                        //取水口变了
                        first = vo ;
                    }else{
                        if(first.year != vo.year) {
                            //年度变了
                            first = vo ;
                        }else{
                            if(first.month != vo.month){
                                //月份变了
                                first = vo ;
                            }else{
                                //同一个取水口同年同月
                                doDelStLossMonth(vo.id) ;
                            }
                        }
                    }
                }
            }
        }
    }
 
    @Transactional
    int doDelStLossMonth(Long id){
        return dao.deleteByMainKey(id) ;
    }
}