update Dms报警类型维护关联设备大类、设备类型字段

master
yinq 1 week ago
parent 7634a410e8
commit d417e53c78

@ -58,5 +58,16 @@ public class BaseAlarmType extends TenantEntity {
*/
private String remark;
/**
*
*/
@TableField(exist = false)
private String deviceCategoryName;
/**
*
*/
@TableField(exist = false)
private String deviceTypeName;
}

@ -0,0 +1,53 @@
package org.dromara.dms.domain;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import lombok.Data;
import lombok.EqualsAndHashCode;
import org.dromara.common.tenant.core.TenantEntity;
import java.io.Serial;
/**
* base_device_category
*
* @author xins
* @date 2025-02-21
*/
@Data
@EqualsAndHashCode(callSuper = true)
@TableName("base_device_category")
public class DmsBaseDeviceCategory extends TenantEntity {
@Serial
private static final long serialVersionUID = 1L;
/**
* ID
*/
@TableId(value = "device_category_id", type = IdType.AUTO)
private Long deviceCategoryId;
/**
*
*/
private String deviceCategoryCode;
/**
*
*/
private String deviceCategoryName;
/**
* 1 0
*/
private String activeFlag;
/**
*
*/
private String remark;
}

@ -0,0 +1,65 @@
package org.dromara.dms.domain;
import com.baomidou.mybatisplus.annotation.TableName;
import lombok.Data;
import lombok.EqualsAndHashCode;
import org.dromara.common.tenant.core.TenantEntity;
import java.io.Serial;
/**
* base_device_type
*
* @author xins
* @date 2025-02-21
*/
@Data
@EqualsAndHashCode(callSuper = true)
@TableName("base_device_type")
public class DmsBaseDeviceType extends TenantEntity {
@Serial
private static final long serialVersionUID = 1L;
/**
* ID
*/
private Long deviceTypeId;
/**
*
*/
private Long parentId;
/**
*
*/
private String deviceTypeCode;
/**
*
*/
private String deviceTypeName;
/**
*
*/
private String ancestors;
/**
* IDIDbase_categorycategory_type2
*/
private Long deviceCategoryId;
/**
* 1 0
*/
private String activeFlag;
/**
*
*/
private String remark;
}

@ -10,8 +10,6 @@ import lombok.Data;
import java.io.Serial;
import java.io.Serializable;
import java.util.Date;
/**
@ -71,5 +69,15 @@ public class BaseAlarmTypeVo implements Serializable {
@ExcelProperty(value = "备注")
private String remark;
/**
*
*/
@ExcelProperty(value = "设备大类名称")
private String deviceCategoryName;
/**
*
*/
@ExcelProperty(value = "设备类型名称")
private String deviceTypeName;
}

@ -0,0 +1,14 @@
package org.dromara.dms.mapper;
import org.dromara.common.mybatis.core.mapper.BaseMapperPlus;
import org.dromara.dms.domain.DmsBaseDeviceCategory;
/**
* Mapper
*
* @author Yinq
* @date 2025-02-21
*/
public interface DmsDeviceCategoryMapper extends BaseMapperPlus<DmsBaseDeviceCategory, DmsBaseDeviceCategory> {
}

@ -0,0 +1,14 @@
package org.dromara.dms.mapper;
import org.dromara.common.mybatis.core.mapper.BaseMapperPlus;
import org.dromara.dms.domain.DmsBaseDeviceType;
/**
* Mapper
*
* @author Yinq
* @date 2025-02-21
*/
public interface DmsDeviceTypeMapper extends BaseMapperPlus<DmsBaseDeviceType, DmsBaseDeviceType> {
}

@ -9,6 +9,8 @@ import com.github.yulichang.toolkit.JoinWrappers;
import com.github.yulichang.wrapper.MPJLambdaWrapper;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import lombok.RequiredArgsConstructor;
import org.dromara.dms.domain.DmsBaseDeviceCategory;
import org.dromara.dms.domain.DmsBaseDeviceType;
import org.springframework.stereotype.Service;
import org.dromara.dms.domain.bo.BaseAlarmTypeBo;
import org.dromara.dms.domain.vo.BaseAlarmTypeVo;
@ -39,7 +41,7 @@ public class BaseAlarmTypeServiceImpl implements IBaseAlarmTypeService {
* @return
*/
@Override
public BaseAlarmTypeVo queryById(Long alarmTypeId){
public BaseAlarmTypeVo queryById(Long alarmTypeId) {
return baseMapper.selectVoById(alarmTypeId);
}
@ -73,6 +75,10 @@ public class BaseAlarmTypeServiceImpl implements IBaseAlarmTypeService {
Map<String, Object> params = bo.getParams();
MPJLambdaWrapper<BaseAlarmType> lqw = JoinWrappers.lambda(BaseAlarmType.class)
.selectAll(BaseAlarmType.class)
.select(DmsBaseDeviceCategory::getDeviceCategoryName)
.select(DmsBaseDeviceType::getDeviceTypeName)
.leftJoin(DmsBaseDeviceCategory.class, DmsBaseDeviceCategory::getDeviceCategoryId, BaseAlarmType::getDeviceCategoryId)
.leftJoin(DmsBaseDeviceType.class, DmsBaseDeviceType::getDeviceTypeId, BaseAlarmType::getDeviceTypeId)
.eq(bo.getAlarmTypeId() != null, BaseAlarmType::getAlarmTypeId, bo.getAlarmTypeId())
.eq(StringUtils.isNotBlank(bo.getAlarmTypeCode()), BaseAlarmType::getAlarmTypeCode, bo.getAlarmTypeCode())
.like(StringUtils.isNotBlank(bo.getAlarmTypeName()), BaseAlarmType::getAlarmTypeName, bo.getAlarmTypeName())
@ -116,7 +122,7 @@ public class BaseAlarmTypeServiceImpl implements IBaseAlarmTypeService {
/**
*
*/
private void validEntityBeforeSave(BaseAlarmType entity){
private void validEntityBeforeSave(BaseAlarmType entity) {
//TODO 做一些数据校验,如唯一约束
}
@ -129,7 +135,7 @@ public class BaseAlarmTypeServiceImpl implements IBaseAlarmTypeService {
*/
@Override
public Boolean deleteWithValidByIds(Collection<Long> ids, Boolean isValid) {
if(isValid){
if (isValid) {
//TODO 做一些业务上的校验,判断是否需要校验
}
return baseMapper.deleteByIds(ids) > 0;

Loading…
Cancel
Save