修改设备类型

This commit is contained in:
2025-06-26 09:52:51 +08:00
parent 968f1cbb16
commit cb57a595aa
4 changed files with 25 additions and 1 deletions

View File

@ -134,4 +134,5 @@ public class APPUserController {
// appUserService.sendSms(phoneNumber);
return ResponseVO.success("success");
}
}

View File

@ -56,10 +56,12 @@ public class APPDeviceServiceImpl extends ServiceImpl<APPDeviceMapper, APPDevice
*/
@Override
public PageResult<APPDevice> appDeviceList(Page<APPDevice> page, DeviceQueryCriteria criteria) {
criteria.setCustomerId(SecurityUtils.getCurrentUserId());
IPage<APPDevice> devices = appDeviceMapper.appDeviceList(page, criteria);
return new PageResult<>(devices.getRecords(), devices.getTotal());
}
/**
* APP用户设备类型列表
*

View File

@ -1,9 +1,13 @@
package com.fuyuanshen.modules.system.service.impl;
import cn.hutool.core.collection.CollectionUtil;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.fuyuanshen.exception.BadRequestException;
import com.fuyuanshen.modules.system.domain.Device;
import com.fuyuanshen.modules.system.domain.DeviceTypeGrants;
import com.fuyuanshen.modules.system.mapper.DeviceMapper;
import com.fuyuanshen.modules.system.mapper.DeviceTypeGrantsMapper;
import com.fuyuanshen.modules.utils.NanoId;
import com.fuyuanshen.utils.enums.NanoIdLengthEnum;
@ -41,6 +45,7 @@ import java.util.stream.Collectors;
public class DeviceTypeServiceImpl extends ServiceImpl<DeviceTypeMapper, DeviceType> implements DeviceTypeService {
private final DeviceTypeMapper deviceTypeMapper;
private final DeviceMapper deviceMapper;
private final UserMapper userMapper;
private final UserCacheManager userCacheManager;
private final DeviceTypeGrantsMapper deviceTypeGrantsMapper;
@ -142,9 +147,20 @@ public class DeviceTypeServiceImpl extends ServiceImpl<DeviceTypeMapper, DeviceT
}
/**
* 修改设备类型
*
* @param resources /
*/
@Override
@Transactional(rollbackFor = Exception.class)
public void update(DeviceType resources) {
List<Device> deviceList = deviceMapper.selectList(new QueryWrapper<Device>().eq("device_type", resources.getId()));
if (CollectionUtil.isNotEmpty(deviceList)) {
throw new BadRequestException("该设备类型下已有设备,请先解绑设备!!!");
}
DeviceType deviceType = getById(resources.getId());
deviceType.copy(resources);
Timestamp timestamp = new Timestamp(System.currentTimeMillis());
@ -153,6 +169,11 @@ public class DeviceTypeServiceImpl extends ServiceImpl<DeviceTypeMapper, DeviceT
}
/**
* 删除设备类型
*
* @param ids /
*/
@Override
@Transactional(rollbackFor = Exception.class)
public void deleteAll(List<Long> ids) {

View File

@ -61,6 +61,6 @@
and dt.create_by = #{criteria.createBy}
</if>
</where>
order by create_time desc
ORDER BY create_time DESC
</select>
</mapper>