package com.slibra.business.service.impl; import java.util.List; import java.util.Objects; import com.slibra.business.domain.TXinyiIndustry; import com.slibra.business.mapper.TXinyiIndustryMapper; import com.slibra.common.DecimalUtils; import com.slibra.common.utils.DateUtils; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import com.slibra.business.mapper.TXinyiMedicineParamMapper; import com.slibra.business.domain.TXinyiMedicineParam; import com.slibra.business.service.ITXinyiMedicineParamService; import static com.slibra.common.constant.MyConstants.INT_2; import static com.slibra.common.constant.MyConstants.INT_4; /** * 智能投药参数设置Service业务层处理 * * @author slibra * @date 2024-09-09 */ @Service public class TXinyiMedicineParamServiceImpl implements ITXinyiMedicineParamService { @Autowired private TXinyiMedicineParamMapper tXinyiMedicineParamMapper; @Autowired private TXinyiIndustryMapper xinyiIndustryMapper; /** * 查询智能投药参数设置 * * @param id 智能投药参数设置主键 * @return 智能投药参数设置 */ @Override public TXinyiMedicineParam selectTXinyiMedicineParamById(Long id) { return tXinyiMedicineParamMapper.selectTXinyiMedicineParamById(id); } /** * 查询智能投药参数设置列表 * * @param tXinyiMedicineParam 智能投药参数设置 * @return 智能投药参数设置 */ @Override public List selectTXinyiMedicineParamList(TXinyiMedicineParam tXinyiMedicineParam) { return tXinyiMedicineParamMapper.selectTXinyiMedicineParamList(tXinyiMedicineParam); } /** * 新增智能投药参数设置 * * @param tXinyiMedicineParam 智能投药参数设置 * @return 结果 */ @Override public int insertTXinyiMedicineParam(TXinyiMedicineParam tXinyiMedicineParam) { tXinyiMedicineParam.setCreateTime(DateUtils.getNowDate()); return tXinyiMedicineParamMapper.insertTXinyiMedicineParam(tXinyiMedicineParam); } /** * 修改智能投药参数设置 * * @param tXinyiMedicineParam 智能投药参数设置 * @return 结果 */ @Override public int updateTXinyiMedicineParam(TXinyiMedicineParam tXinyiMedicineParam) { tXinyiMedicineParam.setUpdateTime(DateUtils.getNowDate()); return tXinyiMedicineParamMapper.updateTXinyiMedicineParam(tXinyiMedicineParam); } /** * 批量删除智能投药参数设置 * * @param ids 需要删除的智能投药参数设置主键 * @return 结果 */ @Override public int deleteTXinyiMedicineParamByIds(Long[] ids) { return tXinyiMedicineParamMapper.deleteTXinyiMedicineParamByIds(ids); } /** * 删除智能投药参数设置信息 * * @param id 智能投药参数设置主键 * @return 结果 */ @Override public int deleteTXinyiMedicineParamById(Long id) { return tXinyiMedicineParamMapper.deleteTXinyiMedicineParamById(id); } @Override public TXinyiMedicineParam getLatestRecord() { TXinyiMedicineParam latestRecord = this.tXinyiMedicineParamMapper.getLatestRecord(); if (!Objects.isNull(latestRecord)) { TXinyiIndustry tXinyiIndustry = this.xinyiIndustryMapper.selectTXinyiIndustryNewest(); if (!Objects.isNull(tXinyiIndustry)) { latestRecord.setTytjTransientLL(DecimalUtils.getAbsAndScale(tXinyiIndustry.getSJTYJLY(), INT_4)); } } return latestRecord; } }