【7.3.4】【file】更新业务数据绑定文件的列表和绑定接口

pull/54/MERGE
fengshuonan 2023-04-05 16:14:23 +08:00
parent a02a8a376b
commit 98b23a2a52
2 changed files with 49 additions and 2 deletions

View File

@ -24,18 +24,22 @@
*/
package cn.stylefeng.roses.kernel.file.modular.controller;
import cn.hutool.core.collection.ListUtil;
import cn.stylefeng.roses.kernel.file.api.pojo.response.SysFileInfoResponse;
import cn.stylefeng.roses.kernel.file.modular.pojo.request.SysFileBusinessRequest;
import cn.stylefeng.roses.kernel.file.modular.service.SysFileBusinessService;
import cn.stylefeng.roses.kernel.rule.enums.ResBizTypeEnum;
import cn.stylefeng.roses.kernel.rule.pojo.response.ResponseData;
import cn.stylefeng.roses.kernel.rule.pojo.response.SuccessResponseData;
import cn.stylefeng.roses.kernel.scanner.api.annotation.ApiResource;
import cn.stylefeng.roses.kernel.scanner.api.annotation.GetResource;
import cn.stylefeng.roses.kernel.scanner.api.annotation.PostResource;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RestController;
import javax.annotation.Resource;
import java.util.List;
/**
*
@ -62,4 +66,31 @@ public class SysFileBusinessController {
return new SuccessResponseData<>();
}
/**
*
*
* @author fengshuonan
* @since 2023/4/5 16:00
*/
@GetResource(name = "获取业务关联的文件信息列表", path = "/sysFileInfo/getBusinessFileList")
public ResponseData<List<SysFileInfoResponse>> getBusinessFileList(@RequestBody @Validated(SysFileBusinessRequest.getBusinessFileList.class) SysFileBusinessRequest sysFileBusinessRequest) {
List<SysFileInfoResponse> list = sysFileBusinessService.getBusinessFileInfoList(sysFileBusinessRequest.getBusinessId());
return new SuccessResponseData<>(list);
}
/**
*
*
* @author fengshuonan
* @since 2023/4/4 20:56
*/
@PostResource(name = "新增绑定业务和文件", path = "/sysFileInfo/bindFile")
public ResponseData<?> bindFile(@RequestBody @Validated(SysFileBusinessRequest.bindFile.class) SysFileBusinessRequest sysFileBusinessRequest) {
sysFileBusinessService.addFileBusinessBind(
sysFileBusinessRequest.getBusinessCode(),
sysFileBusinessRequest.getBusinessId(),
ListUtil.list(false, sysFileBusinessRequest.getFileId()));
return new SuccessResponseData<>();
}
}

View File

@ -5,6 +5,7 @@ import cn.stylefeng.roses.kernel.rule.pojo.request.BaseRequest;
import lombok.Data;
import lombok.EqualsAndHashCode;
import javax.validation.constraints.NotBlank;
import javax.validation.constraints.NotNull;
/**
@ -28,20 +29,21 @@ public class SysFileBusinessRequest extends BaseRequest {
*
*/
@ChineseDescription("业务的编码,业务自定义")
@NotBlank(message = "业务的编码不能为空", groups = {bindFile.class})
private String businessCode;
/**
* id
*/
@ChineseDescription("业务主键id")
@NotNull(message = "业务主键id不能为空", groups = addFileDownloadCount.class)
@NotNull(message = "业务主键id不能为空", groups = {addFileDownloadCount.class, getBusinessFileList.class, bindFile.class})
private Long businessId;
/**
* id
*/
@ChineseDescription("关联文件表的id")
@NotNull(message = "文件id不能为空", groups = addFileDownloadCount.class)
@NotNull(message = "文件id不能为空", groups = {addFileDownloadCount.class, bindFile.class})
private Long fileId;
/**
@ -63,4 +65,18 @@ public class SysFileBusinessRequest extends BaseRequest {
}
/**
*
*/
public @interface getBusinessFileList {
}
/**
*
*/
public @interface bindFile {
}
}