邱宇豪
2023-09-27 76b5e34bccb723c3d414b3d981ed8b00b79411d8
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
package com.thhy.secure.modules.biz.regionHazardInform.service.impl;
 
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import com.thhy.general.common.BasicResult;
import com.thhy.general.config.SysUserInfo;
import com.thhy.general.utils.UUIDUtils;
import com.thhy.general.utils.UserInfoUtils;
import com.thhy.secure.modules.biz.regionHazardInform.dto.TRegionHazardInformDto;
import com.thhy.secure.modules.biz.regionHazardInform.entity.RegionHazardInformEntity;
import com.thhy.secure.modules.biz.regionHazardInform.entity.TRegionHazardInformEntity;
import com.thhy.secure.modules.biz.regionHazardInform.mapper.RegionHazardInformMapper;
import com.thhy.secure.modules.biz.regionHazardInform.service.TRegionHazardInformService;
import org.springframework.stereotype.Service;
 
import javax.annotation.Resource;
import java.util.List;
 
/**
 * @Author QiuYuHao
 * @CreateDate 2023-09-26 13:44:04
 * 危险告知源逻辑实现
 */
@Service
public class TRegionHazardInformServiceImpl implements TRegionHazardInformService {
 
    @Resource
    private RegionHazardInformMapper tRegionHazardInformMapper;
 
    @Override
    public BasicResult findAll(TRegionHazardInformDto tRegionHazardInformDto) {
        SysUserInfo userInfo = UserInfoUtils.getInstance().getUserInfo();
        tRegionHazardInformDto.setCompanyId(userInfo.getCompanyId());
        PageHelper.startPage(tRegionHazardInformDto.getPageNum(), tRegionHazardInformDto.getPageSize());
        List<RegionHazardInformEntity> all = this.tRegionHazardInformMapper.findAllRegionHazardInform(tRegionHazardInformDto);
        PageInfo<RegionHazardInformEntity> pageInfo = new PageInfo<>(all);
        return BasicResult.success(pageInfo);
    }
 
    @Override
    public BasicResult findEntity(String id) {
        RegionHazardInformEntity entity = this.tRegionHazardInformMapper.findEntity(id);
        return BasicResult.success(entity);
    }
 
    @Override
    public BasicResult insert(RegionHazardInformEntity tRegionHazardInformEntity) {
        SysUserInfo userInfo = UserInfoUtils.getInstance().getUserInfo();
        tRegionHazardInformEntity.setCompanyId(userInfo.getCompanyId());
        tRegionHazardInformEntity.setCreateUser(userInfo.getRealName());
        tRegionHazardInformEntity.setId(UUIDUtils.create());
        tRegionHazardInformMapper.insertTRegionHazardInform(tRegionHazardInformEntity);
        return BasicResult.success();
    }
 
    @Override
    public BasicResult update(RegionHazardInformEntity tRegionHazardInformEntity) {
        this.tRegionHazardInformMapper.update(tRegionHazardInformEntity);
        return BasicResult.success();
    }
 
    @Override
    public BasicResult delete(String id) {
        this.tRegionHazardInformMapper.delete(id);
        return BasicResult.success();
    }
}