package com.yonge.cooleshow.admin.controller;

import com.baomidou.mybatisplus.core.metadata.IPage;
import com.microsvc.toolkit.common.response.paging.PageInfo;
import com.microsvc.toolkit.common.response.paging.QueryInfo;
import com.yonge.cooleshow.biz.dal.service.TenantAlbumPurchaseService;
import com.yonge.cooleshow.biz.dal.wrapper.TenantAlbumPurchaseWrapper;
import com.yonge.cooleshow.common.controller.BaseController;
import com.yonge.cooleshow.common.entity.HttpResponseResult;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;


@Slf4j
@Validated
@RestController
@RequestMapping("${app-config.url.admin:}/tenantAlbumPurchase")
@Api(tags = "机构专辑采购")
public class TenantAlbumPurchaseController extends BaseController {

    @Autowired
    private TenantAlbumPurchaseService tenantAlbumPurchaseService;

    @ApiOperation(value = "查询分页", notes = "机构专辑采购- 传入 TenantAlbumPurchaseVo.TenantAlbumPurchaseQuery")
    @PostMapping("/page")
    public HttpResponseResult<PageInfo<TenantAlbumPurchaseWrapper.TenantAlbumPurchase>> page(
            @RequestBody TenantAlbumPurchaseWrapper.TenantAlbumPurchaseQuery query) {
        // 查询数据
        IPage<TenantAlbumPurchaseWrapper.TenantAlbumPurchase> pages =
                tenantAlbumPurchaseService.selectPage(QueryInfo.getPage(query), query);
        return succeed(QueryInfo.pageInfo(pages, pages.getRecords()));
    }
}