|
|
@@ -10,8 +10,12 @@ import com.haha.entity.dto.BatchIdsDTO;
|
|
|
import com.haha.common.annotation.Log;
|
|
|
import com.haha.common.constant.ResponseEnum;
|
|
|
import com.haha.common.enums.OperationType;
|
|
|
+import com.haha.common.vo.BatchResultVO;
|
|
|
import com.haha.common.vo.PageResult;
|
|
|
import com.haha.common.vo.Result;
|
|
|
+import com.haha.common.vo.ShopDeviceVO;
|
|
|
+import com.haha.common.vo.ShopSelectVO;
|
|
|
+import com.haha.common.vo.ShopStatisticsVO;
|
|
|
import com.haha.entity.Shop;
|
|
|
import com.haha.entity.Device;
|
|
|
import com.haha.entity.Replenisher;
|
|
|
@@ -81,8 +85,8 @@ public class ShopController {
|
|
|
*/
|
|
|
@RequirePermission("shop:read")
|
|
|
@GetMapping("/statistics")
|
|
|
- public Result<Map<String, Object>> getStatistics() {
|
|
|
- Map<String, Object> statistics = shopService.getStatistics();
|
|
|
+ public Result<ShopStatisticsVO> getStatistics() {
|
|
|
+ ShopStatisticsVO statistics = shopService.getStatistics();
|
|
|
return Result.success("查询成功", statistics);
|
|
|
}
|
|
|
|
|
|
@@ -92,8 +96,8 @@ public class ShopController {
|
|
|
*/
|
|
|
@RequirePermission("shop:read")
|
|
|
@GetMapping("/enabled")
|
|
|
- public Result<List<Map<String, Object>>> getEnabledShops() {
|
|
|
- List<Map<String, Object>> shops = shopService.getAllEnabledShops();
|
|
|
+ public Result<List<ShopSelectVO>> getEnabledShops() {
|
|
|
+ List<ShopSelectVO> shops = shopService.getAllEnabledShops();
|
|
|
return Result.success("查询成功", shops);
|
|
|
}
|
|
|
|
|
|
@@ -174,8 +178,8 @@ public class ShopController {
|
|
|
*/
|
|
|
@RequirePermission("shop:read")
|
|
|
@GetMapping("/{id}/devices")
|
|
|
- public Result<List<Map<String, Object>>> getDevices(@PathVariable Long id) {
|
|
|
- List<Map<String, Object>> devices = shopService.getDevicesByShopId(id);
|
|
|
+ public Result<List<ShopDeviceVO>> getDevices(@PathVariable Long id) {
|
|
|
+ List<ShopDeviceVO> devices = shopService.getDevicesByShopId(id);
|
|
|
return Result.success("查询成功", devices);
|
|
|
}
|
|
|
|
|
|
@@ -206,12 +210,13 @@ public class ShopController {
|
|
|
@RequirePermission("shop:update")
|
|
|
@Log(module = "门店管理", operation = OperationType.UPDATE, summary = "批量关联设备到门店")
|
|
|
@PostMapping("/{id}/devices/batch")
|
|
|
- public Result<Map<String, Object>> batchLinkDevices(@PathVariable Long id, @RequestBody BatchIdsDTO dto) {
|
|
|
+ public Result<BatchResultVO> batchLinkDevices(@PathVariable Long id, @RequestBody BatchIdsDTO dto) {
|
|
|
int count = shopService.batchLinkDevices(id, dto.getIds());
|
|
|
|
|
|
- Map<String, Object> result = new HashMap<>();
|
|
|
- result.put("success", count);
|
|
|
- result.put("total", dto.getIds().size());
|
|
|
+ BatchResultVO result = BatchResultVO.builder()
|
|
|
+ .success(count)
|
|
|
+ .total(dto.getIds().size())
|
|
|
+ .build();
|
|
|
|
|
|
return Result.success("批量关联完成", result);
|
|
|
}
|
|
|
@@ -243,12 +248,13 @@ public class ShopController {
|
|
|
@RequirePermission("shop:update")
|
|
|
@Log(module = "门店管理", operation = OperationType.UPDATE, summary = "批量移除设备关联")
|
|
|
@DeleteMapping("/{id}/devices/batch")
|
|
|
- public Result<Map<String, Object>> batchUnlinkDevices(@PathVariable Long id, @RequestBody BatchIdsDTO dto) {
|
|
|
+ public Result<BatchResultVO> batchUnlinkDevices(@PathVariable Long id, @RequestBody BatchIdsDTO dto) {
|
|
|
int count = shopService.batchUnlinkDevices(id, dto.getIds());
|
|
|
|
|
|
- Map<String, Object> result = new HashMap<>();
|
|
|
- result.put("success", count);
|
|
|
- result.put("total", dto.getIds().size());
|
|
|
+ BatchResultVO result = BatchResultVO.builder()
|
|
|
+ .success(count)
|
|
|
+ .total(dto.getIds().size())
|
|
|
+ .build();
|
|
|
|
|
|
return Result.success("批量移除完成", result);
|
|
|
}
|