|  |  |  | 
|---|
|  |  |  | @RequestParam(required = false) String timeRange, | 
|---|
|  |  |  | @RequestParam Map<String, Object> param) { | 
|---|
|  |  |  | LambdaQueryWrapper<BasBarcode> wrapper = new LambdaQueryWrapper<>(); | 
|---|
|  |  |  | wrapper.eq(BasBarcode::getHostId, getHostId()); | 
|---|
|  |  |  | if (!Cools.isEmpty(condition)) { | 
|---|
|  |  |  | wrapper.like(BasBarcode::getId, condition); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | 
|---|
|  |  |  | @RequestMapping(value = "/basBarcode/add/auth") | 
|---|
|  |  |  | @ManagerAuth | 
|---|
|  |  |  | public R add(BasBarcode basBarcode) { | 
|---|
|  |  |  | basBarcode.setHostId(getHostId()); | 
|---|
|  |  |  | basBarcode.setCreateTime(new Date()); | 
|---|
|  |  |  | basBarcodeService.save(basBarcode); | 
|---|
|  |  |  | return R.ok(); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | 
|---|
|  |  |  | @ManagerAuth | 
|---|
|  |  |  | public R query(String condition) { | 
|---|
|  |  |  | LambdaQueryWrapper<BasBarcode> wrapper = new LambdaQueryWrapper<>(); | 
|---|
|  |  |  | wrapper.eq(BasBarcode::getHostId, getHostId()); | 
|---|
|  |  |  | wrapper.like(BasBarcode::getId, condition); | 
|---|
|  |  |  | Page<BasBarcode> page = basBarcodeService.page(new Page<>(0, 10), wrapper); | 
|---|
|  |  |  | List<Map<String, Object>> result = new ArrayList<>(); | 
|---|
|  |  |  | 
|---|
|  |  |  | public R getDataKV(@RequestParam(required = false) String condition) { | 
|---|
|  |  |  | List<KeyValueVo> vos = new ArrayList<>(); | 
|---|
|  |  |  | LambdaQueryWrapper<BasBarcode> wrapper = new LambdaQueryWrapper<>(); | 
|---|
|  |  |  | wrapper.eq(BasBarcode::getHostId, getHostId()); | 
|---|
|  |  |  | if (!Cools.isEmpty(condition)) { | 
|---|
|  |  |  | wrapper.like(BasBarcode::getId, condition); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | 
|---|
|  |  |  | public R generateBarcode(@RequestParam("barcode") String barcode, @RequestParam("num") Integer num) { | 
|---|
|  |  |  | Long hostId = getHostId(); | 
|---|
|  |  |  | Date now = new Date(); | 
|---|
|  |  |  | BasBarcode one = basBarcodeService.getOne(new LambdaQueryWrapper<BasBarcode>().eq(BasBarcode::getBarcode, barcode).eq(BasBarcode::getHostId, hostId)); | 
|---|
|  |  |  | if (one != null) { | 
|---|
|  |  |  | return R.error("条码起始值已存在"); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | int barcodeInt = Integer.parseInt(barcode); | 
|---|
|  |  |  | for (int i = 0; i < num; i++) { | 
|---|
|  |  |  | barcodeInt += 1; | 
|---|
|  |  |  | BasBarcode basBarcode = new BasBarcode(); | 
|---|
|  |  |  | basBarcode.setBarcode(String.valueOf(barcodeInt)); | 
|---|
|  |  |  | basBarcode.setHostId(hostId); | 
|---|
|  |  |  | basBarcode.setCreateTime(now); | 
|---|
|  |  |  | basBarcodeService.save(basBarcode); | 
|---|
|  |  |  | barcodeInt += 1; | 
|---|
|  |  |  | } | 
|---|
|  |  |  | return R.ok(); | 
|---|
|  |  |  | } | 
|---|