| | |
| | | } |
| | | |
| | | |
| | | @PostMapping("/base/city/add") |
| | | public Integer add(@RequestBody TCityManager manager){ |
| | | try { |
| | | cityService.save(manager); |
| | | return manager.getId(); |
| | | }catch (Exception e){ |
| | | e.printStackTrace(); |
| | | return null; |
| | | } |
| | | } |
| | | |
| | | |
| | | @PostMapping("/base/city/getById") |
| | | public TCityManager getById(@RequestBody Integer id){ |
| | | try { |
| | | return cityService.getById(id); |
| | | }catch (Exception e){ |
| | | e.printStackTrace(); |
| | | return null; |
| | | } |
| | | } |
| | | |
| | | |
| | | @PostMapping("/base/city/update") |
| | | public void update(@RequestBody TCityManager manager){ |
| | | try { |
| | | cityService.updateById(manager); |
| | | }catch (Exception e){ |
| | | e.printStackTrace(); |
| | | } |
| | | } |
| | | |
| | | |
| | | @PostMapping("/base/city/freeze") |
| | | public void freeze(@RequestBody Integer id){ |
| | | try { |
| | | TCityManager byId = cityService.getById(id); |
| | | byId.setState(2); |
| | | cityService.updateById(byId); |
| | | }catch (Exception e){ |
| | | e.printStackTrace(); |
| | | } |
| | | } |
| | | @PostMapping("/base/city/unfreeze") |
| | | public void unfreeze(@RequestBody Integer id){ |
| | | try { |
| | | TCityManager byId = cityService.getById(id); |
| | | byId.setState(1); |
| | | cityService.updateById(byId); |
| | | }catch (Exception e){ |
| | | e.printStackTrace(); |
| | | } |
| | | } |
| | | } |