whycrzg
2021-02-23 351b9a53cb9ecebdf8f79db0117f540d9c42c2a4
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
96
97
98
99
100
101
package com.fgkj.services;
 
import com.fgkj.dto.ServiceModel;
import com.fgkj.dto.User_jiejiari;
import com.fgkj.mapper.impl.User_jiejiariMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
 
import java.util.List;
 
import javax.annotation.Resource;
@Service
public class User_jiejiariService {
 
    @Resource
    private User_jiejiariMapper mapper;;
 
    //4.3节假日管理(增加)
    public ServiceModel add(User_jiejiari obj) {
        ServiceModel model = new ServiceModel();
        Boolean bl = null;
        try {
            bl = mapper.add(obj) > 0;
        } catch (Exception e) {
            e.printStackTrace();
            model.setMsg("添加失败!");
            return model;
        }
        if (bl) {
            model.setCode(1);
            model.setMsg("添加成功!");
        } else {
            model.setMsg("添加失败!");
        }
        return model;
 
    }
    //4.3节假日管理(修改)
    public ServiceModel update(User_jiejiari obj) {
        ServiceModel model = new ServiceModel();
        Boolean bl = null;
        try {
            bl = mapper.update(obj) > 0;
        } catch (Exception e) {
            e.printStackTrace();
            model.setMsg("修改失败!");
            return model;
        }
        if (bl) {
            model.setCode(1);
            model.setMsg("修改成功!");
        } else {
            model.setMsg("修改失败!");
        }
        return model;
    }
    //4.3节假日管理(删除)
    public ServiceModel delete(User_jiejiari obj) {
        ServiceModel model = new ServiceModel();
        Boolean bl=mapper.del(obj)>0;
        if(bl){
            model.setCode(1);
            model.setMsg("删除成功!");
        }
        else{
            model.setMsg("删除失败!");
            }
        return model;    
    }
    
    //查询所有的节假日
    public ServiceModel serchAll() {
        ServiceModel model = new ServiceModel();
        List<User_jiejiari> list = mapper.searchAll();
        
        if (list != null && list.size() > 0) {
            model.setCode(1);
            model.setData(list);
        }
        return model;
    }
    
    //4.3根据节假日类型查询
    /*0:公历
     *1:农历
     *100:全部*/
    public ServiceModel serchByCondition(User_jiejiari obj){
        ServiceModel model = new ServiceModel();
        List list=mapper.serchByCondition(obj);
//        for (Object object : list) {
//            System.out.println(object);
//        }        
        if(list!=null && list.size()>0){
            model.setCode(1);
            model.setData(list);
        }
        //System.out.println(model);        
        return model;
    }
 
}