| | |
| | | import com.vincent.rsf.server.common.domain.PageParam; |
| | | import com.vincent.rsf.server.manager.entity.CheckDiff; |
| | | import com.vincent.rsf.server.manager.service.CheckDiffService; |
| | | import com.vincent.rsf.server.manager.utils.buildPageRowsUtils; |
| | | import com.vincent.rsf.server.system.controller.BaseController; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.security.access.prepost.PreAuthorize; |
| | |
| | | public R page(@RequestBody Map<String, Object> map) { |
| | | BaseParam baseParam = buildParam(map, BaseParam.class); |
| | | PageParam<CheckDiff, BaseParam> pageParam = new PageParam<>(baseParam, CheckDiff.class); |
| | | return R.ok().add(checkDiffService.page(pageParam, pageParam.buildWrapper(true))); |
| | | PageParam<CheckDiff, BaseParam> page = checkDiffService.page(pageParam, pageParam.buildWrapper(true)); |
| | | return R.ok().add(buildPageRowsUtils.rowsMap(page)); |
| | | } |
| | | |
| | | @PreAuthorize("hasAuthority('manager:checkDiff:list')") |
| | | @PostMapping("/checkDiff/list") |
| | | public R list(@RequestBody Map<String, Object> map) { |
| | | return R.ok().add(checkDiffService.list()); |
| | | return R.ok().add(buildPageRowsUtils.rowsMap(checkDiffService.list())); |
| | | } |
| | | |
| | | @PreAuthorize("hasAuthority('manager:checkDiff:list')") |
| | | @PostMapping({"/checkDiff/many/{ids}", "/checkDiffs/many/{ids}"}) |
| | | public R many(@PathVariable Long[] ids) { |
| | | return R.ok().add(checkDiffService.listByIds(Arrays.asList(ids))); |
| | | return R.ok().add(buildPageRowsUtils.rowsMap(checkDiffService.listByIds(Arrays.asList(ids)))); |
| | | } |
| | | |
| | | @PreAuthorize("hasAuthority('manager:checkDiff:list')") |
| | | @GetMapping("/checkDiff/{id}") |
| | | public R get(@PathVariable("id") Long id) { |
| | | return R.ok().add(checkDiffService.getById(id)); |
| | | return R.ok().add(buildPageRowsUtils.rowsMap(checkDiffService.getById(id))); |
| | | } |
| | | |
| | | @PreAuthorize("hasAuthority('manager:checkDiff:save')") |
| | |
| | | if (!checkDiffService.save(checkDiff)) { |
| | | return R.error("Save Fail"); |
| | | } |
| | | return R.ok("Save Success").add(checkDiff); |
| | | return R.ok("Save Success").add(buildPageRowsUtils.rowsMap(checkDiff)); |
| | | } |
| | | |
| | | @PreAuthorize("hasAuthority('manager:checkDiff:update')") |
| | |
| | | if (!checkDiffService.updateById(checkDiff)) { |
| | | return R.error("Update Fail"); |
| | | } |
| | | return R.ok("Update Success").add(checkDiff); |
| | | return R.ok("Update Success").add(buildPageRowsUtils.rowsMap(checkDiff)); |
| | | } |
| | | |
| | | @PreAuthorize("hasAuthority('manager:checkDiff:remove')") |
| | |
| | | if (!checkDiffService.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:checkDiff:list')") |
| | |
| | | checkDiffService.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:checkDiff:list')") |
| | | @PostMapping("/checkDiff/export") |
| | | public void export(@RequestBody Map<String, Object> map, HttpServletResponse response) throws Exception { |
| | | ExcelUtil.build(ExcelUtil.create(checkDiffService.list(), CheckDiff.class), response); |
| | | ExcelUtil.build(ExcelUtil.create(buildPageRowsUtils.rowsMap(checkDiffService.list()), CheckDiff.class), response); |
| | | } |
| | | |
| | | } |