From baf144e412fc2407ccc214d9f0e2df1b1513fab5 Mon Sep 17 00:00:00 2001 From: "liang.chao" <1360241448@qq.com> Date: Sat, 23 Nov 2024 17:43:19 +0800 Subject: [PATCH] =?UTF-8?q?=E8=AE=BE=E5=A4=87=E4=B8=8A=E4=B8=8B=E6=9E=B6?= =?UTF-8?q?=E5=8A=9F=E8=83=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../device/controller/DevInfoController.java | 11 ++++++++++ .../bonus/material/device/domain/DevInfo.java | 3 +++ .../material/device/mapper/DevInfoMapper.java | 3 +++ .../device/service/DevInfoService.java | 2 ++ .../service/impl/DevInfoServiceImpl.java | 16 +++++++++++++- .../mapper/material/device/DevInfoMapper.xml | 21 +++++++++++++++++++ 6 files changed, 55 insertions(+), 1 deletion(-) diff --git a/bonus-modules/bonus-material-mall/src/main/java/com/bonus/material/device/controller/DevInfoController.java b/bonus-modules/bonus-material-mall/src/main/java/com/bonus/material/device/controller/DevInfoController.java index 3162884..64fbcbe 100644 --- a/bonus-modules/bonus-material-mall/src/main/java/com/bonus/material/device/controller/DevInfoController.java +++ b/bonus-modules/bonus-material-mall/src/main/java/com/bonus/material/device/controller/DevInfoController.java @@ -93,6 +93,17 @@ public class DevInfoController extends BaseController { return success(devInfoService.selectDevInfoByMaId(maId)); } + + /** + * 上下架(批量) + */ + // @RequiresPermissions("equip:info:edit") + @ApiOperation(value = "上下架(批量)") + @PostMapping("updateUpDown") + public AjaxResult updateUp(@RequestBody DevInfo devInfo) { + return toAjax(devInfoService.updateUpDown(devInfo)); + } + /** * 修改设备信息 */ diff --git a/bonus-modules/bonus-material-mall/src/main/java/com/bonus/material/device/domain/DevInfo.java b/bonus-modules/bonus-material-mall/src/main/java/com/bonus/material/device/domain/DevInfo.java index 63e633b..782cff4 100644 --- a/bonus-modules/bonus-material-mall/src/main/java/com/bonus/material/device/domain/DevInfo.java +++ b/bonus-modules/bonus-material-mall/src/main/java/com/bonus/material/device/domain/DevInfo.java @@ -29,6 +29,9 @@ public class DevInfo extends BaseEntity { @Excel(name = "设备id") @ApiModelProperty(value = "设备id") private Long maId; + /** 设备id */ + @ApiModelProperty(value = "设备id") + private List maIds; /** 系统编码 */ @Excel(name = "系统编码") diff --git a/bonus-modules/bonus-material-mall/src/main/java/com/bonus/material/device/mapper/DevInfoMapper.java b/bonus-modules/bonus-material-mall/src/main/java/com/bonus/material/device/mapper/DevInfoMapper.java index 60461a2..c7b82c1 100644 --- a/bonus-modules/bonus-material-mall/src/main/java/com/bonus/material/device/mapper/DevInfoMapper.java +++ b/bonus-modules/bonus-material-mall/src/main/java/com/bonus/material/device/mapper/DevInfoMapper.java @@ -5,6 +5,7 @@ import com.bonus.common.biz.domain.*; import com.bonus.material.device.domain.DevInfo; import com.bonus.material.device.domain.dto.InfoMotionDto; import com.bonus.material.device.domain.vo.DevInfoVo; +import org.apache.ibatis.annotations.Param; import java.util.List; @@ -105,5 +106,7 @@ public interface DevInfoMapper { * @return */ List selectCompanyList(BmCompanyInfo obj); + + int updateUpDown(@Param("maIds") List maIds, @Param("maStatus")String maStatus); } diff --git a/bonus-modules/bonus-material-mall/src/main/java/com/bonus/material/device/service/DevInfoService.java b/bonus-modules/bonus-material-mall/src/main/java/com/bonus/material/device/service/DevInfoService.java index b9401a8..34364a9 100644 --- a/bonus-modules/bonus-material-mall/src/main/java/com/bonus/material/device/service/DevInfoService.java +++ b/bonus-modules/bonus-material-mall/src/main/java/com/bonus/material/device/service/DevInfoService.java @@ -88,4 +88,6 @@ public interface DevInfoService { * @return */ List selectCompanyList(BmCompanyInfo obj); + + int updateUpDown(DevInfo devInfo); } diff --git a/bonus-modules/bonus-material-mall/src/main/java/com/bonus/material/device/service/impl/DevInfoServiceImpl.java b/bonus-modules/bonus-material-mall/src/main/java/com/bonus/material/device/service/impl/DevInfoServiceImpl.java index 53d396f..01cb954 100644 --- a/bonus-modules/bonus-material-mall/src/main/java/com/bonus/material/device/service/impl/DevInfoServiceImpl.java +++ b/bonus-modules/bonus-material-mall/src/main/java/com/bonus/material/device/service/impl/DevInfoServiceImpl.java @@ -156,7 +156,9 @@ public class DevInfoServiceImpl implements DevInfoService { List addressList = devInfoMapper.getBaseAddress(); for (DevInfoVo devInfoVo : list) { for (BaseAddress address : addressList) { - if (devInfoVo.getCityId() == null || address.getCode() == null) { continue; } + if (devInfoVo.getCityId() == null || address.getCode() == null) { + continue; + } if (devInfoVo.getCityId().equals(Integer.valueOf(address.getCode()))) { devInfoVo.setCityStr(address.getName()); break; @@ -277,6 +279,7 @@ public class DevInfoServiceImpl implements DevInfoService { /** * 查询公司列表 + * * @param obj * @return */ @@ -285,6 +288,17 @@ public class DevInfoServiceImpl implements DevInfoService { return devInfoMapper.selectCompanyList(obj); } + @Override + public int updateUpDown(DevInfo devInfo) { + List maIds = devInfo.getMaIds(); + String maStatus = devInfo.getMaStatus(); + int i = 0; + if (CollectionUtil.isNotEmpty(maIds)) { + i = devInfoMapper.updateUpDown(maIds, maStatus); + } + return i; + } + @Override public void insertOutType(String devInfo) { ObjectMapper objectMapper = new ObjectMapper(); diff --git a/bonus-modules/bonus-material-mall/src/main/resources/mapper/material/device/DevInfoMapper.xml b/bonus-modules/bonus-material-mall/src/main/resources/mapper/material/device/DevInfoMapper.xml index 96bfee2..cdc7e67 100644 --- a/bonus-modules/bonus-material-mall/src/main/resources/mapper/material/device/DevInfoMapper.xml +++ b/bonus-modules/bonus-material-mall/src/main/resources/mapper/material/device/DevInfoMapper.xml @@ -417,6 +417,27 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" set search_num = search_num + 1 where ma_id = #{maId} + + + + + + update ma_dev_info + set ma_status = #{maStatus} + where ma_id = #{maIds[0]} + + + + update ma_dev_info + set ma_status = #{maStatus} + where ma_id in + + #{maId} + + + + +