Merge branch 'dyf-device' into 6170
This commit is contained in:
@ -1,26 +1,26 @@
|
|||||||
package com.fuyuanshen.web.controller.device;
|
package com.fuyuanshen.web.controller.device;
|
||||||
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
import lombok.RequiredArgsConstructor;
|
|
||||||
import jakarta.servlet.http.HttpServletResponse;
|
|
||||||
import jakarta.validation.constraints.*;
|
|
||||||
import cn.dev33.satoken.annotation.SaCheckPermission;
|
|
||||||
import org.springframework.web.bind.annotation.*;
|
|
||||||
import org.springframework.validation.annotation.Validated;
|
|
||||||
import com.fuyuanshen.common.idempotent.annotation.RepeatSubmit;
|
|
||||||
import com.fuyuanshen.common.log.annotation.Log;
|
|
||||||
import com.fuyuanshen.common.web.core.BaseController;
|
|
||||||
import com.fuyuanshen.common.mybatis.core.page.PageQuery;
|
|
||||||
import com.fuyuanshen.common.core.domain.R;
|
import com.fuyuanshen.common.core.domain.R;
|
||||||
import com.fuyuanshen.common.core.validate.AddGroup;
|
import com.fuyuanshen.common.core.validate.AddGroup;
|
||||||
import com.fuyuanshen.common.core.validate.EditGroup;
|
import com.fuyuanshen.common.core.validate.EditGroup;
|
||||||
import com.fuyuanshen.common.log.enums.BusinessType;
|
|
||||||
import com.fuyuanshen.common.excel.utils.ExcelUtil;
|
import com.fuyuanshen.common.excel.utils.ExcelUtil;
|
||||||
import com.fuyuanshen.equipment.domain.vo.DeviceAlarmVo;
|
import com.fuyuanshen.common.idempotent.annotation.RepeatSubmit;
|
||||||
import com.fuyuanshen.equipment.domain.bo.DeviceAlarmBo;
|
import com.fuyuanshen.common.log.annotation.Log;
|
||||||
import com.fuyuanshen.equipment.service.IDeviceAlarmService;
|
import com.fuyuanshen.common.log.enums.BusinessType;
|
||||||
|
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.common.web.core.BaseController;
|
||||||
|
import com.fuyuanshen.equipment.domain.bo.DeviceAlarmBo;
|
||||||
|
import com.fuyuanshen.equipment.domain.vo.DeviceAlarmVo;
|
||||||
|
import com.fuyuanshen.equipment.service.IDeviceAlarmService;
|
||||||
|
import jakarta.servlet.http.HttpServletResponse;
|
||||||
|
import jakarta.validation.constraints.NotEmpty;
|
||||||
|
import jakarta.validation.constraints.NotNull;
|
||||||
|
import lombok.RequiredArgsConstructor;
|
||||||
|
import org.springframework.validation.annotation.Validated;
|
||||||
|
import org.springframework.web.bind.annotation.*;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 设备告警
|
* 设备告警
|
||||||
@ -36,6 +36,7 @@ public class DeviceAlarmController extends BaseController {
|
|||||||
|
|
||||||
private final IDeviceAlarmService deviceAlarmService;
|
private final IDeviceAlarmService deviceAlarmService;
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 查询设备告警列表
|
* 查询设备告警列表
|
||||||
*/
|
*/
|
||||||
|
@ -0,0 +1,105 @@
|
|||||||
|
package com.fuyuanshen.web.controller.device;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
import lombok.RequiredArgsConstructor;
|
||||||
|
import jakarta.servlet.http.HttpServletResponse;
|
||||||
|
import jakarta.validation.constraints.*;
|
||||||
|
import cn.dev33.satoken.annotation.SaCheckPermission;
|
||||||
|
import org.springframework.web.bind.annotation.*;
|
||||||
|
import org.springframework.validation.annotation.Validated;
|
||||||
|
import com.fuyuanshen.common.idempotent.annotation.RepeatSubmit;
|
||||||
|
import com.fuyuanshen.common.log.annotation.Log;
|
||||||
|
import com.fuyuanshen.common.web.core.BaseController;
|
||||||
|
import com.fuyuanshen.common.mybatis.core.page.PageQuery;
|
||||||
|
import com.fuyuanshen.common.core.domain.R;
|
||||||
|
import com.fuyuanshen.common.core.validate.AddGroup;
|
||||||
|
import com.fuyuanshen.common.core.validate.EditGroup;
|
||||||
|
import com.fuyuanshen.common.log.enums.BusinessType;
|
||||||
|
import com.fuyuanshen.common.excel.utils.ExcelUtil;
|
||||||
|
import com.fuyuanshen.equipment.domain.vo.DeviceChargeDischargeVo;
|
||||||
|
import com.fuyuanshen.equipment.domain.bo.DeviceChargeDischargeBo;
|
||||||
|
import com.fuyuanshen.equipment.service.IDeviceChargeDischargeService;
|
||||||
|
import com.fuyuanshen.common.mybatis.core.page.TableDataInfo;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 设备充放电记录
|
||||||
|
*
|
||||||
|
* @author Lion Li
|
||||||
|
* @date 2025-08-30
|
||||||
|
*/
|
||||||
|
@Validated
|
||||||
|
@RequiredArgsConstructor
|
||||||
|
@RestController
|
||||||
|
@RequestMapping("/equipment/chargeDischarge")
|
||||||
|
public class DeviceChargeDischargeController extends BaseController {
|
||||||
|
|
||||||
|
private final IDeviceChargeDischargeService deviceChargeDischargeService;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询设备充放电记录列表
|
||||||
|
*/
|
||||||
|
@SaCheckPermission("equipment:chargeDischarge:list")
|
||||||
|
@GetMapping("/list")
|
||||||
|
public TableDataInfo<DeviceChargeDischargeVo> list(DeviceChargeDischargeBo bo, PageQuery pageQuery) {
|
||||||
|
return deviceChargeDischargeService.queryPageList(bo, pageQuery);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 设备充放电记录列表
|
||||||
|
*/
|
||||||
|
@SaCheckPermission("equipment:chargeDischarge:export")
|
||||||
|
@Log(title = "设备充放电记录", businessType = BusinessType.EXPORT)
|
||||||
|
@PostMapping("/export")
|
||||||
|
public void export(DeviceChargeDischargeBo bo, HttpServletResponse response) {
|
||||||
|
List<DeviceChargeDischargeVo> list = deviceChargeDischargeService.queryList(bo);
|
||||||
|
ExcelUtil.exportExcel(list, "设备充放电记录", DeviceChargeDischargeVo.class, response);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取设备充放电记录详细信息
|
||||||
|
*
|
||||||
|
* @param id 主键
|
||||||
|
*/
|
||||||
|
@SaCheckPermission("equipment:chargeDischarge:query")
|
||||||
|
@GetMapping("/{id}")
|
||||||
|
public R<DeviceChargeDischargeVo> getInfo(@NotNull(message = "主键不能为空")
|
||||||
|
@PathVariable Long id) {
|
||||||
|
return R.ok(deviceChargeDischargeService.queryById(id));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 新增设备充放电记录
|
||||||
|
*/
|
||||||
|
@SaCheckPermission("equipment:chargeDischarge:add")
|
||||||
|
@Log(title = "设备充放电记录", businessType = BusinessType.INSERT)
|
||||||
|
@RepeatSubmit()
|
||||||
|
@PostMapping()
|
||||||
|
public R<Void> add(@Validated(AddGroup.class) @RequestBody DeviceChargeDischargeBo bo) {
|
||||||
|
return toAjax(deviceChargeDischargeService.insertByBo(bo));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 修改设备充放电记录
|
||||||
|
*/
|
||||||
|
@SaCheckPermission("equipment:chargeDischarge:edit")
|
||||||
|
@Log(title = "设备充放电记录", businessType = BusinessType.UPDATE)
|
||||||
|
@RepeatSubmit()
|
||||||
|
@PutMapping()
|
||||||
|
public R<Void> edit(@Validated(EditGroup.class) @RequestBody DeviceChargeDischargeBo bo) {
|
||||||
|
return toAjax(deviceChargeDischargeService.updateByBo(bo));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 删除设备充放电记录
|
||||||
|
*
|
||||||
|
* @param ids 主键串
|
||||||
|
*/
|
||||||
|
@SaCheckPermission("equipment:chargeDischarge:remove")
|
||||||
|
@Log(title = "设备充放电记录", businessType = BusinessType.DELETE)
|
||||||
|
@DeleteMapping("/{ids}")
|
||||||
|
public R<Void> remove(@NotEmpty(message = "主键不能为空")
|
||||||
|
@PathVariable Long[] ids) {
|
||||||
|
return toAjax(deviceChargeDischargeService.deleteWithValidByIds(List.of(ids), true));
|
||||||
|
}
|
||||||
|
}
|
@ -153,6 +153,7 @@ public class Device extends TenantEntity {
|
|||||||
*/
|
*/
|
||||||
@Schema(title = "出厂日期")
|
@Schema(title = "出厂日期")
|
||||||
private Date productionDate;
|
private Date productionDate;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 在线状态(0离线,1在线)
|
* 在线状态(0离线,1在线)
|
||||||
*/
|
*/
|
||||||
|
@ -88,7 +88,7 @@ public class DeviceAlarm extends TenantEntity {
|
|||||||
/**
|
/**
|
||||||
* 报警持续时间
|
* 报警持续时间
|
||||||
*/
|
*/
|
||||||
private Date durationTime;
|
private Long durationTime;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 0已处理,1未处理
|
* 0已处理,1未处理
|
||||||
|
@ -0,0 +1,108 @@
|
|||||||
|
package com.fuyuanshen.equipment.domain;
|
||||||
|
|
||||||
|
import com.fuyuanshen.common.tenant.core.TenantEntity;
|
||||||
|
import com.baomidou.mybatisplus.annotation.*;
|
||||||
|
import lombok.Data;
|
||||||
|
import lombok.EqualsAndHashCode;
|
||||||
|
import java.util.Date;
|
||||||
|
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||||
|
|
||||||
|
import java.io.Serial;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 设备充放电记录对象 device_charge_discharge
|
||||||
|
*
|
||||||
|
* @author Lion Li
|
||||||
|
* @date 2025-08-30
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
@EqualsAndHashCode(callSuper = true)
|
||||||
|
@TableName("device_charge_discharge")
|
||||||
|
public class DeviceChargeDischarge extends TenantEntity {
|
||||||
|
|
||||||
|
@Serial
|
||||||
|
private static final long serialVersionUID = 1L;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 记录唯一标识
|
||||||
|
*/
|
||||||
|
@TableId(value = "id")
|
||||||
|
private Long id;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 设备唯一标识
|
||||||
|
*/
|
||||||
|
private String deviceId;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 操作类型: 0 charge-充电, 1 discharge-放电
|
||||||
|
*/
|
||||||
|
private Long operationType;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 开始时间
|
||||||
|
*/
|
||||||
|
private Date startTime;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 结束时间
|
||||||
|
*/
|
||||||
|
private Date endTime;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 起始电量百分比(0-100)
|
||||||
|
*/
|
||||||
|
private Long initialSoc;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 结束电量百分比(0-100)
|
||||||
|
*/
|
||||||
|
private Long finalSoc;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 充放电量(kWh)
|
||||||
|
*/
|
||||||
|
private Long energyKwh;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 设备额定功率(kW)
|
||||||
|
*/
|
||||||
|
private Long powerRating;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 电压(V)
|
||||||
|
*/
|
||||||
|
private Long voltage;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 电流(A)
|
||||||
|
*/
|
||||||
|
private Long current;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 温度(℃)
|
||||||
|
*/
|
||||||
|
private Long temperature;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 当前状态
|
||||||
|
*/
|
||||||
|
private Long status;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 错误代码
|
||||||
|
*/
|
||||||
|
private String errorCode;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 记录创建时间
|
||||||
|
*/
|
||||||
|
private Date createdAt;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 记录更新时间
|
||||||
|
*/
|
||||||
|
private Date updatedAt;
|
||||||
|
|
||||||
|
|
||||||
|
}
|
@ -24,7 +24,7 @@ public class DeviceAlarmBo extends BaseEntity {
|
|||||||
/**
|
/**
|
||||||
* ID
|
* ID
|
||||||
*/
|
*/
|
||||||
@NotNull(message = "ID不能为空", groups = { EditGroup.class })
|
@NotNull(message = "ID不能为空", groups = {EditGroup.class})
|
||||||
private Long id;
|
private Long id;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -34,14 +34,27 @@ public class DeviceAlarmBo extends BaseEntity {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* 报警事项
|
* 报警事项
|
||||||
|
* device_action
|
||||||
*/
|
*/
|
||||||
private String deviceAction;
|
private Integer deviceAction;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 设备名称
|
* 设备名称
|
||||||
*/
|
*/
|
||||||
private String deviceName;
|
private String deviceName;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 设备MAC
|
||||||
|
* device_mac
|
||||||
|
*/
|
||||||
|
private String deviceMac;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 设备IMEI
|
||||||
|
* device_imei
|
||||||
|
*/
|
||||||
|
private String deviceImei;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 数据来源
|
* 数据来源
|
||||||
*/
|
*/
|
||||||
@ -54,12 +67,12 @@ public class DeviceAlarmBo extends BaseEntity {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* 设备类型
|
* 设备类型
|
||||||
|
* device_type
|
||||||
*/
|
*/
|
||||||
private Long deviceType;
|
private Long deviceType;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 经度
|
* 经度
|
||||||
|
|
||||||
*/
|
*/
|
||||||
private Long longitude;
|
private Long longitude;
|
||||||
|
|
||||||
@ -86,12 +99,18 @@ public class DeviceAlarmBo extends BaseEntity {
|
|||||||
/**
|
/**
|
||||||
* 报警持续时间
|
* 报警持续时间
|
||||||
*/
|
*/
|
||||||
private Date durationTime;
|
private Long durationTime;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 报警查询时间
|
||||||
|
*/
|
||||||
|
private String queryTime1;
|
||||||
|
private String queryTime2;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 0已处理,1未处理
|
* 0已处理,1未处理
|
||||||
*/
|
*/
|
||||||
private Long treatmentState;
|
private Integer treatmentState;
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -0,0 +1,110 @@
|
|||||||
|
package com.fuyuanshen.equipment.domain.bo;
|
||||||
|
|
||||||
|
import com.fuyuanshen.common.core.validate.AddGroup;
|
||||||
|
import com.fuyuanshen.common.core.validate.EditGroup;
|
||||||
|
import com.fuyuanshen.equipment.domain.DeviceChargeDischarge;
|
||||||
|
import com.fuyuanshen.common.mybatis.core.domain.BaseEntity;
|
||||||
|
import io.github.linpeilie.annotations.AutoMapper;
|
||||||
|
import lombok.Data;
|
||||||
|
import lombok.EqualsAndHashCode;
|
||||||
|
import jakarta.validation.constraints.*;
|
||||||
|
import java.util.Date;
|
||||||
|
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 设备充放电记录业务对象 device_charge_discharge
|
||||||
|
*
|
||||||
|
* @author Lion Li
|
||||||
|
* @date 2025-08-30
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
@EqualsAndHashCode(callSuper = true)
|
||||||
|
@AutoMapper(target = DeviceChargeDischarge.class, reverseConvertGenerate = false)
|
||||||
|
public class DeviceChargeDischargeBo extends BaseEntity {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 记录唯一标识
|
||||||
|
*/
|
||||||
|
@NotNull(message = "记录唯一标识不能为空", groups = { EditGroup.class })
|
||||||
|
private Long id;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 设备唯一标识
|
||||||
|
*/
|
||||||
|
@NotBlank(message = "设备唯一标识不能为空", groups = { AddGroup.class, EditGroup.class })
|
||||||
|
private String deviceId;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 操作类型: 0 charge-充电, 1 discharge-放电
|
||||||
|
*/
|
||||||
|
@NotNull(message = "操作类型: 0 charge-充电, 1 discharge-放电不能为空", groups = { AddGroup.class, EditGroup.class })
|
||||||
|
private Long operationType;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 开始时间
|
||||||
|
*/
|
||||||
|
@NotNull(message = "开始时间不能为空", groups = { AddGroup.class, EditGroup.class })
|
||||||
|
private Date startTime;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 结束时间
|
||||||
|
*/
|
||||||
|
private Date endTime;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 起始电量百分比(0-100)
|
||||||
|
*/
|
||||||
|
private Long initialSoc;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 结束电量百分比(0-100)
|
||||||
|
*/
|
||||||
|
private Long finalSoc;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 充放电量(kWh)
|
||||||
|
*/
|
||||||
|
private Long energyKwh;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 设备额定功率(kW)
|
||||||
|
*/
|
||||||
|
private Long powerRating;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 电压(V)
|
||||||
|
*/
|
||||||
|
private Long voltage;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 电流(A)
|
||||||
|
*/
|
||||||
|
private Long current;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 温度(℃)
|
||||||
|
*/
|
||||||
|
private Long temperature;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 当前状态
|
||||||
|
*/
|
||||||
|
private Long status;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 错误代码
|
||||||
|
*/
|
||||||
|
private String errorCode;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 记录创建时间
|
||||||
|
*/
|
||||||
|
private Date createdAt;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 记录更新时间
|
||||||
|
*/
|
||||||
|
private Date updatedAt;
|
||||||
|
|
||||||
|
|
||||||
|
}
|
@ -44,9 +44,10 @@ public class DeviceAlarmVo implements Serializable {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* 报警事项
|
* 报警事项
|
||||||
|
* 0-强制报警,1-撞击闯入,2-手动报警,3-电子围栏告警,4-强制告警
|
||||||
*/
|
*/
|
||||||
@ExcelProperty(value = "报警事项")
|
@ExcelProperty(value = "报警事项")
|
||||||
private String deviceAction;
|
private Integer deviceAction;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 设备名称
|
* 设备名称
|
||||||
@ -54,6 +55,16 @@ public class DeviceAlarmVo implements Serializable {
|
|||||||
@ExcelProperty(value = "设备名称")
|
@ExcelProperty(value = "设备名称")
|
||||||
private String deviceName;
|
private String deviceName;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 设备MAC
|
||||||
|
*/
|
||||||
|
private String deviceMac;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 设备IMEI
|
||||||
|
*/
|
||||||
|
private String deviceImei;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 数据来源
|
* 数据来源
|
||||||
*/
|
*/
|
||||||
@ -71,6 +82,7 @@ public class DeviceAlarmVo implements Serializable {
|
|||||||
*/
|
*/
|
||||||
@ExcelProperty(value = "设备类型")
|
@ExcelProperty(value = "设备类型")
|
||||||
private Long deviceType;
|
private Long deviceType;
|
||||||
|
private String deviceTypeName;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 经度
|
* 经度
|
||||||
@ -106,13 +118,13 @@ public class DeviceAlarmVo implements Serializable {
|
|||||||
* 报警持续时间
|
* 报警持续时间
|
||||||
*/
|
*/
|
||||||
@ExcelProperty(value = "报警持续时间")
|
@ExcelProperty(value = "报警持续时间")
|
||||||
private Date durationTime;
|
private Long durationTime;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 0已处理,1未处理
|
* 0已处理,1未处理
|
||||||
*/
|
*/
|
||||||
@ExcelProperty(value = "0已处理,1未处理")
|
@ExcelProperty(value = "0已处理,1未处理")
|
||||||
private Long treatmentState;
|
private Integer treatmentState;
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -0,0 +1,130 @@
|
|||||||
|
package com.fuyuanshen.equipment.domain.vo;
|
||||||
|
|
||||||
|
import java.util.Date;
|
||||||
|
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||||
|
import com.fuyuanshen.equipment.domain.DeviceChargeDischarge;
|
||||||
|
import cn.idev.excel.annotation.ExcelIgnoreUnannotated;
|
||||||
|
import cn.idev.excel.annotation.ExcelProperty;
|
||||||
|
import com.fuyuanshen.common.excel.annotation.ExcelDictFormat;
|
||||||
|
import com.fuyuanshen.common.excel.convert.ExcelDictConvert;
|
||||||
|
import io.github.linpeilie.annotations.AutoMapper;
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
import java.io.Serial;
|
||||||
|
import java.io.Serializable;
|
||||||
|
import java.util.Date;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 设备充放电记录视图对象 device_charge_discharge
|
||||||
|
*
|
||||||
|
* @author Lion Li
|
||||||
|
* @date 2025-08-30
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
@ExcelIgnoreUnannotated
|
||||||
|
@AutoMapper(target = DeviceChargeDischarge.class)
|
||||||
|
public class DeviceChargeDischargeVo implements Serializable {
|
||||||
|
|
||||||
|
@Serial
|
||||||
|
private static final long serialVersionUID = 1L;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 记录唯一标识
|
||||||
|
*/
|
||||||
|
@ExcelProperty(value = "记录唯一标识")
|
||||||
|
private Long id;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 设备唯一标识
|
||||||
|
*/
|
||||||
|
@ExcelProperty(value = "设备唯一标识")
|
||||||
|
private String deviceId;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 操作类型: 0 charge-充电, 1 discharge-放电
|
||||||
|
*/
|
||||||
|
@ExcelProperty(value = "操作类型: 0 charge-充电, 1 discharge-放电")
|
||||||
|
private Long operationType;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 开始时间
|
||||||
|
*/
|
||||||
|
@ExcelProperty(value = "开始时间")
|
||||||
|
private Date startTime;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 结束时间
|
||||||
|
*/
|
||||||
|
@ExcelProperty(value = "结束时间")
|
||||||
|
private Date endTime;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 起始电量百分比(0-100)
|
||||||
|
*/
|
||||||
|
@ExcelProperty(value = "起始电量百分比(0-100)")
|
||||||
|
private Long initialSoc;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 结束电量百分比(0-100)
|
||||||
|
*/
|
||||||
|
@ExcelProperty(value = "结束电量百分比(0-100)")
|
||||||
|
private Long finalSoc;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 充放电量(kWh)
|
||||||
|
*/
|
||||||
|
@ExcelProperty(value = "充放电量(kWh)")
|
||||||
|
private Long energyKwh;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 设备额定功率(kW)
|
||||||
|
*/
|
||||||
|
@ExcelProperty(value = "设备额定功率(kW)")
|
||||||
|
private Long powerRating;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 电压(V)
|
||||||
|
*/
|
||||||
|
@ExcelProperty(value = "电压(V)")
|
||||||
|
private Long voltage;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 电流(A)
|
||||||
|
*/
|
||||||
|
@ExcelProperty(value = "电流(A)")
|
||||||
|
private Long current;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 温度(℃)
|
||||||
|
*/
|
||||||
|
@ExcelProperty(value = "温度(℃)")
|
||||||
|
private Long temperature;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 当前状态
|
||||||
|
*/
|
||||||
|
@ExcelProperty(value = "当前状态")
|
||||||
|
private Long status;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 错误代码
|
||||||
|
*/
|
||||||
|
@ExcelProperty(value = "错误代码")
|
||||||
|
private String errorCode;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 记录创建时间
|
||||||
|
*/
|
||||||
|
@ExcelProperty(value = "记录创建时间")
|
||||||
|
private Date createdAt;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 记录更新时间
|
||||||
|
*/
|
||||||
|
@ExcelProperty(value = "记录更新时间")
|
||||||
|
private Date updatedAt;
|
||||||
|
|
||||||
|
|
||||||
|
}
|
@ -1,8 +1,12 @@
|
|||||||
package com.fuyuanshen.equipment.mapper;
|
package com.fuyuanshen.equipment.mapper;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||||
|
import com.fuyuanshen.common.mybatis.core.page.PageQuery;
|
||||||
import com.fuyuanshen.equipment.domain.DeviceAlarm;
|
import com.fuyuanshen.equipment.domain.DeviceAlarm;
|
||||||
|
import com.fuyuanshen.equipment.domain.bo.DeviceAlarmBo;
|
||||||
import com.fuyuanshen.equipment.domain.vo.DeviceAlarmVo;
|
import com.fuyuanshen.equipment.domain.vo.DeviceAlarmVo;
|
||||||
import com.fuyuanshen.common.mybatis.core.mapper.BaseMapperPlus;
|
import com.fuyuanshen.common.mybatis.core.mapper.BaseMapperPlus;
|
||||||
|
import org.apache.ibatis.annotations.Param;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 设备告警Mapper接口
|
* 设备告警Mapper接口
|
||||||
@ -12,4 +16,13 @@ import com.fuyuanshen.common.mybatis.core.mapper.BaseMapperPlus;
|
|||||||
*/
|
*/
|
||||||
public interface DeviceAlarmMapper extends BaseMapperPlus<DeviceAlarm, DeviceAlarmVo> {
|
public interface DeviceAlarmMapper extends BaseMapperPlus<DeviceAlarm, DeviceAlarmVo> {
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询设备告警列表
|
||||||
|
*
|
||||||
|
* @param bo 设备告警
|
||||||
|
* @return 设备告警
|
||||||
|
*/
|
||||||
|
Page<DeviceAlarmVo> selectVoPage( Page pageQuery,@Param("bo") DeviceAlarmBo bo);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -0,0 +1,15 @@
|
|||||||
|
package com.fuyuanshen.equipment.mapper;
|
||||||
|
|
||||||
|
import com.fuyuanshen.equipment.domain.DeviceChargeDischarge;
|
||||||
|
import com.fuyuanshen.equipment.domain.vo.DeviceChargeDischargeVo;
|
||||||
|
import com.fuyuanshen.common.mybatis.core.mapper.BaseMapperPlus;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 设备充放电记录Mapper接口
|
||||||
|
*
|
||||||
|
* @author Lion Li
|
||||||
|
* @date 2025-08-30
|
||||||
|
*/
|
||||||
|
public interface DeviceChargeDischargeMapper extends BaseMapperPlus<DeviceChargeDischarge, DeviceChargeDischargeVo> {
|
||||||
|
|
||||||
|
}
|
@ -0,0 +1,68 @@
|
|||||||
|
package com.fuyuanshen.equipment.service;
|
||||||
|
|
||||||
|
import com.fuyuanshen.equipment.domain.vo.DeviceChargeDischargeVo;
|
||||||
|
import com.fuyuanshen.equipment.domain.bo.DeviceChargeDischargeBo;
|
||||||
|
import com.fuyuanshen.common.mybatis.core.page.TableDataInfo;
|
||||||
|
import com.fuyuanshen.common.mybatis.core.page.PageQuery;
|
||||||
|
|
||||||
|
import java.util.Collection;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 设备充放电记录Service接口
|
||||||
|
*
|
||||||
|
* @author Lion Li
|
||||||
|
* @date 2025-08-30
|
||||||
|
*/
|
||||||
|
public interface IDeviceChargeDischargeService {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询设备充放电记录
|
||||||
|
*
|
||||||
|
* @param id 主键
|
||||||
|
* @return 设备充放电记录
|
||||||
|
*/
|
||||||
|
DeviceChargeDischargeVo queryById(Long id);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 分页查询设备充放电记录列表
|
||||||
|
*
|
||||||
|
* @param bo 查询条件
|
||||||
|
* @param pageQuery 分页参数
|
||||||
|
* @return 设备充放电记录分页列表
|
||||||
|
*/
|
||||||
|
TableDataInfo<DeviceChargeDischargeVo> queryPageList(DeviceChargeDischargeBo bo, PageQuery pageQuery);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询符合条件的设备充放电记录列表
|
||||||
|
*
|
||||||
|
* @param bo 查询条件
|
||||||
|
* @return 设备充放电记录列表
|
||||||
|
*/
|
||||||
|
List<DeviceChargeDischargeVo> queryList(DeviceChargeDischargeBo bo);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 新增设备充放电记录
|
||||||
|
*
|
||||||
|
* @param bo 设备充放电记录
|
||||||
|
* @return 是否新增成功
|
||||||
|
*/
|
||||||
|
Boolean insertByBo(DeviceChargeDischargeBo bo);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 修改设备充放电记录
|
||||||
|
*
|
||||||
|
* @param bo 设备充放电记录
|
||||||
|
* @return 是否修改成功
|
||||||
|
*/
|
||||||
|
Boolean updateByBo(DeviceChargeDischargeBo bo);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 校验并批量删除设备充放电记录信息
|
||||||
|
*
|
||||||
|
* @param ids 待删除的主键集合
|
||||||
|
* @param isValid 是否进行有效性校验
|
||||||
|
* @return 是否删除成功
|
||||||
|
*/
|
||||||
|
Boolean deleteWithValidByIds(Collection<Long> ids, Boolean isValid);
|
||||||
|
}
|
@ -33,6 +33,7 @@ public class DeviceAlarmServiceImpl implements IDeviceAlarmService {
|
|||||||
|
|
||||||
private final DeviceAlarmMapper baseMapper;
|
private final DeviceAlarmMapper baseMapper;
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 查询设备告警
|
* 查询设备告警
|
||||||
*
|
*
|
||||||
@ -40,10 +41,11 @@ public class DeviceAlarmServiceImpl implements IDeviceAlarmService {
|
|||||||
* @return 设备告警
|
* @return 设备告警
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public DeviceAlarmVo queryById(Long id){
|
public DeviceAlarmVo queryById(Long id) {
|
||||||
return baseMapper.selectVoById(id);
|
return baseMapper.selectVoById(id);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 分页查询设备告警列表
|
* 分页查询设备告警列表
|
||||||
*
|
*
|
||||||
@ -53,11 +55,13 @@ public class DeviceAlarmServiceImpl implements IDeviceAlarmService {
|
|||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public TableDataInfo<DeviceAlarmVo> queryPageList(DeviceAlarmBo bo, PageQuery pageQuery) {
|
public TableDataInfo<DeviceAlarmVo> queryPageList(DeviceAlarmBo bo, PageQuery pageQuery) {
|
||||||
LambdaQueryWrapper<DeviceAlarm> lqw = buildQueryWrapper(bo);
|
// LambdaQueryWrapper<DeviceAlarm> lqw = buildQueryWrapper(bo);
|
||||||
Page<DeviceAlarmVo> result = baseMapper.selectVoPage(pageQuery.build(), lqw);
|
// Page<DeviceAlarmVo> result = baseMapper.selectVoPage(pageQuery.build(), lqw);
|
||||||
|
Page<DeviceAlarmVo> result = baseMapper.selectVoPage(pageQuery.build(), bo);
|
||||||
return TableDataInfo.build(result);
|
return TableDataInfo.build(result);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 查询符合条件的设备告警列表
|
* 查询符合条件的设备告警列表
|
||||||
*
|
*
|
||||||
@ -75,7 +79,7 @@ public class DeviceAlarmServiceImpl implements IDeviceAlarmService {
|
|||||||
LambdaQueryWrapper<DeviceAlarm> lqw = Wrappers.lambdaQuery();
|
LambdaQueryWrapper<DeviceAlarm> lqw = Wrappers.lambdaQuery();
|
||||||
lqw.orderByAsc(DeviceAlarm::getId);
|
lqw.orderByAsc(DeviceAlarm::getId);
|
||||||
lqw.eq(bo.getDeviceId() != null, DeviceAlarm::getDeviceId, bo.getDeviceId());
|
lqw.eq(bo.getDeviceId() != null, DeviceAlarm::getDeviceId, bo.getDeviceId());
|
||||||
lqw.eq(StringUtils.isNotBlank(bo.getDeviceAction()), DeviceAlarm::getDeviceAction, bo.getDeviceAction());
|
// lqw.eq(StringUtils.isNotBlank(bo.getDeviceAction()), DeviceAlarm::getDeviceAction, bo.getDeviceAction());
|
||||||
lqw.like(StringUtils.isNotBlank(bo.getDeviceName()), DeviceAlarm::getDeviceName, bo.getDeviceName());
|
lqw.like(StringUtils.isNotBlank(bo.getDeviceName()), DeviceAlarm::getDeviceName, bo.getDeviceName());
|
||||||
lqw.eq(StringUtils.isNotBlank(bo.getDataSource()), DeviceAlarm::getDataSource, bo.getDataSource());
|
lqw.eq(StringUtils.isNotBlank(bo.getDataSource()), DeviceAlarm::getDataSource, bo.getDataSource());
|
||||||
lqw.eq(StringUtils.isNotBlank(bo.getContent()), DeviceAlarm::getContent, bo.getContent());
|
lqw.eq(StringUtils.isNotBlank(bo.getContent()), DeviceAlarm::getContent, bo.getContent());
|
||||||
@ -123,8 +127,8 @@ public class DeviceAlarmServiceImpl implements IDeviceAlarmService {
|
|||||||
/**
|
/**
|
||||||
* 保存前的数据校验
|
* 保存前的数据校验
|
||||||
*/
|
*/
|
||||||
private void validEntityBeforeSave(DeviceAlarm entity){
|
private void validEntityBeforeSave(DeviceAlarm entity) {
|
||||||
//TODO 做一些数据校验,如唯一约束
|
// TODO 做一些数据校验,如唯一约束
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -136,8 +140,8 @@ public class DeviceAlarmServiceImpl implements IDeviceAlarmService {
|
|||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public Boolean deleteWithValidByIds(Collection<Long> ids, Boolean isValid) {
|
public Boolean deleteWithValidByIds(Collection<Long> ids, Boolean isValid) {
|
||||||
if(isValid){
|
if (isValid) {
|
||||||
//TODO 做一些业务上的校验,判断是否需要校验
|
// TODO 做一些业务上的校验,判断是否需要校验
|
||||||
}
|
}
|
||||||
return baseMapper.deleteByIds(ids) > 0;
|
return baseMapper.deleteByIds(ids) > 0;
|
||||||
}
|
}
|
||||||
|
@ -0,0 +1,146 @@
|
|||||||
|
package com.fuyuanshen.equipment.service.impl;
|
||||||
|
|
||||||
|
import com.fuyuanshen.common.core.utils.MapstructUtils;
|
||||||
|
import com.fuyuanshen.common.mybatis.core.page.TableDataInfo;
|
||||||
|
import com.fuyuanshen.common.mybatis.core.page.PageQuery;
|
||||||
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||||
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||||
|
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
||||||
|
import lombok.RequiredArgsConstructor;
|
||||||
|
import lombok.extern.slf4j.Slf4j;
|
||||||
|
import org.apache.commons.lang3.StringUtils;
|
||||||
|
import org.springframework.stereotype.Service;
|
||||||
|
import com.fuyuanshen.equipment.domain.bo.DeviceChargeDischargeBo;
|
||||||
|
import com.fuyuanshen.equipment.domain.vo.DeviceChargeDischargeVo;
|
||||||
|
import com.fuyuanshen.equipment.domain.DeviceChargeDischarge;
|
||||||
|
import com.fuyuanshen.equipment.mapper.DeviceChargeDischargeMapper;
|
||||||
|
import com.fuyuanshen.equipment.service.IDeviceChargeDischargeService;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
|
import java.util.Collection;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 设备充放电记录Service业务层处理
|
||||||
|
*
|
||||||
|
* @author Lion Li
|
||||||
|
* @date 2025-08-30
|
||||||
|
*/
|
||||||
|
@Slf4j
|
||||||
|
@RequiredArgsConstructor
|
||||||
|
@Service
|
||||||
|
public class DeviceChargeDischargeServiceImpl implements IDeviceChargeDischargeService {
|
||||||
|
|
||||||
|
private final DeviceChargeDischargeMapper baseMapper;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询设备充放电记录
|
||||||
|
*
|
||||||
|
* @param id 主键
|
||||||
|
* @return 设备充放电记录
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public DeviceChargeDischargeVo queryById(Long id){
|
||||||
|
return baseMapper.selectVoById(id);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 分页查询设备充放电记录列表
|
||||||
|
*
|
||||||
|
* @param bo 查询条件
|
||||||
|
* @param pageQuery 分页参数
|
||||||
|
* @return 设备充放电记录分页列表
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public TableDataInfo<DeviceChargeDischargeVo> queryPageList(DeviceChargeDischargeBo bo, PageQuery pageQuery) {
|
||||||
|
LambdaQueryWrapper<DeviceChargeDischarge> lqw = buildQueryWrapper(bo);
|
||||||
|
Page<DeviceChargeDischargeVo> result = baseMapper.selectVoPage(pageQuery.build(), lqw);
|
||||||
|
return TableDataInfo.build(result);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询符合条件的设备充放电记录列表
|
||||||
|
*
|
||||||
|
* @param bo 查询条件
|
||||||
|
* @return 设备充放电记录列表
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public List<DeviceChargeDischargeVo> queryList(DeviceChargeDischargeBo bo) {
|
||||||
|
LambdaQueryWrapper<DeviceChargeDischarge> lqw = buildQueryWrapper(bo);
|
||||||
|
return baseMapper.selectVoList(lqw);
|
||||||
|
}
|
||||||
|
|
||||||
|
private LambdaQueryWrapper<DeviceChargeDischarge> buildQueryWrapper(DeviceChargeDischargeBo bo) {
|
||||||
|
Map<String, Object> params = bo.getParams();
|
||||||
|
LambdaQueryWrapper<DeviceChargeDischarge> lqw = Wrappers.lambdaQuery();
|
||||||
|
lqw.orderByAsc(DeviceChargeDischarge::getId);
|
||||||
|
lqw.eq(StringUtils.isNotBlank(bo.getDeviceId()), DeviceChargeDischarge::getDeviceId, bo.getDeviceId());
|
||||||
|
lqw.eq(bo.getOperationType() != null, DeviceChargeDischarge::getOperationType, bo.getOperationType());
|
||||||
|
lqw.eq(bo.getStartTime() != null, DeviceChargeDischarge::getStartTime, bo.getStartTime());
|
||||||
|
lqw.eq(bo.getEndTime() != null, DeviceChargeDischarge::getEndTime, bo.getEndTime());
|
||||||
|
lqw.eq(bo.getInitialSoc() != null, DeviceChargeDischarge::getInitialSoc, bo.getInitialSoc());
|
||||||
|
lqw.eq(bo.getFinalSoc() != null, DeviceChargeDischarge::getFinalSoc, bo.getFinalSoc());
|
||||||
|
lqw.eq(bo.getEnergyKwh() != null, DeviceChargeDischarge::getEnergyKwh, bo.getEnergyKwh());
|
||||||
|
lqw.eq(bo.getPowerRating() != null, DeviceChargeDischarge::getPowerRating, bo.getPowerRating());
|
||||||
|
lqw.eq(bo.getVoltage() != null, DeviceChargeDischarge::getVoltage, bo.getVoltage());
|
||||||
|
lqw.eq(bo.getCurrent() != null, DeviceChargeDischarge::getCurrent, bo.getCurrent());
|
||||||
|
lqw.eq(bo.getTemperature() != null, DeviceChargeDischarge::getTemperature, bo.getTemperature());
|
||||||
|
lqw.eq(bo.getStatus() != null, DeviceChargeDischarge::getStatus, bo.getStatus());
|
||||||
|
lqw.eq(StringUtils.isNotBlank(bo.getErrorCode()), DeviceChargeDischarge::getErrorCode, bo.getErrorCode());
|
||||||
|
lqw.eq(bo.getCreatedAt() != null, DeviceChargeDischarge::getCreatedAt, bo.getCreatedAt());
|
||||||
|
lqw.eq(bo.getUpdatedAt() != null, DeviceChargeDischarge::getUpdatedAt, bo.getUpdatedAt());
|
||||||
|
return lqw;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 新增设备充放电记录
|
||||||
|
*
|
||||||
|
* @param bo 设备充放电记录
|
||||||
|
* @return 是否新增成功
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public Boolean insertByBo(DeviceChargeDischargeBo bo) {
|
||||||
|
DeviceChargeDischarge add = MapstructUtils.convert(bo, DeviceChargeDischarge.class);
|
||||||
|
validEntityBeforeSave(add);
|
||||||
|
boolean flag = baseMapper.insert(add) > 0;
|
||||||
|
if (flag) {
|
||||||
|
bo.setId(add.getId());
|
||||||
|
}
|
||||||
|
return flag;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 修改设备充放电记录
|
||||||
|
*
|
||||||
|
* @param bo 设备充放电记录
|
||||||
|
* @return 是否修改成功
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public Boolean updateByBo(DeviceChargeDischargeBo bo) {
|
||||||
|
DeviceChargeDischarge update = MapstructUtils.convert(bo, DeviceChargeDischarge.class);
|
||||||
|
validEntityBeforeSave(update);
|
||||||
|
return baseMapper.updateById(update) > 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 保存前的数据校验
|
||||||
|
*/
|
||||||
|
private void validEntityBeforeSave(DeviceChargeDischarge entity){
|
||||||
|
//TODO 做一些数据校验,如唯一约束
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 校验并批量删除设备充放电记录信息
|
||||||
|
*
|
||||||
|
* @param ids 待删除的主键集合
|
||||||
|
* @param isValid 是否进行有效性校验
|
||||||
|
* @return 是否删除成功
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public Boolean deleteWithValidByIds(Collection<Long> ids, Boolean isValid) {
|
||||||
|
if(isValid){
|
||||||
|
//TODO 做一些业务上的校验,判断是否需要校验
|
||||||
|
}
|
||||||
|
return baseMapper.deleteByIds(ids) > 0;
|
||||||
|
}
|
||||||
|
}
|
@ -1,7 +1,33 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8" ?>
|
<?xml version="1.0" encoding="UTF-8" ?>
|
||||||
<!DOCTYPE mapper
|
<!DOCTYPE mapper
|
||||||
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||||
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||||
<mapper namespace="com.fuyuanshen.equipment.mapper.DeviceAlarmMapper">
|
<mapper namespace="com.fuyuanshen.equipment.mapper.DeviceAlarmMapper">
|
||||||
|
|
||||||
|
<!-- 查询设备告警列表 -->
|
||||||
|
<select id="selectVoPage" resultType="com.fuyuanshen.equipment.domain.vo.DeviceAlarmVo">
|
||||||
|
select *, d.device_mac as deviceMac, d.device_imei as deviceImei,
|
||||||
|
d.type_name as deviceTypeName
|
||||||
|
from device_alarm da
|
||||||
|
left join device d on da.device_id = d.id
|
||||||
|
left join device_type dt on dt.id = da.device_type
|
||||||
|
<where>
|
||||||
|
<if test="bo.deviceName != null">
|
||||||
|
and da.device_name = #{bo.deviceName}
|
||||||
|
</if>
|
||||||
|
<if test="bo.deviceType != null">
|
||||||
|
and da.device_type = #{bo.deviceType}
|
||||||
|
</if>
|
||||||
|
<if test="bo.deviceAction != null">
|
||||||
|
and da.device_action = #{bo.deviceAction}
|
||||||
|
</if>
|
||||||
|
<if test="bo.treatmentState != null">
|
||||||
|
and da.treatment_state = #{bo.treatmentState}
|
||||||
|
</if>
|
||||||
|
<if test="bo.queryTime1 != null and bo.queryTime2 != null ">
|
||||||
|
and da.start_time between #{bo.queryTime1} and #{bo.queryTime2}
|
||||||
|
</if>
|
||||||
|
</where>
|
||||||
|
</select>
|
||||||
|
|
||||||
</mapper>
|
</mapper>
|
||||||
|
@ -0,0 +1,7 @@
|
|||||||
|
<?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.equipment.mapper.DeviceChargeDischargeMapper">
|
||||||
|
|
||||||
|
</mapper>
|
Reference in New Issue
Block a user