|
@@ -24,8 +24,10 @@ public class WarningThresholdServiceImpl extends ServiceImpl<WarningThresholdMap
|
|
|
public Page<WarningThreshold> findByPage(long pageNum, long pageSize, String deviceCode, String warningType, String warningCode) {
|
|
public Page<WarningThreshold> findByPage(long pageNum, long pageSize, String deviceCode, String warningType, String warningCode) {
|
|
|
Page<WarningThreshold> page = new Page<>(pageNum, pageSize);
|
|
Page<WarningThreshold> page = new Page<>(pageNum, pageSize);
|
|
|
LambdaQueryWrapper<WarningThreshold> queryWrapper = new LambdaQueryWrapper<>();
|
|
LambdaQueryWrapper<WarningThreshold> queryWrapper = new LambdaQueryWrapper<>();
|
|
|
- queryWrapper.like(WarningThreshold::getDeviceCode,deviceCode)
|
|
|
|
|
- .like(WarningThreshold::getWarningType,warningType)
|
|
|
|
|
|
|
+ if (deviceCode != null && !deviceCode.isEmpty()) {
|
|
|
|
|
+ queryWrapper.apply("CONCAT(',', device_code, ',') LIKE CONCAT('%,', {0}, ',%')", deviceCode);
|
|
|
|
|
+ }
|
|
|
|
|
+ queryWrapper.like(WarningThreshold::getWarningType,warningType)
|
|
|
.like(WarningThreshold::getWarningCode,warningCode);
|
|
.like(WarningThreshold::getWarningCode,warningCode);
|
|
|
queryWrapper.orderByDesc(WarningThreshold::getUpdateTime);
|
|
queryWrapper.orderByDesc(WarningThreshold::getUpdateTime);
|
|
|
return this.page(page, queryWrapper);
|
|
return this.page(page, queryWrapper);
|
|
@@ -34,8 +36,10 @@ public class WarningThresholdServiceImpl extends ServiceImpl<WarningThresholdMap
|
|
|
@Override
|
|
@Override
|
|
|
public List<WarningThreshold> getWarningThresholdList(String deviceCode, String warningType, String warningCode) {
|
|
public List<WarningThreshold> getWarningThresholdList(String deviceCode, String warningType, String warningCode) {
|
|
|
LambdaQueryWrapper<WarningThreshold> queryWrapper = new LambdaQueryWrapper<>();
|
|
LambdaQueryWrapper<WarningThreshold> queryWrapper = new LambdaQueryWrapper<>();
|
|
|
- queryWrapper.like(WarningThreshold::getDeviceCode,deviceCode)
|
|
|
|
|
- .like(WarningThreshold::getWarningType,warningType)
|
|
|
|
|
|
|
+ if (deviceCode != null && !deviceCode.isEmpty()) {
|
|
|
|
|
+ queryWrapper.apply("CONCAT(',', device_code, ',') LIKE CONCAT('%,', {0}, ',%')", deviceCode);
|
|
|
|
|
+ }
|
|
|
|
|
+ queryWrapper.like(WarningThreshold::getWarningType,warningType)
|
|
|
.like(WarningThreshold::getWarningCode,warningCode);
|
|
.like(WarningThreshold::getWarningCode,warningCode);
|
|
|
queryWrapper.orderByDesc(WarningThreshold::getUpdateTime);
|
|
queryWrapper.orderByDesc(WarningThreshold::getUpdateTime);
|
|
|
return this.list(queryWrapper);
|
|
return this.list(queryWrapper);
|
|
@@ -43,11 +47,12 @@ public class WarningThresholdServiceImpl extends ServiceImpl<WarningThresholdMap
|
|
|
|
|
|
|
|
/**
|
|
/**
|
|
|
* 根据设备编号查询该设备所有预警值
|
|
* 根据设备编号查询该设备所有预警值
|
|
|
|
|
+ * device_code 字段支持多个设备编号,用逗号分隔
|
|
|
*/
|
|
*/
|
|
|
@Override
|
|
@Override
|
|
|
public WarningThreshold getWarningThresholdByDeviceAndCode(String deviceCode, String warningCodes) {
|
|
public WarningThreshold getWarningThresholdByDeviceAndCode(String deviceCode, String warningCodes) {
|
|
|
LambdaQueryWrapper<WarningThreshold> lambdaQueryWrapper = Wrappers.lambdaQuery(WarningThreshold.class)
|
|
LambdaQueryWrapper<WarningThreshold> lambdaQueryWrapper = Wrappers.lambdaQuery(WarningThreshold.class)
|
|
|
- .eq(WarningThreshold::getDeviceCode, deviceCode)
|
|
|
|
|
|
|
+ .apply("CONCAT(',', device_code, ',') LIKE CONCAT('%,', {0}, ',%')", deviceCode)
|
|
|
.eq(WarningThreshold::getWarningCode,warningCodes);
|
|
.eq(WarningThreshold::getWarningCode,warningCodes);
|
|
|
|
|
|
|
|
return baseMapper.selectOne(lambdaQueryWrapper);
|
|
return baseMapper.selectOne(lambdaQueryWrapper);
|