mirror of https://gitee.com/stylefeng/roses
【7.3.4】【file】更新业务数据绑定文件的列表和绑定接口
parent
a02a8a376b
commit
98b23a2a52
|
@ -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<>();
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -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 {
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue