张晓波
2023-09-19 164694c47c35d6654df69b533e8dbf8b5423efc5
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
package com.thhy.engineering.modules.biz.restdata.service.impl;
 
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import com.thhy.engineering.modules.biz.restdata.dto.TRestDataDto;
import com.thhy.engineering.modules.biz.restdata.entity.TRestDataVo;
import com.thhy.engineering.modules.biz.restdata.mapper.TRestDataMapper;
import com.thhy.engineering.modules.biz.restdata.service.TRestDataService;
import com.thhy.general.common.BasicResult;
import com.thhy.general.config.SysUserInfo;
import com.thhy.general.utils.ExcelUtils;
import com.thhy.general.utils.UserInfoUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
 
import javax.servlet.http.HttpServletResponse;
import java.util.List;
 
/**
 * @Author QiuYuHao
 * @CreateDate 2023-09-15 14:59:05
 * 静养区接口实现
 */
@Service
public class TRestDataServiceImpl implements TRestDataService {
 
 
    @Autowired
    private TRestDataMapper tRestDataMapper;
 
    /**
     * 查询静养区所有
     * @param tRestDataDto
     * @return
     */
    @Override
    public BasicResult findAll(TRestDataDto tRestDataDto) {
        SysUserInfo sysUserInfo = UserInfoUtils.getInstance().getUserInfo();
        String companyId = sysUserInfo.getCompanyId();
        tRestDataDto.setCompanyId(companyId);
        PageHelper.startPage(tRestDataDto.getPageNum(),tRestDataDto.getPageSize());
        List<TRestDataVo> all = this.tRestDataMapper.findAll(tRestDataDto);
        PageInfo<TRestDataVo> pageInfo = new PageInfo<>(all);
        return BasicResult.success(pageInfo);
    }
 
    @Override
    public void export(TRestDataDto tRestDataDto, HttpServletResponse rsp) {
        SysUserInfo sysUserInfo = UserInfoUtils.getInstance().getUserInfo();
        String companyId = sysUserInfo.getCompanyId();
        tRestDataDto.setCompanyId(companyId);
        List<TRestDataVo> all = this.tRestDataMapper.findAll(tRestDataDto);
        ExcelUtils.downExcel(all,TRestDataVo.class,rsp,"静养区记录");
    }
}