Compare commits

2 Commits

Author SHA1 Message Date
837953bf3d 设备类型ID 2025-08-27 10:20:37 +08:00
8b25fd9ba4 设备操作记录 2025-08-27 09:25:08 +08:00
5 changed files with 55 additions and 7 deletions

View File

@ -4,6 +4,7 @@ package com.fuyuanshen.web.controller.device;
import com.fuyuanshen.app.domain.AppPersonnelInfoRecords; import com.fuyuanshen.app.domain.AppPersonnelInfoRecords;
import com.fuyuanshen.common.core.domain.R; import com.fuyuanshen.common.core.domain.R;
import com.fuyuanshen.common.web.core.BaseController; import com.fuyuanshen.common.web.core.BaseController;
import com.fuyuanshen.equipment.domain.DeviceLog;
import com.fuyuanshen.equipment.domain.vo.WebDeviceVo; import com.fuyuanshen.equipment.domain.vo.WebDeviceVo;
import com.fuyuanshen.web.service.WEBDeviceService; import com.fuyuanshen.web.service.WEBDeviceService;
import io.swagger.v3.oas.annotations.Operation; import io.swagger.v3.oas.annotations.Operation;
@ -60,13 +61,27 @@ public class WEBDeviceController extends BaseController {
/** /**
* 设备用户详情 * 设备用户详情
* *
* @param id * @param deviceId
* @return * @return
*/ */
@Operation(summary = "设备详情") @Operation(summary = "设备详情")
@GetMapping(value = "/getDeviceUser/{id}") @GetMapping(value = "/getDeviceUser/{deviceId}")
public R<List<AppPersonnelInfoRecords>> getDeviceUser(@PathVariable Long id) { public R<List<AppPersonnelInfoRecords>> getDeviceUser(@PathVariable Long deviceId) {
List<AppPersonnelInfoRecords> device = deviceService.getDeviceUser(id); List<AppPersonnelInfoRecords> device = deviceService.getDeviceUser(deviceId);
return R.ok(device);
}
/**
* 设备操作记录
*
* @param deviceId
* @return
*/
@Operation(summary = "设备操作记录")
@GetMapping(value = "/getOperationRecord/{deviceId}")
public R<List<DeviceLog>> getOperationRecord(@PathVariable Long deviceId) {
List<DeviceLog> device = deviceService.getOperationRecord(deviceId);
return R.ok(device); return R.ok(device);
} }

View File

@ -6,6 +6,7 @@ import com.fuyuanshen.app.domain.AppPersonnelInfoRecords;
import com.fuyuanshen.common.mybatis.core.page.PageQuery; import com.fuyuanshen.common.mybatis.core.page.PageQuery;
import com.fuyuanshen.common.mybatis.core.page.TableDataInfo; import com.fuyuanshen.common.mybatis.core.page.TableDataInfo;
import com.fuyuanshen.equipment.domain.Device; import com.fuyuanshen.equipment.domain.Device;
import com.fuyuanshen.equipment.domain.DeviceLog;
import com.fuyuanshen.equipment.domain.dto.AppDeviceBo; import com.fuyuanshen.equipment.domain.dto.AppDeviceBo;
import com.fuyuanshen.equipment.domain.form.DeviceForm; import com.fuyuanshen.equipment.domain.form.DeviceForm;
import com.fuyuanshen.equipment.domain.query.DeviceQueryCriteria; import com.fuyuanshen.equipment.domain.query.DeviceQueryCriteria;
@ -45,6 +46,13 @@ public interface WEBDeviceService extends IService<Device> {
* @param id * @param id
* @return * @return
*/ */
List<AppPersonnelInfoRecords> getDeviceUser(Long id); List<AppPersonnelInfoRecords> getDeviceUser(Long id);
/**
* 设备操作记录
*
* @param deviceId
* @return
*/
List<DeviceLog> getOperationRecord(Long deviceId);
} }

View File

