jar
jinlin
2025-03-10 f0aae4b39afbcbb18fb5a0b32e3ca689662c5ca7
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
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
package com.example.server.teamGroup.service;
 
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.example.client.dto.JComboBoxItem;
import com.example.client.entity.MapData;
import com.example.client.service.BaseService;
import com.example.server.teamGroup.dao.SysTeamGroupClassDao;
import com.example.server.teamGroup.model.SysTeamGroupClass;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Service;
 
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.stream.Collectors;
 
/**
 * DJ_SYS_TEAMGROUP_CLASS
 *
 * @author zt generator
 * @since 1.0.0 2020-08-30
 */
@Service
public class SysTeamGroupClassService extends BaseService<SysTeamGroupClassDao, SysTeamGroupClass> {
 
 
    @Value("${zt.oss.local-area}")
    private String localArea;
 
    /**
     * 树形结构
     *
     * @return
     */
  /*  public List<SysTeamGroupClass> tree() {
        List<SysTeamGroupClass> list = new ArrayList<>();
        list.addAll(this.getWithDescendant(0L));
        return TreeUtils.build(list);
    }*/
 
    /**
     * 树形结构
     *
     * @return
     */
 /*   public List<SysTeamGroupClass> tree2(String area) {
        List<SysTeamGroupClass> list = new ArrayList<>();
        list.addAll(this.getWithDescendant2(0L,area));
        return TreeUtils.build(list);
    }*/
 
    /**
     * 树形结构
     * 依据dictType,model进行查询
     *
     * @return
     */
/*    public List<SysTeamGroupClass> treeByCriteria(Map<String, String> criteria) {
        List<SysTeamGroupClass> list = new ArrayList<>();
        list.addAll(this.getWithDescendantByCriteria(0L, criteria));
        return TreeUtils.build(list);
    }*/
 
    /**
     * 获取自己和下一级
     * 依据dictType,model进行查询
     *
     * @param id
     * @return
     */
/*
    public List<SysTeamGroupClass> getWithDescendantByCriteria(Long id, Map<String, String> criteria) {
        return TreeUtils.getWithDescendant(getAllByCriteria(criteria), id);
    }
*/
 
    /**
     * @return
     */
    public List<SysTeamGroupClass> getAllByCriteria(Map<String, String> criteria) {
        List<SysTeamGroupClass> all = baseDao.getAllByCriteria(criteria,localArea);
        return all.stream().map(teamGroupClass -> {
            try {
                return teamGroupClass.clone();
            } catch (CloneNotSupportedException e) {
                e.printStackTrace();
            }
            return null;
        }).collect(Collectors.toList());
    }
 
    /**
     * 获取自己和下一级
     *
     * @param id
     * @return
     */
  /*  public List<SysTeamGroupClass> getWithDescendant(Long id) {
        return TreeUtils.getWithDescendant(getAll(), id);
    }
*/
/*
    public List<SysTeamGroupClass> getWithDescendant2(Long id, String area) {
        return TreeUtils.getWithDescendant(getAll2(area), id);
    }
*/
 
    /**
     * @return
     */
 
 
    public List<SysTeamGroupClass> getAll() {
        List<SysTeamGroupClass> all = baseDao.getAll(localArea);
        return all.stream().map(teamGroupClass -> {
            try {
                return teamGroupClass.clone();
            } catch (CloneNotSupportedException e) {
                e.printStackTrace();
            }
            return null;
        }).collect(Collectors.toList());
    }
 
    public List<SysTeamGroupClass> getAll2(String area) {
        List<SysTeamGroupClass> all = baseDao.getAll(area);
        return all.stream().map(teamGroupClass -> {
            try {
                return teamGroupClass.clone();
            } catch (CloneNotSupportedException e) {
                e.printStackTrace();
            }
            return null;
        }).collect(Collectors.toList());
    }
 
    /**
     * 删除
     *
     * @param ids
     */
    public void delete(Long[] ids) {
        super.deleteLogic(ids);
    }
 
    /**
     * 通过ID查询班组信息
     *
     * @param stgcId
     * @return
     */
    public SysTeamGroupClass getBySysTeamGroupClassId(Long stgcId) {
        return baseDao.selectOne(new QueryWrapper<SysTeamGroupClass>().lambda().eq(SysTeamGroupClass::getId, stgcId));
    }
 
    /**
     * 通过班组名称查询班组id
     */
    public List<Long> getTeamGroupIdByNames(List<String> list, String area) {
        return baseDao.getTeamGroupIdByNames(list,area);
    }
 
 
    /**
     * 通过班组名称查询班组id
     */
    public List<Long> getTeamGroupIdByName(String name, String area) {
        return baseDao.getTeamGroupIdByName(name,area);
    }
 
    public Long getBzTeamGroupIdByName(String name, String area) {
        return baseDao.getBzTeamGroupIdByName(name,area);
    }
 
    public Map<String, String> getMapGroup(Boolean idToName, String area) {
        Map<String, String> result = new HashMap<>();
        List<MapData> list = baseDao.getMapAll(area);
        for (MapData item : list) {
            if (idToName)
                result.put(item.getId().toString(), item.getName());
            else
                result.put(item.getName(), item.getId().toString());
        }
        return result;
    }
 
    public List<SysTeamGroupClass> getTeamGroupClassList() {
        return baseDao.getTeamGroupClassList();
    }
 
    public JComboBoxItem[] getList() {
        return baseDao.getList();
    }
 
    public JComboBoxItem[] getTeamList(Long pid) {
        return baseDao.getTeamList(pid);
    }
 
    public JComboBoxItem[] getDeptList() {
        return baseDao.getDeptList();
    }
 
    public List<SysTeamGroupClass> getListByTree() {
        return baseDao.getListByTree();
    }
 
    public Integer getSortMax(Long pid) {
        return baseDao.getSortMax(pid);
    }
 
    public void save(SysTeamGroupClass data) {
        if (data.getId()!=null){
            this.update(data);
        }else{
            this.insert(data);
        }
    }
}