zhitong.yu
2024-10-11 eb7075c41933b7d8043a66912631076eed13ae08
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
package com.hxzk.service.impl;
 
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import com.hxzk.mapper.TbZypBlindMapper;
import com.hxzk.pojo.TbZypBlind;
import com.hxzk.service.TbZypBlindService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
 
import java.time.LocalDate;
import java.time.format.DateTimeFormatter;
import java.util.List;
 
/**
 * <p>
 * 航锦化工盲板抽堵安全作业证 服务实现类
 * </p>
 *
 * @author wangfei
 * @since 2024-04-23
 */
@Service
public class TbZypBlindServiceImpl extends ServiceImpl<TbZypBlindMapper, TbZypBlind> implements TbZypBlindService {
    @Autowired
    TbZypBlindMapper tbZypBlindMapper;
 
    @Override
    public PageInfo<TbZypBlind> findAll(Integer page, Integer limit) {
        QueryWrapper queryWrapper = new QueryWrapper<>();
        PageHelper.startPage(page,limit);
        List<TbZypBlind> tbFireSafeties = baseMapper.selectList(queryWrapper);
        PageInfo<TbZypBlind> info = new PageInfo<>(tbFireSafeties);
        return info;
    }
 
    @Override
    public PageInfo<TbZypBlind> findSearch(Integer page, Integer limit,String applicant,String code) {
        List<TbZypBlind> cardList = null;
//        if (acHistoryPower.getAddtime() == null){
        LocalDate currentDate = LocalDate.now();
        DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyyMMdd");
        String formattedDate = currentDate.format(formatter);
//            acHistoryPower.setAddtime(formattedDate);
        QueryWrapper<TbZypBlind> queryWrapper = new QueryWrapper<>();
        queryWrapper.like("code", code)
                .like("applicant", applicant);
        cardList = tbZypBlindMapper.selectList(queryWrapper);
//        }else{
//            cardList = acHistroyPowerDao.findSearch(acHistoryPower);
//        }
        PageInfo<TbZypBlind> info = new PageInfo<>(cardList);
        return info;
    }
    @Override
    public TbZypBlind findtagidZypBlind(Integer id) {
        QueryWrapper queryWrapper = new QueryWrapper<>();
        queryWrapper.eq("id",id);
        return baseMapper.selectOne(queryWrapper);
    }
 
    @Override
    public int addZypBlind(TbZypBlind tbZypBlind) {
        return getBaseMapper().insert(tbZypBlind);
    }
 
    @Override
    public void updateZypBlind(TbZypBlind tbZypBlind) {
        QueryWrapper queryWrapper = new QueryWrapper<>();
        queryWrapper.eq("id",tbZypBlind.getId());
        baseMapper.update(tbZypBlind,queryWrapper);
    }
 
    @Override
    public void deleteZypBlind(Integer id) {
        QueryWrapper queryWrapper = new QueryWrapper<>();
        queryWrapper.eq("id",id);
        baseMapper.delete(queryWrapper);
    }
}