RoleServiceImpl.java
1.4 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
package vion.service.impl;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import io.github.linpeilie.Converter;
import lombok.RequiredArgsConstructor;
import org.springframework.stereotype.Service;
import vion.dto.RoleDTO;
import vion.mapper.RoleMapper;
import vion.model.RUserRole;
import vion.model.Role;
import vion.model.User;
import vion.service.IRUserRoleService;
import vion.service.IRoleService;
import vion.service.IUserService;
import vion.vo.RoleVO;
import vion.vo.UserVO;
import java.util.List;
import java.util.stream.Collectors;
/**
* @author HlQ
* @date 2023/11/28
*/
@Service
@RequiredArgsConstructor
public class RoleServiceImpl extends ServiceImpl<RoleMapper, Role> implements IRoleService {
private final Converter converter;
@Override
public Page<RoleVO> list(RoleDTO dto) {
Page<Role> rolePage = this
.lambdaQuery(converter.convert(dto, new Role()))
.between(dto.getStartDate() != null && dto.getEndDate() != null, Role::getCreateTime, dto.getStartDate(), dto.getEndDate())
.page(Page.of(dto.getPageNum(), dto.getPageSize()));
List<RoleVO> roleVOList = converter.convert(rolePage.getRecords(), RoleVO.class);
return Page.<RoleVO>of(rolePage.getCurrent(), rolePage.getSize(), rolePage.getTotal()).setRecords(roleVOList);
}
}