package org.springblade.modules.farmplant.service.impl; import com.baomidou.mybatisplus.core.metadata.IPage; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; import org.springblade.modules.farmplant.entity.FarmPlant; import org.springblade.modules.farmplant.mapper.FarmPlantMapper; import org.springblade.modules.farmplant.service.FarmPlantService; import org.springblade.modules.farmplant.vo.FarmPlantVO; import org.springframework.stereotype.Service; import java.util.List; /** * 农场养殖记录表服务实现类 * @since 2022-05-12 * @author zhongrj */ @Service public class FarmPlantServiceImpl extends ServiceImpl implements FarmPlantService { /** * 自定义分页 * * @param page * @param farm * @return */ @Override public IPage selectFarmPlantPage(IPage page, FarmPlantVO farm) { List farmPlantVOS = baseMapper.selectFarmPlantPage(page, farm); //遍历 farmPlantVOS.forEach(farmPlantVO -> { if (farmPlantVO.getLandUnit().equals("0")){ farmPlantVO.setArea(farmPlantVO.getArea()+"亩"); } if (farmPlantVO.getLandUnit().equals("1")){ farmPlantVO.setArea(farmPlantVO.getArea()+"分"); } if (farmPlantVO.getLandUnit().equals("2")){ farmPlantVO.setArea(farmPlantVO.getArea()+"平方米"); } }); return page.setRecords(farmPlantVOS); } }