DgArchivesDestructionServiceImpl.java
3.17 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
79
80
81
82
83
84
85
86
87
package com.pashanhoo.destroy.service.impl;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.pashanhoo.destroy.entity.*;
import com.pashanhoo.destroy.entity.vo.AddDgArchivesDestructionRequest;
import com.pashanhoo.destroy.entity.vo.DgArchivesDestructionDetailVO;
import com.pashanhoo.destroy.entity.vo.DgArchivesDestructionSearchRequest;
import com.pashanhoo.destroy.entity.vo.UpdateDgArchivesDestructionRequest;
import com.pashanhoo.destroy.mapper.DgArchivesDestructionMapper;
import com.pashanhoo.destroy.service.DgArchivesDestructionService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
/**
* <p>
* 档案销毁 服务实现类
* </p>
*
* @author
* @since 2021-11-05
*/
@Service
public class DgArchivesDestructionServiceImpl extends ServiceImpl<DgArchivesDestructionMapper, DgArchivesDestructionDO> implements DgArchivesDestructionService {
@Autowired
private DgArchivesDestructionConverter dgarchivesdestructionConverter;
@Autowired
private DgArchivesDestructionMapper dgarchivesdestructionMapper;
/**
* 新增记录
* @param request
* @return
*/
@Override
public boolean insertDgArchivesDestruction(AddDgArchivesDestructionRequest request) {
DgArchivesDestructionDO dgarchivesdestructionDO = dgarchivesdestructionConverter.addRequest2DO(request);
return this.save(dgarchivesdestructionDO);
}
/**
* 根据主键查询记录详情
* @param id
* @return
*/
@Override
public DgArchivesDestructionDetailVO getDgArchivesDestructionDetailById(String id) {
DgArchivesDestructionDO dgarchivesdestructionDO = this.getById(id);
return dgarchivesdestructionConverter.do2DetailVO(dgarchivesdestructionDO);
}
/**
* 修改单条记录
* @param request
* @return
*/
@Override
public boolean updateDgArchivesDestruction(UpdateDgArchivesDestructionRequest request) {
DgArchivesDestructionDO dgarchivesdestructionDO = dgarchivesdestructionConverter.updateRequest2DO(request);
return this.updateById(dgarchivesdestructionDO);
}
/**
* 根据条件进行列表查询
* @param request
* @return
*/
@Override
public Page searchDgArchivesDestructionList(DgArchivesDestructionSearchRequest request) {
Page<DgArchivesDestructionDO> pageParam = new Page<DgArchivesDestructionDO>(request.getCurrentPage(), request.getPageSize());
QueryWrapper<DgArchivesDestructionDO> wrapper = new QueryWrapper<>();
//设置默认排序
wrapper = "desc".equals(request.getSortOrder()) ? wrapper.orderByDesc(request.getSortField()) : wrapper.orderByAsc(request.getSortField());
//TODO 根据当前情况设置wrapper条件
Page page = this.page(pageParam, wrapper);
//将查询出来的DO List转为 ListVO List并重新设置到page对象中,并返回page对象
return page.setRecords(dgarchivesdestructionConverter.doList2ListVOList(page.getRecords()));
}
}