| | |
| | | package com.zy.asrs.controller; |
| | | |
| | | import com.baomidou.mybatisplus.mapper.EntityWrapper; |
| | | import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
| | | import com.zy.asrs.entity.BasCrnp; |
| | | import com.zy.asrs.entity.BasDevp; |
| | | import com.zy.asrs.entity.BasDualCrnp; |
| | |
| | | @RequestMapping("/list/auth") |
| | | @ManagerAuth |
| | | public R list() { |
| | | return R.ok(basStationDeviceService.selectList(new EntityWrapper<>())); |
| | | return R.ok(basStationDeviceService.list(new QueryWrapper<>())); |
| | | } |
| | | |
| | | @RequestMapping("/save/auth") |
| | |
| | | |
| | | // However, to be safer, we should probably only delete for the stations involved or delete all if it's a full save. |
| | | // Let's assume the UI sends the full current state of configuration. |
| | | basStationDeviceService.delete(new EntityWrapper<>()); |
| | | basStationDeviceService.remove(new QueryWrapper<>()); |
| | | if (list != null && !list.isEmpty()) { |
| | | basStationDeviceService.insertBatch(list); |
| | | basStationDeviceService.saveBatch(list); |
| | | } |
| | | return R.ok(); |
| | | } |
| | |
| | | Map<String, Object> data = new HashMap<>(); |
| | | |
| | | List<Integer> stationList = new ArrayList<>(); |
| | | List<BasDevp> devps = basDevpService.selectList(new EntityWrapper<BasDevp>().eq("status", 1)); |
| | | List<BasDevp> devps = basDevpService.list(new QueryWrapper<BasDevp>().eq("status", 1)); |
| | | for (BasDevp devp : devps) { |
| | | for (StationObjModel stationObjModel : devp.getBarcodeStationList$()) { |
| | | stationList.add(stationObjModel.getStationId()); |
| | | } |
| | | } |
| | | |
| | | List<BasStation> stations = basStationService.selectList(new EntityWrapper<BasStation>().in("station_id", stationList)); |
| | | List<BasStation> stations = basStationService.list(new QueryWrapper<BasStation>().in("station_id", stationList)); |
| | | data.put("stations", stations); |
| | | |
| | | // Get Devices (Crn and DualCrn) |
| | | List<Map<String, Object>> devices = new ArrayList<>(); |
| | | |
| | | List<BasCrnp> crns = basCrnpService.selectList(new EntityWrapper<BasCrnp>().eq("status", 1)); |
| | | List<BasCrnp> crns = basCrnpService.list(new QueryWrapper<BasCrnp>().eq("status", 1)); |
| | | for (BasCrnp crn : crns) { |
| | | Map<String, Object> d = new HashMap<>(); |
| | | d.put("deviceNo", crn.getCrnNo()); |
| | |
| | | devices.add(d); |
| | | } |
| | | |
| | | List<BasDualCrnp> dualCrns = basDualCrnpService.selectList(new EntityWrapper<BasDualCrnp>().eq("status", 1)); |
| | | List<BasDualCrnp> dualCrns = basDualCrnpService.list(new QueryWrapper<BasDualCrnp>().eq("status", 1)); |
| | | for (BasDualCrnp dualCrn : dualCrns) { |
| | | Map<String, Object> d = new HashMap<>(); |
| | | d.put("deviceNo", dualCrn.getCrnNo()); |
| | |
| | | data.put("devices", devices); |
| | | |
| | | // Get existing relations |
| | | List<BasStationDevice> relations = basStationDeviceService.selectList(new EntityWrapper<>()); |
| | | List<BasStationDevice> relations = basStationDeviceService.list(new QueryWrapper<>()); |
| | | data.put("relations", relations); |
| | | |
| | | return R.ok(data); |