| | |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.security.access.prepost.PreAuthorize; |
| | | import org.springframework.web.bind.annotation.*; |
| | | import com.vincent.rsf.server.manager.utils.buildPageRowsUtils; |
| | | |
| | | import jakarta.servlet.http.HttpServletResponse; |
| | | import java.util.*; |
| | |
| | | public R page(@RequestBody Map<String, Object> map) { |
| | | BaseParam baseParam = buildParam(map, BaseParam.class); |
| | | PageParam<BasStationType, BaseParam> pageParam = new PageParam<>(baseParam, BasStationType.class); |
| | | return R.ok().add(basStationTypeService.page(pageParam, pageParam.buildWrapper(true))); |
| | | return R.ok().add(buildPageRowsUtils.rowsMap(basStationTypeService.page(pageParam, pageParam.buildWrapper(true)))); |
| | | } |
| | | |
| | | @PreAuthorize("hasAuthority('manager:basStationType:list')") |
| | | @PostMapping("/basStationType/list") |
| | | public R list(@RequestBody Map<String, Object> map) { |
| | | return R.ok().add(basStationTypeService.list()); |
| | | return R.ok().add(buildPageRowsUtils.rowsMap(basStationTypeService.list())); |
| | | } |
| | | |
| | | @PreAuthorize("hasAuthority('manager:basStationType:list')") |
| | | @PostMapping({"/basStationType/many/{ids}", "/basStationTypes/many/{ids}"}) |
| | | public R many(@PathVariable Long[] ids) { |
| | | return R.ok().add(basStationTypeService.listByIds(Arrays.asList(ids))); |
| | | return R.ok().add(buildPageRowsUtils.rowsMap(basStationTypeService.listByIds(Arrays.asList(ids)))); |
| | | } |
| | | |
| | | @PreAuthorize("hasAuthority('manager:basStationType:list')") |
| | | @GetMapping("/basStationType/{id}") |
| | | public R get(@PathVariable("id") Long id) { |
| | | return R.ok().add(basStationTypeService.getById(id)); |
| | | return R.ok().add(buildPageRowsUtils.rowsMap(basStationTypeService.getById(id))); |
| | | } |
| | | |
| | | @PreAuthorize("hasAuthority('manager:basStationType:save')") |
| | |
| | | // if (!basStationTypeService.save(basStationType)) { |
| | | // return R.error("Save Fail"); |
| | | // } |
| | | return R.ok("Save Success").add(basStationType); |
| | | return R.ok("Save Success").add(buildPageRowsUtils.rowsMap(basStationType)); |
| | | } |
| | | |
| | | @PreAuthorize("hasAuthority('manager:basStationType:update')") |
| | |
| | | // if (!basStationTypeService.updateById(basStationType)) { |
| | | // return R.error("Update Fail"); |
| | | // } |
| | | return R.ok("Update Success").add(basStationType); |
| | | return R.ok("Update Success").add(buildPageRowsUtils.rowsMap(basStationType)); |
| | | } |
| | | |
| | | @PreAuthorize("hasAuthority('manager:basStationType:remove')") |
| | |
| | | if (!basStationTypeService.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:basStationType:list')") |
| | |
| | | basStationTypeService.page(new Page<>(1, 30), wrapper).getRecords().forEach( |
| | | item -> vos.add(new KeyValVo(item.getId(), item.getId())) |
| | | ); |
| | | return R.ok().add(vos); |
| | | return R.ok().add(buildPageRowsUtils.rowsMap(vos)); |
| | | } |
| | | |
| | | @PreAuthorize("hasAuthority('manager:basStationType:list')") |
| | | @PostMapping("/basStationType/export") |
| | | public void export(@RequestBody Map<String, Object> map, HttpServletResponse response) throws Exception { |
| | | ExcelUtil.build(ExcelUtil.create(basStationTypeService.list(), BasStationType.class), response); |
| | | ExcelUtil.build(ExcelUtil.create(buildPageRowsUtils.rowsMap(basStationTypeService.list()), BasStationType.class), response); |
| | | } |
| | | |
| | | } |