微调字典类型和字典数据,被检设备功能实现
This commit is contained in:
@@ -11,84 +11,84 @@ import java.time.LocalDateTime;
|
||||
* @data 2024/11/6
|
||||
*/
|
||||
@Data
|
||||
public class DictDataVO implements Serializable {
|
||||
public class DictDataExcel implements Serializable {
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/**
|
||||
* 字典数据表Id
|
||||
*/
|
||||
@Excel(name = "字典数据表Id")
|
||||
@Excel(name = "字典数据id", width = 40)
|
||||
private String id;
|
||||
|
||||
/**
|
||||
* 字典类型表Id
|
||||
*/
|
||||
@Excel(name = "字典类型表Id")
|
||||
@Excel(name = "字典类型id", width = 40)
|
||||
private String typeId;
|
||||
|
||||
/**
|
||||
* 名称
|
||||
*/
|
||||
@Excel(name = "名称")
|
||||
@Excel(name = "名称", width = 20)
|
||||
private String name;
|
||||
|
||||
/**
|
||||
* 编码
|
||||
*/
|
||||
@Excel(name = "编码")
|
||||
@Excel(name = "编码", width = 20)
|
||||
private String code;
|
||||
|
||||
/**
|
||||
* 排序
|
||||
*/
|
||||
@Excel(name = "排序")
|
||||
@Excel(name = "排序", width = 15)
|
||||
private Integer sort;
|
||||
|
||||
/**
|
||||
* 事件等级:0-普通;1-中等;2-严重(默认为0)
|
||||
*/
|
||||
@Excel(name = "事件等级")
|
||||
@Excel(name = "事件等级", width = 15)
|
||||
private Integer level;
|
||||
|
||||
/**
|
||||
* 与高级算法内部Id描述对应;
|
||||
*/
|
||||
@Excel(name = "与高级算法内部Id描述对应")
|
||||
@Excel(name = "高级算法内部id", width = 15)
|
||||
private Integer algoDescribe;
|
||||
|
||||
/**
|
||||
* 目前只用于表示电压等级数值
|
||||
*/
|
||||
@Excel(name = "数值")
|
||||
@Excel(name = "数值", width = 15)
|
||||
private String value;
|
||||
|
||||
/**
|
||||
* 状态:0-删除 1-正常
|
||||
*/
|
||||
@Excel(name = "状态")
|
||||
private Integer state;
|
||||
// @Excel(name = "状态", width = 15)
|
||||
// private Integer state;
|
||||
|
||||
/**
|
||||
* 创建人
|
||||
*/
|
||||
@Excel(name = "创建人")
|
||||
@Excel(name = "创建人", width = 40)
|
||||
private String createBy;
|
||||
|
||||
/**
|
||||
* 创建时间
|
||||
*/
|
||||
@Excel(name = "创建时间", format = "yyyy-MM-dd HH:mm:ss")
|
||||
@Excel(name = "创建时间", format = "yyyy-MM-dd HH:mm:ss", width = 25)
|
||||
private LocalDateTime createTime;
|
||||
|
||||
/**
|
||||
* 更新人
|
||||
*/
|
||||
@Excel(name = "更新人")
|
||||
@Excel(name = "更新人", width = 40)
|
||||
private String updateBy;
|
||||
|
||||
/**
|
||||
* 更新时间
|
||||
*/
|
||||
@Excel(name = "更新时间", format = "yyyy-MM-dd HH:mm:ss")
|
||||
@Excel(name = "更新时间", format = "yyyy-MM-dd HH:mm:ss", width = 25)
|
||||
private LocalDateTime updateTime;
|
||||
}
|
||||
@@ -12,78 +12,78 @@ import java.time.LocalDateTime;
|
||||
* @date 2024/11/5
|
||||
*/
|
||||
@Data
|
||||
public class DictTypeVO implements Serializable {
|
||||
public class DictTypeExcel implements Serializable {
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/**
|
||||
* 字典类型表Id
|
||||
*/
|
||||
@Excel(name = "Id")
|
||||
@Excel(name = "id", width = 40)
|
||||
private String id;
|
||||
|
||||
/**
|
||||
* 名称
|
||||
*/
|
||||
@Excel(name = "名称")
|
||||
@Excel(name = "名称", width = 20)
|
||||
private String name;
|
||||
|
||||
/**
|
||||
* 编码
|
||||
*/
|
||||
@Excel(name = "编码")
|
||||
@Excel(name = "编码", width = 20)
|
||||
private String code;
|
||||
|
||||
/**
|
||||
* 排序
|
||||
*/
|
||||
@Excel(name = "排序")
|
||||
@Excel(name = "排序", width = 15)
|
||||
private Integer sort;
|
||||
|
||||
/**
|
||||
* 开启等级:0-不开启;1-开启,默认不开启
|
||||
*/
|
||||
@Excel(name = "开启等级")
|
||||
@Excel(name = "开启等级", width = 15)
|
||||
private Integer openLevel;
|
||||
|
||||
/**
|
||||
* 开启描述:0-不开启;1-开启,默认不开启
|
||||
*/
|
||||
@Excel(name = "开启描述")
|
||||
@Excel(name = "开启描述", width = 15)
|
||||
private Integer openDescribe;
|
||||
|
||||
/**
|
||||
* 描述
|
||||
*/
|
||||
@Excel(name = "描述")
|
||||
@Excel(name = "描述", width = 50)
|
||||
private String remark;
|
||||
|
||||
/**
|
||||
* 状态:0-删除 1-正常
|
||||
*/
|
||||
@Excel(name = "状态")
|
||||
private Integer state;
|
||||
// @Excel(name = "状态", width = 15)
|
||||
// private Integer state;
|
||||
|
||||
/**
|
||||
* 创建人
|
||||
*/
|
||||
@Excel(name = "创建人")
|
||||
@Excel(name = "创建人", width = 40)
|
||||
private String createBy;
|
||||
|
||||
/**
|
||||
* 创建时间
|
||||
*/
|
||||
@Excel(name = "创建时间", format = "yyyy-MM-dd HH:mm:ss")
|
||||
@Excel(name = "创建时间", format = "yyyy-MM-dd HH:mm:ss", width = 25)
|
||||
private LocalDateTime createTime;
|
||||
|
||||
/**
|
||||
* 更新人
|
||||
*/
|
||||
@Excel(name = "更新人")
|
||||
@Excel(name = "更新人", width = 40)
|
||||
private String updateBy;
|
||||
|
||||
/**
|
||||
* 更新时间
|
||||
*/
|
||||
@Excel(name = "更新时间", format = "yyyy-MM-dd HH:mm:ss")
|
||||
@Excel(name = "更新时间", format = "yyyy-MM-dd HH:mm:ss", width = 25)
|
||||
private LocalDateTime updateTime;
|
||||
}
|
||||
@@ -13,8 +13,7 @@ import com.njcn.common.pojo.exception.BusinessException;
|
||||
import com.njcn.db.mybatisplus.constant.DbConstant;
|
||||
import com.njcn.gather.system.dictionary.mapper.DictDataMapper;
|
||||
import com.njcn.gather.system.dictionary.pojo.dto.DictDataCache;
|
||||
import com.njcn.gather.system.dictionary.pojo.vo.DictDataVO;
|
||||
import com.njcn.gather.system.dictionary.pojo.vo.DictTypeVO;
|
||||
import com.njcn.gather.system.dictionary.pojo.vo.DictDataExcel;
|
||||
import com.njcn.gather.system.pojo.enums.SystemResponseEnum;
|
||||
import com.njcn.gather.system.dictionary.pojo.param.DictDataParam;
|
||||
import com.njcn.gather.system.dictionary.pojo.po.DictData;
|
||||
@@ -47,7 +46,7 @@ public class DictDataServiceImpl extends ServiceImpl<DictDataMapper, DictData> i
|
||||
QueryWrapper<DictData> queryWrapper = new QueryWrapper<>();
|
||||
if (ObjectUtil.isNotNull(queryParam)) {
|
||||
queryWrapper.like(StrUtil.isNotBlank(queryParam.getName()), "sys_dict_data.name", queryParam.getName())
|
||||
.like(StrUtil.isNotBlank(queryParam.getCode()), "sys_dict_data.code", queryParam.getCode());
|
||||
.like(StrUtil.isNotBlank(queryParam.getCode()), "sys_dict_data.code", queryParam.getCode());
|
||||
//排序
|
||||
if (ObjectUtil.isAllNotEmpty(queryParam.getSortBy(), queryParam.getOrderBy())) {
|
||||
queryWrapper.orderBy(true, queryParam.getOrderBy().equals(DbConstant.ASC), StrUtil.toUnderlineCase(queryParam.getSortBy()));
|
||||
@@ -100,7 +99,7 @@ public class DictDataServiceImpl extends ServiceImpl<DictDataMapper, DictData> i
|
||||
@Override
|
||||
public DictData getDicDataByCode(String code) {
|
||||
LambdaQueryWrapper<DictData> queryWrapper = new LambdaQueryWrapper<>();
|
||||
queryWrapper.eq(DictData::getCode,code)
|
||||
queryWrapper.eq(DictData::getCode, code)
|
||||
.eq(DictData::getState, DataStateEnum.ENABLE.getCode());
|
||||
return this.baseMapper.selectOne(queryWrapper);
|
||||
}
|
||||
@@ -110,10 +109,10 @@ public class DictDataServiceImpl extends ServiceImpl<DictDataMapper, DictData> i
|
||||
MPJLambdaWrapper<DictData> dictTypeWrapper = new MPJLambdaWrapper<DictData>()
|
||||
.selectAll(DictData.class)
|
||||
.selectAs(DictType::getId, DictDataCache::getTypeId)
|
||||
.selectAs(DictType::getName,DictDataCache::getTypeName)
|
||||
.selectAs(DictType::getCode,DictDataCache::getTypeCode)
|
||||
.selectAs(DictType::getName, DictDataCache::getTypeName)
|
||||
.selectAs(DictType::getCode, DictDataCache::getTypeCode)
|
||||
.leftJoin(DictType.class, DictType::getId, DictData::getTypeId);
|
||||
List<DictDataCache> allDictData = this.getBaseMapper().selectJoinList(DictDataCache.class,dictTypeWrapper);
|
||||
List<DictDataCache> allDictData = this.getBaseMapper().selectJoinList(DictDataCache.class, dictTypeWrapper);
|
||||
|
||||
Map<Object, List<DictDataCache>> dictDataCacheMap = allDictData.stream()
|
||||
.collect(Collectors.groupingBy(DictDataCache::getTypeId));
|
||||
@@ -155,8 +154,8 @@ public class DictDataServiceImpl extends ServiceImpl<DictDataMapper, DictData> i
|
||||
queryWrapper.ne("sys_dict_data.state", DataStateEnum.DELETED.getCode())
|
||||
.eq("sys_dict_data.type_id", queryParam.getTypeId());
|
||||
List<DictData> dictDatas = this.list(queryWrapper);
|
||||
List<DictDataVO> dictDataVOS = BeanUtil.copyToList(dictDatas, DictDataVO.class);
|
||||
ExcelUtil.exportExcel("字典数据导出数据.xls", "字典数据", DictDataVO.class, dictDataVOS);
|
||||
List<DictDataExcel> dictDataExcels = BeanUtil.copyToList(dictDatas, DictDataExcel.class);
|
||||
ExcelUtil.exportExcel("字典数据导出数据.xlsx", "字典数据", DictDataExcel.class, dictDataExcels);
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -13,7 +13,7 @@ import com.njcn.db.mybatisplus.constant.DbConstant;
|
||||
import com.njcn.gather.system.dictionary.mapper.DictTypeMapper;
|
||||
import com.njcn.gather.system.dictionary.pojo.param.DictTypeParam;
|
||||
import com.njcn.gather.system.dictionary.pojo.po.DictType;
|
||||
import com.njcn.gather.system.dictionary.pojo.vo.DictTypeVO;
|
||||
import com.njcn.gather.system.dictionary.pojo.vo.DictTypeExcel;
|
||||
import com.njcn.gather.system.dictionary.service.IDictTypeService;
|
||||
import com.njcn.gather.system.pojo.enums.SystemResponseEnum;
|
||||
import com.njcn.web.factory.PageFactory;
|
||||
@@ -21,7 +21,6 @@ import com.njcn.web.utils.ExcelUtil;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
@@ -37,7 +36,7 @@ public class DictTypeServiceImpl extends ServiceImpl<DictTypeMapper, DictType> i
|
||||
QueryWrapper<DictType> queryWrapper = new QueryWrapper<>();
|
||||
if (ObjectUtil.isNotNull(queryParam)) {
|
||||
queryWrapper.like(StrUtil.isNotBlank(queryParam.getName()), "sys_dict_type.name", queryParam.getName())
|
||||
.like(StrUtil.isNotBlank(queryParam.getCode()), "sys_dict_type.code", queryParam.getCode());
|
||||
.like(StrUtil.isNotBlank(queryParam.getCode()), "sys_dict_type.code", queryParam.getCode());
|
||||
//排序
|
||||
if (ObjectUtil.isAllNotEmpty(queryParam.getSortBy(), queryParam.getOrderBy())) {
|
||||
queryWrapper.orderBy(true, queryParam.getOrderBy().equals(DbConstant.ASC), StrUtil.toUnderlineCase(queryParam.getSortBy()));
|
||||
@@ -92,8 +91,8 @@ public class DictTypeServiceImpl extends ServiceImpl<DictTypeMapper, DictType> i
|
||||
}
|
||||
queryWrapper.ne("sys_dict_type.state", DataStateEnum.DELETED.getCode());
|
||||
List<DictType> dictTypes = this.list(queryWrapper);
|
||||
List<DictTypeVO> dictTypeVOS = BeanUtil.copyToList(dictTypes, DictTypeVO.class);
|
||||
ExcelUtil.exportExcel("字典类型导出数据.xls", "字典类型", DictTypeVO.class, dictTypeVOS);
|
||||
List<DictTypeExcel> dictTypeVOS = BeanUtil.copyToList(dictTypes, DictTypeExcel.class);
|
||||
ExcelUtil.exportExcel("字典类型导出数据.xlsx", "字典类型", DictTypeExcel.class, dictTypeVOS);
|
||||
}
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user