| | |
| | | BaseParam baseParam = buildParam(map, BaseParam.class); |
| | | PageParam<DeviceSite, BaseParam> pageParam = new PageParam<>(baseParam, DeviceSite.class); |
| | | PageParam<DeviceSite, BaseParam> page = deviceSiteService.page(pageParam, pageParam.buildWrapper(true)); |
| | | buildPageRowsUtils.userNameMap(page.getRecords()); |
| | | return R.ok().add(page); |
| | | return R.ok().add(buildPageRowsUtils.rowsMap(page)); |
| | | } |
| | | |
| | | |
| | |
| | | map.entrySet().removeIf(next -> next.getKey().equals("type")); |
| | | } |
| | | List<DeviceSite> list = deviceSiteService.list(new LambdaQueryWrapper<DeviceSite>().in(DeviceSite::getType, longs)); |
| | | return R.ok().add(list); |
| | | return R.ok().add(buildPageRowsUtils.rowsMap(list)); |
| | | } |
| | | |
| | | @PreAuthorize("hasAuthority('manager:deviceSite:list')") |
| | | @PostMapping("/deviceSite/list") |
| | | public R list(@RequestBody Map<String, Object> map) { |
| | | return R.ok().add(deviceSiteService.list()); |
| | | return R.ok().add(buildPageRowsUtils.rowsMap(deviceSiteService.list())); |
| | | } |
| | | |
| | | @PreAuthorize("hasAuthority('manager:deviceSite:list')") |
| | | @PostMapping({"/deviceSite/many/{ids}", "/deviceSites/many/{ids}"}) |
| | | public R many(@PathVariable Long[] ids) { |
| | | return R.ok().add(deviceSiteService.listByIds(Arrays.asList(ids))); |
| | | return R.ok().add(buildPageRowsUtils.rowsMap(deviceSiteService.listByIds(Arrays.asList(ids)))); |
| | | } |
| | | |
| | | @PreAuthorize("hasAuthority('manager:deviceSite:list')") |
| | | @GetMapping("/deviceSite/{id}") |
| | | public R get(@PathVariable("id") Long id) { |
| | | return R.ok().add(deviceSiteService.getById(id)); |
| | | return R.ok().add(buildPageRowsUtils.rowsMap(deviceSiteService.getById(id))); |
| | | } |
| | | |
| | | @PreAuthorize("hasAuthority('manager:deviceSite:save')") |
| | |
| | | if (!deviceSiteService.save(deviceSite)) { |
| | | return R.error("Save Fail"); |
| | | } |
| | | return R.ok("Save Success").add(deviceSite); |
| | | return R.ok("Save Success").add(buildPageRowsUtils.rowsMap(deviceSite)); |
| | | } |
| | | |
| | | @PreAuthorize("hasAuthority('manager:deviceSite:update')") |
| | |
| | | if (!deviceSiteService.updateById(deviceSite)) { |
| | | return R.error("Update Fail"); |
| | | } |
| | | return R.ok("Update Success").add(deviceSite); |
| | | return R.ok("Update Success").add(buildPageRowsUtils.rowsMap(deviceSite)); |
| | | } |
| | | |
| | | @PreAuthorize("hasAuthority('manager:deviceSite:remove')") |
| | |
| | | if (!deviceSiteService.removeByIds(Arrays.asList(ids))) { |
| | | return R.error("Delete Fail"); |
| | | } |
| | | return R.ok("Delete Success").add(ids); |
| | | return R.ok("Delete Success").add(buildPageRowsUtils.rowsMap(ids)); |
| | | } |
| | | |
| | | @PreAuthorize("hasAuthority('manager:deviceSite:list')") |
| | |
| | | deviceSiteService.page(new Page<>(1, 30), wrapper).getRecords().forEach( |
| | | item -> vos.add(new KeyValVo(item.getId(), item.getName())) |
| | | ); |
| | | return R.ok().add(vos); |
| | | return R.ok().add(buildPageRowsUtils.rowsMap(vos)); |
| | | } |
| | | |
| | | @PreAuthorize("hasAuthority('manager:deviceSite:list')") |
| | | @PostMapping("/deviceSite/export") |
| | | public void export(@RequestBody Map<String, Object> map, HttpServletResponse response) throws Exception { |
| | | ExcelUtil.build(ExcelUtil.create(deviceSiteService.list(), DeviceSite.class), response); |
| | | ExcelUtil.build(ExcelUtil.create(buildPageRowsUtils.rowsMap(deviceSiteService.list()), DeviceSite.class), response); |
| | | } |
| | | |
| | | @PreAuthorize("hasAuthority('manager:deviceSite:save')") |