feat:联动控制,定时控制,通知推送功能代码提交。
This commit is contained in:
@@ -0,0 +1,105 @@
|
||||
package com.intc.fishery.controller;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import com.intc.common.excel.utils.ExcelUtil;
|
||||
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.intc.common.idempotent.annotation.RepeatSubmit;
|
||||
import com.intc.common.log.annotation.Log;
|
||||
import com.intc.common.web.core.BaseController;
|
||||
import com.intc.common.mybatis.core.page.PageQuery;
|
||||
import com.intc.common.core.domain.R;
|
||||
import com.intc.common.core.validate.AddGroup;
|
||||
import com.intc.common.core.validate.EditGroup;
|
||||
import com.intc.common.log.enums.BusinessType;
|
||||
import com.intc.fishery.domain.vo.LinkedCtrlVo;
|
||||
import com.intc.fishery.domain.bo.LinkedCtrlBo;
|
||||
import com.intc.fishery.service.ILinkedCtrlService;
|
||||
import com.intc.common.mybatis.core.page.TableDataInfo;
|
||||
|
||||
/**
|
||||
* 溶解氧联动控制
|
||||
*
|
||||
* @author intc
|
||||
* @date 2025-10-23
|
||||
*/
|
||||
@Validated
|
||||
@RequiredArgsConstructor
|
||||
@RestController
|
||||
@RequestMapping("/fishery/linkedCtrl")
|
||||
public class LinkedCtrlController extends BaseController {
|
||||
|
||||
private final ILinkedCtrlService linkedCtrlService;
|
||||
|
||||
/**
|
||||
* 查询溶解氧联动控制列表
|
||||
*/
|
||||
@SaCheckPermission("fishery:linkedCtrl:list")
|
||||
@GetMapping("/list")
|
||||
public TableDataInfo<LinkedCtrlVo> list(LinkedCtrlBo bo, PageQuery pageQuery) {
|
||||
return linkedCtrlService.queryPageList(bo, pageQuery);
|
||||
}
|
||||
|
||||
/**
|
||||
* 导出溶解氧联动控制列表
|
||||
*/
|
||||
@SaCheckPermission("fishery:linkedCtrl:export")
|
||||
@Log(title = "溶解氧联动控制", businessType = BusinessType.EXPORT)
|
||||
@PostMapping("/export")
|
||||
public void export(LinkedCtrlBo bo, HttpServletResponse response) {
|
||||
List<LinkedCtrlVo> list = linkedCtrlService.queryList(bo);
|
||||
ExcelUtil.exportExcel(list, "溶解氧联动控制", LinkedCtrlVo.class, response);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取溶解氧联动控制详细信息
|
||||
*
|
||||
* @param id 主键
|
||||
*/
|
||||
@SaCheckPermission("fishery:linkedCtrl:query")
|
||||
@GetMapping("/{id}")
|
||||
public R<LinkedCtrlVo> getInfo(@NotNull(message = "主键不能为空")
|
||||
@PathVariable Long id) {
|
||||
return R.ok(linkedCtrlService.queryById(id));
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增溶解氧联动控制
|
||||
*/
|
||||
@SaCheckPermission("fishery:linkedCtrl:add")
|
||||
@Log(title = "溶解氧联动控制", businessType = BusinessType.INSERT)
|
||||
@RepeatSubmit()
|
||||
@PostMapping()
|
||||
public R<Void> add(@Validated(AddGroup.class) @RequestBody LinkedCtrlBo bo) {
|
||||
return toAjax(linkedCtrlService.insertByBo(bo));
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改溶解氧联动控制
|
||||
*/
|
||||
@SaCheckPermission("fishery:linkedCtrl:edit")
|
||||
@Log(title = "溶解氧联动控制", businessType = BusinessType.UPDATE)
|
||||
@RepeatSubmit()
|
||||
@PutMapping()
|
||||
public R<Void> edit(@Validated(EditGroup.class) @RequestBody LinkedCtrlBo bo) {
|
||||
return toAjax(linkedCtrlService.updateByBo(bo));
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除溶解氧联动控制
|
||||
*
|
||||
* @param ids 主键串
|
||||
*/
|
||||
@SaCheckPermission("fishery:linkedCtrl:remove")
|
||||
@Log(title = "溶解氧联动控制", businessType = BusinessType.DELETE)
|
||||
@DeleteMapping("/{ids}")
|
||||
public R<Void> remove(@NotEmpty(message = "主键不能为空")
|
||||
@PathVariable Long[] ids) {
|
||||
return toAjax(linkedCtrlService.deleteWithValidByIds(List.of(ids), true));
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,104 @@
|
||||
package com.intc.fishery.controller;
|
||||
|
||||
import java.util.List;
|
||||
import com.intc.common.excel.utils.ExcelUtil;
|
||||
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.intc.common.idempotent.annotation.RepeatSubmit;
|
||||
import com.intc.common.log.annotation.Log;
|
||||
import com.intc.common.web.core.BaseController;
|
||||
import com.intc.common.mybatis.core.page.PageQuery;
|
||||
import com.intc.common.core.domain.R;
|
||||
import com.intc.common.core.validate.AddGroup;
|
||||
import com.intc.common.core.validate.EditGroup;
|
||||
import com.intc.common.log.enums.BusinessType;
|
||||
import com.intc.fishery.domain.vo.TimingCtrlVo;
|
||||
import com.intc.fishery.domain.bo.TimingCtrlBo;
|
||||
import com.intc.fishery.service.ITimingCtrlService;
|
||||
import com.intc.common.mybatis.core.page.TableDataInfo;
|
||||
|
||||
/**
|
||||
* 开关定时控制
|
||||
*
|
||||
* @author intc
|
||||
* @date 2025-10-23
|
||||
*/
|
||||
@Validated
|
||||
@RequiredArgsConstructor
|
||||
@RestController
|
||||
@RequestMapping("/fishery/timingCtrl")
|
||||
public class TimingCtrlController extends BaseController {
|
||||
|
||||
private final ITimingCtrlService timingCtrlService;
|
||||
|
||||
/**
|
||||
* 查询开关定时控制列表
|
||||
*/
|
||||
@SaCheckPermission("fishery:timingCtrl:list")
|
||||
@GetMapping("/list")
|
||||
public TableDataInfo<TimingCtrlVo> list(TimingCtrlBo bo, PageQuery pageQuery) {
|
||||
return timingCtrlService.queryPageList(bo, pageQuery);
|
||||
}
|
||||
|
||||
/**
|
||||
* 导出开关定时控制列表
|
||||
*/
|
||||
@SaCheckPermission("fishery:timingCtrl:export")
|
||||
@Log(title = "开关定时控制", businessType = BusinessType.EXPORT)
|
||||
@PostMapping("/export")
|
||||
public void export(TimingCtrlBo bo, HttpServletResponse response) {
|
||||
List<TimingCtrlVo> list = timingCtrlService.queryList(bo);
|
||||
ExcelUtil.exportExcel(list, "开关定时控制", TimingCtrlVo.class, response);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取开关定时控制详细信息
|
||||
*
|
||||
* @param id 主键
|
||||
*/
|
||||
@SaCheckPermission("fishery:timingCtrl:query")
|
||||
@GetMapping("/{id}")
|
||||
public R<TimingCtrlVo> getInfo(@NotNull(message = "主键不能为空")
|
||||
@PathVariable Long id) {
|
||||
return R.ok(timingCtrlService.queryById(id));
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增开关定时控制
|
||||
*/
|
||||
@SaCheckPermission("fishery:timingCtrl:add")
|
||||
@Log(title = "开关定时控制", businessType = BusinessType.INSERT)
|
||||
@RepeatSubmit()
|
||||
@PostMapping()
|
||||
public R<Void> add(@Validated(AddGroup.class) @RequestBody TimingCtrlBo bo) {
|
||||
return toAjax(timingCtrlService.insertByBo(bo));
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改开关定时控制
|
||||
*/
|
||||
@SaCheckPermission("fishery:timingCtrl:edit")
|
||||
@Log(title = "开关定时控制", businessType = BusinessType.UPDATE)
|
||||
@RepeatSubmit()
|
||||
@PutMapping()
|
||||
public R<Void> edit(@Validated(EditGroup.class) @RequestBody TimingCtrlBo bo) {
|
||||
return toAjax(timingCtrlService.updateByBo(bo));
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除开关定时控制
|
||||
*
|
||||
* @param ids 主键串
|
||||
*/
|
||||
@SaCheckPermission("fishery:timingCtrl:remove")
|
||||
@Log(title = "开关定时控制", businessType = BusinessType.DELETE)
|
||||
@DeleteMapping("/{ids}")
|
||||
public R<Void> remove(@NotEmpty(message = "主键不能为空")
|
||||
@PathVariable Long[] ids) {
|
||||
return toAjax(timingCtrlService.deleteWithValidByIds(List.of(ids), true));
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,70 @@
|
||||
package com.intc.fishery.domain;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.*;
|
||||
import com.intc.common.tenant.core.TenantEntity;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
|
||||
import java.io.Serial;
|
||||
import java.util.Date;
|
||||
|
||||
/**
|
||||
* 溶解氧联动控制对象 aqu_linked_ctrl
|
||||
*
|
||||
* @author intc
|
||||
* @date 2025-10-23
|
||||
*/
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@TableName("aqu_linked_ctrl")
|
||||
public class LinkedCtrl extends TenantEntity {
|
||||
|
||||
@Serial
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/**
|
||||
* 主键id
|
||||
*/
|
||||
@TableId(value = "id")
|
||||
private Long id;
|
||||
|
||||
/**
|
||||
* 设备id
|
||||
*/
|
||||
private Long deviceId;
|
||||
|
||||
/**
|
||||
* 溶解氧上限开关
|
||||
*/
|
||||
private Integer oxyUpperOpen;
|
||||
|
||||
/**
|
||||
* 溶解氧上限值
|
||||
*/
|
||||
private Double oxyUpperValue;
|
||||
|
||||
/**
|
||||
* 溶解氧下限开关
|
||||
*/
|
||||
private Integer oxyLowerOpen;
|
||||
|
||||
/**
|
||||
* 溶解氧下限值
|
||||
*/
|
||||
private Double oxyLowerValue;
|
||||
|
||||
/**
|
||||
* 是否触发上限关闭操作
|
||||
*/
|
||||
private Integer isOxyUpperTrigger;
|
||||
|
||||
/**
|
||||
* 备注
|
||||
*/
|
||||
private String remark;
|
||||
|
||||
private Date createTime;
|
||||
|
||||
private Date updateTime;
|
||||
|
||||
}
|
||||
@@ -0,0 +1,69 @@
|
||||
package com.intc.fishery.domain;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.*;
|
||||
import com.intc.common.tenant.core.TenantEntity;
|
||||
import com.intc.common.translation.annotation.Translation;
|
||||
import com.intc.common.translation.constant.TransConstant;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import java.util.Date;
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
|
||||
import java.io.Serial;
|
||||
|
||||
/**
|
||||
* 开关定时控制对象 aqu_timing_ctrl
|
||||
*
|
||||
* @author intc
|
||||
* @date 2025-10-23
|
||||
*/
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@TableName("aqu_timing_ctrl")
|
||||
public class TimingCtrl extends TenantEntity {
|
||||
|
||||
@Serial
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/**
|
||||
* 主键id
|
||||
*/
|
||||
@TableId(value = "id")
|
||||
private Long id;
|
||||
|
||||
/**
|
||||
* 开关id
|
||||
*/
|
||||
private Long switchId;
|
||||
|
||||
/**
|
||||
* 开启时间
|
||||
*/
|
||||
private Date openTime;
|
||||
|
||||
/**
|
||||
* 关闭时间
|
||||
*/
|
||||
private Date closeTime;
|
||||
|
||||
/**
|
||||
* 循环类型
|
||||
*/
|
||||
private Long loopType;
|
||||
|
||||
/**
|
||||
* 是否启用
|
||||
*/
|
||||
private Long isOpen;
|
||||
|
||||
/**
|
||||
* 备注
|
||||
*/
|
||||
private String remark;
|
||||
|
||||
private Date createTime;
|
||||
|
||||
private Date updateTime;
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,70 @@
|
||||
package com.intc.fishery.domain.bo;
|
||||
import com.intc.common.core.validate.AddGroup;
|
||||
import com.intc.common.core.validate.EditGroup;
|
||||
import com.intc.fishery.domain.LinkedCtrl;
|
||||
import com.intc.common.mybatis.core.domain.BaseEntity;
|
||||
import io.github.linpeilie.annotations.AutoMapper;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import jakarta.validation.constraints.*;
|
||||
|
||||
/**
|
||||
* 溶解氧联动控制业务对象 aqu_linked_ctrl
|
||||
*
|
||||
* @author intc
|
||||
* @date 2025-10-23
|
||||
*/
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@AutoMapper(target = LinkedCtrl.class, reverseConvertGenerate = false)
|
||||
public class LinkedCtrlBo extends BaseEntity {
|
||||
|
||||
/**
|
||||
* 主键id
|
||||
*/
|
||||
@NotNull(message = "主键id不能为空", groups = { EditGroup.class })
|
||||
private Long id;
|
||||
|
||||
/**
|
||||
* 设备id
|
||||
*/
|
||||
@NotNull(message = "设备id不能为空", groups = { AddGroup.class, EditGroup.class })
|
||||
private Long deviceId;
|
||||
|
||||
/**
|
||||
* 溶解氧上限开关
|
||||
*/
|
||||
@NotNull(message = "溶解氧上限开关不能为空", groups = { AddGroup.class, EditGroup.class })
|
||||
private Integer oxyUpperOpen;
|
||||
|
||||
/**
|
||||
* 溶解氧上限值
|
||||
*/
|
||||
@NotNull(message = "溶解氧上限值不能为空", groups = { AddGroup.class, EditGroup.class })
|
||||
private Double oxyUpperValue;
|
||||
|
||||
/**
|
||||
* 溶解氧下限开关
|
||||
*/
|
||||
@NotNull(message = "溶解氧下限开关不能为空", groups = { AddGroup.class, EditGroup.class })
|
||||
private Integer oxyLowerOpen;
|
||||
|
||||
/**
|
||||
* 溶解氧下限值
|
||||
*/
|
||||
@NotNull(message = "溶解氧下限值不能为空", groups = { AddGroup.class, EditGroup.class })
|
||||
private Double oxyLowerValue;
|
||||
|
||||
/**
|
||||
* 是否触发上限关闭操作
|
||||
*/
|
||||
@NotNull(message = "是否触发上限关闭操作不能为空", groups = { AddGroup.class, EditGroup.class })
|
||||
private Integer isOxyUpperTrigger;
|
||||
|
||||
/**
|
||||
* 备注
|
||||
*/
|
||||
private String remark;
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,66 @@
|
||||
package com.intc.fishery.domain.bo;
|
||||
import com.intc.common.core.validate.AddGroup;
|
||||
import com.intc.common.core.validate.EditGroup;
|
||||
import com.intc.fishery.domain.TimingCtrl;
|
||||
import com.intc.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;
|
||||
|
||||
/**
|
||||
* 开关定时控制业务对象 aqu_timing_ctrl
|
||||
*
|
||||
* @author intc
|
||||
* @date 2025-10-23
|
||||
*/
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@AutoMapper(target = TimingCtrl.class, reverseConvertGenerate = false)
|
||||
public class TimingCtrlBo extends BaseEntity {
|
||||
|
||||
/**
|
||||
* 主键id
|
||||
*/
|
||||
@NotNull(message = "主键id不能为空", groups = { EditGroup.class })
|
||||
private Long id;
|
||||
|
||||
/**
|
||||
* 开关id
|
||||
*/
|
||||
@NotNull(message = "开关id不能为空", groups = { AddGroup.class, EditGroup.class })
|
||||
private Long switchId;
|
||||
|
||||
/**
|
||||
* 开启时间
|
||||
*/
|
||||
@NotNull(message = "开启时间不能为空", groups = { AddGroup.class, EditGroup.class })
|
||||
private Date openTime;
|
||||
|
||||
/**
|
||||
* 关闭时间
|
||||
*/
|
||||
@NotNull(message = "关闭时间不能为空", groups = { AddGroup.class, EditGroup.class })
|
||||
private Date closeTime;
|
||||
|
||||
/**
|
||||
* 循环类型
|
||||
*/
|
||||
@NotNull(message = "循环类型不能为空", groups = { AddGroup.class, EditGroup.class })
|
||||
private Long loopType;
|
||||
|
||||
/**
|
||||
* 是否启用
|
||||
*/
|
||||
@NotNull(message = "是否启用不能为空", groups = { AddGroup.class, EditGroup.class })
|
||||
private Long isOpen;
|
||||
|
||||
/**
|
||||
* 备注
|
||||
*/
|
||||
private String remark;
|
||||
|
||||
|
||||
}
|
||||
@@ -1,18 +1,18 @@
|
||||
package com.intc.fishery.domain.vo;
|
||||
|
||||
import java.io.Serial;
|
||||
import java.io.Serializable;
|
||||
import java.util.Date;
|
||||
|
||||
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
|
||||
import com.intc.common.json.handler.DoubleSerializer;
|
||||
import com.intc.fishery.domain.DeviceSwitch;
|
||||
|
||||
import cn.idev.excel.annotation.ExcelIgnoreUnannotated;
|
||||
import cn.idev.excel.annotation.ExcelProperty;
|
||||
import io.github.linpeilie.annotations.AutoMapper;
|
||||
import lombok.Data;
|
||||
|
||||
import java.io.Serial;
|
||||
import java.io.Serializable;
|
||||
|
||||
|
||||
/**
|
||||
* 测控一体机开关视图对象 aqu_device_switch
|
||||
@@ -131,6 +131,24 @@ public class DeviceSwitchVo implements Serializable {
|
||||
@ExcelProperty(value = "是否联动控制")
|
||||
private Integer isLinkedCtrl;
|
||||
|
||||
/**
|
||||
* 用户名
|
||||
*/
|
||||
@ExcelProperty(value = "用户名")
|
||||
private String userName;
|
||||
|
||||
/**
|
||||
* 用户手机号
|
||||
*/
|
||||
@ExcelProperty(value = "用户手机号")
|
||||
private String mobilePhone;
|
||||
|
||||
/**
|
||||
* 定时控制数量
|
||||
*/
|
||||
@ExcelProperty(value = "定时控制数量")
|
||||
private Integer timingCtrlCount;
|
||||
|
||||
|
||||
private Date createTime;
|
||||
|
||||
|
||||
@@ -0,0 +1,113 @@
|
||||
package com.intc.fishery.domain.vo;
|
||||
|
||||
import java.io.Serial;
|
||||
import java.io.Serializable;
|
||||
|
||||
import com.intc.common.excel.annotation.ExcelDictFormat;
|
||||
import com.intc.common.excel.convert.ExcelDictConvert;
|
||||
import com.intc.fishery.domain.LinkedCtrl;
|
||||
|
||||
import cn.idev.excel.annotation.ExcelIgnoreUnannotated;
|
||||
import cn.idev.excel.annotation.ExcelProperty;
|
||||
import io.github.linpeilie.annotations.AutoMapper;
|
||||
import lombok.Data;
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* 溶解氧联动控制视图对象 aqu_linked_ctrl
|
||||
*
|
||||
* @author intc
|
||||
* @date 2025-10-23
|
||||
*/
|
||||
@Data
|
||||
@ExcelIgnoreUnannotated
|
||||
@AutoMapper(target = LinkedCtrl.class)
|
||||
public class LinkedCtrlVo implements Serializable {
|
||||
|
||||
@Serial
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/**
|
||||
* 主键id
|
||||
*/
|
||||
@ExcelProperty(value = "主键id")
|
||||
private Long id;
|
||||
|
||||
/**
|
||||
* 设备id
|
||||
*/
|
||||
@ExcelProperty(value = "设备id")
|
||||
private Long deviceId;
|
||||
|
||||
/**
|
||||
* 溶解氧上限开关
|
||||
*/
|
||||
@ExcelProperty(value = "溶解氧上限开关", converter = ExcelDictConvert.class)
|
||||
@ExcelDictFormat(dictType = "open_close")
|
||||
private Integer oxyUpperOpen;
|
||||
|
||||
/**
|
||||
* 溶解氧上限值
|
||||
*/
|
||||
@ExcelProperty(value = "溶解氧上限值")
|
||||
private Double oxyUpperValue;
|
||||
|
||||
/**
|
||||
* 溶解氧下限开关
|
||||
*/
|
||||
@ExcelProperty(value = "溶解氧下限开关", converter = ExcelDictConvert.class)
|
||||
@ExcelDictFormat(dictType = "open_close")
|
||||
private Integer oxyLowerOpen;
|
||||
|
||||
/**
|
||||
* 溶解氧下限值
|
||||
*/
|
||||
@ExcelProperty(value = "溶解氧下限值")
|
||||
private Double oxyLowerValue;
|
||||
|
||||
/**
|
||||
* 是否触发上限关闭操作
|
||||
*/
|
||||
@ExcelProperty(value = "是否触发上限关闭操作", converter = ExcelDictConvert.class)
|
||||
@ExcelDictFormat(dictType = "yes_no")
|
||||
private Integer isOxyUpperTrigger;
|
||||
|
||||
/**
|
||||
* 备注
|
||||
*/
|
||||
@ExcelProperty(value = "备注")
|
||||
private String remark;
|
||||
|
||||
/**
|
||||
* 设备名称
|
||||
*/
|
||||
@ExcelProperty(value = "塘口名称")
|
||||
private String pondName;
|
||||
|
||||
/**
|
||||
* 设备名称
|
||||
*/
|
||||
@ExcelProperty(value = "设备名称")
|
||||
private String deviceName;
|
||||
|
||||
/**
|
||||
* 设备编号
|
||||
*/
|
||||
@ExcelProperty(value = "设备编号")
|
||||
private String serialNum;
|
||||
|
||||
/**
|
||||
* 用户手机号
|
||||
*/
|
||||
@ExcelProperty(value = "用户手机号")
|
||||
private String mobilePhone;
|
||||
|
||||
/**
|
||||
* 用户名
|
||||
*/
|
||||
@ExcelProperty(value = "用户名")
|
||||
private String userName;
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,106 @@
|
||||
package com.intc.fishery.domain.vo;
|
||||
|
||||
import java.io.Serial;
|
||||
import java.io.Serializable;
|
||||
import java.util.Date;
|
||||
|
||||
import com.intc.common.excel.annotation.ExcelDictFormat;
|
||||
import com.intc.common.excel.convert.ExcelDictConvert;
|
||||
import com.intc.fishery.domain.TimingCtrl;
|
||||
|
||||
import cn.idev.excel.annotation.ExcelIgnoreUnannotated;
|
||||
import cn.idev.excel.annotation.ExcelProperty;
|
||||
import io.github.linpeilie.annotations.AutoMapper;
|
||||
import lombok.Data;
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* 开关定时控制视图对象 aqu_timing_ctrl
|
||||
*
|
||||
* @author intc
|
||||
* @date 2025-10-23
|
||||
*/
|
||||
@Data
|
||||
@ExcelIgnoreUnannotated
|
||||
@AutoMapper(target = TimingCtrl.class)
|
||||
public class TimingCtrlVo implements Serializable {
|
||||
|
||||
@Serial
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/**
|
||||
* 主键id
|
||||
*/
|
||||
@ExcelProperty(value = "主键id")
|
||||
private Long id;
|
||||
|
||||
/**
|
||||
* 开关id
|
||||
*/
|
||||
@ExcelProperty(value = "开关id")
|
||||
private Long switchId;
|
||||
|
||||
/**
|
||||
* 开启时间
|
||||
*/
|
||||
@ExcelProperty(value = "开启时间")
|
||||
private Date openTime;
|
||||
|
||||
/**
|
||||
* 关闭时间
|
||||
*/
|
||||
@ExcelProperty(value = "关闭时间")
|
||||
private Date closeTime;
|
||||
|
||||
/**
|
||||
* 循环类型
|
||||
*/
|
||||
@ExcelProperty(value = "循环类型", converter = ExcelDictConvert.class)
|
||||
@ExcelDictFormat(dictType = "loop_type")
|
||||
private Long loopType;
|
||||
|
||||
/**
|
||||
* 是否启用
|
||||
*/
|
||||
@ExcelProperty(value = "是否启用")
|
||||
private Long isOpen;
|
||||
|
||||
/**
|
||||
* 备注
|
||||
*/
|
||||
@ExcelProperty(value = "备注")
|
||||
private String remark;
|
||||
|
||||
/**
|
||||
* 开关名称
|
||||
*/
|
||||
@ExcelProperty(value = "开关名称")
|
||||
private String switchName;
|
||||
|
||||
/**
|
||||
* 设备名称
|
||||
*/
|
||||
@ExcelProperty(value = "设备名称")
|
||||
private String deviceName;
|
||||
|
||||
/**
|
||||
* 设备编号
|
||||
*/
|
||||
@ExcelProperty(value = "设备编号")
|
||||
private String serialNum;
|
||||
|
||||
/**
|
||||
* 用户手机号
|
||||
*/
|
||||
@ExcelProperty(value = "用户手机号")
|
||||
private String mobilePhone;
|
||||
|
||||
/**
|
||||
* 用户名
|
||||
*/
|
||||
@ExcelProperty(value = "用户名")
|
||||
private String userName;
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,15 @@
|
||||
package com.intc.fishery.mapper;
|
||||
|
||||
import com.intc.common.mybatis.core.mapper.BaseMapperPlusJoin;
|
||||
import com.intc.fishery.domain.LinkedCtrl;
|
||||
import com.intc.fishery.domain.vo.LinkedCtrlVo;
|
||||
|
||||
/**
|
||||
* 溶解氧联动控制Mapper接口
|
||||
*
|
||||
* @author intc
|
||||
* @date 2025-10-23
|
||||
*/
|
||||
public interface LinkedCtrlMapper extends BaseMapperPlusJoin<LinkedCtrl, LinkedCtrlVo> {
|
||||
|
||||
}
|
||||
@@ -0,0 +1,15 @@
|
||||
package com.intc.fishery.mapper;
|
||||
|
||||
import com.intc.common.mybatis.core.mapper.BaseMapperPlusJoin;
|
||||
import com.intc.fishery.domain.TimingCtrl;
|
||||
import com.intc.fishery.domain.vo.TimingCtrlVo;
|
||||
|
||||
/**
|
||||
* 开关定时控制Mapper接口
|
||||
*
|
||||
* @author intc
|
||||
* @date 2025-10-23
|
||||
*/
|
||||
public interface TimingCtrlMapper extends BaseMapperPlusJoin<TimingCtrl, TimingCtrlVo> {
|
||||
|
||||
}
|
||||
@@ -0,0 +1,68 @@
|
||||
package com.intc.fishery.service;
|
||||
|
||||
import com.intc.fishery.domain.vo.LinkedCtrlVo;
|
||||
import com.intc.fishery.domain.bo.LinkedCtrlBo;
|
||||
import com.intc.common.mybatis.core.page.TableDataInfo;
|
||||
import com.intc.common.mybatis.core.page.PageQuery;
|
||||
|
||||
import java.util.Collection;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 溶解氧联动控制Service接口
|
||||
*
|
||||
* @author intc
|
||||
* @date 2025-10-23
|
||||
*/
|
||||
public interface ILinkedCtrlService {
|
||||
|
||||
/**
|
||||
* 查询溶解氧联动控制
|
||||
*
|
||||
* @param id 主键
|
||||
* @return 溶解氧联动控制
|
||||
*/
|
||||
LinkedCtrlVo queryById(Long id);
|
||||
|
||||
/**
|
||||
* 分页查询溶解氧联动控制列表
|
||||
*
|
||||
* @param bo 查询条件
|
||||
* @param pageQuery 分页参数
|
||||
* @return 溶解氧联动控制分页列表
|
||||
*/
|
||||
TableDataInfo<LinkedCtrlVo> queryPageList(LinkedCtrlBo bo, PageQuery pageQuery);
|
||||
|
||||
/**
|
||||
* 查询符合条件的溶解氧联动控制列表
|
||||
*
|
||||
* @param bo 查询条件
|
||||
* @return 溶解氧联动控制列表
|
||||
*/
|
||||
List<LinkedCtrlVo> queryList(LinkedCtrlBo bo);
|
||||
|
||||
/**
|
||||
* 新增溶解氧联动控制
|
||||
*
|
||||
* @param bo 溶解氧联动控制
|
||||
* @return 是否新增成功
|
||||
*/
|
||||
Boolean insertByBo(LinkedCtrlBo bo);
|
||||
|
||||
/**
|
||||
* 修改溶解氧联动控制
|
||||
*
|
||||
* @param bo 溶解氧联动控制
|
||||
* @return 是否修改成功
|
||||
*/
|
||||
Boolean updateByBo(LinkedCtrlBo bo);
|
||||
|
||||
/**
|
||||
* 校验并批量删除溶解氧联动控制信息
|
||||
*
|
||||
* @param ids 待删除的主键集合
|
||||
* @param isValid 是否进行有效性校验
|
||||
* @return 是否删除成功
|
||||
*/
|
||||
Boolean deleteWithValidByIds(Collection<Long> ids, Boolean isValid);
|
||||
}
|
||||
@@ -0,0 +1,68 @@
|
||||
package com.intc.fishery.service;
|
||||
|
||||
import com.intc.fishery.domain.vo.TimingCtrlVo;
|
||||
import com.intc.fishery.domain.bo.TimingCtrlBo;
|
||||
import com.intc.common.mybatis.core.page.TableDataInfo;
|
||||
import com.intc.common.mybatis.core.page.PageQuery;
|
||||
|
||||
import java.util.Collection;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 开关定时控制Service接口
|
||||
*
|
||||
* @author intc
|
||||
* @date 2025-10-23
|
||||
*/
|
||||
public interface ITimingCtrlService {
|
||||
|
||||
/**
|
||||
* 查询开关定时控制
|
||||
*
|
||||
* @param id 主键
|
||||
* @return 开关定时控制
|
||||
*/
|
||||
TimingCtrlVo queryById(Long id);
|
||||
|
||||
/**
|
||||
* 分页查询开关定时控制列表
|
||||
*
|
||||
* @param bo 查询条件
|
||||
* @param pageQuery 分页参数
|
||||
* @return 开关定时控制分页列表
|
||||
*/
|
||||
TableDataInfo<TimingCtrlVo> queryPageList(TimingCtrlBo bo, PageQuery pageQuery);
|
||||
|
||||
/**
|
||||
* 查询符合条件的开关定时控制列表
|
||||
*
|
||||
* @param bo 查询条件
|
||||
* @return 开关定时控制列表
|
||||
*/
|
||||
List<TimingCtrlVo> queryList(TimingCtrlBo bo);
|
||||
|
||||
/**
|
||||
* 新增开关定时控制
|
||||
*
|
||||
* @param bo 开关定时控制
|
||||
* @return 是否新增成功
|
||||
*/
|
||||
Boolean insertByBo(TimingCtrlBo bo);
|
||||
|
||||
/**
|
||||
* 修改开关定时控制
|
||||
*
|
||||
* @param bo 开关定时控制
|
||||
* @return 是否修改成功
|
||||
*/
|
||||
Boolean updateByBo(TimingCtrlBo bo);
|
||||
|
||||
/**
|
||||
* 校验并批量删除开关定时控制信息
|
||||
*
|
||||
* @param ids 待删除的主键集合
|
||||
* @param isValid 是否进行有效性校验
|
||||
* @return 是否删除成功
|
||||
*/
|
||||
Boolean deleteWithValidByIds(Collection<Long> ids, Boolean isValid);
|
||||
}
|
||||
@@ -16,6 +16,7 @@ import com.intc.fishery.domain.vo.DeviceSwitchVo;
|
||||
import com.intc.fishery.domain.DeviceSwitch;
|
||||
import com.intc.fishery.domain.Device;
|
||||
import com.intc.fishery.domain.Pond;
|
||||
import com.intc.fishery.domain.AquUser;
|
||||
import com.intc.fishery.mapper.DeviceSwitchMapper;
|
||||
import com.intc.fishery.service.IDeviceSwitchService;
|
||||
|
||||
@@ -106,8 +107,13 @@ public class DeviceSwitchServiceImpl implements IDeviceSwitchService {
|
||||
.selectAs(Device::getDeviceName, DeviceSwitchVo::getDeviceName)
|
||||
.selectAs(Device::getSerialNum, DeviceSwitchVo::getSerialNum)
|
||||
.selectAs(Pond::getPondName, DeviceSwitchVo::getPondName)
|
||||
.selectAs(AquUser::getUserName, DeviceSwitchVo::getUserName)
|
||||
.selectAs(AquUser::getMobilePhone, DeviceSwitchVo::getMobilePhone)
|
||||
// 使用子查询统计定时控制数量
|
||||
.select("(SELECT COUNT(*) FROM aqu_timing_ctrl tc WHERE tc.switch_id = t.id) AS timing_ctrl_count")
|
||||
.leftJoin(Device.class, Device::getId, DeviceSwitch::getDeviceId)
|
||||
.leftJoin(Pond.class, Pond::getId, DeviceSwitch::getPondId)
|
||||
.leftJoin(AquUser.class, AquUser::getId, Device::getUserId)
|
||||
.eq(bo.getDeviceId() != null, DeviceSwitch::getDeviceId, bo.getDeviceId())
|
||||
.eq(bo.getIndex() != null, DeviceSwitch::getIndex, bo.getIndex())
|
||||
.like(StringUtils.isNotBlank(bo.getSwitchName()), DeviceSwitch::getSwitchName, bo.getSwitchName())
|
||||
@@ -116,7 +122,7 @@ public class DeviceSwitchServiceImpl implements IDeviceSwitchService {
|
||||
.eq(bo.getIsOpen() != null, DeviceSwitch::getIsOpen, bo.getIsOpen())
|
||||
.eq(bo.getLinkedCtrlId() != null, DeviceSwitch::getLinkedCtrlId, bo.getLinkedCtrlId())
|
||||
.eq(bo.getLastTurnTime() != null, DeviceSwitch::getLastTurnTime, bo.getLastTurnTime())
|
||||
.orderByAsc(DeviceSwitch::getId);
|
||||
.orderByDesc(DeviceSwitch::getCreateTime);
|
||||
|
||||
// 处理额外的查询参数
|
||||
if (params != null && !params.isEmpty()) {
|
||||
@@ -156,16 +162,13 @@ public class DeviceSwitchServiceImpl implements IDeviceSwitchService {
|
||||
.like(Device::getSerialNum, deviceKeyword));
|
||||
}
|
||||
|
||||
// 处理设备名称模糊查询
|
||||
String deviceName = (String) params.get("deviceName");
|
||||
if (StringUtils.isNotBlank(deviceName)) {
|
||||
wrapper.like(Device::getDeviceName, deviceName);
|
||||
}
|
||||
|
||||
// 处理设备编号模糊查询
|
||||
String serialNum = (String) params.get("serialNum");
|
||||
if (StringUtils.isNotBlank(serialNum)) {
|
||||
wrapper.like(Device::getSerialNum, serialNum);
|
||||
// 处理用户名或用户手机号模糊查询
|
||||
String userKeyword = (String) params.get("userKeyword");
|
||||
if (StringUtils.isNotBlank(userKeyword)) {
|
||||
wrapper.and(w -> w.like(AquUser::getUserName, userKeyword)
|
||||
.or()
|
||||
.like(AquUser::getMobilePhone, userKeyword));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -0,0 +1,200 @@
|
||||
package com.intc.fishery.service.impl;
|
||||
|
||||
import com.intc.common.core.utils.MapstructUtils;
|
||||
import com.intc.common.core.utils.StringUtils;
|
||||
import com.intc.common.mybatis.core.page.TableDataInfo;
|
||||
import com.intc.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 com.github.yulichang.wrapper.MPJLambdaWrapper;
|
||||
import com.intc.fishery.domain.*;
|
||||
import com.intc.fishery.domain.vo.DeviceSwitchVo;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.stereotype.Service;
|
||||
import com.intc.fishery.domain.bo.LinkedCtrlBo;
|
||||
import com.intc.fishery.domain.vo.LinkedCtrlVo;
|
||||
import com.intc.fishery.mapper.LinkedCtrlMapper;
|
||||
import com.intc.fishery.service.ILinkedCtrlService;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Collection;
|
||||
|
||||
/**
|
||||
* 溶解氧联动控制Service业务层处理
|
||||
*
|
||||
* @author intc
|
||||
* @date 2025-10-23
|
||||
*/
|
||||
@Slf4j
|
||||
@RequiredArgsConstructor
|
||||
@Service
|
||||
public class LinkedCtrlServiceImpl implements ILinkedCtrlService {
|
||||
|
||||
private final LinkedCtrlMapper baseMapper;
|
||||
|
||||
/**
|
||||
* 查询溶解氧联动控制
|
||||
*
|
||||
* @param id 主键
|
||||
* @return 溶解氧联动控制
|
||||
*/
|
||||
@Override
|
||||
public LinkedCtrlVo queryById(Long id){
|
||||
return baseMapper.selectVoById(id);
|
||||
}
|
||||
|
||||
/**
|
||||
* 分页查询溶解氧联动控制列表
|
||||
*
|
||||
* @param bo 查询条件
|
||||
* @param pageQuery 分页参数
|
||||
* @return 溶解氧联动控制分页列表
|
||||
*/
|
||||
@Override
|
||||
public TableDataInfo<LinkedCtrlVo> queryPageList(LinkedCtrlBo bo, PageQuery pageQuery) {
|
||||
MPJLambdaWrapper<LinkedCtrl> wrapper = buildJoinQueryWrapper(bo);
|
||||
Page<LinkedCtrlVo> result = baseMapper.selectJoinPage(pageQuery.build(), LinkedCtrlVo.class, wrapper);
|
||||
return TableDataInfo.build(result);
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询符合条件的溶解氧联动控制列表
|
||||
*
|
||||
* @param bo 查询条件
|
||||
* @return 溶解氧联动控制列表
|
||||
*/
|
||||
@Override
|
||||
public List<LinkedCtrlVo> queryList(LinkedCtrlBo bo) {
|
||||
MPJLambdaWrapper<LinkedCtrl> wrapper = buildJoinQueryWrapper(bo);
|
||||
return baseMapper.selectJoinList(LinkedCtrlVo.class, wrapper);
|
||||
}
|
||||
|
||||
private MPJLambdaWrapper<LinkedCtrl> buildQueryWrapper(LinkedCtrlBo bo) {
|
||||
Map<String, Object> params = bo.getParams();
|
||||
MPJLambdaWrapper<LinkedCtrl> wrapper = new MPJLambdaWrapper<LinkedCtrl>()
|
||||
.selectAll(LinkedCtrl.class)
|
||||
.selectAs(Device::getDeviceName, DeviceSwitchVo::getDeviceName)
|
||||
.selectAs(Device::getSerialNum, DeviceSwitchVo::getSerialNum)
|
||||
.selectAs(Pond::getPondName, DeviceSwitchVo::getPondName)
|
||||
.selectAs(AquUser::getUserName, DeviceSwitchVo::getUserName)
|
||||
.selectAs(AquUser::getMobilePhone, DeviceSwitchVo::getMobilePhone)
|
||||
.leftJoin(Device.class, Device::getId, LinkedCtrl::getDeviceId)
|
||||
.leftJoin(Pond.class, Pond::getId, Device::getPondId)
|
||||
.leftJoin(AquUser.class, AquUser::getId, Device::getUserId)
|
||||
.orderByDesc(LinkedCtrl::getCreateTime)
|
||||
.eq(bo.getDeviceId() != null, LinkedCtrl::getDeviceId, bo.getDeviceId())
|
||||
.eq(bo.getOxyUpperOpen() != null, LinkedCtrl::getOxyUpperOpen, bo.getOxyUpperOpen())
|
||||
.eq(bo.getOxyLowerOpen() != null, LinkedCtrl::getOxyLowerOpen, bo.getOxyLowerOpen())
|
||||
.eq(bo.getIsOxyUpperTrigger() != null, LinkedCtrl::getIsOxyUpperTrigger, bo.getIsOxyUpperTrigger());
|
||||
// 处理额外的查询参数
|
||||
if (params != null && !params.isEmpty()) {
|
||||
handleExtraParams(wrapper, params);
|
||||
}
|
||||
return wrapper;
|
||||
}
|
||||
|
||||
/**
|
||||
* 处理额外的查询参数
|
||||
*
|
||||
* @param wrapper 查询包装器
|
||||
* @param params 额外参数
|
||||
*/
|
||||
private void handleExtraParams(MPJLambdaWrapper<LinkedCtrl> wrapper, Map<String, Object> params) {
|
||||
// 处理设备名称或设备编号模糊查询
|
||||
String deviceKeyword = (String) params.get("deviceKeyword");
|
||||
if (StringUtils.isNotBlank(deviceKeyword)) {
|
||||
wrapper.and(w -> w.like(Device::getDeviceName, deviceKeyword)
|
||||
.or()
|
||||
.like(Device::getSerialNum, deviceKeyword));
|
||||
}
|
||||
|
||||
|
||||
// 处理用户名或用户手机号模糊查询
|
||||
String userKeyword = (String) params.get("userKeyword");
|
||||
if (StringUtils.isNotBlank(userKeyword)) {
|
||||
wrapper.and(w -> w.like(AquUser::getUserName, userKeyword)
|
||||
.or()
|
||||
.like(AquUser::getMobilePhone, userKeyword));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 构建关联查询条件
|
||||
*
|
||||
* @param bo 查询条件
|
||||
* @return 关联查询Wrapper
|
||||
*/
|
||||
private MPJLambdaWrapper<LinkedCtrl> buildJoinQueryWrapper(LinkedCtrlBo bo) {
|
||||
Map<String, Object> params = bo.getParams();
|
||||
MPJLambdaWrapper<LinkedCtrl> wrapper = new MPJLambdaWrapper<LinkedCtrl>()
|
||||
.selectAll(LinkedCtrl.class)
|
||||
.selectAs(Device::getDeviceName, LinkedCtrlVo::getDeviceName)
|
||||
.selectAs(Device::getSerialNum, LinkedCtrlVo::getSerialNum)
|
||||
.selectAs(AquUser::getMobilePhone, LinkedCtrlVo::getMobilePhone)
|
||||
.selectAs(AquUser::getUserName, LinkedCtrlVo::getUserName)
|
||||
.leftJoin(Device.class, Device::getId, LinkedCtrl::getDeviceId)
|
||||
.leftJoin(AquUser.class, AquUser::getId, Device::getUserId)
|
||||
.orderByAsc(LinkedCtrl::getId)
|
||||
.eq(bo.getDeviceId() != null, LinkedCtrl::getDeviceId, bo.getDeviceId())
|
||||
.eq(bo.getOxyUpperOpen() != null, LinkedCtrl::getOxyUpperOpen, bo.getOxyUpperOpen())
|
||||
.eq(bo.getOxyLowerOpen() != null, LinkedCtrl::getOxyLowerOpen, bo.getOxyLowerOpen())
|
||||
.eq(bo.getIsOxyUpperTrigger() != null, LinkedCtrl::getIsOxyUpperTrigger, bo.getIsOxyUpperTrigger());
|
||||
return wrapper;
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增溶解氧联动控制
|
||||
*
|
||||
* @param bo 溶解氧联动控制
|
||||
* @return 是否新增成功
|
||||
*/
|
||||
@Override
|
||||
public Boolean insertByBo(LinkedCtrlBo bo) {
|
||||
LinkedCtrl add = MapstructUtils.convert(bo, LinkedCtrl.class);
|
||||
validEntityBeforeSave(add);
|
||||
boolean flag = baseMapper.insert(add) > 0;
|
||||
if (flag) {
|
||||
bo.setId(add.getId());
|
||||
}
|
||||
return flag;
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改溶解氧联动控制
|
||||
*
|
||||
* @param bo 溶解氧联动控制
|
||||
* @return 是否修改成功
|
||||
*/
|
||||
@Override
|
||||
public Boolean updateByBo(LinkedCtrlBo bo) {
|
||||
LinkedCtrl update = MapstructUtils.convert(bo, LinkedCtrl.class);
|
||||
validEntityBeforeSave(update);
|
||||
return baseMapper.updateById(update) > 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* 保存前的数据校验
|
||||
*/
|
||||
private void validEntityBeforeSave(LinkedCtrl entity){
|
||||
//TODO 做一些数据校验,如唯一约束
|
||||
}
|
||||
|
||||
/**
|
||||
* 校验并批量删除溶解氧联动控制信息
|
||||
*
|
||||
* @param ids 待删除的主键集合
|
||||
* @param isValid 是否进行有效性校验
|
||||
* @return 是否删除成功
|
||||
*/
|
||||
@Override
|
||||
public Boolean deleteWithValidByIds(Collection<Long> ids, Boolean isValid) {
|
||||
if(isValid){
|
||||
//TODO 做一些业务上的校验,判断是否需要校验
|
||||
}
|
||||
return baseMapper.deleteByIds(ids) > 0;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,198 @@
|
||||
package com.intc.fishery.service.impl;
|
||||
|
||||
import com.intc.common.core.utils.MapstructUtils;
|
||||
import com.intc.common.core.utils.StringUtils;
|
||||
import com.intc.common.mybatis.core.page.TableDataInfo;
|
||||
import com.intc.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 com.github.yulichang.wrapper.MPJLambdaWrapper;
|
||||
import com.intc.fishery.domain.*;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.stereotype.Service;
|
||||
import com.intc.fishery.domain.bo.TimingCtrlBo;
|
||||
import com.intc.fishery.domain.vo.TimingCtrlVo;
|
||||
import com.intc.fishery.mapper.TimingCtrlMapper;
|
||||
import com.intc.fishery.service.ITimingCtrlService;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Collection;
|
||||
|
||||
/**
|
||||
* 开关定时控制Service业务层处理
|
||||
*
|
||||
* @author intc
|
||||
* @date 2025-10-23
|
||||
*/
|
||||
@Slf4j
|
||||
@RequiredArgsConstructor
|
||||
@Service
|
||||
public class TimingCtrlServiceImpl implements ITimingCtrlService {
|
||||
|
||||
private final TimingCtrlMapper baseMapper;
|
||||
|
||||
/**
|
||||
* 查询开关定时控制
|
||||
*
|
||||
* @param id 主键
|
||||
* @return 开关定时控制
|
||||
*/
|
||||
@Override
|
||||
public TimingCtrlVo queryById(Long id){
|
||||
return baseMapper.selectVoById(id);
|
||||
}
|
||||
|
||||
/**
|
||||
* 分页查询开关定时控制列表
|
||||
*
|
||||
* @param bo 查询条件
|
||||
* @param pageQuery 分页参数
|
||||
* @return 开关定时控制分页列表
|
||||
*/
|
||||
@Override
|
||||
public TableDataInfo<TimingCtrlVo> queryPageList(TimingCtrlBo bo, PageQuery pageQuery) {
|
||||
MPJLambdaWrapper<TimingCtrl> wrapper = buildJoinQueryWrapper(bo);
|
||||
Page<TimingCtrlVo> result = baseMapper.selectJoinPage(pageQuery.build(), TimingCtrlVo.class, wrapper);
|
||||
return TableDataInfo.build(result);
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询符合条件的开关定时控制列表
|
||||
*
|
||||
* @param bo 查询条件
|
||||
* @return 开关定时控制列表
|
||||
*/
|
||||
@Override
|
||||
public List<TimingCtrlVo> queryList(TimingCtrlBo bo) {
|
||||
MPJLambdaWrapper<TimingCtrl> wrapper = buildJoinQueryWrapper(bo);
|
||||
return baseMapper.selectJoinList(TimingCtrlVo.class, wrapper);
|
||||
}
|
||||
|
||||
private LambdaQueryWrapper<TimingCtrl> buildQueryWrapper(TimingCtrlBo bo) {
|
||||
Map<String, Object> params = bo.getParams();
|
||||
LambdaQueryWrapper<TimingCtrl> lqw = Wrappers.lambdaQuery();
|
||||
lqw.orderByAsc(TimingCtrl::getId);
|
||||
lqw.eq(bo.getSwitchId() != null, TimingCtrl::getSwitchId, bo.getSwitchId());
|
||||
lqw.eq(bo.getLoopType() != null, TimingCtrl::getLoopType, bo.getLoopType());
|
||||
lqw.eq(bo.getIsOpen() != null, TimingCtrl::getIsOpen, bo.getIsOpen());
|
||||
return lqw;
|
||||
}
|
||||
|
||||
/**
|
||||
* 构建关联查询条件
|
||||
*
|
||||
* @param bo 查询条件
|
||||
* @return 关联查询Wrapper
|
||||
*/
|
||||
private MPJLambdaWrapper<TimingCtrl> buildJoinQueryWrapper(TimingCtrlBo bo) {
|
||||
Map<String, Object> params = bo.getParams();
|
||||
MPJLambdaWrapper<TimingCtrl> wrapper = new MPJLambdaWrapper<TimingCtrl>()
|
||||
.selectAll(TimingCtrl.class)
|
||||
.selectAs(DeviceSwitch::getSwitchName, TimingCtrlVo::getSwitchName)
|
||||
.selectAs(Device::getDeviceName, TimingCtrlVo::getDeviceName)
|
||||
.selectAs(Device::getSerialNum, TimingCtrlVo::getSerialNum)
|
||||
.selectAs(AquUser::getMobilePhone, TimingCtrlVo::getMobilePhone)
|
||||
.selectAs(AquUser::getUserName, TimingCtrlVo::getUserName)
|
||||
.leftJoin(DeviceSwitch.class, DeviceSwitch::getId, TimingCtrl::getSwitchId)
|
||||
.leftJoin(Device.class, Device::getId, DeviceSwitch::getDeviceId)
|
||||
.leftJoin(AquUser.class, AquUser::getId, Device::getUserId)
|
||||
.orderByDesc(TimingCtrl::getCreateTime)
|
||||
.eq(bo.getSwitchId() != null, TimingCtrl::getSwitchId, bo.getSwitchId())
|
||||
.eq(bo.getLoopType() != null, TimingCtrl::getLoopType, bo.getLoopType())
|
||||
.eq(bo.getIsOpen() != null, TimingCtrl::getIsOpen, bo.getIsOpen());
|
||||
// 处理额外的查询参数
|
||||
if (params != null && !params.isEmpty()) {
|
||||
handleExtraParams(wrapper, params);
|
||||
}
|
||||
|
||||
|
||||
return wrapper;
|
||||
}
|
||||
|
||||
/**
|
||||
* 处理额外的查询参数
|
||||
*
|
||||
* @param wrapper 查询包装器
|
||||
* @param params 额外参数
|
||||
*/
|
||||
private void handleExtraParams(MPJLambdaWrapper<TimingCtrl> wrapper, Map<String, Object> params) {
|
||||
|
||||
// 处理设备名称或设备编号模糊查询
|
||||
String switchKeyword = (String) params.get("switchKeyword");
|
||||
if (StringUtils.isNotBlank(switchKeyword)) {
|
||||
wrapper.and(w -> w.like(DeviceSwitch::getSwitchName, switchKeyword));
|
||||
}
|
||||
|
||||
// 处理设备名称或设备编号模糊查询
|
||||
String deviceKeyword = (String) params.get("deviceKeyword");
|
||||
if (StringUtils.isNotBlank(deviceKeyword)) {
|
||||
wrapper.and(w -> w.like(Device::getDeviceName, deviceKeyword)
|
||||
.or()
|
||||
.like(Device::getSerialNum, deviceKeyword));
|
||||
}
|
||||
|
||||
|
||||
// 处理用户名或用户手机号模糊查询
|
||||
String userKeyword = (String) params.get("userKeyword");
|
||||
if (StringUtils.isNotBlank(userKeyword)) {
|
||||
wrapper.and(w -> w.like(AquUser::getUserName, userKeyword)
|
||||
.or()
|
||||
.like(AquUser::getMobilePhone, userKeyword));
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增开关定时控制
|
||||
*
|
||||
* @param bo 开关定时控制
|
||||
* @return 是否新增成功
|
||||
*/
|
||||
@Override
|
||||
public Boolean insertByBo(TimingCtrlBo bo) {
|
||||
TimingCtrl add = MapstructUtils.convert(bo, TimingCtrl.class);
|
||||
validEntityBeforeSave(add);
|
||||
boolean flag = baseMapper.insert(add) > 0;
|
||||
if (flag) {
|
||||
bo.setId(add.getId());
|
||||
}
|
||||
return flag;
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改开关定时控制
|
||||
*
|
||||
* @param bo 开关定时控制
|
||||
* @return 是否修改成功
|
||||
*/
|
||||
@Override
|
||||
public Boolean updateByBo(TimingCtrlBo bo) {
|
||||
TimingCtrl update = MapstructUtils.convert(bo, TimingCtrl.class);
|
||||
validEntityBeforeSave(update);
|
||||
return baseMapper.updateById(update) > 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* 保存前的数据校验
|
||||
*/
|
||||
private void validEntityBeforeSave(TimingCtrl entity){
|
||||
//TODO 做一些数据校验,如唯一约束
|
||||
}
|
||||
|
||||
/**
|
||||
* 校验并批量删除开关定时控制信息
|
||||
*
|
||||
* @param ids 待删除的主键集合
|
||||
* @param isValid 是否进行有效性校验
|
||||
* @return 是否删除成功
|
||||
*/
|
||||
@Override
|
||||
public Boolean deleteWithValidByIds(Collection<Long> ids, Boolean isValid) {
|
||||
if(isValid){
|
||||
//TODO 做一些业务上的校验,判断是否需要校验
|
||||
}
|
||||
return baseMapper.deleteByIds(ids) > 0;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,6 @@
|
||||
<?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.intc.fishery.mapper.LinkedCtrlMapper">
|
||||
</mapper>
|
||||
@@ -0,0 +1,6 @@
|
||||
<?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.intc.fishery.mapper.TimingCtrlMapper">
|
||||
</mapper>
|
||||
@@ -3,7 +3,7 @@ gen:
|
||||
# 作者
|
||||
author: intc
|
||||
# 默认生成包路径 system 需改成自己的模块名称 如 system monitor tool
|
||||
packageName: org.dromara.fishery
|
||||
packageName: com.intc.fishery
|
||||
# 自动去除表前缀,默认是false
|
||||
autoRemovePre: true
|
||||
# 表前缀(生成类名不会包含表前缀,多个用逗号分隔)
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
package ${packageName}.domain.bo;
|
||||
|
||||
import com.intc.common.core.validate.AddGroup;
|
||||
import com.intc.common.core.validate.EditGroup;
|
||||
import ${packageName}.domain.${ClassName};
|
||||
import com.intc.common.mybatis.core.domain.BaseEntity;
|
||||
import io.github.linpeilie.annotations.AutoMapper;
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
package ${packageName}.controller;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import com.intc.common.excel.utils.ExcelUtil;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import jakarta.servlet.http.HttpServletResponse;
|
||||
import jakarta.validation.constraints.*;
|
||||
@@ -16,7 +16,6 @@ import com.intc.common.core.domain.R;
|
||||
import com.intc.common.core.validate.AddGroup;
|
||||
import com.intc.common.core.validate.EditGroup;
|
||||
import com.intc.common.log.enums.BusinessType;
|
||||
com.intc
|
||||
import ${packageName}.domain.vo.${ClassName}Vo;
|
||||
import ${packageName}.domain.bo.${ClassName}Bo;
|
||||
import ${packageName}.service.I${ClassName}Service;
|
||||
|
||||
@@ -6,10 +6,10 @@ package ${packageName}.domain;
|
||||
#end
|
||||
#end
|
||||
#if($IsTenant==1)
|
||||
com.intc
|
||||
#else
|
||||
#end
|
||||
import com.baomidou.mybatisplus.annotation.*;
|
||||
import com.intc.common.tenant.core.TenantEntity;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
#foreach ($import in $importList)
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
package ${packageName}.service.impl;
|
||||
|
||||
import com.intc.common.core.utils.MapstructUtils;
|
||||
import com.intc.common.core.utils.StringUtils;
|
||||
#if($table.crud)
|
||||
import com.intc.common.mybatis.core.page.TableDataInfo;
|
||||
import com.intc.common.mybatis.core.page.PageQuery;
|
||||
|
||||
@@ -6,8 +6,8 @@ import ${import};
|
||||
import ${packageName}.domain.${ClassName};
|
||||
import cn.idev.excel.annotation.ExcelIgnoreUnannotated;
|
||||
import cn.idev.excel.annotation.ExcelProperty;
|
||||
com.intc
|
||||
com.intc
|
||||
import com.intc.common.excel.annotation.ExcelDictFormat;
|
||||
import com.intc.common.excel.convert.ExcelDictConvert;
|
||||
import io.github.linpeilie.annotations.AutoMapper;
|
||||
import lombok.Data;
|
||||
|
||||
@@ -62,5 +62,7 @@ public class ${ClassName}Vo implements Serializable {
|
||||
#end
|
||||
#end
|
||||
#end
|
||||
private Date createTime;
|
||||
|
||||
private Date updateTime;
|
||||
}
|
||||
|
||||
@@ -6,6 +6,8 @@ import com.intc.common.tenant.core.TenantEntity;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
|
||||
import java.util.Date;
|
||||
|
||||
|
||||
/**
|
||||
* 通知公告表 sys_notice
|
||||
@@ -48,4 +50,14 @@ public class SysNotice extends TenantEntity {
|
||||
*/
|
||||
private String remark;
|
||||
|
||||
/**
|
||||
* 优先级
|
||||
*/
|
||||
private Integer priority;
|
||||
|
||||
/**
|
||||
* 有效期
|
||||
*/
|
||||
private Date deadTime;
|
||||
|
||||
}
|
||||
|
||||
@@ -9,6 +9,8 @@ import com.intc.common.core.xss.Xss;
|
||||
import com.intc.common.mybatis.core.domain.BaseEntity;
|
||||
import com.intc.system.domain.SysNotice;
|
||||
|
||||
import java.util.Date;
|
||||
|
||||
/**
|
||||
* 通知公告业务对象 sys_notice
|
||||
*
|
||||
@@ -58,4 +60,14 @@ public class SysNoticeBo extends BaseEntity {
|
||||
*/
|
||||
private String createByName;
|
||||
|
||||
/**
|
||||
* 优先级
|
||||
*/
|
||||
private Integer priority;
|
||||
|
||||
/**
|
||||
* 有效期
|
||||
*/
|
||||
private Date deadTime;
|
||||
|
||||
}
|
||||
|
||||
@@ -70,4 +70,14 @@ public class SysNoticeVo implements Serializable {
|
||||
*/
|
||||
private Date createTime;
|
||||
|
||||
/**
|
||||
* 优先级
|
||||
*/
|
||||
private Integer priority;
|
||||
|
||||
/**
|
||||
* 有效期
|
||||
*/
|
||||
private Date deadTime;
|
||||
|
||||
}
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||
<parent>
|
||||
<artifactId>intc-vue-plus</artifactId>
|
||||
<artifactId>intc-vue-ultra</artifactId>
|
||||
<groupId>com.intc</groupId>
|
||||
<version>${revision}</version>
|
||||
</parent>
|
||||
|
||||
Reference in New Issue
Block a user