yangys
2024-10-09 7ef593e1e3c35aaeecf9318f0b3941230d3ed002
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
package com.qianwen.mdc.collect.controller;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
 
import com.qianwen.mdc.collect.common.OpResult;
import com.qianwen.mdc.collect.entity.mgr.WorkstationAppMapping;
import com.qianwen.mdc.collect.service.WorkstationAppMappingService;
 
@RequestMapping("/workstation/appmapping")
@RestController()
public class WorkstationAppMappingController {
    Logger log = LoggerFactory.getLogger(this.getClass());
    @Autowired
    private WorkstationAppMappingService mappingService;;
    
   
    
    @PostMapping("create")
    public OpResult<Void> create(WorkstationAppMapping mapping) {
        try {
            mappingService.save(mapping);
        }catch(Exception e) {
            log.error("新增映射失败,",e);
            return OpResult.fail(e.getMessage());
        }
        return OpResult.success();
        
        
    }
    
    @PostMapping("update")
    public OpResult<Void> update(WorkstationAppMapping mapping) {
        try {
            mappingService.update(mapping);
        }catch(Exception e) {
            log.error("修改映射失败,",e);
            return OpResult.fail(e.getMessage());
        }
        mappingService.update(mapping);
        return OpResult.success();
        
    }
    
    @PostMapping("delete")
    public OpResult<Void> delete(long id) {
        try {
            mappingService.remove(id);
        }catch(Exception e) {
            log.error("删除映射失败,",e);
            return OpResult.fail(e.getMessage());
        }
 
        return OpResult.success();
        
    }
    
    @GetMapping("/saveCache")
    public void testsSaveCache() {
        mappingService.saveToCache();
    }
    
    
}