CompanyMemberMappingServiceImpl.java
3.41 KB
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
package com.subsidy.service.impl;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.subsidy.dto.company.AttendMembersDTO;
import com.subsidy.dto.member.CancerMemberDTO;
import com.subsidy.dto.member.DepartMembersDTO;
import com.subsidy.mapper.MemberDepartmentMappingMapper;
import com.subsidy.model.CompanyMemberMappingDO;
import com.subsidy.mapper.CompanyMemberMappingMapper;
import com.subsidy.service.CompanyMemberMappingService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.subsidy.util.ConstantUtils;
import com.subsidy.util.excel.ExcelUtil;
import com.subsidy.vo.member.AttendMembersVO;
import com.subsidy.vo.member.DepartMembersVO;
import com.subsidy.vo.member.MemberAttendInfoVO;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.List;
/**
* <p>
* 公司人员映射表 服务实现类
* </p>
*
* @author Tuyp
* @since 2024-01-11
*/
@Service
public class CompanyMemberMappingServiceImpl extends ServiceImpl<CompanyMemberMappingMapper, CompanyMemberMappingDO> implements CompanyMemberMappingService {
@Autowired
private MemberDepartmentMappingMapper memberDepartmentMappingMapper;
public String cancerMember(CancerMemberDTO cancerMemberDTO) {
List<Long> members = cancerMemberDTO.getMemberIds();
for (Long memberId : members) {
CompanyMemberMappingDO companyMemberMappingDO1 = this.baseMapper.selectOne(new QueryWrapper<CompanyMemberMappingDO>()
.lambda()
.eq(CompanyMemberMappingDO::getCompanyId, cancerMemberDTO.getCompanyId())
.eq(CompanyMemberMappingDO::getMemberId, memberId)
.eq(CompanyMemberMappingDO::getMemberStatus, 1));
companyMemberMappingDO1.setMemberStatus(0);
this.baseMapper.updateById(companyMemberMappingDO1);
memberDepartmentMappingMapper.cancelMember(memberId);
}
return ConstantUtils.DELETE_SUCCESS;
}
public IPage<DepartMembersVO> departMembers(DepartMembersDTO departMembersDTO) {
Page pager = new Page(departMembersDTO.getPageNum(), departMembersDTO.getPageSize());
return this.baseMapper.departMembers(pager, departMembersDTO.getCompanyId(), departMembersDTO.getUserName());
}
public void exportDepartMembers(DepartMembersDTO departMembersDTO) {
Page pager = new Page(1, -1);
IPage<DepartMembersVO> departMembersVOIPage = this.baseMapper.departMembers(pager, departMembersDTO.getCompanyId(), departMembersDTO.getUserName());
List<DepartMembersVO> departMembersVOS = departMembersVOIPage.getRecords();
ExcelUtil.writeExcel(departMembersVOS, DepartMembersVO.class);
}
public IPage<AttendMembersVO> attendMembers(AttendMembersDTO attendMembersDTO) {
Page pager = new Page(attendMembersDTO.getPageNum(), attendMembersDTO.getPageSize());
return this.baseMapper.attendMembers(pager, attendMembersDTO.getCompanyId(), attendMembersDTO.getDepartmentId(), attendMembersDTO.getUserName());
}
public List<MemberAttendInfoVO> memberAttendInfo(CompanyMemberMappingDO companyMemberMappingDO) {
return this.baseMapper.memberAttendInfo(companyMemberMappingDO.getMemberId(),companyMemberMappingDO.getCompanyId());
}
}