perryhsu
2020-10-17 a543f4de1c91ef6f43aace92975c6cf28de23618
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
package com.fgkj.services;
 
import com.fgkj.dto.Batt_maintenance_inf;
import com.fgkj.dto.ServiceModel;
import com.fgkj.mapper.impl.Batt_maintenance_infMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
 
import java.util.ArrayList;
import java.util.List;
 
@Service
public class Batt_maintenance_infService {
 
    private ServiceModel model;
 
    @Autowired
    private Batt_maintenance_infMapper mapper;;
    
    public ServiceModel searchAll(){
        List list =mapper.searchAll();
        if(list!=null && list.size()>0){
            model.setCode(1);
            model.setData(list);
        }
        return model;
    }
    
    public ServiceModel serchByCondition(Object obj) {
        List<Batt_maintenance_inf> list = mapper.serchByCondition(obj);
        List<Batt_maintenance_inf> l=new ArrayList<Batt_maintenance_inf>();
        model=new ServiceModel();
        if (list != null && list.size()>0) {
            model.setCode(1);
            l.add(list.get(list.size()-1));
            model.setData(l);
            //TODO perry
            // model.setSum(list.size());
        }else{
            model.setCode(0);
            model.setData(l);
            //TODO perry
            // model.setSum(0);
        }
        //System.out.println(model);
        return model;
    }
}