xazn报错解决
This commit is contained in:
parent
83f9aac3c0
commit
27f4e48181
@ -5,7 +5,7 @@ fastbee:
|
|||||||
copyrightYear: 2023 # 版权年份
|
copyrightYear: 2023 # 版权年份
|
||||||
demoEnabled: true # 实例演示开关
|
demoEnabled: true # 实例演示开关
|
||||||
# 文件路径,以uploadPath结尾 示例( Windows配置 D:/uploadPath,Linux配置 /uploadPath)
|
# 文件路径,以uploadPath结尾 示例( Windows配置 D:/uploadPath,Linux配置 /uploadPath)
|
||||||
profile: /uploadPath
|
profile: D:/uploadPath
|
||||||
addressEnabled: true # 获取ip地址开关
|
addressEnabled: true # 获取ip地址开关
|
||||||
captchaType: math # 验证码类型 math 数组计算 char 字符验证
|
captchaType: math # 验证码类型 math 数组计算 char 字符验证
|
||||||
|
|
||||||
|
@ -114,7 +114,8 @@ public class FirmwareController extends BaseController
|
|||||||
@PutMapping
|
@PutMapping
|
||||||
public AjaxResult edit(@RequestBody Firmware firmware)
|
public AjaxResult edit(@RequestBody Firmware firmware)
|
||||||
{
|
{
|
||||||
return toAjax(firmwareService.updateById(firmware));
|
firmware.setUpdateBy(getUsername());
|
||||||
|
return toAjax(firmwareService.update(firmware));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -53,4 +53,6 @@ public interface IFirmwareService extends IService<Firmware>
|
|||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
int deleteBatchByIds(List<Long> firmwareIdList);
|
int deleteBatchByIds(List<Long> firmwareIdList);
|
||||||
|
|
||||||
|
int update(Firmware firmware);
|
||||||
}
|
}
|
||||||
|
@ -1,11 +1,15 @@
|
|||||||
package com.fastbee.iot.service.impl;
|
package com.fastbee.iot.service.impl;
|
||||||
|
|
||||||
|
import cn.hutool.core.util.ObjectUtil;
|
||||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||||
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
||||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||||
|
import com.fastbee.common.annotation.DataScope;
|
||||||
|
import com.fastbee.common.extend.aspectj.DataScopeAspect;
|
||||||
import com.fastbee.common.extend.core.domin.entity.SysUser;
|
import com.fastbee.common.extend.core.domin.entity.SysUser;
|
||||||
|
import com.fastbee.common.mybatis.LambdaQueryWrapperX;
|
||||||
import com.fastbee.common.utils.DateUtils;
|
import com.fastbee.common.utils.DateUtils;
|
||||||
import com.fastbee.common.utils.StringUtils;
|
import com.fastbee.common.utils.StringUtils;
|
||||||
import com.fastbee.iot.domain.Firmware;
|
import com.fastbee.iot.domain.Firmware;
|
||||||
@ -51,14 +55,8 @@ public class FirmwareServiceImpl extends ServiceImpl<FirmwareMapper,Firmware> im
|
|||||||
* @return 产品固件
|
* @return 产品固件
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
|
@DataScope()
|
||||||
public Page<Firmware> selectFirmwareList(Firmware firmware) {
|
public Page<Firmware> selectFirmwareList(Firmware firmware) {
|
||||||
SysUser user = getLoginUser().getUser();
|
|
||||||
// 查询所属机构
|
|
||||||
if (null != user.getDeptId()) {
|
|
||||||
firmware.setTenantId(user.getDept().getDeptUserId());
|
|
||||||
} else {
|
|
||||||
firmware.setTenantId(user.getUserId());
|
|
||||||
}
|
|
||||||
LambdaQueryWrapper<Firmware> lqw = buildQueryWrapper(firmware);
|
LambdaQueryWrapper<Firmware> lqw = buildQueryWrapper(firmware);
|
||||||
lqw.orderByDesc(Firmware::getCreateTime);
|
lqw.orderByDesc(Firmware::getCreateTime);
|
||||||
return baseMapper.selectPage(new Page<>(firmware.getPageNum(), firmware.getPageSize()),lqw);
|
return baseMapper.selectPage(new Page<>(firmware.getPageNum(), firmware.getPageSize()),lqw);
|
||||||
@ -83,6 +81,12 @@ public class FirmwareServiceImpl extends ServiceImpl<FirmwareMapper,Firmware> im
|
|||||||
!Objects.isNull(params.get("endTime"))) {
|
!Objects.isNull(params.get("endTime"))) {
|
||||||
lqw.between(Firmware::getCreateTime, params.get("beginTime"), params.get("endTime"));
|
lqw.between(Firmware::getCreateTime, params.get("beginTime"), params.get("endTime"));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// 数据范围过滤
|
||||||
|
if (ObjectUtil.isNotEmpty(query.getParams().get(DataScopeAspect.DATA_SCOPE))){
|
||||||
|
lqw.apply((String) query.getParams().get(DataScopeAspect.DATA_SCOPE));
|
||||||
|
}
|
||||||
|
|
||||||
return lqw;
|
return lqw;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -105,14 +109,51 @@ public class FirmwareServiceImpl extends ServiceImpl<FirmwareMapper,Firmware> im
|
|||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public int insertFirmware(Firmware firmware){
|
public int insertFirmware(Firmware firmware){
|
||||||
|
// 判断 isLatest 是否为 1
|
||||||
|
if (Objects.equals(firmware.getIsLatest(), 1)) {
|
||||||
|
// 查询该产品下的所有固件
|
||||||
|
LambdaQueryWrapper<Firmware> queryWrapper = new LambdaQueryWrapper<>();
|
||||||
|
queryWrapper.eq(Firmware::getProductId, firmware.getProductId());
|
||||||
|
List<Firmware> firmwareList = firmwareMapper.selectList(queryWrapper);
|
||||||
|
if (!firmwareList.isEmpty()) {
|
||||||
|
for (Firmware f : firmwareList) {
|
||||||
|
f.setIsLatest(0);
|
||||||
|
firmwareMapper.updateById(f);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
SysUser user = getLoginUser().getUser();
|
SysUser user = getLoginUser().getUser();
|
||||||
firmware.setTenantId(user.getDept().getDeptUserId());
|
firmware.setTenantId(user.getDept().getDeptUserId());
|
||||||
firmware.setTenantName(user.getDept().getDeptUserName());
|
firmware.setTenantName(user.getDept().getDeptName());
|
||||||
firmware.setCreateBy(user.getUserName());
|
firmware.setCreateBy(user.getUserName());
|
||||||
firmware.setCreateTime(DateUtils.getNowDate());
|
firmware.setCreateTime(DateUtils.getNowDate());
|
||||||
return firmwareMapper.insert(firmware);
|
return firmwareMapper.insert(firmware);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 修改产品固件
|
||||||
|
*
|
||||||
|
* @param firmware 产品固件
|
||||||
|
* @return 结果
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public int update(Firmware firmware){
|
||||||
|
// 判断 isLatest 是否为 1
|
||||||
|
if (Objects.equals(firmware.getIsLatest(), 1)) {
|
||||||
|
// 查询该产品下的所有固件
|
||||||
|
LambdaQueryWrapper<Firmware> queryWrapper = new LambdaQueryWrapper<>();
|
||||||
|
queryWrapper.eq(Firmware::getProductId, firmware.getProductId());
|
||||||
|
List<Firmware> firmwareList = firmwareMapper.selectList(queryWrapper);
|
||||||
|
if (!firmwareList.isEmpty()) {
|
||||||
|
for (Firmware f : firmwareList) {
|
||||||
|
f.setIsLatest(0);
|
||||||
|
firmwareMapper.updateById(f);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return firmwareMapper.updateById(firmware);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 查询设备最新固件
|
* 查询设备最新固件
|
||||||
|
Loading…
x
Reference in New Issue
Block a user