|
@@ -2,6 +2,7 @@ package com.xy.service;
|
|
|
|
|
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
|
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
|
|
+import com.xy.dbmapper.SyncUpdate;
|
|
|
import com.xy.dto.DeviceStatusDto;
|
|
|
import com.xy.dto.DeviceTempRecordsDto;
|
|
|
import com.xy.entity.DeviceStatus;
|
|
@@ -17,6 +18,7 @@ import org.springframework.stereotype.Service;
|
|
|
import org.springframework.web.bind.annotation.PostMapping;
|
|
|
import org.springframework.web.bind.annotation.RequestBody;
|
|
|
|
|
|
+import java.math.BigDecimal;
|
|
|
import java.time.LocalDateTime;
|
|
|
import java.util.List;
|
|
|
|
|
@@ -56,6 +58,24 @@ public class DeviceStatusServiceImpl extends ServiceImpl<DeviceStatusMapper, Dev
|
|
|
return R.ok();
|
|
|
}
|
|
|
|
|
|
+ /**
|
|
|
+ * 修改库存
|
|
|
+ *
|
|
|
+ * @return
|
|
|
+ */
|
|
|
+ public R upStock(long deviceId, int stock) {
|
|
|
+ DeviceStatus deviceStatusInfo = getById(deviceId);
|
|
|
+ if (deviceStatusInfo == null) {
|
|
|
+ return R.ok();
|
|
|
+ }
|
|
|
+ new SyncUpdate().update(DeviceStatus.class)
|
|
|
+ .set(DeviceStatus::getStock, new BigDecimal(stock))
|
|
|
+ .udateDateTime(DeviceStatus::getUpdateTime)
|
|
|
+ .eq(DeviceStatus::getDeviceId, deviceId)
|
|
|
+ .exec();
|
|
|
+ return R.ok();
|
|
|
+ }
|
|
|
+
|
|
|
@PostMapping("obj")
|
|
|
@ApiOperation("对象查询")
|
|
|
public R<DeviceStatusDto.Vo> obj(@RequestBody DeviceStatusDto.Vo vo) {
|