| | |
| | | import org.springframework.util.CollectionUtils; |
| | | import org.springframework.web.bind.annotation.*; |
| | | |
| | | import java.io.IOException; |
| | | import java.util.Arrays; |
| | | import java.util.HashMap; |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | import java.util.stream.Collectors; |
| | | |
| | | /** |
| | |
| | | return objectBaseResult; |
| | | } |
| | | } |
| | | /** |
| | | * 链接类型删除 |
| | | * linkType 链接类型对象 |
| | | * @return 删除结果 |
| | | */ |
| | | @DeleteMapping("/deleteLink") |
| | | public BaseResult deleteLink(@RequestBody LinkType linkType){ |
| | | try { |
| | | return linkTypeService.deleteLink(linkType); |
| | | } catch (PLException e) { |
| | | BaseResult objectBaseResult = new BaseResult<>(); |
| | | objectBaseResult.setCode(Integer.parseInt(e.code)); |
| | | objectBaseResult.setMsg(Arrays.toString(e.messages)); |
| | | return objectBaseResult; |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * 一致性检查 |
| | | * @return 删除结果 |
| | | */ |
| | | @GetMapping("/checkLinkType") |
| | | public BaseResult checkLinkType(){ |
| | | try { |
| | | return linkTypeService.checkLinkType(); |
| | | } catch (PLException e) { |
| | | BaseResult objectBaseResult = new BaseResult<>(); |
| | | objectBaseResult.setCode(Integer.parseInt(e.code)); |
| | | objectBaseResult.setMsg(Arrays.toString(e.messages)); |
| | | return objectBaseResult; |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * 一致性检查修复数据库表 |
| | | * repairData 需要修复的数据 |
| | | * @return 修复结果 |
| | | */ |
| | | @PostMapping("/repairTable") |
| | | public BaseResult repairTable(@RequestBody String repairData){ |
| | | try { |
| | | return linkTypeService.repairTable(repairData); |
| | | } catch (PLException e) { |
| | | BaseResult objectBaseResult = new BaseResult<>(); |
| | | objectBaseResult.setCode(Integer.parseInt(e.code)); |
| | | objectBaseResult.setMsg(Arrays.toString(e.messages)); |
| | | return objectBaseResult; |
| | | } catch (IOException e) { |
| | | BaseResult objectBaseResult = new BaseResult<>(); |
| | | objectBaseResult.setCode(500); |
| | | objectBaseResult.setMsg(e.getMessage()); |
| | | return objectBaseResult; |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * 创建视图 |
| | | * @return 创建结果 |
| | | */ |
| | | @PostMapping("/createView") |
| | | public BaseResult createView(){ |
| | | try { |
| | | return linkTypeService.createView(); |
| | | } catch (PLException e) { |
| | | BaseResult objectBaseResult = new BaseResult<>(); |
| | | objectBaseResult.setCode(Integer.parseInt(e.code)); |
| | | objectBaseResult.setMsg(Arrays.toString(e.messages)); |
| | | return objectBaseResult; |
| | | } |
| | | } |
| | | } |