| | |
| | | BaseParam baseParam = buildParam(map, BaseParam.class); |
| | | PageParam<StockStatistic, BaseParam> pageParam = new PageParam<>(baseParam, StockStatistic.class); |
| | | PageParam<StockStatistic, BaseParam> page = stockStatisticService.page(pageParam, pageParam.buildWrapper(true)); |
| | | buildPageRowsUtils.userNameMap(page.getRecords()); |
| | | return R.ok().add(page); |
| | | return R.ok().add(buildPageRowsUtils.rowsMap(page)); |
| | | } |
| | | |
| | | @PreAuthorize("hasAuthority('manager:stockStatistic:list')") |
| | |
| | | "SUM(anfme) AS anfme, MAX(unit) AS unit"); |
| | | wrapper.groupBy("day_time, task_type, task_status, matnr_code"); |
| | | PageParam<StockStatistic, BaseParam> page = stockStatisticService.page(pageParam, wrapper); |
| | | buildPageRowsUtils.userNameMap(page.getRecords()); |
| | | return R.ok().add(page); |
| | | return R.ok().add(buildPageRowsUtils.rowsMap(page)); |
| | | } |
| | | |
| | | @PreAuthorize("hasAuthority('manager:stockStatistic:list')") |
| | |
| | | "SUM(anfme) AS anfme, MAX(unit) AS unit"); |
| | | wrapper.groupBy("day_time, task_type, task_status, matnr_code"); |
| | | PageParam<StockStatistic, BaseParam> page = stockStatisticService.page(pageParam, wrapper); |
| | | buildPageRowsUtils.userNameMap(page.getRecords()); |
| | | return R.ok().add(page); |
| | | return R.ok().add(buildPageRowsUtils.rowsMap(page)); |
| | | } |
| | | |
| | | @PreAuthorize("hasAuthority('manager:stockStatistic:list')") |
| | |
| | | "MAX(unit) AS unit, create_by, update_by, create_time, update_time"); |
| | | wrapper.groupBy("loc_code, day_time, task_type, task_status, barcode, matnr_code, create_by, update_by, create_time, update_time"); |
| | | PageParam<StockStatistic, BaseParam> page = stockStatisticService.page(pageParam, wrapper); |
| | | buildPageRowsUtils.userNameMap(page.getRecords()); |
| | | return R.ok().add(page); |
| | | return R.ok().add(buildPageRowsUtils.rowsMap(page)); |
| | | } |
| | | |
| | | @PreAuthorize("hasAuthority('manager:stockStatistic:list')") |
| | |
| | | "MAX(unit) AS unit, create_by, update_by, create_time, update_time"); |
| | | wrapper.groupBy("loc_code, day_time, task_type, task_status, barcode, matnr_code, create_by, update_by, create_time, update_time"); |
| | | PageParam<StockStatistic, BaseParam> page = stockStatisticService.page(pageParam, wrapper); |
| | | buildPageRowsUtils.userNameMap(page.getRecords()); |
| | | return R.ok().add(page); |
| | | return R.ok().add(buildPageRowsUtils.rowsMap(page)); |
| | | } |
| | | |
| | | @PreAuthorize("hasAuthority('manager:stockStatistic:list')") |
| | |
| | | "SUM( CASE WHEN task_type = 101 THEN anfme ELSE 0 END ) out_anfme"); |
| | | wrapper.in("task_type", Arrays.asList(TaskType.TASK_TYPE_IN.type, TaskType.TASK_TYPE_OUT.type)).groupBy("day_time"); |
| | | PageParam<StockStatistic, BaseParam> page = stockStatisticService.page(pageParam, wrapper); |
| | | buildPageRowsUtils.userNameMap(page.getRecords()); |
| | | return R.ok().add(page); |
| | | return R.ok().add(buildPageRowsUtils.rowsMap(page)); |
| | | } |
| | | |
| | | @PreAuthorize("hasAuthority('manager:stockStatistic:list')") |
| | | @PostMapping("/stockStatistic/list") |
| | | public R list(@RequestBody Map<String, Object> map) { |
| | | return R.ok().add(stockStatisticService.list()); |
| | | return R.ok().add(buildPageRowsUtils.rowsMap(stockStatisticService.list())); |
| | | } |
| | | |
| | | @PreAuthorize("hasAuthority('manager:stockStatistic:list')") |
| | | @PostMapping({"/stockStatistic/many/{ids}", "/stockStatistics/many/{ids}"}) |
| | | public R many(@PathVariable Long[] ids) { |
| | | return R.ok().add(stockStatisticService.listByIds(Arrays.asList(ids))); |
| | | return R.ok().add(buildPageRowsUtils.rowsMap(stockStatisticService.listByIds(Arrays.asList(ids)))); |
| | | } |
| | | |
| | | @PreAuthorize("hasAuthority('manager:stockStatistic:list')") |
| | | @GetMapping("/stockStatistic/{id}") |
| | | public R get(@PathVariable("id") Long id) { |
| | | return R.ok().add(stockStatisticService.getById(id)); |
| | | return R.ok().add(buildPageRowsUtils.rowsMap(stockStatisticService.getById(id))); |
| | | } |
| | | |
| | | @PreAuthorize("hasAuthority('manager:stockStatistic:save')") |
| | |
| | | if (!stockStatisticService.save(stockStatistic)) { |
| | | return R.error("Save Fail"); |
| | | } |
| | | return R.ok("Save Success").add(stockStatistic); |
| | | return R.ok("Save Success").add(buildPageRowsUtils.rowsMap(stockStatistic)); |
| | | } |
| | | |
| | | @PreAuthorize("hasAuthority('manager:stockStatistic:update')") |
| | |
| | | if (!stockStatisticService.updateById(stockStatistic)) { |
| | | return R.error("Update Fail"); |
| | | } |
| | | return R.ok("Update Success").add(stockStatistic); |
| | | return R.ok("Update Success").add(buildPageRowsUtils.rowsMap(stockStatistic)); |
| | | } |
| | | |
| | | @PreAuthorize("hasAuthority('manager:stockStatistic:remove')") |
| | |
| | | if (!stockStatisticService.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:stockStatistic:list')") |
| | |
| | | stockStatisticService.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:stockStatistic:list')") |
| | | @PostMapping("/stockStatistic/export") |
| | | public void export(@RequestBody Map<String, Object> map, HttpServletResponse response) throws Exception { |
| | | ExcelUtil.build(ExcelUtil.create(stockStatisticService.list(), StockStatistic.class), response); |
| | | ExcelUtil.build(ExcelUtil.create(buildPageRowsUtils.rowsMap(stockStatisticService.list()), StockStatistic.class), response); |
| | | } |
| | | |
| | | } |