代码提交

This commit is contained in:
liang.chao 2025-11-13 18:20:27 +08:00
parent 099f9af785
commit 5b32b4c07d
1 changed files with 10 additions and 0 deletions

View File

@ -6,6 +6,7 @@ import com.bonus.waterdesign.domain.DeviceRecord;
import com.bonus.waterdesign.domain.SelectDto;
import com.bonus.waterdesign.mapper.DeviceMapper;
import com.bonus.waterdesign.service.DeviceService;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
@ -79,6 +80,12 @@ public class DeviceServiceImpl implements DeviceService {
@Override
public AjaxResult use(DeviceRecord dto) {
if (StringUtils.isBlank(dto.getUserId())){
return AjaxResult.error("请选择领用人");
}
if (StringUtils.isBlank(dto.getStartTime())){
return AjaxResult.error("请选择领用时间");
}
int update = deviceMapper.updateStatus(dto);
if (update > 0) {
deviceMapper.addUseRecord(dto);
@ -89,6 +96,9 @@ public class DeviceServiceImpl implements DeviceService {
@Override
public AjaxResult returnDevice(DeviceRecord dto) {
if (StringUtils.isBlank(dto.getEndTime())){
return AjaxResult.error("请选择归还时间");
}
int update = deviceMapper.updateStatus(dto);
if (update > 0) {
deviceMapper.updateReturnRecord(dto);