MerchantFileController.java 1.67 KB
package cn.com.glsx.merchants.controller;


import cn.com.glsx.framework.core.exception.RpcServiceException;
import cn.com.glsx.framework.rop.response.RopResponse;
import cn.com.glsx.merchants.request.file.FileSearchRequest;
import cn.com.glsx.merchants.response.FileResponse;
import cn.com.glsx.merchants.service.MerchantFileService;
import com.rop.annotation.NeedInSessionType;
import com.rop.annotation.ServiceMethod;
import com.rop.annotation.ServiceMethodBean;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import java.util.List;

/**
 * @author Administrator
 */
@ServiceMethodBean(version = "1.0.0", needInSession = NeedInSessionType.NO)
@Api("文件管理接口")
@Slf4j
public class MerchantFileController {

    @Autowired
    private MerchantFileService merchantFileService;

    /**
     * 查询素材库
     * @param fileSearchRequest
     * @return
     */
    @ServiceMethod(method = "merchants.api.menu.findMerchantFile", needInSession = NeedInSessionType.NO)
    @ApiOperation("查询素材库")
    public RopResponse<List<FileResponse>> findMerchantFile(FileSearchRequest fileSearchRequest){
        try {
            List<FileResponse> fileResponseList = merchantFileService.findMerchantFile(fileSearchRequest);
            return RopResponse.success(fileResponseList);
        } catch (RpcServiceException e) {
            log.info("=======MerchantFileController__invoke__findMerchantFile__exception:{}", e.getMessage());
            return RopResponse.error(e.getError(),e.getMessage());
        }
    }
}