package com.qianwen.mdc.service.account;
|
|
import java.util.List;
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.stereotype.Service;
|
import org.springframework.transaction.annotation.Transactional;
|
|
import com.qianwen.mdc.domain.MachineAccount;
|
import com.qianwen.mdc.dto.account.MachineAccountEditDTO;
|
import com.qianwen.mdc.mapper.MachineAccountMapper;
|
import com.qianwen.mdc.mapper.MachineMapper;
|
|
/**
|
* @author y_ys79
|
* 设备台账修改服务
|
*/
|
@Service
|
public class MachineAccountEditService {
|
@Autowired
|
private MachineAccountMapper accountMapper;
|
@Autowired
|
private MachineMapper machineMapper;
|
@Transactional
|
public void modify(MachineAccountEditDTO dto) {
|
|
MachineAccount account = accountMapper.selectById(dto.getId());
|
|
account.setMachineName(dto.getMachineName());
|
account.setUuid(dto.getUuid());
|
account.setSpecification(dto.getSpecification());
|
account.setType(dto.getType());
|
account.setCategory(dto.getCategory());
|
account.setDeviceTypeId(dto.getDeviceTypeId());
|
account.setAccountingAttribute(dto.getAccountingAttribute());
|
// account.setLocation(location);
|
account.setDepartment(dto.getDepartment());
|
//account.setState(dto.getState());
|
|
account.setElecCompFactor(dto.getElecCompFactor());
|
|
account.setMechCompFactor(dto.getMechCompFactor());
|
|
account.setCountry(dto.getCountry());
|
account.setManufacturer(dto.getManufacturer());
|
|
account.setOriginalValue(dto.getOriginalValue());
|
account.setPresentValue(dto.getPresentValue());
|
account.setWeight(dto.getWeight());
|
account.setProductionDate(dto.getProductionDate());
|
account.setManageType(dto.getManageType());
|
|
account.setPic(dto.getPic());
|
account.setRemark(dto.getRemark());
|
|
accountMapper.updateById(account);
|
}
|
|
@Transactional
|
public void remove(List<Long> ids) {
|
|
for(Long id : ids ) {
|
MachineAccount account = accountMapper.selectById(id);
|
Long machineId = account.getMachineId();
|
accountMapper.deleteById(id);
|
|
//删除对应的采集信息
|
machineMapper.deleteById(machineId);
|
}
|
|
}
|
}
|