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
package com.tanpu.feo.feojob.service;
import java.util.ArrayList;
import java.util.List;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.tanpu.feo.feojob.constant.BaseConstant;
import com.tanpu.feo.feojob.dto.DepartmentEmployeeDTO;
import com.tanpu.feo.feojob.dao.user.entity.DepartmentEmployeeEntity;
import com.tanpu.feo.feojob.dao.user.mapper.DepartmentEmployeeMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import lombok.extern.slf4j.Slf4j;
import cn.hutool.core.bean.BeanUtil;
/**
* 部门员工关系表ServiceImp
*
* @author zejia zj wu 2021年05月18日
* @version 1.0
*/
@Service("departmentEmployeeService")
@Slf4j
public class DepartmentEmployeeService extends ServiceImpl<DepartmentEmployeeMapper, DepartmentEmployeeEntity> {
@Autowired
private DepartmentEmployeeMapper departmentEmployeeMapper;
public DepartmentEmployeeDTO selectById(String id) {
DepartmentEmployeeEntity departmentEmployee = departmentEmployeeMapper.selectById(id);
return BeanUtil.toBean(departmentEmployee, DepartmentEmployeeDTO.class);
}
public List<DepartmentEmployeeDTO> selectListByObject(DepartmentEmployeeDTO departmentEmployeeDTO) {
DepartmentEmployeeEntity departmentEmployee = BeanUtil.toBean(departmentEmployeeDTO, DepartmentEmployeeEntity.class);
QueryWrapper queryWrapper = new QueryWrapper<>(departmentEmployee);
List<DepartmentEmployeeEntity> departmentEmployeeList = departmentEmployeeMapper.selectList(queryWrapper);
List<DepartmentEmployeeDTO> departmentEmployeeDtoList = new ArrayList<>();
departmentEmployeeList.forEach(departmentEmployeeEntity -> {
departmentEmployeeDtoList.add(BeanUtil.toBean(departmentEmployeeEntity, DepartmentEmployeeDTO.class));
});
return departmentEmployeeDtoList;
}
public List<DepartmentEmployeeEntity> findInfoByOrgId(String orgId) {
return departmentEmployeeMapper.selectList(Wrappers.lambdaQuery(DepartmentEmployeeEntity.class)
.eq(DepartmentEmployeeEntity::getOrgId, orgId)
.eq(DepartmentEmployeeEntity::getDeleteTag, BaseConstant.DeleteTagStr.NOT_DELETED));
}
public List<DepartmentEmployeeEntity> findInfoByOrgIdAll(String orgId) {
return departmentEmployeeMapper.selectList(Wrappers.lambdaQuery(DepartmentEmployeeEntity.class)
.eq(DepartmentEmployeeEntity::getOrgId, orgId));
}
}