提交 | 用户 | 时间
|
1ac2bc
|
1 |
package cn.stylefeng.guns.excel.service.impl; |
懒 |
2 |
|
|
3 |
import cn.stylefeng.guns.base.pojo.page.LayuiPageFactory; |
|
4 |
import cn.stylefeng.guns.base.pojo.page.LayuiPageInfo; |
|
5 |
import cn.stylefeng.guns.excel.entity.ExcelExportDeploy; |
|
6 |
import cn.stylefeng.guns.excel.mapper.ExcelExportDeployMapper; |
|
7 |
import cn.stylefeng.guns.excel.model.params.ExcelExportDeployParam; |
|
8 |
import cn.stylefeng.guns.excel.model.result.ExcelExportDeployResult; |
|
9 |
import cn.stylefeng.guns.excel.service.ExcelExportDeployService; |
|
10 |
import cn.stylefeng.roses.core.util.ToolUtil; |
|
11 |
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
|
12 |
import com.baomidou.mybatisplus.core.metadata.IPage; |
|
13 |
import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
|
14 |
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
|
15 |
import org.springframework.stereotype.Service; |
|
16 |
|
|
17 |
import java.io.Serializable; |
|
18 |
import java.util.List; |
|
19 |
|
|
20 |
/** |
|
21 |
* <p> |
|
22 |
* excel导出配置 服务实现类 |
|
23 |
* </p> |
|
24 |
* |
|
25 |
* @author York |
|
26 |
* @since 2019-11-26 |
|
27 |
*/ |
|
28 |
@Service |
|
29 |
public class ExcelExportDeployServiceImpl extends ServiceImpl<ExcelExportDeployMapper, ExcelExportDeploy> implements ExcelExportDeployService { |
|
30 |
@Override |
|
31 |
public void add(ExcelExportDeployParam param) { |
|
32 |
ExcelExportDeploy entity = getEntity(param); |
|
33 |
this.save(entity); |
|
34 |
} |
|
35 |
|
|
36 |
@Override |
|
37 |
public void delete(ExcelExportDeployParam param) { |
|
38 |
this.removeById(getKey(param)); |
|
39 |
} |
|
40 |
|
|
41 |
@Override |
|
42 |
public void update(ExcelExportDeployParam param) { |
|
43 |
ExcelExportDeploy oldEntity = getOldEntity(param); |
|
44 |
ExcelExportDeploy newEntity = getEntity(param); |
|
45 |
ToolUtil.copyProperties(newEntity, oldEntity); |
|
46 |
this.updateById(newEntity); |
|
47 |
} |
|
48 |
|
|
49 |
@Override |
|
50 |
public ExcelExportDeploy findBySpec(ExcelExportDeploy param) { |
|
51 |
QueryWrapper<ExcelExportDeploy> queryWrapper = new QueryWrapper<>(); |
|
52 |
queryWrapper.setEntity(param); |
|
53 |
return baseMapper.selectOne(queryWrapper); |
|
54 |
} |
|
55 |
|
|
56 |
@Override |
|
57 |
public List<ExcelExportDeployResult> findListBySpec(ExcelExportDeployParam param) { |
|
58 |
return null; |
|
59 |
} |
|
60 |
|
|
61 |
@Override |
|
62 |
public LayuiPageInfo findPageBySpec(ExcelExportDeployParam param) { |
|
63 |
Page<ExcelExportDeployResult> pageContext = getPageContext(); |
|
64 |
IPage<ExcelExportDeployResult> page = this.baseMapper.customPageList(pageContext, param); |
|
65 |
return LayuiPageFactory.createPageInfo(page); |
|
66 |
} |
|
67 |
|
|
68 |
private Serializable getKey(ExcelExportDeployParam param) { |
|
69 |
return param.getId(); |
|
70 |
} |
|
71 |
|
|
72 |
private Page<ExcelExportDeployResult> getPageContext() { |
|
73 |
return LayuiPageFactory.defaultPage(); |
|
74 |
} |
|
75 |
|
|
76 |
private ExcelExportDeploy getOldEntity(ExcelExportDeployParam param) { |
|
77 |
return this.getById(getKey(param)); |
|
78 |
} |
|
79 |
|
|
80 |
private ExcelExportDeploy getEntity(ExcelExportDeployParam param) { |
|
81 |
ExcelExportDeploy entity = new ExcelExportDeploy(); |
|
82 |
ToolUtil.copyProperties(param, entity); |
|
83 |
return entity; |
|
84 |
} |
|
85 |
} |