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
package com.yiboshi.science.service.impl;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.yiboshi.science.base.BaseServiceImpl;
import com.yiboshi.science.dao.ComProjectMembersDAO;
import com.yiboshi.science.entity.ComProjectMembers;
import com.yiboshi.science.param.dto.ComProjectMembersDTO;
import com.yiboshi.science.param.query.ComProjectMembersQueryVO;
import com.yiboshi.science.service.ComProjectMembersService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.ArrayList;
import java.util.List;
import java.util.Objects;
/**
* 项目组成员表 Service 实现类
*
* @author lkl
* @version 2021-08-26
*/
@Service
public class ComProjectMembersServiceImpl extends BaseServiceImpl<ComProjectMembersDAO, ComProjectMembersQueryVO, ComProjectMembersDTO, ComProjectMembers> implements ComProjectMembersService {
@Autowired
private ComProjectMembersDAO comProjectMembersDAO;
@Override
protected void setCriteriaForQuery(ComProjectMembersQueryVO vo, QueryWrapper<ComProjectMembersQueryVO> criteria) {
if (Objects.nonNull(vo.getObjectId())) {
criteria.eq("object_id", vo.getObjectId());
}
if (Objects.nonNull(vo.getName())) {
criteria.eq("name", vo.getName());
}
if (Objects.nonNull(vo.getBirthday())) {
criteria.eq("birthday", vo.getBirthday());
}
if (Objects.nonNull(vo.getDegree())) {
criteria.eq("degree", vo.getDegree());
}
if (Objects.nonNull(vo.getTitle())) {
criteria.eq("title", vo.getTitle());
}
if (Objects.nonNull(vo.getResearchDirection())) {
criteria.eq("research_direction", vo.getResearchDirection());
}
if (Objects.nonNull(vo.getWorkUnit())) {
criteria.eq("work_unit", vo.getWorkUnit());
}
if (Objects.nonNull(vo.getProjWork())) {
criteria.eq("proj_work", vo.getProjWork());
}
if (Objects.nonNull(vo.getForMonths())) {
criteria.eq("for_months", vo.getForMonths());
}
if (Objects.nonNull(vo.getShowIndex())) {
criteria.eq("show_index", vo.getShowIndex());
}
if (Objects.nonNull(vo.getRole())) {
criteria.eq("role", vo.getRole());
}
}
@Override
public List<ComProjectMembersDTO> getListByObjectId(String objectId) {
List<ComProjectMembersDTO> list = comProjectMembersDAO.getListByObjectId(objectId);
// if (null != list && list.size() > 0)
// list.forEach((e) -> {
// e.setCertId(hideAllIdCardNum(e.getCertId()));
// });
return list;
}
@Override
public void insertList(List<ComProjectMembersDTO> list, String objectId) {
ComProjectMembers model = new ComProjectMembers();
model.setObjectId(objectId);
this.delete(model);
// if (!isObjectNull(membersList.get(i)))
if (null != list) {
List<ComProjectMembers> iList = new ArrayList<>();
for (int i = 0; i < list.size(); i++) {
ComProjectMembers item = convert2Entity(list.get(i));
item.setFileId(list.get(i).getDownloadId());
if (i == 0)
item.setRole(1);
else
item.setRole(2);
item.setShowIndex(i + 1);
item.setObjectId(objectId);
iList.add(item);
}
this.insertBatch(iList);
}
}
@Override
public void deleteByObjectId(String objectId) {
ComProjectMembers e = new ComProjectMembers();
e.setObjectId(objectId);
this.delete(e);
}
@Override
public ComProjectMembersDTO getMemCountById(String objectId) {
ComProjectMembersDTO member = comProjectMembersDAO.getMemCountById(objectId);
member.setWorkCount(comProjectMembersDAO.getMemWorkCountByObjectId(objectId));
return member;
}
}