修改设备类型
This commit is contained in:
@ -134,4 +134,5 @@ public class APPUserController {
|
|||||||
// appUserService.sendSms(phoneNumber);
|
// appUserService.sendSms(phoneNumber);
|
||||||
return ResponseVO.success("success!!!");
|
return ResponseVO.success("success!!!");
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -56,10 +56,12 @@ public class APPDeviceServiceImpl extends ServiceImpl<APPDeviceMapper, APPDevice
|
|||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public PageResult<APPDevice> appDeviceList(Page<APPDevice> page, DeviceQueryCriteria criteria) {
|
public PageResult<APPDevice> appDeviceList(Page<APPDevice> page, DeviceQueryCriteria criteria) {
|
||||||
|
criteria.setCustomerId(SecurityUtils.getCurrentUserId());
|
||||||
IPage<APPDevice> devices = appDeviceMapper.appDeviceList(page, criteria);
|
IPage<APPDevice> devices = appDeviceMapper.appDeviceList(page, criteria);
|
||||||
return new PageResult<>(devices.getRecords(), devices.getTotal());
|
return new PageResult<>(devices.getRecords(), devices.getTotal());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* APP用户设备类型列表
|
* APP用户设备类型列表
|
||||||
*
|
*
|
||||||
|
@ -1,9 +1,13 @@
|
|||||||
package com.fuyuanshen.modules.system.service.impl;
|
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.core.conditions.query.QueryWrapper;
|
||||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
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.domain.DeviceTypeGrants;
|
||||||
|
import com.fuyuanshen.modules.system.mapper.DeviceMapper;
|
||||||
import com.fuyuanshen.modules.system.mapper.DeviceTypeGrantsMapper;
|
import com.fuyuanshen.modules.system.mapper.DeviceTypeGrantsMapper;
|
||||||
import com.fuyuanshen.modules.utils.NanoId;
|
import com.fuyuanshen.modules.utils.NanoId;
|
||||||
import com.fuyuanshen.utils.enums.NanoIdLengthEnum;
|
import com.fuyuanshen.utils.enums.NanoIdLengthEnum;
|
||||||
@ -41,6 +45,7 @@ import java.util.stream.Collectors;
|
|||||||
public class DeviceTypeServiceImpl extends ServiceImpl<DeviceTypeMapper, DeviceType> implements DeviceTypeService {
|
public class DeviceTypeServiceImpl extends ServiceImpl<DeviceTypeMapper, DeviceType> implements DeviceTypeService {
|
||||||
|
|
||||||
private final DeviceTypeMapper deviceTypeMapper;
|
private final DeviceTypeMapper deviceTypeMapper;
|
||||||
|
private final DeviceMapper deviceMapper;
|
||||||
private final UserMapper userMapper;
|
private final UserMapper userMapper;
|
||||||
private final UserCacheManager userCacheManager;
|
private final UserCacheManager userCacheManager;
|
||||||
private final DeviceTypeGrantsMapper deviceTypeGrantsMapper;
|
private final DeviceTypeGrantsMapper deviceTypeGrantsMapper;
|
||||||
@ -142,9 +147,20 @@ public class DeviceTypeServiceImpl extends ServiceImpl<DeviceTypeMapper, DeviceT
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 修改设备类型
|
||||||
|
*
|
||||||
|
* @param resources /
|
||||||
|
*/
|
||||||
@Override
|
@Override
|
||||||
@Transactional(rollbackFor = Exception.class)
|
@Transactional(rollbackFor = Exception.class)
|
||||||
public void update(DeviceType resources) {
|
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 deviceType = getById(resources.getId());
|
||||||
deviceType.copy(resources);
|
deviceType.copy(resources);
|
||||||
Timestamp timestamp = new Timestamp(System.currentTimeMillis());
|
Timestamp timestamp = new Timestamp(System.currentTimeMillis());
|
||||||
@ -153,6 +169,11 @@ public class DeviceTypeServiceImpl extends ServiceImpl<DeviceTypeMapper, DeviceT
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 删除设备类型
|
||||||
|
*
|
||||||
|
* @param ids /
|
||||||
|
*/
|
||||||
@Override
|
@Override
|
||||||
@Transactional(rollbackFor = Exception.class)
|
@Transactional(rollbackFor = Exception.class)
|
||||||
public void deleteAll(List<Long> ids) {
|
public void deleteAll(List<Long> ids) {
|
||||||
|
@ -61,6 +61,6 @@
|
|||||||
and dt.create_by = #{criteria.createBy}
|
and dt.create_by = #{criteria.createBy}
|
||||||
</if>
|
</if>
|
||||||
</where>
|
</where>
|
||||||
order by create_time desc
|
ORDER BY create_time DESC
|
||||||
</select>
|
</select>
|
||||||
</mapper>
|
</mapper>
|
Reference in New Issue
Block a user