zhangherong
2 天以前 8904f9e6005e7e1f3cc06f415fdcde0033c32332
lxzn-module-eam-common/src/main/java/org/jeecg/modules/eam/service/impl/EamEquipmentExtendServiceImpl.java
@@ -1,5 +1,9 @@
package org.jeecg.modules.eam.service.impl;
import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
import org.apache.commons.lang3.StringUtils;
import org.jeecg.common.constant.CommonConstant;
import org.jeecg.common.util.DateUtils;
import org.jeecg.modules.eam.entity.EamEquipmentExtend;
import org.jeecg.modules.eam.mapper.EamEquipmentExtendMapper;
import org.jeecg.modules.eam.service.IEamEquipmentExtendService;
@@ -9,6 +13,7 @@
import org.springframework.transaction.annotation.Transactional;
import javax.annotation.Resource;
import java.util.Date;
/**
 * @Description: 设备台账扩展表
@@ -45,4 +50,28 @@
        eamEquipmentExtendMapper.updateById(entity);
        return true;
    }
    @Override
    @Transactional(rollbackFor = Exception.class)
    public boolean updateTechnologyParam(String equipmentId, String status, Date evaluationDate, String technologyGenerateFlag) {
        if (StringUtils.isBlank(status) && StringUtils.isBlank(technologyGenerateFlag) && evaluationDate == null) {
            return false;
        }
        EamEquipmentExtend entity = this.getBaseMapper().selectById(equipmentId);
        UpdateWrapper<EamEquipmentExtend> updateWrapper = new UpdateWrapper<>();
        updateWrapper.eq("id", equipmentId);
        if (StringUtils.isNotBlank(status)) {
            entity.setTechnologyStatus(status);
        }
        if (StringUtils.isNotBlank(technologyGenerateFlag)) {
            entity.setTechnologyGenerateFlag(technologyGenerateFlag);
        }
        if (evaluationDate != null) {
            entity.setLatestTechnologyCheck(evaluationDate);
            if (entity.getTechnologyCheckPeriod() != null) {
                entity.setNextTechnologyCheck(DateUtils.addYear(entity.getLatestTechnologyCheck(), entity.getTechnologyCheckPeriod()));
            }
        }
        return this.getBaseMapper().updateById(entity) > 0;
    }
}