parent
dd532f9f8c
commit
002f11e52c
@ -0,0 +1,117 @@
|
||||
package cn.iocoder.yudao.module.system.controller.admin.dusttargetinfo;
|
||||
|
||||
import cn.iocoder.yudao.module.system.service.dustequipinfo.DustEquipinfoService;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
import jakarta.annotation.Resource;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.security.access.prepost.PreAuthorize;
|
||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||
import io.swagger.v3.oas.annotations.Parameter;
|
||||
import io.swagger.v3.oas.annotations.Operation;
|
||||
|
||||
import jakarta.validation.constraints.*;
|
||||
import jakarta.validation.*;
|
||||
import jakarta.servlet.http.*;
|
||||
import java.util.*;
|
||||
import java.io.IOException;
|
||||
|
||||
import cn.iocoder.yudao.framework.common.pojo.PageParam;
|
||||
import cn.iocoder.yudao.framework.common.pojo.PageResult;
|
||||
import cn.iocoder.yudao.framework.common.pojo.CommonResult;
|
||||
import cn.iocoder.yudao.framework.common.util.object.BeanUtils;
|
||||
import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success;
|
||||
|
||||
import cn.iocoder.yudao.framework.excel.core.util.ExcelUtils;
|
||||
|
||||
import cn.iocoder.yudao.framework.apilog.core.annotation.ApiAccessLog;
|
||||
import static cn.iocoder.yudao.framework.apilog.core.enums.OperateTypeEnum.*;
|
||||
|
||||
import cn.iocoder.yudao.module.system.controller.admin.dusttargetinfo.vo.*;
|
||||
import cn.iocoder.yudao.module.system.dal.dataobject.dusttargetinfo.DustTargetinfoDO;
|
||||
import cn.iocoder.yudao.module.system.service.dusttargetinfo.DustTargetinfoService;
|
||||
|
||||
@Tag(name = "管理后台 - 除尘系统监测指标信息")
|
||||
@RestController
|
||||
@RequestMapping("/system/dust-targetinfo")
|
||||
@Validated
|
||||
public class DustTargetinfoController {
|
||||
|
||||
@Resource
|
||||
private DustTargetinfoService dustTargetinfoService;
|
||||
|
||||
@Resource
|
||||
private DustEquipinfoService dustEquipinfoService;
|
||||
@PostMapping("/create")
|
||||
@Operation(summary = "创建除尘系统监测指标信息")
|
||||
@PreAuthorize("@ss.hasPermission('system:dust-targetinfo:create')")
|
||||
public CommonResult<String> createDustTargetinfo(@Valid @RequestBody DustTargetinfoSaveReqVO createReqVO) {
|
||||
return success(dustTargetinfoService.createDustTargetinfo(createReqVO));
|
||||
}
|
||||
|
||||
@PutMapping("/update")
|
||||
@Operation(summary = "更新除尘系统监测指标信息")
|
||||
@PreAuthorize("@ss.hasPermission('system:dust-targetinfo:update')")
|
||||
public CommonResult<Boolean> updateDustTargetinfo(@Valid @RequestBody DustTargetinfoSaveReqVO updateReqVO) {
|
||||
dustTargetinfoService.updateDustTargetinfo(updateReqVO);
|
||||
return success(true);
|
||||
}
|
||||
|
||||
@DeleteMapping("/delete")
|
||||
@Operation(summary = "删除除尘系统监测指标信息")
|
||||
@Parameter(name = "id", description = "编号", required = true)
|
||||
@PreAuthorize("@ss.hasPermission('system:dust-targetinfo:delete')")
|
||||
public CommonResult<Boolean> deleteDustTargetinfo(@RequestParam("id") String id) {
|
||||
dustTargetinfoService.deleteDustTargetinfo(id);
|
||||
return success(true);
|
||||
}
|
||||
|
||||
@DeleteMapping("/delete-list")
|
||||
@Parameter(name = "ids", description = "编号", required = true)
|
||||
@Operation(summary = "批量删除除尘系统监测指标信息")
|
||||
@PreAuthorize("@ss.hasPermission('system:dust-targetinfo:delete')")
|
||||
public CommonResult<Boolean> deleteDustTargetinfoList(@RequestParam("ids") List<String> ids) {
|
||||
dustTargetinfoService.deleteDustTargetinfoListByIds(ids);
|
||||
return success(true);
|
||||
}
|
||||
|
||||
@GetMapping("/get")
|
||||
@Operation(summary = "获得除尘系统监测指标信息")
|
||||
@Parameter(name = "id", description = "编号", required = true, example = "1024")
|
||||
@PreAuthorize("@ss.hasPermission('system:dust-targetinfo:query')")
|
||||
public CommonResult<DustTargetinfoRespVO> getDustTargetinfo(@RequestParam("id") String id) {
|
||||
DustTargetinfoDO dustTargetinfo = dustTargetinfoService.getDustTargetinfo(id);
|
||||
DustTargetinfoRespVO respVO = BeanUtils.toBean(dustTargetinfo, DustTargetinfoRespVO.class);
|
||||
String equipName = dustEquipinfoService.getDustEquipNameByCode(dustTargetinfo.getEquipCode());
|
||||
respVO.setEquipCodeName(equipName != null ? equipName : "");
|
||||
return success(respVO);
|
||||
}
|
||||
|
||||
@GetMapping("/page")
|
||||
@Operation(summary = "获得除尘系统监测指标信息分页")
|
||||
@PreAuthorize("@ss.hasPermission('system:dust-targetinfo:query')")
|
||||
public CommonResult<PageResult<DustTargetinfoRespVO>> getDustTargetinfoPage(@Valid DustTargetinfoPageReqVO pageReqVO) {
|
||||
PageResult<DustTargetinfoDO> pageResult = dustTargetinfoService.getDustTargetinfoPage(pageReqVO);
|
||||
PageResult<DustTargetinfoRespVO> result = BeanUtils.toBean(pageResult, DustTargetinfoRespVO.class);
|
||||
for (DustTargetinfoRespVO vo : result.getList()) {
|
||||
if (vo != null && vo.getEquipCode() != null) {
|
||||
String equipName = dustEquipinfoService.getDustEquipNameByCode(vo.getEquipCode());
|
||||
vo.setEquipCodeName(equipName != null ? equipName : "");
|
||||
}
|
||||
}
|
||||
return success(result);
|
||||
}
|
||||
|
||||
@GetMapping("/export-excel")
|
||||
@Operation(summary = "导出除尘系统监测指标信息 Excel")
|
||||
@PreAuthorize("@ss.hasPermission('system:dust-targetinfo:export')")
|
||||
@ApiAccessLog(operateType = EXPORT)
|
||||
public void exportDustTargetinfoExcel(@Valid DustTargetinfoPageReqVO pageReqVO,
|
||||
HttpServletResponse response) throws IOException {
|
||||
pageReqVO.setPageSize(PageParam.PAGE_SIZE_NONE);
|
||||
List<DustTargetinfoDO> list = dustTargetinfoService.getDustTargetinfoPage(pageReqVO).getList();
|
||||
// 导出 Excel
|
||||
ExcelUtils.write(response, "除尘系统监测指标信息.xls", "数据", DustTargetinfoRespVO.class,
|
||||
BeanUtils.toBean(list, DustTargetinfoRespVO.class));
|
||||
}
|
||||
|
||||
}
|
||||
@ -0,0 +1,69 @@
|
||||
package cn.iocoder.yudao.module.system.controller.admin.dusttargetinfo.vo;
|
||||
|
||||
import lombok.*;
|
||||
import java.util.*;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import cn.iocoder.yudao.framework.common.pojo.PageParam;
|
||||
import java.math.BigDecimal;
|
||||
import org.springframework.format.annotation.DateTimeFormat;
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
import static cn.iocoder.yudao.framework.common.util.date.DateUtils.FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND;
|
||||
|
||||
@Schema(description = "管理后台 - 除尘系统监测指标信息分页 Request VO")
|
||||
@Data
|
||||
public class DustTargetinfoPageReqVO extends PageParam {
|
||||
|
||||
@Schema(description = "指标编码")
|
||||
private String targetCode;
|
||||
|
||||
@Schema(description = "指标名称", example = "王五")
|
||||
private String targetName;
|
||||
|
||||
@Schema(description = "所属除尘系统编码")
|
||||
private String equipCode;
|
||||
|
||||
@Schema(description = "指标类别", example = "2")
|
||||
private String targetType;
|
||||
|
||||
@Schema(description = "指标位置")
|
||||
private String targetPlace;
|
||||
|
||||
@Schema(description = "计量单位")
|
||||
private String targetUnit;
|
||||
|
||||
@Schema(description = "指标阈值上限 ")
|
||||
private BigDecimal thresholdUpLimit;
|
||||
|
||||
@Schema(description = "指标阈值上上限 ")
|
||||
private BigDecimal thresholdUpUpLimit;
|
||||
|
||||
@Schema(description = "指标阈值下限 ")
|
||||
private BigDecimal thresholdDownLimit;
|
||||
|
||||
@Schema(description = "指标阈值下下限 ")
|
||||
private BigDecimal thresholdDownDownLimit;
|
||||
|
||||
@Schema(description = "量程上限")
|
||||
private BigDecimal rangeUp;
|
||||
private BigDecimal rangeDown;
|
||||
@Schema(description = "描述 ", example = "你猜")
|
||||
private String targetDescription;
|
||||
|
||||
@Schema(description = "位号")
|
||||
private String bitNo;
|
||||
|
||||
@Schema(description = "信号类型", example = "1")
|
||||
private String signalType;
|
||||
|
||||
@Schema(description = "开关量报警值")
|
||||
private Integer alarmValue;
|
||||
|
||||
@Schema(description = "指标停用状态", example = "2")
|
||||
private String targetStatus;
|
||||
|
||||
@Schema(description = "创建时间")
|
||||
@DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
|
||||
private LocalDateTime[] createTime;
|
||||
|
||||
}
|
||||
@ -0,0 +1,96 @@
|
||||
package cn.iocoder.yudao.module.system.controller.admin.dusttargetinfo.vo;
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.*;
|
||||
import java.util.*;
|
||||
import java.math.BigDecimal;
|
||||
import org.springframework.format.annotation.DateTimeFormat;
|
||||
import java.time.LocalDateTime;
|
||||
import cn.idev.excel.annotation.*;
|
||||
import cn.iocoder.yudao.framework.excel.core.annotations.DictFormat;
|
||||
import cn.iocoder.yudao.framework.excel.core.convert.DictConvert;
|
||||
|
||||
@Schema(description = "管理后台 - 除尘系统监测指标信息 Response VO")
|
||||
@Data
|
||||
@ExcelIgnoreUnannotated
|
||||
public class DustTargetinfoRespVO {
|
||||
|
||||
@Schema(description = "主键", requiredMode = Schema.RequiredMode.REQUIRED, example = "23526")
|
||||
@ExcelProperty("主键")
|
||||
private String id;
|
||||
|
||||
@Schema(description = "指标编码", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||
@ExcelProperty("指标编码")
|
||||
private String targetCode;
|
||||
|
||||
@Schema(description = "指标名称", requiredMode = Schema.RequiredMode.REQUIRED, example = "王五")
|
||||
@ExcelProperty(value = "指标名称", converter = DictConvert.class)
|
||||
@DictFormat("target_name") // TODO 代码优化:建议设置到对应的 DictTypeConstants 枚举类中
|
||||
private String targetName;
|
||||
|
||||
@Schema(description = "所属除尘系统编码", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||
@ExcelProperty("所属除尘系统编码")
|
||||
private String equipCode;
|
||||
private String equipCodeName;
|
||||
|
||||
@Schema(description = "指标类别", requiredMode = Schema.RequiredMode.REQUIRED, example = "2")
|
||||
@ExcelProperty(value = "指标类别", converter = DictConvert.class)
|
||||
@DictFormat("target_type") // TODO 代码优化:建议设置到对应的 DictTypeConstants 枚举类中
|
||||
private String targetType;
|
||||
|
||||
@Schema(description = "指标位置", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||
@ExcelProperty("指标位置")
|
||||
private String targetPlace;
|
||||
|
||||
@Schema(description = "计量单位", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||
@ExcelProperty("计量单位")
|
||||
private String targetUnit;
|
||||
|
||||
@Schema(description = "指标阈值上限 ")
|
||||
@ExcelProperty("指标阈值上限 ")
|
||||
private BigDecimal thresholdUpLimit;
|
||||
|
||||
@Schema(description = "指标阈值上上限 ")
|
||||
@ExcelProperty("指标阈值上上限 ")
|
||||
private BigDecimal thresholdUpUpLimit;
|
||||
|
||||
@Schema(description = "指标阈值下限 ")
|
||||
@ExcelProperty("指标阈值下限 ")
|
||||
private BigDecimal thresholdDownLimit;
|
||||
|
||||
@Schema(description = "指标阈值下下限 ")
|
||||
@ExcelProperty("指标阈值下下限 ")
|
||||
private BigDecimal thresholdDownDownLimit;
|
||||
|
||||
@Schema(description = "量程上限")
|
||||
@ExcelProperty("量程上限")
|
||||
private BigDecimal rangeUp;
|
||||
private BigDecimal rangeDown;
|
||||
@Schema(description = "描述 ", example = "你猜")
|
||||
@ExcelProperty("描述 ")
|
||||
private String targetDescription;
|
||||
|
||||
@Schema(description = "位号")
|
||||
@ExcelProperty("位号")
|
||||
private String bitNo;
|
||||
|
||||
@Schema(description = "信号类型", requiredMode = Schema.RequiredMode.REQUIRED, example = "1")
|
||||
@ExcelProperty(value = "信号类型", converter = DictConvert.class)
|
||||
@DictFormat("signal_type") // TODO 代码优化:建议设置到对应的 DictTypeConstants 枚举类中
|
||||
private String signalType;
|
||||
|
||||
@Schema(description = "开关量报警值")
|
||||
@ExcelProperty(value = "开关量报警值", converter = DictConvert.class)
|
||||
@DictFormat("alarm_value") // TODO 代码优化:建议设置到对应的 DictTypeConstants 枚举类中
|
||||
private Integer alarmValue;
|
||||
|
||||
@Schema(description = "指标停用状态", requiredMode = Schema.RequiredMode.REQUIRED, example = "2")
|
||||
@ExcelProperty(value = "指标停用状态", converter = DictConvert.class)
|
||||
@DictFormat("target_status") // TODO 代码优化:建议设置到对应的 DictTypeConstants 枚举类中
|
||||
private String targetStatus;
|
||||
|
||||
@Schema(description = "创建时间", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||
@ExcelProperty("创建时间")
|
||||
private LocalDateTime createTime;
|
||||
|
||||
}
|
||||
@ -0,0 +1,75 @@
|
||||
package cn.iocoder.yudao.module.system.controller.admin.dusttargetinfo.vo;
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.*;
|
||||
import java.util.*;
|
||||
import jakarta.validation.constraints.*;
|
||||
import java.math.BigDecimal;
|
||||
|
||||
@Schema(description = "管理后台 - 除尘系统监测指标信息新增/修改 Request VO")
|
||||
@Data
|
||||
public class DustTargetinfoSaveReqVO {
|
||||
|
||||
@Schema(description = "主键", requiredMode = Schema.RequiredMode.REQUIRED, example = "23526")
|
||||
private String id;
|
||||
|
||||
@Schema(description = "指标编码", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||
// @NotEmpty(message = "指标编码不能为空")
|
||||
private String targetCode;
|
||||
|
||||
@Schema(description = "指标名称", requiredMode = Schema.RequiredMode.REQUIRED, example = "王五")
|
||||
@NotEmpty(message = "指标名称不能为空")
|
||||
private String targetName;
|
||||
|
||||
@Schema(description = "所属除尘系统编码", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||
@NotEmpty(message = "所属除尘系统编码不能为空")
|
||||
private String equipCode;
|
||||
|
||||
@Schema(description = "指标类别", requiredMode = Schema.RequiredMode.REQUIRED, example = "2")
|
||||
@NotEmpty(message = "指标类别不能为空")
|
||||
private String targetType;
|
||||
|
||||
@Schema(description = "指标位置", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||
@NotEmpty(message = "指标位置不能为空")
|
||||
private String targetPlace;
|
||||
|
||||
@Schema(description = "计量单位", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||
// @NotEmpty(message = "计量单位不能为空")
|
||||
private String targetUnit;
|
||||
|
||||
@Schema(description = "指标阈值上限 ")
|
||||
private BigDecimal thresholdUpLimit;
|
||||
|
||||
@Schema(description = "指标阈值上上限 ")
|
||||
private BigDecimal thresholdUpUpLimit;
|
||||
|
||||
@Schema(description = "指标阈值下限 ")
|
||||
private BigDecimal thresholdDownLimit;
|
||||
|
||||
@Schema(description = "指标阈值下下限 ")
|
||||
private BigDecimal thresholdDownDownLimit;
|
||||
|
||||
@Schema(description = "量程上限")
|
||||
private BigDecimal rangeUp;
|
||||
|
||||
@Schema(description = "量程下限")
|
||||
private BigDecimal rangeDown;
|
||||
|
||||
@Schema(description = "描述 ", example = "你猜")
|
||||
private String targetDescription;
|
||||
|
||||
@Schema(description = "位号")
|
||||
private String bitNo;
|
||||
|
||||
@Schema(description = "信号类型", requiredMode = Schema.RequiredMode.REQUIRED, example = "1")
|
||||
@NotEmpty(message = "信号类型不能为空")
|
||||
private String signalType;
|
||||
|
||||
@Schema(description = "开关量报警值")
|
||||
private Integer alarmValue;
|
||||
|
||||
@Schema(description = "指标停用状态", requiredMode = Schema.RequiredMode.REQUIRED, example = "2")
|
||||
@NotEmpty(message = "指标停用状态不能为空")
|
||||
private String targetStatus;
|
||||
|
||||
}
|
||||
@ -0,0 +1,116 @@
|
||||
package cn.iocoder.yudao.module.system.dal.dataobject.dusttargetinfo;
|
||||
|
||||
import lombok.*;
|
||||
import java.util.*;
|
||||
import java.math.BigDecimal;
|
||||
import java.math.BigDecimal;
|
||||
import java.math.BigDecimal;
|
||||
import java.math.BigDecimal;
|
||||
import java.math.BigDecimal;
|
||||
import java.time.LocalDateTime;
|
||||
import java.time.LocalDateTime;
|
||||
import com.baomidou.mybatisplus.annotation.*;
|
||||
import cn.iocoder.yudao.framework.mybatis.core.dataobject.BaseDO;
|
||||
|
||||
/**
|
||||
* 除尘系统监测指标信息 DO
|
||||
*
|
||||
* @author 超级管理员
|
||||
*/
|
||||
@TableName("hazard_dust_targetinfo")
|
||||
@KeySequence("hazard_dust_targetinfo_seq") // 用于 Oracle、PostgreSQL、Kingbase、DB2、H2 数据库的主键自增。如果是 MySQL 等数据库,可不写。
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@ToString(callSuper = true)
|
||||
@Builder
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
public class DustTargetinfoDO extends BaseDO {
|
||||
|
||||
/**
|
||||
* 主键
|
||||
*/
|
||||
@TableId(type = IdType.ASSIGN_ID)
|
||||
private String id;
|
||||
/**
|
||||
* 指标编码
|
||||
*/
|
||||
private String targetCode;
|
||||
/**
|
||||
* 指标名称
|
||||
*
|
||||
* 枚举 {@link TODO target_name 对应的类}
|
||||
*/
|
||||
private String targetName;
|
||||
/**
|
||||
* 所属除尘系统编码
|
||||
*/
|
||||
private String equipCode;
|
||||
/**
|
||||
* 指标类别
|
||||
*
|
||||
* 枚举 {@link TODO target_type 对应的类}
|
||||
*/
|
||||
private String targetType;
|
||||
/**
|
||||
* 指标位置
|
||||
*/
|
||||
private String targetPlace;
|
||||
/**
|
||||
* 计量单位
|
||||
*/
|
||||
private String targetUnit;
|
||||
/**
|
||||
* 指标阈值上限
|
||||
*/
|
||||
private BigDecimal thresholdUpLimit;
|
||||
/**
|
||||
* 指标阈值上上限
|
||||
*/
|
||||
private BigDecimal thresholdUpUpLimit;
|
||||
/**
|
||||
* 指标阈值下限
|
||||
*/
|
||||
private BigDecimal thresholdDownLimit;
|
||||
/**
|
||||
* 指标阈值下下限
|
||||
*/
|
||||
private BigDecimal thresholdDownDownLimit;
|
||||
/**
|
||||
* 量程上限
|
||||
*/
|
||||
private BigDecimal rangeUp;
|
||||
|
||||
/**
|
||||
* 量程下限
|
||||
*/
|
||||
private BigDecimal rangeDown;
|
||||
/**
|
||||
* 描述
|
||||
*/
|
||||
private String targetDescription;
|
||||
/**
|
||||
* 位号
|
||||
*/
|
||||
private String bitNo;
|
||||
/**
|
||||
* 信号类型
|
||||
*
|
||||
* 枚举 {@link TODO signal_type 对应的类}
|
||||
*/
|
||||
private String signalType;
|
||||
/**
|
||||
* 开关量报警值
|
||||
*
|
||||
* 枚举 {@link TODO alarm_value 对应的类}
|
||||
*/
|
||||
private Integer alarmValue;
|
||||
/**
|
||||
* 指标停用状态
|
||||
*
|
||||
* 枚举 {@link TODO target_status 对应的类}
|
||||
*/
|
||||
private String targetStatus;
|
||||
|
||||
|
||||
}
|
||||
@ -0,0 +1,44 @@
|
||||
package cn.iocoder.yudao.module.system.dal.mysql.dusttargetinfo;
|
||||
|
||||
import java.util.*;
|
||||
|
||||
import cn.iocoder.yudao.framework.common.pojo.PageResult;
|
||||
import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX;
|
||||
import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX;
|
||||
import cn.iocoder.yudao.module.system.dal.dataobject.dusttargetinfo.DustTargetinfoDO;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
import cn.iocoder.yudao.module.system.controller.admin.dusttargetinfo.vo.*;
|
||||
import org.apache.ibatis.annotations.Select;
|
||||
|
||||
/**
|
||||
* 除尘系统监测指标信息 Mapper
|
||||
*
|
||||
* @author 超级管理员
|
||||
*/
|
||||
@Mapper
|
||||
public interface DustTargetinfoMapper extends BaseMapperX<DustTargetinfoDO> {
|
||||
|
||||
default PageResult<DustTargetinfoDO> selectPage(DustTargetinfoPageReqVO reqVO) {
|
||||
return selectPage(reqVO, new LambdaQueryWrapperX<DustTargetinfoDO>()
|
||||
.eqIfPresent(DustTargetinfoDO::getTargetCode, reqVO.getTargetCode())
|
||||
.likeIfPresent(DustTargetinfoDO::getTargetName, reqVO.getTargetName())
|
||||
.eqIfPresent(DustTargetinfoDO::getEquipCode, reqVO.getEquipCode())
|
||||
.eqIfPresent(DustTargetinfoDO::getTargetType, reqVO.getTargetType())
|
||||
.eqIfPresent(DustTargetinfoDO::getTargetPlace, reqVO.getTargetPlace())
|
||||
.eqIfPresent(DustTargetinfoDO::getTargetUnit, reqVO.getTargetUnit())
|
||||
.eqIfPresent(DustTargetinfoDO::getThresholdUpLimit, reqVO.getThresholdUpLimit())
|
||||
.eqIfPresent(DustTargetinfoDO::getThresholdUpUpLimit, reqVO.getThresholdUpUpLimit())
|
||||
.eqIfPresent(DustTargetinfoDO::getThresholdDownLimit, reqVO.getThresholdDownLimit())
|
||||
.eqIfPresent(DustTargetinfoDO::getThresholdDownDownLimit, reqVO.getThresholdDownDownLimit())
|
||||
.eqIfPresent(DustTargetinfoDO::getRangeUp, reqVO.getRangeUp())
|
||||
.eqIfPresent(DustTargetinfoDO::getTargetDescription, reqVO.getTargetDescription())
|
||||
.eqIfPresent(DustTargetinfoDO::getBitNo, reqVO.getBitNo())
|
||||
.eqIfPresent(DustTargetinfoDO::getSignalType, reqVO.getSignalType())
|
||||
.eqIfPresent(DustTargetinfoDO::getAlarmValue, reqVO.getAlarmValue())
|
||||
.eqIfPresent(DustTargetinfoDO::getTargetStatus, reqVO.getTargetStatus())
|
||||
.betweenIfPresent(DustTargetinfoDO::getCreateTime, reqVO.getCreateTime())
|
||||
.orderByDesc(DustTargetinfoDO::getId));
|
||||
}
|
||||
@Select("select equip_code from hazard_dust_targetinfo where equip_code = #{equipCode} and deleted = 0 ORDER BY CAST(target_code AS UNSIGNED) DESC LIMIT 1")
|
||||
Long getMaxTargetCode(String equipCode);
|
||||
}
|
||||
@ -0,0 +1,63 @@
|
||||
package cn.iocoder.yudao.module.system.service.dusttargetinfo;
|
||||
|
||||
import java.util.*;
|
||||
import jakarta.validation.*;
|
||||
import cn.iocoder.yudao.module.system.controller.admin.dusttargetinfo.vo.*;
|
||||
import cn.iocoder.yudao.module.system.dal.dataobject.dusttargetinfo.DustTargetinfoDO;
|
||||
import cn.iocoder.yudao.framework.common.pojo.PageResult;
|
||||
import cn.iocoder.yudao.framework.common.pojo.PageParam;
|
||||
|
||||
/**
|
||||
* 除尘系统监测指标信息 Service 接口
|
||||
*
|
||||
* @author 超级管理员
|
||||
*/
|
||||
public interface DustTargetinfoService {
|
||||
|
||||
/**
|
||||
* 创建除尘系统监测指标信息
|
||||
*
|
||||
* @param createReqVO 创建信息
|
||||
* @return 编号
|
||||
*/
|
||||
String createDustTargetinfo(@Valid DustTargetinfoSaveReqVO createReqVO);
|
||||
|
||||
/**
|
||||
* 更新除尘系统监测指标信息
|
||||
*
|
||||
* @param updateReqVO 更新信息
|
||||
*/
|
||||
void updateDustTargetinfo(@Valid DustTargetinfoSaveReqVO updateReqVO);
|
||||
|
||||
/**
|
||||
* 删除除尘系统监测指标信息
|
||||
*
|
||||
* @param id 编号
|
||||
*/
|
||||
void deleteDustTargetinfo(String id);
|
||||
|
||||
/**
|
||||
* 批量删除除尘系统监测指标信息
|
||||
*
|
||||
* @param ids 编号
|
||||
*/
|
||||
void deleteDustTargetinfoListByIds(List<String> ids);
|
||||
|
||||
/**
|
||||
* 获得除尘系统监测指标信息
|
||||
*
|
||||
* @param id 编号
|
||||
* @return 除尘系统监测指标信息
|
||||
*/
|
||||
DustTargetinfoDO getDustTargetinfo(String id);
|
||||
|
||||
/**
|
||||
* 获得除尘系统监测指标信息分页
|
||||
*
|
||||
* @param pageReqVO 分页查询
|
||||
* @return 除尘系统监测指标信息分页
|
||||
*/
|
||||
PageResult<DustTargetinfoDO> getDustTargetinfoPage(DustTargetinfoPageReqVO pageReqVO);
|
||||
|
||||
List<DustTargetinfoDO> getEquipTargetList(String equipCode);
|
||||
}
|
||||
@ -0,0 +1,99 @@
|
||||
package cn.iocoder.yudao.module.system.service.dusttargetinfo;
|
||||
|
||||
import cn.hutool.core.collection.CollUtil;
|
||||
import cn.iocoder.yudao.module.system.service.dustequipinfo.DustEquipinfoService;
|
||||
import org.springframework.stereotype.Service;
|
||||
import jakarta.annotation.Resource;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import java.util.*;
|
||||
import cn.iocoder.yudao.module.system.controller.admin.dusttargetinfo.vo.*;
|
||||
import cn.iocoder.yudao.module.system.dal.dataobject.dusttargetinfo.DustTargetinfoDO;
|
||||
import cn.iocoder.yudao.framework.common.pojo.PageResult;
|
||||
import cn.iocoder.yudao.framework.common.pojo.PageParam;
|
||||
import cn.iocoder.yudao.framework.common.util.object.BeanUtils;
|
||||
|
||||
import cn.iocoder.yudao.module.system.dal.mysql.dusttargetinfo.DustTargetinfoMapper;
|
||||
|
||||
import static cn.iocoder.yudao.framework.common.exception.util.ServiceExceptionUtil.exception;
|
||||
import static cn.iocoder.yudao.framework.common.util.collection.CollectionUtils.convertList;
|
||||
import static cn.iocoder.yudao.framework.common.util.collection.CollectionUtils.diffList;
|
||||
import static cn.iocoder.yudao.module.system.enums.ErrorCodeConstants.*;
|
||||
|
||||
/**
|
||||
* 除尘系统监测指标信息 Service 实现类
|
||||
*
|
||||
* @author 超级管理员
|
||||
*/
|
||||
@Service
|
||||
@Validated
|
||||
public class DustTargetinfoServiceImpl implements DustTargetinfoService {
|
||||
|
||||
@Resource
|
||||
private DustTargetinfoMapper dustTargetinfoMapper;
|
||||
|
||||
@Resource
|
||||
private DustEquipinfoService dustEquipinfoService;
|
||||
@Override
|
||||
public String createDustTargetinfo(DustTargetinfoSaveReqVO createReqVO) {
|
||||
// 插入
|
||||
//所属除尘系统设备编码
|
||||
String equipCode = createReqVO.getEquipCode();
|
||||
//然后根据设备编码去查找所有的指标信息,并将他们倒叙排序找到指标编码的最大值
|
||||
Long maxTargetCode = dustTargetinfoMapper.getMaxTargetCode(equipCode);
|
||||
Long targetCode = Optional.ofNullable(maxTargetCode).map(maxCode -> maxCode+1).orElse(1L);
|
||||
createReqVO.setTargetCode(String.format("%03d", targetCode));
|
||||
DustTargetinfoDO dustTargetinfo = BeanUtils.toBean(createReqVO, DustTargetinfoDO.class);
|
||||
dustTargetinfoMapper.insert(dustTargetinfo);
|
||||
|
||||
// 返回
|
||||
return dustTargetinfo.getId();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void updateDustTargetinfo(DustTargetinfoSaveReqVO updateReqVO) {
|
||||
// 校验存在
|
||||
validateDustTargetinfoExists(updateReqVO.getId());
|
||||
// 更新
|
||||
DustTargetinfoDO updateObj = BeanUtils.toBean(updateReqVO, DustTargetinfoDO.class);
|
||||
dustTargetinfoMapper.updateById(updateObj);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void deleteDustTargetinfo(String id) {
|
||||
// 校验存在
|
||||
validateDustTargetinfoExists(id);
|
||||
// 删除
|
||||
dustTargetinfoMapper.deleteById(id);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void deleteDustTargetinfoListByIds(List<String> ids) {
|
||||
// 删除
|
||||
dustTargetinfoMapper.deleteByIds(ids);
|
||||
}
|
||||
|
||||
|
||||
private void validateDustTargetinfoExists(String id) {
|
||||
if (dustTargetinfoMapper.selectById(id) == null) {
|
||||
throw exception(DUST_TARGETINFO_NOT_EXISTS);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public DustTargetinfoDO getDustTargetinfo(String id) {
|
||||
return dustTargetinfoMapper.selectById(id);
|
||||
}
|
||||
|
||||
@Override
|
||||
public PageResult<DustTargetinfoDO> getDustTargetinfoPage(DustTargetinfoPageReqVO pageReqVO) {
|
||||
return dustTargetinfoMapper.selectPage(pageReqVO);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<DustTargetinfoDO> getEquipTargetList(String equipCode) {
|
||||
return dustTargetinfoMapper.selectList(DustTargetinfoDO::getEquipCode, equipCode);
|
||||
}
|
||||
|
||||
}
|
||||
Loading…
Reference in new issue