智慧农业后台管理
tangzy
2022-06-30 373513b5e5c32f935320625e35d18abace6c0720
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
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
package org.springblade.modules.farm.service.impl;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springblade.modules.farm.entity.FarmingRecord;
import org.springblade.modules.farm.mapper.FarmingRecordMapper;
import org.springblade.modules.farm.service.FarmingRecordService;
import org.springblade.modules.farm.vo.FarmingRecordVO;
import org.springblade.modules.system.entity.DictBiz;
import org.springblade.modules.system.service.IDictBizService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
 
import java.util.List;
 
/**
 * 农事记录服务实现类
 * @since 2022-05-13
 * @author zhongrj
 */
@Service
public class FarmRecordServiceImpl extends ServiceImpl<FarmingRecordMapper, FarmingRecord> implements FarmingRecordService {
 
    @Autowired
    private IDictBizService dictBizService;
 
    /**
     * 自定义分页
     * @param page
     * @param farm
     * @return
     */
    @Override
    public IPage<FarmingRecordVO> selectFarmingRecordPage(IPage<FarmingRecordVO> page, FarmingRecordVO farm) {
        List<FarmingRecordVO> recordVOS = baseMapper.selectFarmingRecordPage(page, farm);
        recordVOS.forEach(recordVO->{
            //查询字典对应的名称
            DictBiz dictBiz = new DictBiz();
            dictBiz.setTenantId(farm.getTenantId());
            dictBiz.setCode("farmingType");
            dictBiz.setDictKey(recordVO.getType());
            DictBiz one = dictBizService.getOne(new QueryWrapper<>(dictBiz));
            //设置名称
            recordVO.setTypeName(one.getDictValue());
        });
        return page.setRecords(recordVOS);
    }
 
    @Override
    public List<FarmingRecordVO> selectFarmingRecordPages(FarmingRecordVO farm) {
        List<FarmingRecordVO> farmingRecordVOS = baseMapper.selectFarmingRecordPages(farm);
        farmingRecordVOS.forEach(recordVO->{
            //查询字典对应的名称
            DictBiz dictBiz = new DictBiz();
            dictBiz.setTenantId(recordVO.getTenantId());
            dictBiz.setCode("farmingType");
            dictBiz.setDictKey(recordVO.getType());
            DictBiz one = dictBizService.getOne(new QueryWrapper<>(dictBiz));
            //设置名称
            recordVO.setTypeName(one.getDictValue());
        });
        return farmingRecordVOS;
    }
 
 
    /**
     * 查询统计本年农事记录操作总数
     * @return
     */
    @Override
    public Object getFarmingCount(String deptId) {
        return baseMapper.getFarmingCount(deptId);
    }
 
    /**
     * 查询统计本年农事记录操作,按分类统计
     * @return
     */
    @Override
    public Object getFarmingStatis(String deptId) {
        return baseMapper.getFarmingStatis(deptId);
    }
 
    @Override
    public Double selectJyCount(String deptId) {
        return baseMapper.selectJyCount(deptId);
    }
 
    @Override
    public Double selectQyCount(String deptId) {
        return baseMapper.selectQyCount(deptId);
    }
 
    @Override
    public Double selectByCount(String deptId) {
        return baseMapper.selectByCount(deptId);
    }
}