app设备类型查询
This commit is contained in:
@ -37,8 +37,7 @@ public class APPDeviceController {
|
||||
public TableDataInfo<APPDevice> appDeviceList(@RequestBody APPDeviceQueryCriteria criteria) {
|
||||
Page<APPDevice> page = new Page<>(criteria.getPage(), criteria.getSize());
|
||||
|
||||
TableDataInfo<APPDevice> devices = appDeviceService.appDeviceList(page, criteria);
|
||||
return devices;
|
||||
return appDeviceService.appDeviceList(page, criteria);
|
||||
}
|
||||
|
||||
|
||||
@ -69,11 +68,12 @@ public class APPDeviceController {
|
||||
|
||||
|
||||
@PostMapping(value = "/unbind")
|
||||
@Operation(summary = "WEB端APP客户设备解绑")
|
||||
@Operation(summary = "设备解绑")
|
||||
public ResponseVO<String> unbindAPPDevice(@Validated @ModelAttribute APPUnbindDTO deviceForm) {
|
||||
appDeviceService.unbindAPPDevice(deviceForm);
|
||||
return ResponseVO.success("解绑成功!!!");
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
@ -0,0 +1,21 @@
|
||||
package com.fuyuanshen.app.domain.dto;
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import jakarta.validation.constraints.NotBlank;
|
||||
import jakarta.validation.constraints.NotNull;
|
||||
import lombok.Data;
|
||||
|
||||
|
||||
/**
|
||||
* @author: 默苍璃
|
||||
* @date: 2025-06-1818:36
|
||||
*/
|
||||
@Data
|
||||
public class APPReNameDTO {
|
||||
|
||||
private Long id;
|
||||
|
||||
@NotBlank(message = "设备名称不能为空")
|
||||
private String deviceName;
|
||||
|
||||
}
|
@ -0,0 +1,15 @@
|
||||
package com.fuyuanshen.app.domain.vo;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
|
||||
@Data
|
||||
public class APPDeviceTypeVo {
|
||||
|
||||
private Long id;
|
||||
|
||||
private String typeName;
|
||||
|
||||
private String communicationMode;
|
||||
|
||||
}
|
@ -4,10 +4,14 @@ import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.fuyuanshen.app.domain.APPDevice;
|
||||
import com.fuyuanshen.app.domain.APPDeviceType;
|
||||
import com.fuyuanshen.app.domain.query.APPDeviceQueryCriteria;
|
||||
import com.fuyuanshen.app.domain.vo.APPDeviceTypeVo;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @Description:
|
||||
* @Author: WY
|
||||
@ -36,4 +40,5 @@ public interface APPDeviceMapper extends BaseMapper<APPDevice> {
|
||||
IPage<APPDevice> queryAll(Page<APPDevice> page, @Param("criteria") APPDeviceQueryCriteria criteria);
|
||||
|
||||
|
||||
List<APPDeviceTypeVo> getTypeList(@Param("userId") Long userId);
|
||||
}
|
||||
|
@ -4,9 +4,10 @@ import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import com.fuyuanshen.app.domain.APPDevice;
|
||||
import com.fuyuanshen.app.domain.APPDeviceType;
|
||||
import com.fuyuanshen.app.domain.dto.APPReNameDTO;
|
||||
import com.fuyuanshen.app.domain.dto.APPUnbindDTO;
|
||||
import com.fuyuanshen.app.domain.query.APPDeviceQueryCriteria;
|
||||
import com.fuyuanshen.common.core.domain.PageResult;
|
||||
import com.fuyuanshen.app.domain.vo.APPDeviceTypeVo;
|
||||
import com.fuyuanshen.common.mybatis.core.page.TableDataInfo;
|
||||
|
||||
import java.util.List;
|
||||
@ -58,4 +59,7 @@ public interface APPDeviceService extends IService<APPDevice> {
|
||||
void unbindAPPDevice(APPUnbindDTO deviceForm);
|
||||
|
||||
|
||||
List<APPDeviceTypeVo> getTypeList();
|
||||
|
||||
void reName(APPReNameDTO reNameDTO);
|
||||
}
|
||||
|
@ -3,20 +3,23 @@ package com.fuyuanshen.app.service.impl.equipment;
|
||||
import cn.hutool.core.bean.BeanUtil;
|
||||
import cn.hutool.core.collection.CollectionUtil;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.fuyuanshen.app.domain.APPDevice;
|
||||
import com.fuyuanshen.app.domain.APPDeviceType;
|
||||
import com.fuyuanshen.app.domain.dto.APPReNameDTO;
|
||||
import com.fuyuanshen.app.domain.dto.APPUnbindDTO;
|
||||
import com.fuyuanshen.app.domain.query.APPDeviceQueryCriteria;
|
||||
import com.fuyuanshen.app.domain.vo.APPDeviceTypeVo;
|
||||
import com.fuyuanshen.app.enums.UserType;
|
||||
import com.fuyuanshen.app.mapper.equipment.APPDeviceMapper;
|
||||
import com.fuyuanshen.app.mapper.equipment.AppDeviceTypeMapper;
|
||||
import com.fuyuanshen.app.service.equipment.APPDeviceService;
|
||||
import com.fuyuanshen.common.core.domain.PageResult;
|
||||
import com.fuyuanshen.common.core.exception.BadRequestException;
|
||||
import com.fuyuanshen.common.mybatis.core.page.TableDataInfo;
|
||||
import com.fuyuanshen.common.satoken.utils.AppLoginHelper;
|
||||
import com.fuyuanshen.common.satoken.utils.LoginHelper;
|
||||
import com.fuyuanshen.equipment.domain.Device;
|
||||
import com.fuyuanshen.equipment.domain.DeviceType;
|
||||
@ -32,7 +35,6 @@ import org.springframework.transaction.annotation.Transactional;
|
||||
import java.sql.Timestamp;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
* @Description:
|
||||
@ -192,5 +194,20 @@ public class APPDeviceServiceImpl extends ServiceImpl<APPDeviceMapper, APPDevice
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<APPDeviceTypeVo> getTypeList() {
|
||||
Long userId = AppLoginHelper.getUserId();
|
||||
return appDeviceMapper.getTypeList(userId);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void reName(APPReNameDTO reNameDTO) {
|
||||
UpdateWrapper<Device> updateWrapper = new UpdateWrapper<>();
|
||||
updateWrapper.eq("id", reNameDTO.getId())
|
||||
.eq("binding_user_id", AppLoginHelper.getUserId())
|
||||
.set("device_name", reNameDTO.getDeviceName());
|
||||
deviceMapper.update(updateWrapper);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
@ -87,5 +87,10 @@
|
||||
order by d.create_time desc
|
||||
</select>
|
||||
|
||||
<select id="getTypeList" resultType="com.fuyuanshen.app.domain.vo.APPDeviceTypeVo">
|
||||
SELECT dt.id, dt.type_name, dt.communication_mode FROM device_type dt
|
||||
WHERE EXISTS(select 1 from device d where d.device_type = dt.id and d.binding_user_id = #{userId} AND d.binding_status = 1 )
|
||||
</select>
|
||||
|
||||
|
||||
</mapper>
|
@ -107,4 +107,5 @@ public class Device extends TenantEntity {
|
||||
*/
|
||||
private String createByName;
|
||||
|
||||
private Long bindingUserId;
|
||||
}
|
||||
|
@ -27,4 +27,9 @@ public class AppDeviceVo {
|
||||
* 通讯方式 0:4G;1:蓝牙
|
||||
*/
|
||||
private Integer communicationMode;
|
||||
|
||||
/**
|
||||
* 设备图片
|
||||
*/
|
||||
private String devicePic;
|
||||
}
|
||||
|
@ -90,4 +90,5 @@ public interface DeviceService extends IService<Device> {
|
||||
int bindDevice(AppDeviceBo bo);
|
||||
|
||||
int unBindDevice(Long id);
|
||||
|
||||
}
|
||||
|
@ -496,7 +496,7 @@ public class DeviceServiceImpl extends ServiceImpl<DeviceMapper, Device> impleme
|
||||
deviceUpdateWrapper.eq("id", device.getId())
|
||||
.set("binding_status", BindingStatusEnum.BOUND.getCode())
|
||||
.set("binding_user_id",userId);
|
||||
return baseMapper.update(null, qw);
|
||||
return baseMapper.update(null, deviceUpdateWrapper);
|
||||
}else{
|
||||
throw new RuntimeException("通讯方式错误");
|
||||
}
|
||||
@ -509,11 +509,10 @@ public class DeviceServiceImpl extends ServiceImpl<DeviceMapper, Device> impleme
|
||||
if(device == null){
|
||||
throw new RuntimeException("请先将设备入库!!!");
|
||||
}
|
||||
// DeviceType deviceType = deviceTypeMapper.selectById(device.getDeviceType());
|
||||
// String mode = deviceType.getCommunicationMode();
|
||||
UpdateWrapper<Device> deviceUpdateWrapper = new UpdateWrapper<>();
|
||||
deviceUpdateWrapper.eq("id", device.getId())
|
||||
.set("binding_status", BindingStatusEnum.UNBOUND.getCode());
|
||||
|
||||
return baseMapper.update(null, deviceUpdateWrapper);
|
||||
}
|
||||
|
||||
|
@ -96,9 +96,12 @@
|
||||
<select id="queryAppDeviceList" resultType="com.fuyuanshen.equipment.domain.vo.AppDeviceVo">
|
||||
select
|
||||
d.id, d.device_name, d.device_mac, d.device_sn,
|
||||
d.device_imei, d.device_mac ,dt.communication_mode
|
||||
d.device_imei, d.device_mac ,dt.communication_mode,d.device_pic
|
||||
from device d inner join device_type dt on d.device_type = dt.id
|
||||
where d.binding_user_id = #{criteria.bindingUserId}
|
||||
where d.binding_user_id = #{criteria.bindingUserId} and d.binding_status = 1
|
||||
<if test="criteria.deviceType != null">
|
||||
and d.device_type = #{criteria.deviceType}
|
||||
</if>
|
||||
</select>
|
||||
|
||||
<!-- 获取分配设备的客户 -->
|
||||
|
Reference in New Issue
Block a user