@ -13,9 +13,11 @@ import com.fuyuanshen.app.mapper.AppDeviceShareMapper;
import com.fuyuanshen.app.mapper.AppPersonnelInfoRecordsMapper; import com.fuyuanshen.app.mapper.AppPersonnelInfoRecordsMapper;
import com.fuyuanshen.equipment.domain.Device; import com.fuyuanshen.equipment.domain.Device;
import com.fuyuanshen.equipment.domain.DeviceAssignments; import com.fuyuanshen.equipment.domain.DeviceAssignments;
import com.fuyuanshen.equipment.domain.DeviceLog;
import com.fuyuanshen.equipment.domain.vo.WebDeviceVo; import com.fuyuanshen.equipment.domain.vo.WebDeviceVo;
import com.fuyuanshen.equipment.enums.BindingStatusEnum; import com.fuyuanshen.equipment.enums.BindingStatusEnum;
import com.fuyuanshen.equipment.mapper.DeviceAssignmentsMapper; import com.fuyuanshen.equipment.mapper.DeviceAssignmentsMapper;
import com.fuyuanshen.equipment.mapper.DeviceLogMapper;
import com.fuyuanshen.equipment.mapper.DeviceMapper; import com.fuyuanshen.equipment.mapper.DeviceMapper;
import com.fuyuanshen.web.service.WEBDeviceService; import com.fuyuanshen.web.service.WEBDeviceService;
import com.fuyuanshen.web.service.device.DeviceBizService; import com.fuyuanshen.web.service.device.DeviceBizService;
@ -40,6 +42,7 @@ public class WEBDeviceServiceImpl extends ServiceImpl<DeviceMapper, Device> impl
private final AppDeviceBindRecordMapper appDeviceBindRecordMapper; private final AppDeviceBindRecordMapper appDeviceBindRecordMapper;
private final AppPersonnelInfoRecordsMapper infoRecordsMapper; private final AppPersonnelInfoRecordsMapper infoRecordsMapper;
private final DeviceLogMapper deviceLogMapper;
private final DeviceMapper deviceMapper; private final DeviceMapper deviceMapper;
private final AppDeviceShareMapper appDeviceShareMapper; private final AppDeviceShareMapper appDeviceShareMapper;
@ -115,4 +118,19 @@ public class WEBDeviceServiceImpl extends ServiceImpl<DeviceMapper, Device> impl
} }
/**
* 设备操作记录
*
* @param deviceId
* @return
*/
@Override
public List<DeviceLog> getOperationRecord(Long deviceId) {
List<DeviceLog> logList = deviceLogMapper.selectList(
new QueryWrapper<DeviceLog>().eq("device_id", deviceId)
.orderByDesc("create_time"));
return logList;
}
} }

View File

@ -21,6 +21,12 @@ public class DeviceType extends TenantEntity {
@Schema(title = "ID", hidden = true) @Schema(title = "ID", hidden = true)
private Long id; private Long id;
/**
* 设备类型ID
*/
@TableField(exist = false)
private Long deviceTypeId;
@Schema(title = "客户号") @Schema(title = "客户号")
private Long customerId; private Long customerId;

View File

@ -4,6 +4,7 @@
<resultMap id="BaseResultMap" type="com.fuyuanshen.equipment.domain.DeviceType"> <resultMap id="BaseResultMap" type="com.fuyuanshen.equipment.domain.DeviceType">
<id column="grant_id" property="id"/> <id column="grant_id" property="id"/>
<result column="type_name" property="typeName"/> <result column="type_name" property="typeName"/>
<result column="device_type_id" property="deviceTypeId"/>
<result column="is_support_ble" property="isSupportBle"/> <result column="is_support_ble" property="isSupportBle"/>
<result column="locate_mode" property="locateMode"/> <result column="locate_mode" property="locateMode"/>
<result column="network_way" property="networkWay"/> <result column="network_way" property="networkWay"/>
@ -21,7 +22,7 @@
<!-- 查询所有设备类型 --> <!-- 查询所有设备类型 -->
<select id="findAll" resultMap="BaseResultMap"> <select id="findAll" resultMap="BaseResultMap">
SELECT DISTINCT dt.* ,dg.id AS grant_id ,dg.create_time AS Dcreate_time SELECT DISTINCT dt.* ,dg.id AS grant_id ,dg.create_time AS Dcreate_time,dt.id AS device_type_id
FROM device_type dt FROM device_type dt
JOIN device_type_grants dg ON dt.id = dg.device_type_id JOIN device_type_grants dg ON dt.id = dg.device_type_id
<where> <where>
@ -44,7 +45,7 @@
</select> </select>
<!-- 根据名称查询设备类型 --> <!-- 根据名称查询设备类型 -->
<select id="queryByName" resultMap="BaseResultMap" <select id="queryByName" resultMap="BaseResultMap"
parameterType="com.fuyuanshen.equipment.domain.query.DeviceTypeQueryCriteria"> parameterType="com.fuyuanshen.equipment.domain.query.DeviceTypeQueryCriteria">
SELECT dt.*, dg.id AS grant_id SELECT dt.*, dg.id AS grant_id
FROM device_type dt FROM device_type dt