package com.ym.mec.teacher.controller;

import com.ym.mec.biz.dal.dto.SysCouponCodeDto;
import com.ym.mec.biz.dal.page.SysCouponCodeQueryInfo;
import com.ym.mec.biz.service.SysCouponCodeService;
import com.ym.mec.common.controller.BaseController;
import com.ym.mec.common.entity.HttpResponseResult;
import com.ym.mec.common.exception.BizException;
import com.ym.mec.common.page.PageInfo;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RequestMapping("eduSysCouponCode")
@Api(tags = "优惠券明细")
@RestController
public class EduSysCouponCodeController extends BaseController {

	@Autowired
	private SysCouponCodeService sysCouponCodeService;

	@ApiOperation("分页查询")
	@RequestMapping(value = "queryPage")
	public HttpResponseResult<PageInfo<SysCouponCodeDto>> queryPage(SysCouponCodeQueryInfo queryInfo) {
		if(queryInfo.getUserId() == null){
			throw new BizException("请指定学员");
		}
		return succeed(sysCouponCodeService.querySysCouponUseList(queryInfo));
	}
}
