智慧农业后台管理
guoshilong
2022-11-08 72b971c98c46531064d74b68fc8fe8864ed0b544
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
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
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.recovery.vo.RecoveryVO;
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 IPage<FarmingRecordVO> selectFarmingRecordPageByNz(IPage<FarmingRecordVO> page, FarmingRecordVO farm) {
        List<FarmingRecordVO> recordVOS = baseMapper.selectFarmingRecordPageByNz(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 farmId) {
        return baseMapper.getFarmingCount(farmId);
    }
 
    /**
     * 查询统计本年农事记录操作,按分类统计
     * @return
     */
    @Override
    public Object getFarmingStatis(String farmId) {
        return baseMapper.getFarmingStatis(farmId);
    }
 
    @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);
    }
 
    /**
     * 查询农事记录信息(种植开始起)
     * @param recoveryVO 采收信息
     * @return
     */
    @Override
    public List<FarmingRecordVO> getFarmingRecordByFarmPlantId(RecoveryVO recoveryVO) {
        return baseMapper.getFarmingRecordByFarmPlantId(recoveryVO);
    }
 
    /**
     * 查询农事操作记录(不分页)
     * @param farm
     * @return
     */
    @Override
    public List<FarmingRecordVO> getFarmingRecordListfarm(FarmingRecordVO farm) {
        return baseMapper.getFarmingRecordListfarm(farm);
    }
 
    @Override
    public FarmingRecordVO getDetails(FarmingRecordVO farmingRecordVO) {
        return baseMapper.getDetails(farmingRecordVO);
    }
}