feat(file): 添加获取文件类型列表功能
This commit is contained in:
parent
92899d578f
commit
e82e68c602
|
|
@ -150,4 +150,14 @@ public class FileController extends ControllerBase {
|
||||||
fileUploadRecordService.removeBatchByIds(ids);
|
fileUploadRecordService.removeBatchByIds(ids);
|
||||||
return ApiResult.success();
|
return ApiResult.success();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取文件类型列表
|
||||||
|
* @return 文件类型列表
|
||||||
|
*/
|
||||||
|
@PostMapping("getFileTypes")
|
||||||
|
@ApiMark(moduleName = "文件管理", apiName = "获取文件类型列表")
|
||||||
|
public ApiResult<List<String>> getFileTypes(){
|
||||||
|
return ApiResult.success(fileUploadRecordService.getFileTypes());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -3,6 +3,8 @@ package com.nflg.mobilebroken.repository.mapper;
|
||||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||||
import com.nflg.mobilebroken.repository.entity.FileUploadRecord;
|
import com.nflg.mobilebroken.repository.entity.FileUploadRecord;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* <p>
|
* <p>
|
||||||
* Mapper 接口
|
* Mapper 接口
|
||||||
|
|
@ -13,4 +15,5 @@ import com.nflg.mobilebroken.repository.entity.FileUploadRecord;
|
||||||
*/
|
*/
|
||||||
public interface FileUploadRecordMapper extends BaseMapper<FileUploadRecord> {
|
public interface FileUploadRecordMapper extends BaseMapper<FileUploadRecord> {
|
||||||
|
|
||||||
|
List<String> getFileTypes();
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -6,6 +6,8 @@ import com.nflg.mobilebroken.common.pojo.request.FileSearchRequest;
|
||||||
import com.nflg.mobilebroken.common.pojo.vo.FileVO;
|
import com.nflg.mobilebroken.common.pojo.vo.FileVO;
|
||||||
import com.nflg.mobilebroken.repository.entity.FileUploadRecord;
|
import com.nflg.mobilebroken.repository.entity.FileUploadRecord;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* <p>
|
* <p>
|
||||||
* 服务类
|
* 服务类
|
||||||
|
|
@ -17,4 +19,6 @@ import com.nflg.mobilebroken.repository.entity.FileUploadRecord;
|
||||||
public interface IFileUploadRecordService extends IService<FileUploadRecord> {
|
public interface IFileUploadRecordService extends IService<FileUploadRecord> {
|
||||||
|
|
||||||
PageData<FileVO> search(FileSearchRequest request);
|
PageData<FileVO> search(FileSearchRequest request);
|
||||||
|
|
||||||
|
List<String> getFileTypes();
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -13,6 +13,7 @@ import com.nflg.mobilebroken.repository.service.IFileUploadRecordService;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
import java.time.LocalDate;
|
import java.time.LocalDate;
|
||||||
|
import java.util.List;
|
||||||
import java.util.Objects;
|
import java.util.Objects;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
@ -46,4 +47,9 @@ public class FileUploadRecordServiceImpl extends ServiceImpl<FileUploadRecordMap
|
||||||
.page(new Page<>(request.getPage(), request.getPageSize()));
|
.page(new Page<>(request.getPage(), request.getPageSize()));
|
||||||
return PageUtil.convert(datas, d -> Convert.convert(FileVO.class, d));
|
return PageUtil.convert(datas, d -> Convert.convert(FileVO.class, d));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public List<String> getFileTypes() {
|
||||||
|
return baseMapper.getFileTypes();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -2,4 +2,7 @@
|
||||||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||||
<mapper namespace="com.nflg.mobilebroken.repository.mapper.FileUploadRecordMapper">
|
<mapper namespace="com.nflg.mobilebroken.repository.mapper.FileUploadRecordMapper">
|
||||||
|
|
||||||
|
<select id="getFileTypes" resultType="java.lang.String">
|
||||||
|
select distinct file_type from file_upload_record
|
||||||
|
</select>
|
||||||
</mapper>
|
</mapper>
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue