package com.yonge.cooleshow.admin.controller;

import com.baomidou.mybatisplus.core.metadata.IPage;
import com.yonge.cooleshow.biz.dal.dto.search.SysUserContractRecordSearch;
import com.yonge.cooleshow.biz.dal.service.SysUserContractRecordService;
import com.yonge.cooleshow.biz.dal.vo.SysUserContractRecordVo;
import com.yonge.cooleshow.common.controller.BaseController;
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.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.RestController;

import javax.annotation.Resource;

/**
 * 用户协议记录表-一个用户一种协议一个版本一条记录(SysUserContractRecord)表控制层
 *
 * @author hgw
 * @since 2022-05-07 15:04:05
 */
@Api(tags = "用户协议记录表-一个用户一种协议一个版本一条记录")
@RestController
@RequestMapping("/sysUserContractRecord")
public class SysUserContractRecordController extends BaseController {
    /**
     * 服务对象
     */
    @Resource
    private SysUserContractRecordService sysUserContractRecordService;

    /**
     * 查询分页
     */
    @PostMapping("/page")
    @ApiOperation(value = "查询分页", notes = "传入sysUserContractRecordSearch")
    @PreAuthorize("@pcs.hasPermissions('sysUserContractRecord/page')")
    public HttpResponseResult<PageInfo<SysUserContractRecordVo>> page(@RequestBody SysUserContractRecordSearch query) {
        IPage<SysUserContractRecordVo> pages = sysUserContractRecordService.selectPage(PageUtil.getPage(query), query);
        return succeed(PageUtil.pageInfo(pages));
    }
}

