yangys
2024-03-07 55bb7e09cc5b7eb1de77f128db0e4071a9a8df88
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
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);
        }
        
    }
}