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
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
package com.fgkj.services;
 
import com.fgkj.dto.Batt_maint_process;
import com.fgkj.dto.ServiceModel;
import com.fgkj.mapper.impl.Batt_maint_processMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
 
import java.util.List;
 
@Service
public class Batt_maint_processService {
 
    private ServiceModel model;
 
    @Autowired
    private Batt_maint_processMapper mapper;;
    
    public ServiceModel add(Object obj) {
        Boolean bl=mapper.add(obj);
        if(bl){
            model.setCode(1);
            model.setMsg("添加成功!");
        }
        else{
            model.setMsg("添加失败!");
        }
        return model;
        
    }
    public ServiceModel update(Object obj) {
        Boolean bl=mapper.update(obj);
        if(bl){
            model.setCode(1);
            model.setMsg("修改成功!");
        }
        else{
            model.setMsg("修改失败!");
        }
        return model;    
    }
    public ServiceModel delete(Object obj) {
        Boolean bl=mapper.del(obj);
        if(bl){
            model.setCode(1);
            model.setMsg("删除成功!");
        }
        else{
            model.setMsg("删除失败!");
        }
        return model;    
    }
    
    //3.1根据usr_id查所有的信息
    public ServiceModel serchByCondition(Object obj) {
        model=new ServiceModel();
        List<Batt_maint_process> list = mapper.serchByCondition(obj);
        /*for (Batt_maint_process u : list) {
            System.out.println(u);
        }*/
        if (list != null && list.size() > 0) {
            model.setCode(1);
            model.setData(list);
        }else{
            model.setMsg("查询失败!");
        }
        return model;
    }
    public ServiceModel searchAll() {
        List<Batt_maint_process> list = mapper.searchAll();
//        for (Batt_maint_process u : list) {
//            System.out.println(u);
//        }
//        System.out.println(list.size());
        if (list != null && list.size() > 0) {
            model.setCode(1);
            model.setData(list);
        }
        return model;
    }
 
    /*public static void main(String[] args) {
        Batt_maint_processService us = new Batt_maint_processService();
        us.searchAll();
    }*/
 
}