forked from dyf/fys-Multi-tenant
APP:客户设备管理
This commit is contained in:
@ -39,8 +39,8 @@ public class EncryptUtilsTest {
|
||||
loginBody.setClientId("e5cd7e4891bf95d1d19206ce24a7b32e");
|
||||
loginBody.setGrantType("password");
|
||||
loginBody.setTenantId("894078");
|
||||
loginBody.setCode("9");
|
||||
loginBody.setUuid("64d5a9107e4949f3ba8f57ede00bd034");
|
||||
loginBody.setCode("10");
|
||||
loginBody.setUuid("390942eb87174dcc9c2c074b066b1b79");
|
||||
// loginBody.setUsername("admin");
|
||||
// loginBody.setPassword("admin123");
|
||||
loginBody.setUsername("dyf");
|
||||
|
@ -0,0 +1,89 @@
|
||||
package com.fuyuanshen.app.controller.equipment;
|
||||
|
||||
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.dto.APPUnbindDTO;
|
||||
import com.fuyuanshen.app.domain.query.APPDeviceQueryCriteria;
|
||||
import com.fuyuanshen.app.service.equipment.APPDeviceService;
|
||||
import com.fuyuanshen.common.core.domain.PageResult;
|
||||
import com.fuyuanshen.common.core.domain.ResponseVO;
|
||||
import io.swagger.v3.oas.annotations.Operation;
|
||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @Description:
|
||||
* @Author: WY
|
||||
* @Date: 2025/5/16
|
||||
**/
|
||||
@Slf4j
|
||||
@Tag(name = "APP:客户设备管理", description = "APP:客户设备管理")
|
||||
@RestController
|
||||
@RequiredArgsConstructor
|
||||
@RequestMapping("/api/app/device")
|
||||
public class APPDeviceController {
|
||||
|
||||
private final APPDeviceService appDeviceService;
|
||||
|
||||
|
||||
@PostMapping(value = "/list")
|
||||
@Operation(summary = "APP客户设备列表")
|
||||
public ResponseVO<PageResult<APPDevice>> appDeviceList(@RequestBody APPDeviceQueryCriteria criteria) {
|
||||
Page<APPDevice> page = new Page<>(criteria.getPage(), criteria.getSize());
|
||||
PageResult<APPDevice> devices = null;
|
||||
try {
|
||||
devices = appDeviceService.appDeviceList(page, criteria);
|
||||
} catch (Exception e) {
|
||||
log.error("queryDevice error: " + e.getMessage());
|
||||
return ResponseVO.fail("");
|
||||
}
|
||||
return ResponseVO.success(devices);
|
||||
}
|
||||
|
||||
|
||||
@PostMapping(value = "/typeList")
|
||||
@Operation(summary = "APP客户设备类型列表")
|
||||
public ResponseVO<List<APPDeviceType>> appTypeList(@RequestBody APPDeviceQueryCriteria criteria) {
|
||||
List<APPDeviceType> typeList = appDeviceService.appTypeList(criteria);
|
||||
return ResponseVO.success(typeList);
|
||||
}
|
||||
|
||||
|
||||
@PostMapping(value = "/bind")
|
||||
@Operation(summary = "APP客户设备绑定")
|
||||
public ResponseVO<String> appBindDevice(@RequestBody APPDeviceQueryCriteria criteria) {
|
||||
appDeviceService.appBindDevice(criteria);
|
||||
return ResponseVO.success("绑定成功!");
|
||||
}
|
||||
|
||||
|
||||
@GetMapping
|
||||
@Operation(summary = "WEB端查看APP客户设备绑定")
|
||||
public ResponseVO<PageResult<APPDevice>> queryAPPDevice(APPDeviceQueryCriteria criteria) {
|
||||
Page<APPDevice> page = new Page<>(criteria.getPage(), criteria.getSize());
|
||||
PageResult<APPDevice> devices = null;
|
||||
try {
|
||||
devices = appDeviceService.queryAll(page, criteria);
|
||||
} catch (Exception e) {
|
||||
log.error("queryDevice error: " + e.getMessage());
|
||||
return ResponseVO.fail("");
|
||||
}
|
||||
return ResponseVO.success(devices);
|
||||
}
|
||||
|
||||
|
||||
@PostMapping(value = "/unbind")
|
||||
@Operation(summary = "WEB端APP客户设备解绑")
|
||||
public ResponseVO<String> unbindAPPDevice(@Validated @ModelAttribute APPUnbindDTO deviceForm) {
|
||||
appDeviceService.unbindAPPDevice(deviceForm);
|
||||
return ResponseVO.success("解绑成功!!!");
|
||||
}
|
||||
|
||||
|
||||
}
|
@ -0,0 +1,106 @@
|
||||
package com.fuyuanshen.app.domain;
|
||||
|
||||
import cn.hutool.core.bean.BeanUtil;
|
||||
import cn.hutool.core.bean.copier.CopyOptions;
|
||||
import com.baomidou.mybatisplus.annotation.IdType;
|
||||
import com.baomidou.mybatisplus.annotation.TableField;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import com.fuyuanshen.common.tenant.core.TenantEntity;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.Data;
|
||||
|
||||
/**
|
||||
* @Description: 设备表
|
||||
* @Author: WY
|
||||
* @Date: 2025/5/16
|
||||
**/
|
||||
@Data
|
||||
@TableName("app_device")
|
||||
public class APPDevice extends TenantEntity {
|
||||
|
||||
@TableId(value = "app_device_id", type = IdType.AUTO)
|
||||
@Schema(name = "ID")
|
||||
private Long id;
|
||||
|
||||
@Schema(name = "设备类型")
|
||||
private Long deviceType;
|
||||
|
||||
@Schema(name = "设备类型名称")
|
||||
private String deviceTypeName;
|
||||
|
||||
@Schema(name = "客户号")
|
||||
private Long customerId;
|
||||
|
||||
@Schema(name = "所属客户")
|
||||
private String customerName;
|
||||
|
||||
/*@Schema(name = "设备编号")
|
||||
private String deviceNo;*/
|
||||
|
||||
@Schema(name = "设备名称")
|
||||
private String deviceName;
|
||||
|
||||
@Schema(name = "设备图片")
|
||||
private String devicePic;
|
||||
|
||||
@Schema(name = "设备MAC")
|
||||
private String deviceMac;
|
||||
|
||||
@Schema(name = "设备IMEI")
|
||||
private String deviceImei;
|
||||
|
||||
@Schema(name = "设备SN")
|
||||
private String deviceSn;
|
||||
|
||||
@Schema(name = "经度")
|
||||
private String longitude;
|
||||
|
||||
@Schema(name = "纬度")
|
||||
private String latitude;
|
||||
|
||||
@Schema(name = "备注")
|
||||
private String remark;
|
||||
|
||||
@TableField(exist = false)
|
||||
@Schema(name = "设备类型名称")
|
||||
private String typeName;
|
||||
|
||||
/**
|
||||
* 租户ID
|
||||
*/
|
||||
@TableField(value = "tenant_id")
|
||||
@Schema(hidden = true)
|
||||
private String tenantId;
|
||||
|
||||
/**
|
||||
* 设备状态
|
||||
* 0 失效
|
||||
* 1 正常
|
||||
*/
|
||||
@Schema(name = "设备状态")
|
||||
private Integer deviceStatus;
|
||||
|
||||
/**
|
||||
* 绑定状态
|
||||
* 0 未绑定
|
||||
* 1 已绑定
|
||||
*/
|
||||
@Schema(name = "绑定状态")
|
||||
private Integer bindingStatus;
|
||||
|
||||
/**
|
||||
* 绑定类型
|
||||
* 0 APP
|
||||
* 1 小程序
|
||||
*/
|
||||
@Schema(name = "绑定类型")
|
||||
private Integer bindingType;
|
||||
|
||||
|
||||
public void copy(APPDevice source) {
|
||||
BeanUtil.copyProperties(source, this, CopyOptions.create().setIgnoreNullValue(true));
|
||||
}
|
||||
|
||||
|
||||
}
|
@ -0,0 +1,56 @@
|
||||
package com.fuyuanshen.app.domain;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.IdType;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import com.fuyuanshen.common.tenant.core.TenantEntity;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import jakarta.validation.constraints.NotBlank;
|
||||
import lombok.Data;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
/**
|
||||
* @Description: 设备类型
|
||||
* @Author: WY
|
||||
* @Date: 2025/5/14
|
||||
**/
|
||||
@Data
|
||||
@TableName("app_device_type")
|
||||
public class APPDeviceType extends TenantEntity {
|
||||
|
||||
@TableId(value = "id", type = IdType.AUTO)
|
||||
@Schema(name = "ID", hidden = true)
|
||||
private Long id;
|
||||
|
||||
@Schema(name = "客户号")
|
||||
private Long customerId;
|
||||
|
||||
@Schema(name = "创建该类型的客户")
|
||||
private Long ownerCustomerId;
|
||||
|
||||
/**
|
||||
* 租户ID
|
||||
*/
|
||||
// @TableField(value = "tenant_id")
|
||||
// @ApiModelProperty(hidden = true)
|
||||
// private Long tenantId;
|
||||
|
||||
@NotBlank(message = "设备类型名称不能为空")
|
||||
@Schema(name = "类型名称", required = true)
|
||||
private String typeName;
|
||||
|
||||
@Schema(name = "是否支持蓝牙")
|
||||
private Boolean isSupportBle;
|
||||
|
||||
@Schema(name = "定位方式", example = "0:无;1:GPS;2:基站;3:wifi;4:北斗")
|
||||
private String locateMode;
|
||||
|
||||
@Schema(name = "联网方式", example = "0:无;1:4G;2:WIFI")
|
||||
private String networkWay;
|
||||
|
||||
@Schema(name = "通讯方式", example = "0:4G;1:蓝牙")
|
||||
private String communicationMode;
|
||||
|
||||
|
||||
}
|
@ -0,0 +1,26 @@
|
||||
package com.fuyuanshen.app.domain.dto;
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import jakarta.validation.constraints.NotNull;
|
||||
import lombok.Data;
|
||||
|
||||
|
||||
/**
|
||||
* @author: 默苍璃
|
||||
* @date: 2025-06-1818:36
|
||||
*/
|
||||
@Data
|
||||
public class APPUnbindDTO {
|
||||
|
||||
// @NotBlank(message = "设备MAC不能为空")
|
||||
@Schema(name = "设备MAC", required = true)
|
||||
private String deviceMac;
|
||||
|
||||
@Schema(name = "设备IMEI")
|
||||
private String deviceImei;
|
||||
|
||||
@NotNull(message = "客户号不能为空")
|
||||
@Schema(name = "客户号")
|
||||
private Long customerId;
|
||||
|
||||
}
|
@ -0,0 +1,65 @@
|
||||
package com.fuyuanshen.app.domain.query;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.Data;
|
||||
|
||||
import java.sql.Timestamp;
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
|
||||
/**
|
||||
* @Description:
|
||||
* @Author: WY
|
||||
* @Date: 2025/5/16
|
||||
**/
|
||||
@Data
|
||||
public class APPDeviceQueryCriteria {
|
||||
|
||||
@Schema(name = "设备名称")
|
||||
private String deviceName;
|
||||
|
||||
@Schema(name = "设备类型")
|
||||
private Long deviceType;
|
||||
|
||||
@Schema(name = "设备MAC")
|
||||
private String deviceMac;
|
||||
|
||||
@Schema(name = "设备IMEI")
|
||||
private String deviceImei;
|
||||
|
||||
@Schema(name = "设备SN")
|
||||
private String deviceSn;
|
||||
|
||||
/**
|
||||
* 设备状态
|
||||
* 0 失效
|
||||
* 1 正常
|
||||
*/
|
||||
@Schema(name = "设备状态 0 失效 1 正常 ")
|
||||
private Integer deviceStatus;
|
||||
|
||||
@JsonFormat(pattern = "yyyy-MM-dd'T'HH:mm:ss'Z'")
|
||||
@Schema(name = "创建时间")
|
||||
private List<Timestamp> createTime;
|
||||
|
||||
@Schema(name = "页码", example = "1")
|
||||
private Integer page = 1;
|
||||
|
||||
@Schema(name = "每页数据量", example = "10")
|
||||
private Integer size = 10;
|
||||
|
||||
@Schema(name = "客户id")
|
||||
private Long customerId;
|
||||
private Set<Long> customerIds;
|
||||
|
||||
@Schema(name = "当前所有者")
|
||||
private Long currentOwnerId;
|
||||
|
||||
@Schema(name = "租户ID")
|
||||
private Long tenantId;
|
||||
|
||||
@Schema(name = "通讯方式", example = "0:4G;1:蓝牙")
|
||||
private Integer communicationMode;
|
||||
|
||||
}
|
@ -0,0 +1,39 @@
|
||||
package com.fuyuanshen.app.mapper.equipment;
|
||||
|
||||
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.query.APPDeviceQueryCriteria;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
|
||||
/**
|
||||
* @Description:
|
||||
* @Author: WY
|
||||
* @Date: 2025/5/16
|
||||
**/
|
||||
@Mapper
|
||||
public interface APPDeviceMapper extends BaseMapper<APPDevice> {
|
||||
|
||||
/**
|
||||
* APP用户设备列表
|
||||
*
|
||||
* @param page
|
||||
* @param criteria
|
||||
* @return
|
||||
*/
|
||||
IPage<APPDevice> appDeviceList(Page<APPDevice> page,@Param("criteria") APPDeviceQueryCriteria criteria);
|
||||
|
||||
|
||||
/**
|
||||
* 分页查询APP/小程序设备
|
||||
*
|
||||
* @param criteria
|
||||
* @param page
|
||||
* @return
|
||||
*/
|
||||
IPage<APPDevice> queryAll(Page<APPDevice> page, @Param("criteria") APPDeviceQueryCriteria criteria);
|
||||
|
||||
|
||||
}
|
@ -0,0 +1,60 @@
|
||||
package com.fuyuanshen.app.service.equipment;
|
||||
|
||||
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.APPUnbindDTO;
|
||||
import com.fuyuanshen.app.domain.query.APPDeviceQueryCriteria;
|
||||
import com.fuyuanshen.common.core.domain.PageResult;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @Description:
|
||||
* @Author: WY
|
||||
* @Date: 2025/5/16
|
||||
**/
|
||||
public interface APPDeviceService extends IService<APPDevice> {
|
||||
|
||||
/**
|
||||
* APP用户设备列表
|
||||
*
|
||||
* @param criteria
|
||||
*/
|
||||
PageResult<APPDevice> appDeviceList(Page<APPDevice> page, APPDeviceQueryCriteria criteria);
|
||||
|
||||
|
||||
/**
|
||||
* APP用户设备类型列表
|
||||
*
|
||||
* @param criteria
|
||||
* @return
|
||||
*/
|
||||
List<APPDeviceType> appTypeList(APPDeviceQueryCriteria criteria);
|
||||
|
||||
/**
|
||||
* APP/小程序用户设备绑定
|
||||
*
|
||||
* @param criteria
|
||||
*/
|
||||
void appBindDevice(APPDeviceQueryCriteria criteria);
|
||||
|
||||
/**
|
||||
* 分页查询APP/小程序设备绑定
|
||||
*
|
||||
* @param criteria
|
||||
* @param page
|
||||
* @return
|
||||
*/
|
||||
PageResult<APPDevice> queryAll(Page<APPDevice> page, APPDeviceQueryCriteria criteria);
|
||||
|
||||
/**
|
||||
* APP/小程序用户设备解绑
|
||||
*
|
||||
* @param deviceForm
|
||||
*/
|
||||
void unbindAPPDevice(APPUnbindDTO deviceForm);
|
||||
|
||||
|
||||
}
|
@ -0,0 +1,182 @@
|
||||
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.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.APPUnbindDTO;
|
||||
import com.fuyuanshen.app.domain.query.APPDeviceQueryCriteria;
|
||||
import com.fuyuanshen.app.mapper.equipment.APPDeviceMapper;
|
||||
import com.fuyuanshen.app.service.equipment.APPDeviceService;
|
||||
import com.fuyuanshen.common.core.domain.PageResult;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import java.sql.Timestamp;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
* @Description:
|
||||
* @Author: WY
|
||||
* @Date: 2025/5/16
|
||||
**/
|
||||
@Slf4j
|
||||
@Service
|
||||
@RequiredArgsConstructor
|
||||
public class APPDeviceServiceImpl extends ServiceImpl<APPDeviceMapper, APPDevice> implements APPDeviceService {
|
||||
|
||||
private final APPDeviceMapper appDeviceMapper;
|
||||
|
||||
|
||||
/**
|
||||
* APP用户设备列表
|
||||
*
|
||||
* @param criteria
|
||||
*/
|
||||
@Override
|
||||
public PageResult<APPDevice> appDeviceList(Page<APPDevice> page, APPDeviceQueryCriteria criteria) {
|
||||
// criteria.setCustomerId(SecurityUtils.getCurrentUserId());
|
||||
// IPage<APPDevice> devices = appDeviceMapper.appDeviceList(page, criteria);
|
||||
// return new PageResult<>(devices.getRecords(), devices.getTotal());
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* APP用户设备类型列表
|
||||
*
|
||||
* @param criteria
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
public List<APPDeviceType> appTypeList(APPDeviceQueryCriteria criteria) {
|
||||
// criteria.setCustomerId(SecurityUtils.getCurrentUserId());
|
||||
// return appDeviceTypeMapper.appTypeList(criteria);
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* APP/小程序用户设备绑定
|
||||
*
|
||||
* @param criteria
|
||||
*/
|
||||
@Override
|
||||
@Transactional
|
||||
public void appBindDevice(APPDeviceQueryCriteria criteria) {
|
||||
//
|
||||
// List<Device> devices = new ArrayList<>();
|
||||
//
|
||||
// if (criteria.getCommunicationMode().equals(CommunicationModeEnum.BLUETOOTH.getValue())) {
|
||||
// devices = deviceMapper.selectList(new QueryWrapper<Device>().eq("device_mac", criteria.getDeviceMac()));
|
||||
// if (CollectionUtil.isEmpty(devices)) {
|
||||
// throw new BadRequestException("请先将设备入库!!!");
|
||||
// }
|
||||
// List<APPDevice> appDevices = appDeviceMapper.selectList(new QueryWrapper<APPDevice>()
|
||||
// .eq("device_mac", criteria.getDeviceMac()).eq("binding_type", UserType.APP.getValue()));
|
||||
// if (CollectionUtil.isNotEmpty(appDevices)) {
|
||||
// throw new BadRequestException("该设备已绑定!!!");
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// if (criteria.getCommunicationMode().equals(CommunicationModeEnum.FOUR_G.getValue())) {
|
||||
// devices = deviceMapper.selectList(new QueryWrapper<Device>().eq("device_imei", criteria.getDeviceImei()));
|
||||
// if (CollectionUtil.isEmpty(devices)) {
|
||||
// throw new BadRequestException("请先将设备入库!!!");
|
||||
// }
|
||||
// List<APPDevice> appDevices = appDeviceMapper.selectList(new QueryWrapper<APPDevice>()
|
||||
// .eq("device_imei", criteria.getDeviceImei()).eq("binding_type", UserType.APP.getValue()));
|
||||
// if (CollectionUtil.isNotEmpty(appDevices)) {
|
||||
// throw new BadRequestException("该设备已绑定!!!");
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// Device device = devices.get(0);
|
||||
// device.setBindingStatus(BindingStatusEnum.BOUND.getCode());
|
||||
// deviceMapper.updateById(device);
|
||||
//
|
||||
// APPDevice appDevice = new APPDevice();
|
||||
// BeanUtil.copyProperties(device, appDevice);
|
||||
// appDevice.setBindingType(UserType.APP.getValue());
|
||||
// appDevice.setBindingStatus(BindingStatusEnum.BOUND.getCode());
|
||||
// Long currentUserId = SecurityUtils.getCurrentUserId();
|
||||
// appDevice.setCustomerId(currentUserId);
|
||||
// appDevice.setCreateTime(new Timestamp(System.currentTimeMillis()));
|
||||
// // 设备类型名称
|
||||
// appDevice.setDeviceTypeName(device.getTypeName());
|
||||
// appDeviceMapper.insert(appDevice);
|
||||
//
|
||||
// APPDeviceType appDeviceType = appDeviceTypeMapper.selectById(device.getDeviceType());
|
||||
// if (appDeviceType == null) {
|
||||
// DeviceType deviceType = deviceTypeMapper.selectById(device.getDeviceType());
|
||||
// APPDeviceType type = new APPDeviceType();
|
||||
// BeanUtil.copyProperties(deviceType, type);
|
||||
// type.setCustomerId(currentUserId);
|
||||
// appDeviceTypeMapper.insert(type);
|
||||
// }
|
||||
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 分页查询APP/小程序设备
|
||||
*
|
||||
* @param criteria
|
||||
* @param page
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
public PageResult<APPDevice> queryAll(Page<APPDevice> page, APPDeviceQueryCriteria criteria) {
|
||||
// IPage<APPDevice> devices = appDeviceMapper.queryAll(page, criteria);
|
||||
// return new PageResult<>(devices.getRecords(), devices.getTotal());
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* APP/小程序用户设备解绑
|
||||
*
|
||||
* @param deviceForm
|
||||
*/
|
||||
@Override
|
||||
@Transactional
|
||||
public void unbindAPPDevice(APPUnbindDTO deviceForm) {
|
||||
// QueryWrapper<APPDevice> queryWrapper = new QueryWrapper<>();
|
||||
// QueryWrapper<Device> qw = new QueryWrapper<>();
|
||||
// if (StringUtils.isNotEmpty(deviceForm.getDeviceMac())) {
|
||||
// queryWrapper.eq("device_mac", deviceForm.getDeviceMac());
|
||||
// qw.eq("device_mac", deviceForm.getDeviceMac());
|
||||
// }
|
||||
// if (StringUtils.isNotEmpty(deviceForm.getDeviceImei())) {
|
||||
// queryWrapper.eq("device_imei", deviceForm.getDeviceImei());
|
||||
// qw.eq("device_imei", deviceForm.getDeviceImei());
|
||||
// }
|
||||
// queryWrapper.eq("binding_type", UserType.APP.getValue());
|
||||
// APPDevice appDevice = appDeviceMapper.selectOne(queryWrapper);
|
||||
// appDeviceMapper.delete(queryWrapper);
|
||||
//
|
||||
// List<Device> devices = deviceMapper.selectList(qw);
|
||||
// List<Long> ids = devices.stream()
|
||||
// .map(Device::getId)
|
||||
// .collect(Collectors.toList());
|
||||
// if (CollectionUtil.isNotEmpty(ids)) {
|
||||
// appDeviceTypeMapper.deleteBatchIds(ids);
|
||||
// }
|
||||
// Device device = new Device();
|
||||
// device.setId(appDevice.getId());
|
||||
// device.setBindingStatus(BindingStatusEnum.UNBOUND.getCode());
|
||||
// deviceMapper.updateById(device);
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
@ -0,0 +1,91 @@
|
||||
<?xml version="1.0" encoding="UTF-8" ?>
|
||||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd" >
|
||||
<mapper namespace="com.fuyuanshen.app.mapper.equipment.APPDeviceMapper">
|
||||
<resultMap id="BaseResultMap" type="com.fuyuanshen.app.domain.APPDevice">
|
||||
<id column="id" property="id"/>
|
||||
<result column="device_type" property="deviceType"/>
|
||||
<result column="customer_id" property="customerId"/>
|
||||
<!--<result column="device_no" property="deviceNo"/>-->
|
||||
<result column="device_name" property="deviceName"/>
|
||||
<result column="device_pic" property="devicePic"/>
|
||||
<result column="device_mac" property="deviceMac"/>
|
||||
<result column="device_sn" property="deviceSn"/>
|
||||
<result column="device_status" property="deviceStatus"/>
|
||||
<result column="remark" property="remark"/>
|
||||
<result column="create_by" property="createBy"/>
|
||||
<result column="update_by" property="updateBy"/>
|
||||
<result column="create_time" property="createTime"/>
|
||||
<result column="update_time" property="updateTime"/>
|
||||
<result column="binding_status" property="bindingStatus"/>
|
||||
</resultMap>
|
||||
|
||||
<!-- APP用户设备列表 -->
|
||||
<select id="appDeviceList" resultType="com.fuyuanshen.app.domain.APPDevice">
|
||||
select d.* from app_device as d
|
||||
<where>
|
||||
<!-- 时间范围等其他条件保持原样 -->
|
||||
<if test="criteria.deviceName != null and criteria.deviceName.trim() != ''">
|
||||
and d.device_name like concat('%', TRIM(#{criteria.deviceName}), '%')
|
||||
</if>
|
||||
<if test="criteria.deviceMac != null and criteria.deviceMac.trim() != ''">
|
||||
and d.device_mac = #{criteria.deviceMac}
|
||||
</if>
|
||||
<if test="criteria.deviceImei != null and criteria.deviceImei.trim() != ''">
|
||||
and d.device_imei = #{criteria.deviceImei}
|
||||
</if>
|
||||
<if test="criteria.deviceSn != null">
|
||||
and d.device_sn = #{criteria.deviceSn}
|
||||
</if>
|
||||
<if test="criteria.deviceType != null">
|
||||
and d.device_type = #{criteria.deviceType}
|
||||
</if>
|
||||
<if test="criteria.deviceStatus != null">
|
||||
and d.device_status = #{criteria.deviceStatus}
|
||||
</if>
|
||||
<if test="criteria.createTime != null and criteria.createTime.size() != 0">
|
||||
and d.create_time between #{criteria.createTime[0]} and #{criteria.createTime[1]}
|
||||
</if>
|
||||
<if test="criteria.tenantId != null">
|
||||
AND tenant_id = #{criteria.tenantId}
|
||||
</if>
|
||||
and d.customer_id = #{criteria.customerId}
|
||||
</where>
|
||||
order by d.create_time desc
|
||||
</select>
|
||||
|
||||
<!-- 分页查询APP/小程序设备 -->
|
||||
<select id="queryAll" resultType="com.fuyuanshen.app.domain.APPDevice">
|
||||
select d.* from app_device as d
|
||||
<where>
|
||||
<!-- 时间范围等其他条件保持原样 -->
|
||||
<if test="criteria.deviceName != null and criteria.deviceName.trim() != ''">
|
||||
and d.device_name like concat('%', TRIM(#{criteria.deviceName}), '%')
|
||||
</if>
|
||||
<if test="criteria.deviceMac != null and criteria.deviceMac.trim() != ''">
|
||||
and d.device_mac = #{criteria.deviceMac}
|
||||
</if>
|
||||
<if test="criteria.deviceImei != null and criteria.deviceImei.trim() != ''">
|
||||
and d.device_imei = #{criteria.deviceImei}
|
||||
</if>
|
||||
<if test="criteria.deviceSn != null">
|
||||
and d.device_sn = #{criteria.deviceSn}
|
||||
</if>
|
||||
<if test="criteria.deviceType != null">
|
||||
and d.device_type = #{criteria.deviceType}
|
||||
</if>
|
||||
<if test="criteria.deviceStatus != null">
|
||||
and d.device_status = #{criteria.deviceStatus}
|
||||
</if>
|
||||
<if test="criteria.createTime != null and criteria.createTime.size() != 0">
|
||||
and d.create_time between #{criteria.createTime[0]} and #{criteria.createTime[1]}
|
||||
</if>
|
||||
<if test="criteria.tenantId != null">
|
||||
AND tenant_id = #{criteria.tenantId}
|
||||
</if>
|
||||
and d.customer_id = #{criteria.customerId}
|
||||
</where>
|
||||
order by d.create_time desc
|
||||
</select>
|
||||
|
||||
|
||||
</mapper>
|
Reference in New Issue
Block a user