| | |
| | | import com.alibaba.fastjson.JSON; |
| | | 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.file.FileUploadDto; |
| | | import com.sandu.common.object.BaseConditionVO; |
| | |
| | | import com.sandu.ximon.admin.security.SecurityUtils; |
| | | import com.sandu.ximon.admin.utils.StoreOperationRecordsUtils; |
| | | import com.sandu.ximon.dao.domain.IpVolumeFile; |
| | | import com.sandu.ximon.dao.enums.OrderByEnums; |
| | | import com.sandu.ximon.dao.mapper.IpVolumeFileMapper; |
| | | import lombok.AllArgsConstructor; |
| | | import org.springframework.stereotype.Service; |
| | |
| | | |
| | | public boolean addFile(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()); |
| | | file.setClientId(clientService.getClientId()); |
| | | } |
| | | |
| | | file.setUserName(SecurityUtils.getUsername()); |
| | | file.setUserId(SecurityUtils.getClientId()); |
| | | file.setClientId(clientService.getClientId()); |
| | | |
| | | file.setFileName(fileParam.getFileName()); |
| | | file.setFileUrl(fileParam.getFileUrl()); |
| | |
| | | return removeById(fileId); |
| | | } |
| | | |
| | | public LambdaQueryWrapper<IpVolumeFile> listFile(BaseConditionVO baseConditionVO, String keyword, String orderBy) { |
| | | if (orderBy.isEmpty() || orderBy == null) { |
| | | orderBy = "id desc"; |
| | | } |
| | | if ("createTime-1".equals(orderBy)) { |
| | | orderBy = "create_time asc"; |
| | | } else if ("createTime-2".equals(orderBy)) { |
| | | orderBy = "create_time desc"; |
| | | } |
| | | public List<IpVolumeFile> ipVolumeFileList(BaseConditionVO baseConditionVO, String keyword, Integer order, Integer seq) { |
| | | LambdaQueryWrapper<IpVolumeFile> wrapper = Wrappers.lambdaQuery(IpVolumeFile.class); |
| | | |
| | | //不是超管 |
| | | if (SecurityUtils.getClientId() != null) { |
| | | wrapper = wrapper.eq(IpVolumeFile::getClientId, SecurityUtils.getUserId()) |
| | |
| | | if (keyword != null && !keyword.isEmpty()) { |
| | | wrapper.like(IpVolumeFile::getFileName, keyword); |
| | | } |
| | | return wrapper; |
| | | |
| | | //排序字段 |
| | | String orderByResult = "id"; |
| | | //正序、倒叙 |
| | | String orderBySeq = OrderByEnums.ASC.getCode(); |
| | | if (order != null) { |
| | | switch (order) { |
| | | case 1: |
| | | orderByResult = OrderByEnums.IP_VOLUME_FILE_CREATE_TIME.getCode(); |
| | | break; |
| | | default: |
| | | } |
| | | } |
| | | if (seq != null) { |
| | | switch (seq) { |
| | | case 1: |
| | | orderBySeq = OrderByEnums.ASC.getCode(); |
| | | break; |
| | | case 2: |
| | | orderBySeq = OrderByEnums.DESC.getCode(); |
| | | break; |
| | | default: |
| | | break; |
| | | } |
| | | } |
| | | //排序方式 |
| | | String orderBy = orderByResult + " " + orderBySeq; |
| | | |
| | | PageHelper.startPage(baseConditionVO.getPageNo(), baseConditionVO.getPageSize(), orderBy); |
| | | List<IpVolumeFile> list = list(wrapper); |
| | | |
| | | return list; |
| | | } |
| | | |
| | | public List<IpVolumeFile> listFiles() { |