package com.yonge.cooleshow.admin.controller;

import com.yonge.cooleshow.biz.dal.vo.PlatformCashAccountPageVo;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;

import javax.validation.Valid;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.ui.ModelMap;
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 com.yonge.cooleshow.biz.dal.dto.search.PlatformCashAccountRecordSearch;
import com.yonge.cooleshow.biz.dal.entity.PlatformCashAccountRecord;
import com.yonge.cooleshow.biz.dal.service.PlatformCashAccountRecordService;
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;

@RestController
@RequestMapping("/platformCashAccountRecord")
@Api(value = "平台账户记录", tags = "平台账户记录")
public class PlatformCashAccountRecordController extends BaseController {

    @Autowired
    private PlatformCashAccountRecordService platformCashAccountRecordService;

	@ApiOperation(value = "平台账户记录-列表", httpMethod = "POST", consumes = "application/json", produces = "application/json")
	@PostMapping(value = "/list", consumes = "application/json", produces = "application/json")
	@PreAuthorize("@pcs.hasPermissions('platformCashAccountRecord/list')")
	public HttpResponseResult<PlatformCashAccountPageVo> list(@Valid @RequestBody PlatformCashAccountRecordSearch query) {
		PlatformCashAccountPageVo model = new PlatformCashAccountPageVo();
		
		PageInfo<PlatformCashAccountRecord> pageInfo = PageUtil.pageInfo(platformCashAccountRecordService.queryPage(PageUtil.getPage(query),query));
		model.setPageInfo(pageInfo);
		model.setSummary(platformCashAccountRecordService.querySummary(query));
		return succeed(model);
	}

}