| | |
| | | import com.vincent.rsf.server.common.domain.KeyValVo; |
| | | import com.vincent.rsf.server.common.domain.PageParam; |
| | | import com.vincent.rsf.server.common.utils.ExcelUtil; |
| | | import com.vincent.rsf.server.common.utils.OptimisticLockUtils; |
| | | import com.vincent.rsf.server.manager.controller.params.LocModifyParams; |
| | | import com.vincent.rsf.server.manager.entity.Loc; |
| | | import com.vincent.rsf.server.manager.enums.LocStsType; |
| | | import com.vincent.rsf.server.manager.service.LocService; |
| | | import com.vincent.rsf.server.manager.utils.buildPageRowsUtils; |
| | | import com.vincent.rsf.server.system.controller.BaseController; |
| | | import io.swagger.annotations.Api; |
| | | import io.swagger.annotations.ApiOperation; |
| | |
| | | list.add("row"); |
| | | list.add("col"); |
| | | list.add("lev"); |
| | | return R.ok().add(locService.page(pageParam, pageParam.buildWrapper(true, list))); |
| | | PageParam<Loc, BaseParam> page = locService.page(pageParam, pageParam.buildWrapper(true, list)); |
| | | return R.ok().add(buildPageRowsUtils.rowsMap(page)); |
| | | } |
| | | |
| | | @PreAuthorize("hasAuthority('manager:locPreview:list')") |
| | | @PostMapping("/locPreview/list") |
| | | public R list(@RequestBody Map<String, Object> map) { |
| | | return R.ok().add(locService.list()); |
| | | return R.ok().add(buildPageRowsUtils.rowsMap(locService.list())); |
| | | } |
| | | |
| | | @PreAuthorize("hasAuthority('manager:locPreview:list')") |
| | |
| | | @PreAuthorize("hasAuthority('manager:locPreview:list')") |
| | | @PostMapping({"/locPreview/many/{ids}", "/locPreview/many/{ids}"}) |
| | | public R many(@PathVariable Long[] ids) { |
| | | return R.ok().add(locService.listByIds(Arrays.asList(ids))); |
| | | return R.ok().add(buildPageRowsUtils.rowsMap(locService.listByIds(Arrays.asList(ids)))); |
| | | } |
| | | |
| | | @PreAuthorize("hasAuthority('manager:locPreview:list')") |
| | | @GetMapping("/locPreview/{id}") |
| | | public R get(@PathVariable("id") Long id) { |
| | | return R.ok().add(locService.getById(id)); |
| | | return R.ok().add(buildPageRowsUtils.rowsMap(locService.getById(id))); |
| | | } |
| | | |
| | | @PreAuthorize("hasAuthority('manager:locPreview:save')") |
| | |
| | | if (!locService.saveType(loc)) { |
| | | throw new CoolException("库位类型关联关系保存失败!!"); |
| | | } |
| | | return R.ok("Save Success").add(loc); |
| | | return R.ok("Save Success").add(buildPageRowsUtils.rowsMap(loc)); |
| | | } |
| | | |
| | | @PreAuthorize("hasAuthority('manager:locPreview:update')") |
| | |
| | | @PostMapping("/locPreview/update") |
| | | @Transactional(rollbackFor = Exception.class) |
| | | public R update(@RequestBody Loc loc) { |
| | | OptimisticLockUtils.requireVersion("库位", loc.getVersion()); |
| | | loc.setUpdateBy(getLoginUserId()); |
| | | String join = StringUtils.join(loc.getTypeIds(), ","); |
| | | loc.setType(join); |
| | |
| | | if (!locService.updateLoc(loc)) { |
| | | throw new CoolException("库位类型关联关系修改失败!!"); |
| | | } |
| | | return R.ok("Update Success").add(loc); |
| | | return R.ok("Update Success").add(buildPageRowsUtils.rowsMap(loc)); |
| | | } |
| | | |
| | | @PreAuthorize("hasAuthority('manager:locPreview:remove')") |
| | |
| | | if (!locService.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:locPreview:list')") |
| | |
| | | locService.page(new Page<>(1, 30), wrapper).getRecords().forEach( |
| | | item -> vos.add(new KeyValVo(item.getId(), item.getCode())) |
| | | ); |
| | | return R.ok().add(vos); |
| | | return R.ok().add(buildPageRowsUtils.rowsMap(vos)); |
| | | } |
| | | |
| | | @PreAuthorize("hasAuthority('manager:locPreview:list')") |
| | |
| | | } else { |
| | | locs = locService.list(new LambdaQueryWrapper<Loc>().eq(Loc::getStatus, 1)); |
| | | } |
| | | ExcelUtil.build(ExcelUtil.create(locs, Loc.class), response); |
| | | ExcelUtil.build(ExcelUtil.create(buildPageRowsUtils.rowsMap(locs), Loc.class), response); |
| | | } |
| | | |
| | | @PreAuthorize("hasAuthority('manager:locPreview:update')") |