Merge remote-tracking branch 'origin/master'
This commit is contained in:
commit
6eea48f7a9
|
|
@ -21,7 +21,7 @@ public class BonusMaterialMallApplication
|
||||||
public static void main(String[] args)
|
public static void main(String[] args)
|
||||||
{
|
{
|
||||||
SpringApplication.run(BonusMaterialMallApplication.class, args);
|
SpringApplication.run(BonusMaterialMallApplication.class, args);
|
||||||
System.out.println("(♥◠‿◠)ノ゙ 2024机具租赁商城启动成功 ლ(´ڡ`ლ)゙ \n" +
|
System.out.println("(♥◠‿◠)ノ゙ 2024安徽机械化装备平台启动成功 ლ(´ڡ`ლ)゙ \n" +
|
||||||
" .-------. ____ __ \n" +
|
" .-------. ____ __ \n" +
|
||||||
" | _ _ \\ \\ \\ / / \n" +
|
" | _ _ \\ \\ \\ / / \n" +
|
||||||
" | ( ' ) | \\ _. / ' \n" +
|
" | ( ' ) | \\ _. / ' \n" +
|
||||||
|
|
|
||||||
|
|
@ -430,6 +430,14 @@ public class DevInfoServiceImpl implements DevInfoService {
|
||||||
return sumTypeMap;
|
return sumTypeMap;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询设备信息列表
|
||||||
|
* 该方法根据传入的DevInfoVo对象中的属性值,查询符合条件的设备信息列表
|
||||||
|
* 主要用于设备信息的批量查询筛选
|
||||||
|
*
|
||||||
|
* @param devInfo 包含查询条件的DevInfoVo对象,用于指定查询的设备信息条件
|
||||||
|
* @return 返回一个DevInfoVo对象列表,包含所有符合条件的设备信息
|
||||||
|
*/
|
||||||
@Override
|
@Override
|
||||||
public List<DevInfoVo> selectDevInfoLists(DevInfoVo devInfo) {
|
public List<DevInfoVo> selectDevInfoLists(DevInfoVo devInfo) {
|
||||||
return devInfoMapper.selectDevInfoLists(devInfo);
|
return devInfoMapper.selectDevInfoLists(devInfo);
|
||||||
|
|
@ -443,20 +451,31 @@ public class DevInfoServiceImpl implements DevInfoService {
|
||||||
return devInfoMapper.selectCompanyList(obj);
|
return devInfoMapper.selectCompanyList(obj);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 更新设备的上下架状态
|
||||||
|
*
|
||||||
|
* @param devInfo 包含设备ID列表和新状态的设备信息对象
|
||||||
|
* @return AjaxResult对象,操作结果或错误信息
|
||||||
|
*/
|
||||||
@Override
|
@Override
|
||||||
public AjaxResult updateUpDown(DevInfo devInfo) {
|
public AjaxResult updateUpDown(DevInfo devInfo) {
|
||||||
|
// 检查是否提供了设备ID列表和新状态
|
||||||
if (devInfo == null || CollectionUtil.isEmpty(devInfo.getMaIds())) {
|
if (devInfo == null || CollectionUtil.isEmpty(devInfo.getMaIds())) {
|
||||||
return AjaxResult.warn("请选择设备");
|
return AjaxResult.warn("请选择设备");
|
||||||
}
|
}
|
||||||
if (devInfo.getMaStatus() == null) {
|
if (devInfo.getMaStatus() == null) {
|
||||||
return AjaxResult.warn("请选择设备状态");
|
return AjaxResult.warn("请选择设备状态");
|
||||||
}
|
}
|
||||||
|
|
||||||
devInfo.getMaIds().removeIf(Objects::isNull);
|
devInfo.getMaIds().removeIf(Objects::isNull);
|
||||||
List<Long> maIds = devInfo.getMaIds();
|
List<Long> maIds = devInfo.getMaIds();
|
||||||
|
|
||||||
if (CollectionUtil.isNotEmpty(maIds)) {
|
if (CollectionUtil.isNotEmpty(maIds)) {
|
||||||
for (Long maId : maIds) {
|
for (Long maId : maIds) {
|
||||||
Integer oldStatus = devInfoMapper.getMaStatusByMaId(maId);
|
Integer oldStatus = devInfoMapper.getMaStatusByMaId(maId);
|
||||||
Integer newStatus = devInfo.getMaStatus();
|
Integer newStatus = devInfo.getMaStatus();
|
||||||
|
|
||||||
|
// 根据旧状态和新状态进行状态转换检查
|
||||||
switch (oldStatus) {
|
switch (oldStatus) {
|
||||||
case 0:
|
case 0:
|
||||||
if (newStatus.equals(TO_BE_LISTED.getCode()) || newStatus.equals(ON_HIRE.getCode())) {continue;}
|
if (newStatus.equals(TO_BE_LISTED.getCode()) || newStatus.equals(ON_HIRE.getCode())) {continue;}
|
||||||
|
|
@ -473,12 +492,14 @@ public class DevInfoServiceImpl implements DevInfoService {
|
||||||
return AjaxResult.warn("设备ID:" + maId + "设备状态异常,请修改后重试");
|
return AjaxResult.warn("设备ID:" + maId + "设备状态异常,请修改后重试");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
try {
|
try {
|
||||||
devInfoMapper.updateUpDown(maIds, devInfo.getMaStatus());
|
devInfoMapper.updateUpDown(maIds, devInfo.getMaStatus());
|
||||||
} catch (DataAccessException e) {
|
} catch (DataAccessException e) {
|
||||||
throw new ServiceException("批量修改状态时SQL执行异常:" + e.getMessage());
|
throw new ServiceException("批量修改状态时SQL执行异常:" + e.getMessage());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return AjaxResult.success("操作成功");
|
return AjaxResult.success("操作成功");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue