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
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
package com.dy.pipIrrTemp.delSome;
 
import com.dy.pipIrrGlobal.daoTmp.DeleteMapper;
import com.dy.pipIrrGlobal.voTmp.VoStIntakeAmountMonth;
import com.dy.pipIrrGlobal.voTmp.VoStIntakeAmountYear;
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 DelSomeIntakeAmountSv {
 
    private DeleteMapper dao;
 
    @Autowired
    private void setDao(DeleteMapper dao){
        this.dao = dao;
    }
 
    public void delStIntakeMonth(){
        VoStIntakeAmountMonth first = null ;
        List<VoStIntakeAmountMonth> list = dao.selectAllStIntakeMonth() ;
        if(list != null && list.size() > 0){
            for(VoStIntakeAmountMonth vo : list){
                if(first == null){
                    first = vo ;
                }else{
                    if(first.intakeId.longValue() != vo.intakeId.longValue()){
                        //取水口变了
                        first = vo ;
                    }else{
                        if(first.year.intValue() != vo.year.intValue()) {
                            //年度变了
                            first = vo ;
                        }else{
                            if(first.month.intValue() != vo.month.intValue()){
                                //月份变了
                                first = vo ;
                            }else{
                                //同一个取水口同年同月
                                doDelStIntakeMonth(vo.id) ;
                            }
                        }
                    }
                }
            }
        }
    }
 
 
    public void delStIntakeYear(){
        VoStIntakeAmountYear first = null ;
        List<VoStIntakeAmountYear> list = dao.selectAllStIntakeYear() ;
        if(list != null && list.size() > 0){
            for(VoStIntakeAmountYear vo : list){
                if(first == null){
                    first = vo ;
                }else{
                    if(first.intakeId.longValue() != vo.intakeId.longValue()){
                        //取水口变了
                        first = vo ;
                    }else{
                        if(first.year.intValue() != vo.year.intValue()) {
                            //年度变了
                            first = vo ;
                        }else{
                            //同一个取水口同年
                            doDelStIntakeYear(vo.id) ;
                        }
                    }
                }
            }
        }
    }
    @Transactional
    int doDelStIntakeMonth(Long id){
        return dao.deleteStIntakeMonthById(id) ;
    }
 
    @Transactional
    int doDelStIntakeYear(Long id){
        return dao.deleteStIntakeYearById(id) ;
    }
 
}