| | |
| | | |
| | | import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
| | | import com.baomidou.mybatisplus.core.toolkit.Wrappers; |
| | | import com.github.pagehelper.PageHelper; |
| | | import com.sandu.common.execption.BusinessException; |
| | | import com.sandu.common.object.BaseConditionVO; |
| | | import com.sandu.common.service.impl.BaseServiceImpl; |
| | | import com.sandu.ximon.admin.param.IpVolumeFileParam; |
| | | import com.sandu.ximon.admin.param.ReceiveParam; |
| | | import com.sandu.ximon.admin.security.SecurityUtils; |
| | | import com.sandu.ximon.dao.domain.IpVolumeFile; |
| | | import com.sandu.ximon.dao.mapper.IpVolumeFileMapper; |
| | |
| | | |
| | | public boolean addFile(IpVolumeFileParam fileParam) { |
| | | IpVolumeFile file = new IpVolumeFile(); |
| | | file.setUserId(SecurityUtils.getClientId()); |
| | | // if(SecurityUtils.getClientId()!=null){ |
| | | // file.setUserName(SecurityUtils.getUsername()); |
| | | // } |
| | | // |
| | | if(SecurityUtils.getClientId()!=null){ |
| | | file.setUserName(SecurityUtils.getUsername()); |
| | | file.setUserId(SecurityUtils.getClientId()); |
| | | } |
| | | |
| | | if(clientService.getClientId()!=null){ |
| | | file.setClientId(clientService.getClientId()); |
| | | } |
| | | file.setFileName(fileParam.getFileName()); |
| | | file.setFileSize(fileParam.getFileSizeIp()); |
| | | file.setFileUrl(fileParam.getFileUrl()); |
| | | file.setOriginSize(fileParam.getOriginSize()); |
| | | return save(file); |
| | | } |
| | |
| | | return removeById(fileId); |
| | | } |
| | | |
| | | public LambdaQueryWrapper<IpVolumeFile> listFile(ReceiveParam receiveParam) { |
| | | public LambdaQueryWrapper<IpVolumeFile> listFile(BaseConditionVO baseConditionVO, String keyword) { |
| | | PageHelper.startPage(baseConditionVO.getPageNo(), baseConditionVO.getPageSize()); |
| | | LambdaQueryWrapper<IpVolumeFile> wrapper = Wrappers.lambdaQuery(IpVolumeFile.class).eq(IpVolumeFile::getClientId, clientService.getClientId()); |
| | | if (receiveParam.getKeyWord() == null) { |
| | | if (keyword.isEmpty()) { |
| | | return wrapper; |
| | | } else { |
| | | return wrapper.like(IpVolumeFile::getFileName,receiveParam.getKeyWord()); |
| | | return wrapper.like(IpVolumeFile::getFileName,keyword); |
| | | } |
| | | } |
| | | |
| | | public boolean upload(IpVolumeFileParam fileParam) { |
| | | IpVolumeFile file = new IpVolumeFile(); |
| | | // if(SecurityUtils.getClientId()!=null){ |
| | | // file.setUserName(SecurityUtils.getUsername()); |
| | | // } |
| | | // |
| | | if(SecurityUtils.getClientId()!=null){ |
| | | file.setUserName(SecurityUtils.getUsername()); |
| | | file.setUserId(SecurityUtils.getClientId()); |
| | | } |
| | | |
| | | if(clientService.getClientId()!=null){ |
| | | file.setClientId(clientService.getClientId()); |
| | | } |
| | | file.setFileName(fileParam.getFileName()); |
| | | file.setFileUrl(fileParam.getFileUrl()); |
| | | file.setOriginSize(fileParam.getOriginSize()); |
| | | return save(file); |
| | | } |
| | | |
| | | } |