package com.yonge.cooleshow.student.controller;

import com.baomidou.mybatisplus.core.metadata.IPage;
import com.microsvc.toolkit.common.response.paging.QueryInfo;
import com.yonge.cooleshow.biz.dal.service.TenantAlbumMusicService;
import com.yonge.cooleshow.biz.dal.service.TenantAlbumRefService;
import com.yonge.cooleshow.biz.dal.service.TenantAlbumService;
import com.yonge.cooleshow.biz.dal.service.TenantInfoService;
import com.yonge.cooleshow.biz.dal.wrapper.TenantAlbumWrapper;
import com.yonge.cooleshow.common.entity.HttpResponseResult;
import com.yonge.toolset.base.page.PageInfo;
import com.yonge.toolset.mybatis.support.PageUtil;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.access.prepost.PreAuthorize;
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.RequestParam;
import org.springframework.web.bind.annotation.RestController;

/**
 * @Author：haonan
 * @Date：2023/7/27 18:26
 * @Filename：TenantAlbumController
 */

@RestController
@RequestMapping("${app-config.url.student:}/StudentTenantAlbum")
@Api(value = "学生端机构管理", tags = "学生端机构管理")
public class TenantAlbumController {
    @Autowired
    TenantAlbumService tenantAlbumService;

    @Autowired
    private TenantAlbumMusicService tenantAlbumMusicService;

    @Autowired
    private TenantAlbumRefService tenantAlbumRefService;

    @Autowired
    private TenantInfoService tenantInfoService;

    /**
     * 查询分页
     *
     * @param query
     */
    @PostMapping("/page")
    @ApiOperation(value = "查询分页", notes = "StudentTenantAlbum")
    @PreAuthorize("@pcs.hasPermissions('tenantAlbum/page')")
    public HttpResponseResult<PageInfo<TenantAlbumWrapper.TenantAlbum>> page(@RequestBody TenantAlbumWrapper.TenantAlbumQuery query) {
        IPage<TenantAlbumWrapper.TenantAlbum> pages = tenantAlbumService.selectPage(QueryInfo.getPage(query), query);
        return HttpResponseResult.succeed(PageUtil.pageInfo(pages));
    }

    /**
     * 下拉框搜索
     *
     * @param query
     */
    @PostMapping("/select")
    @ApiOperation(value = "查询分页", notes = "StudentTenantAlbum")
    @PreAuthorize("@pcs.hasPermissions('tenantAlbum/select')")
    public HttpResponseResult<PageInfo<TenantAlbumWrapper.TenantAlbum>> select(@RequestBody TenantAlbumWrapper.TenantAlbumQuery query) {
        IPage<TenantAlbumWrapper.TenantAlbum> pages = tenantAlbumService.selectPage(QueryInfo.getPage(query), query);
        return HttpResponseResult.succeed(PageUtil.pageInfo(pages));
    }



    /**
     * 查询详情
     *
     * @param id 详情ID
     * @return TenantAlbum
     */
    @PostMapping("/detail")
    @ApiOperation(value = "查询详情", notes = "detail")
    @PreAuthorize("@pcs.hasPermissions('tenantAlbum/detail')")
    public HttpResponseResult<TenantAlbumWrapper.TenantAlbum> detail(@RequestParam("id") Long id) {

        return null;
    }



}
