forked from dyf/fys-Multi-tenant
web:更新设备信息
This commit is contained in:
@ -32,7 +32,16 @@ public interface DeviceMapper extends BaseMapper<Device> {
|
|||||||
|
|
||||||
List<Device> findAllDevices(@Param("criteria") DeviceQueryCriteria criteria);
|
List<Device> findAllDevices(@Param("criteria") DeviceQueryCriteria criteria);
|
||||||
|
|
||||||
Page<AppDeviceVo> queryAppDeviceList(Page<AppDeviceVo> page,@Param("criteria") DeviceQueryCriteria criteria);
|
/**
|
||||||
|
* 根据条件查询
|
||||||
|
*
|
||||||
|
* @param criteria
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
List<Device> findDevices(@Param("criteria") DeviceQueryCriteria criteria);
|
||||||
|
|
||||||
|
Page<AppDeviceVo> queryAppDeviceList(Page<AppDeviceVo> page, @Param("criteria") DeviceQueryCriteria criteria);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 获取分配设备的客户
|
* 获取分配设备的客户
|
||||||
*
|
*
|
||||||
|
@ -31,7 +31,6 @@ import com.fuyuanshen.equipment.domain.vo.CustomerVo;
|
|||||||
import com.fuyuanshen.equipment.enums.BindingStatusEnum;
|
import com.fuyuanshen.equipment.enums.BindingStatusEnum;
|
||||||
import com.fuyuanshen.equipment.enums.CommunicationModeEnum;
|
import com.fuyuanshen.equipment.enums.CommunicationModeEnum;
|
||||||
import com.fuyuanshen.equipment.enums.DeviceActiveStatusEnum;
|
import com.fuyuanshen.equipment.enums.DeviceActiveStatusEnum;
|
||||||
import com.fuyuanshen.equipment.enums.DeviceStatusEnum;
|
|
||||||
import com.fuyuanshen.equipment.mapper.DeviceAssignmentsMapper;
|
import com.fuyuanshen.equipment.mapper.DeviceAssignmentsMapper;
|
||||||
import com.fuyuanshen.equipment.mapper.DeviceMapper;
|
import com.fuyuanshen.equipment.mapper.DeviceMapper;
|
||||||
import com.fuyuanshen.equipment.mapper.DeviceTypeGrantsMapper;
|
import com.fuyuanshen.equipment.mapper.DeviceTypeGrantsMapper;
|
||||||
@ -52,7 +51,9 @@ import java.io.File;
|
|||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.sql.Timestamp;
|
import java.sql.Timestamp;
|
||||||
import java.time.LocalDateTime;
|
import java.time.LocalDateTime;
|
||||||
import java.util.*;
|
import java.util.ArrayList;
|
||||||
|
import java.util.Date;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @Description:
|
* @Description:
|
||||||
@ -205,16 +206,12 @@ public class DeviceServiceImpl extends ServiceImpl<DeviceMapper, Device> impleme
|
|||||||
if (deviceTypes.isEmpty()) {
|
if (deviceTypes.isEmpty()) {
|
||||||
throw new Exception("设备类型不存在!!!");
|
throw new Exception("设备类型不存在!!!");
|
||||||
}
|
}
|
||||||
|
Device device = deviceMapper.selectById(deviceAssignments.getDeviceId());
|
||||||
DeviceQueryCriteria queryCriteria = new DeviceQueryCriteria();
|
if (device == null) {
|
||||||
queryCriteria.setDeviceId(deviceAssignments.getDeviceId());
|
|
||||||
queryCriteria.setCustomerId(LoginHelper.getUserId());
|
|
||||||
queryCriteria.setCurrentOwnerId(LoginHelper.getUserId());
|
|
||||||
List<Device> devices = deviceMapper.findAll(queryCriteria);
|
|
||||||
if (devices.isEmpty()) {
|
|
||||||
throw new Exception("设备不存在!!!");
|
throw new Exception("设备不存在!!!");
|
||||||
}
|
}
|
||||||
Device device = devices.get(0);
|
// 设备类型
|
||||||
|
Long deviceType = device.getDeviceType();
|
||||||
|
|
||||||
// 处理上传的图片
|
// 处理上传的图片
|
||||||
if (deviceForm.getFile() != null) {
|
if (deviceForm.getFile() != null) {
|
||||||
@ -226,6 +223,7 @@ public class DeviceServiceImpl extends ServiceImpl<DeviceMapper, Device> impleme
|
|||||||
// 更新字段
|
// 更新字段
|
||||||
BeanUtil.copyProperties(deviceForm, device, true);
|
BeanUtil.copyProperties(deviceForm, device, true);
|
||||||
device.setId(deviceAssignments.getDeviceId());
|
device.setId(deviceAssignments.getDeviceId());
|
||||||
|
device.setDeviceType(deviceType);
|
||||||
device.setUpdateTime(new Timestamp(System.currentTimeMillis()));
|
device.setUpdateTime(new Timestamp(System.currentTimeMillis()));
|
||||||
deviceMapper.updateById(device);
|
deviceMapper.updateById(device);
|
||||||
}
|
}
|
||||||
|
@ -133,6 +133,38 @@
|
|||||||
order by d.id desc
|
order by d.id desc
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
|
<!-- 根据条件查询 -->
|
||||||
|
<select id="findDevices" resultType="com.fuyuanshen.equipment.domain.Device"
|
||||||
|
parameterType="com.fuyuanshen.equipment.domain.query.DeviceQueryCriteria">
|
||||||
|
SELECT d.*
|
||||||
|
FROM device 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 d.device_mac = #{criteria.deviceMac}
|
||||||
|
</if>
|
||||||
|
<if test="criteria.deviceImei != null">
|
||||||
|
and d.device_imei = #{criteria.deviceImei}
|
||||||
|
</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.currentOwnerId != null">
|
||||||
|
and d.current_owner_id = #{criteria.currentOwnerId}
|
||||||
|
</if>
|
||||||
|
<if test="criteria.params.beginTime != null and criteria.params.endTime != null">
|
||||||
|
and d.create_time between #{criteria.params.beginTime} and #{criteria.params.endTime}
|
||||||
|
</if>
|
||||||
|
</where>
|
||||||
|
</select>
|
||||||
|
|
||||||
|
|
||||||
<select id="queryAppDeviceList" resultType="com.fuyuanshen.equipment.domain.vo.AppDeviceVo">
|
<select id="queryAppDeviceList" resultType="com.fuyuanshen.equipment.domain.vo.AppDeviceVo">
|
||||||
select d.id,
|
select d.id,
|
||||||
d.device_name,
|
d.device_name,
|
||||||
|
Reference in New Issue
Block a user