| | |
| | | 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; |
| | | |
| | | /** |
| | | * 农事记录服务实现类 |
| | |
| | | @Service |
| | | public class FarmRecordServiceImpl extends ServiceImpl<FarmingRecordMapper, FarmingRecord> implements FarmingRecordService { |
| | | |
| | | @Autowired |
| | | private IDictBizService dictBizService; |
| | | |
| | | /** |
| | | * 自定义分页 |
| | | * @param page |
| | |
| | | */ |
| | | @Override |
| | | public IPage<FarmingRecordVO> selectFarmingRecordPage(IPage<FarmingRecordVO> page, FarmingRecordVO farm) { |
| | | return page.setRecords(baseMapper.selectFarmingRecordPage(page, farm)); |
| | | List<FarmingRecordVO> recordVOS = baseMapper.selectFarmingRecordPage(page, farm); |
| | | recordVOS.forEach(recordVO->{ |
| | | //查询字典对应的名称 |
| | | DictBiz dictBiz = new DictBiz(); |
| | | dictBiz.setCode("farmingType"); |
| | | dictBiz.setDictKey(recordVO.getType()); |
| | | DictBiz one = dictBizService.getOne(new QueryWrapper<>(dictBiz)); |
| | | //设置名称 |
| | | recordVO.setTypeName(one.getDictValue()); |
| | | }); |
| | | return page.setRecords(recordVOS); |
| | | } |
| | | |
| | | |