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 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 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 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(); } }