feat(pltcm): 新增设备启用状态管理功能

- 创建 ModDeviceEnable 实体类定义设备启用状态数据结构
- 实现 IModDeviceEnableService 接口及 ModDeviceEnableServiceImpl 业务逻辑
- 添加 ModDeviceEnableController 提供 REST API 接口支持增删改查操作
- 配置 ModDeviceEnableMapper 和 MyBatis XML 映射文件
- 定义 ModDeviceEnableBo 和 ModDeviceEnableVo 数据传输对象
- 集成 Excel 导出功能支持设备数据批量导出
- 实现分页查询、条件筛选和排序功能
This commit is contained in:
2026-07-06 17:34:25 +08:00
parent e42eac9115
commit 038e8544a0
8 changed files with 283 additions and 0 deletions

View File

@@ -0,0 +1,81 @@
package com.klp.pltcm.service.impl;
import cn.hutool.core.bean.BeanUtil;
import com.klp.common.core.page.TableDataInfo;
import com.klp.common.core.domain.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.klp.common.utils.StringUtils;
import lombok.RequiredArgsConstructor;
import org.springframework.stereotype.Service;
import com.klp.pltcm.domain.bo.ModDeviceEnableBo;
import com.klp.pltcm.domain.vo.ModDeviceEnableVo;
import com.klp.pltcm.domain.ModDeviceEnable;
import com.klp.pltcm.mapper.ModDeviceEnableMapper;
import com.klp.pltcm.service.IModDeviceEnableService;
import java.util.List;
import java.util.Map;
import java.util.Collection;
@RequiredArgsConstructor
@Service
public class ModDeviceEnableServiceImpl implements IModDeviceEnableService {
private final ModDeviceEnableMapper baseMapper;
@Override
public ModDeviceEnableVo queryById(Long id) {
return baseMapper.selectVoById(id);
}
@Override
public TableDataInfo<ModDeviceEnableVo> queryPageList(ModDeviceEnableBo bo, PageQuery pageQuery) {
LambdaQueryWrapper<ModDeviceEnable> lqw = buildQueryWrapper(bo);
Page<ModDeviceEnableVo> result = baseMapper.selectVoPage(pageQuery.build(), lqw);
return TableDataInfo.build(result);
}
@Override
public List<ModDeviceEnableVo> queryList(ModDeviceEnableBo bo) {
LambdaQueryWrapper<ModDeviceEnable> lqw = buildQueryWrapper(bo);
return baseMapper.selectVoList(lqw);
}
private LambdaQueryWrapper<ModDeviceEnable> buildQueryWrapper(ModDeviceEnableBo bo) {
Map<String, Object> params = bo.getParams();
LambdaQueryWrapper<ModDeviceEnable> lqw = Wrappers.lambdaQuery();
lqw.like(StringUtils.isNotBlank(bo.getDeviceCode()), ModDeviceEnable::getDeviceCode, bo.getDeviceCode());
lqw.like(StringUtils.isNotBlank(bo.getDeviceName()), ModDeviceEnable::getDeviceName, bo.getDeviceName());
lqw.eq(StringUtils.isNotBlank(bo.getDeviceType()), ModDeviceEnable::getDeviceType, bo.getDeviceType());
lqw.like(StringUtils.isNotBlank(bo.getWorkshop()), ModDeviceEnable::getWorkshop, bo.getWorkshop());
lqw.like(StringUtils.isNotBlank(bo.getLineName()), ModDeviceEnable::getLineName, bo.getLineName());
lqw.eq(bo.getIsEnabled() != null, ModDeviceEnable::getIsEnabled, bo.getIsEnabled());
lqw.orderByAsc(ModDeviceEnable::getSortOrder);
return lqw;
}
@Override
public Boolean insertByBo(ModDeviceEnableBo bo) {
ModDeviceEnable add = BeanUtil.toBean(bo, ModDeviceEnable.class);
boolean flag = baseMapper.insert(add) > 0;
if (flag) {
bo.setId(add.getId());
}
return flag;
}
@Override
public Boolean updateByBo(ModDeviceEnableBo bo) {
ModDeviceEnable update = BeanUtil.toBean(bo, ModDeviceEnable.class);
return baseMapper.updateById(update) > 0;
}
@Override
public Boolean deleteWithValidByIds(Collection<Long> ids, Boolean isValid) {
if (isValid) {
}
return baseMapper.deleteBatchIds(ids) > 0;
}
}