This commit is contained in:
郝彬 2025-08-05 10:15:11 +08:00
commit a49d01d23a
5 changed files with 32 additions and 30 deletions

View File

@ -11,7 +11,7 @@ import java.util.List;
@ApiOperation("商务资料文件对象") @ApiOperation("商务资料文件对象")
public interface BusinessDataFileMapper { public interface BusinessDataFileMapper {
public List<BusinessDataFileEntity> List( @Param("folderId") Long folderId,String fileName); public List<BusinessDataFileEntity> List(@Param("folderId") Long folderId, @Param("fileName") String fileName);
void delete(@Param("fileId") Long fileId,@Param("folderId") Long folderId); void delete(@Param("fileId") Long fileId,@Param("folderId") Long folderId);
void add(BusinessDataFileEntity businessDataFileEntity); void add(BusinessDataFileEntity businessDataFileEntity);

View File

@ -10,7 +10,7 @@ import org.springframework.web.bind.annotation.RequestParam;
public interface BusinessDataFileService { public interface BusinessDataFileService {
PageBean pageSelect(Integer page, Integer pageSize, Long folderId); PageBean pageSelect(Integer page, Integer pageSize, Long folderId, String fileName);
Result delete(@RequestParam(value = "fileId", required = false) Long fileId,@RequestParam(value = "foldelId", required = false) Long folderId); Result delete(@RequestParam(value = "fileId", required = false) Long fileId,@RequestParam(value = "foldelId", required = false) Long folderId);

View File

@ -30,9 +30,10 @@ public class BusinessDataFileServiceImpl implements BusinessDataFileService {
@ApiOperation("分页查询文件") @ApiOperation("分页查询文件")
public PageBean pageSelect(Integer page, Integer pageSize, Long folderId) { @Override
public PageBean pageSelect(Integer page, Integer pageSize, Long folderId, String fileName) {
PageHelper.startPage(page, pageSize); PageHelper.startPage(page, pageSize);
List<BusinessDataFileEntity> list = businessDataFileMapper.List(folderId ,""); List<BusinessDataFileEntity> list = businessDataFileMapper.List(folderId, fileName);
Page<BusinessDataFileEntity> p = (Page<BusinessDataFileEntity>) list; Page<BusinessDataFileEntity> p = (Page<BusinessDataFileEntity>) list;
PageBean pageBean = new PageBean(p.getTotal(), p.getResult()); PageBean pageBean = new PageBean(p.getTotal(), p.getResult());
return pageBean; return pageBean;

View File

@ -4,11 +4,11 @@
<select id="List" resultType="com.dite.znpt.domain.entity.BusinessDataFileEntity"> <select id="List" resultType="com.dite.znpt.domain.entity.BusinessDataFileEntity">
select * from business_data_part_file select * from business_data_part_file
<where> <where>
<if test="param1 != null"> <if test="folderId != null">
and folder_id = #{param1} and folder_id = #{folderId}
</if> </if>
<if test="param2 != null and param2 != ''"> <if test="fileName != null and fileName != ''">
and file_name = #{param2} and file_name like concat('%', #{fileName}, '%')
</if> </if>
</where> </where>
</select> </select>

View File

@ -45,8 +45,9 @@ public class BusinessDataFileController {
@GetMapping("/list") @GetMapping("/list")
public Result pageSelect(@RequestParam(defaultValue = "1") Integer page, public Result pageSelect(@RequestParam(defaultValue = "1") Integer page,
@RequestParam(defaultValue = "10") Integer pageSize, @RequestParam(defaultValue = "10") Integer pageSize,
@RequestParam(defaultValue = "0") Long folderId) { @RequestParam(defaultValue = "0") Long folderId,
PageBean pageBean = businessDataFileService.pageSelect(page, pageSize, folderId); @RequestParam(required = false) String fileName) {
PageBean pageBean = businessDataFileService.pageSelect(page, pageSize, folderId, fileName);
return Result.ok(pageBean); return Result.ok(pageBean);
} }
@ -96,6 +97,7 @@ public class BusinessDataFileController {
businessDataFileService.delete(fileId, null); businessDataFileService.delete(fileId, null);
return Result.okM("删除成功"); return Result.okM("删除成功");
} }
@ApiOperation(value = "下载文件") @ApiOperation(value = "下载文件")
@GetMapping("/download") @GetMapping("/download")
public void download(@RequestParam("fileId") Long fileId, HttpServletResponse response) { public void download(@RequestParam("fileId") Long fileId, HttpServletResponse response) {
@ -133,5 +135,4 @@ public class BusinessDataFileController {
} }
} }
} }