zhitong.yu
2024-10-11 4f58a93c95ff123d51adcb8fa2e521333e8ab022
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.TbZypLiftingMapper;
import com.hxzk.pojo.TbZypLifting;
import com.hxzk.service.TbZypLiftingService;
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 TbZypLiftingServiceImpl extends ServiceImpl<TbZypLiftingMapper, TbZypLifting> implements TbZypLiftingService {
    @Autowired
    TbZypLiftingMapper tbZypLiftingMapper;
 
    @Override
    public PageInfo<TbZypLifting> findAll(Integer page, Integer limit) {
        QueryWrapper queryWrapper = new QueryWrapper<>();
        PageHelper.startPage(page,limit);
        List<TbZypLifting> tbFireSafeties = baseMapper.selectList(queryWrapper);
        PageInfo<TbZypLifting> info = new PageInfo<>(tbFireSafeties);
        return info;
    }
 
    @Override
    public PageInfo<TbZypLifting> findSearch(Integer page, Integer limit,String applicant,String code) {
        List<TbZypLifting> cardList = null;
//        if (acHistoryPower.getAddtime() == null){
        LocalDate currentDate = LocalDate.now();
        DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyyMMdd");
        String formattedDate = currentDate.format(formatter);
//            acHistoryPower.setAddtime(formattedDate);
        QueryWrapper<TbZypLifting> queryWrapper = new QueryWrapper<>();
        queryWrapper.like("code", code)
                .like("applicant", applicant);
        cardList = tbZypLiftingMapper.selectList(queryWrapper);
//        }else{
//            cardList = acHistroyPowerDao.findSearch(acHistoryPower);
//        }
        PageInfo<TbZypLifting> info = new PageInfo<>(cardList);
        return info;
    }
    @Override
    public TbZypLifting findtagidZypLifting(Integer id) {
        QueryWrapper queryWrapper = new QueryWrapper<>();
        queryWrapper.eq("id",id);
        return baseMapper.selectOne(queryWrapper);
    }
 
    @Override
    public int addZypLifting(TbZypLifting tbZypLifting) {
        return getBaseMapper().insert(tbZypLifting);
    }
 
    @Override
    public void updateZypLifting(TbZypLifting tbZypLifting) {
        QueryWrapper queryWrapper = new QueryWrapper<>();
        queryWrapper.eq("id",tbZypLifting.getId());
        baseMapper.update(tbZypLifting,queryWrapper);
    }
 
    @Override
    public void deleteZypLifting(Integer id) {
        QueryWrapper queryWrapper = new QueryWrapper<>();
        queryWrapper.eq("id",id);
        baseMapper.delete(queryWrapper);
    }
}