package com.yonge.cooleshow.student.controller;

import com.yonge.cooleshow.biz.dal.dto.search.MemberPriceSettingsSearch;
import com.yonge.cooleshow.biz.dal.entity.SysConfig;
import com.yonge.cooleshow.biz.dal.service.MemberPriceSettingsService;
import com.yonge.cooleshow.biz.dal.service.SysConfigService;
import com.yonge.cooleshow.biz.dal.vo.MemberPriceSettingsVo;
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 org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.HashMap;
import java.util.List;
import java.util.Map;

@RequestMapping("memberPriceSettings")
@Api(tags = "会员价格设置")
@RestController
public class MemberPriceSettingsController extends BaseController {
	@Autowired
	private MemberPriceSettingsService memberPriceSettingsService;
	@Autowired
	private SysConfigService sysConfigService;

	@PostMapping("/list")
	@ApiOperation(value = "查询列表")
	public HttpResponseResult<List<MemberPriceSettingsVo>> list(@RequestBody MemberPriceSettingsSearch query) {
		List<MemberPriceSettingsVo> list = memberPriceSettingsService.selectList(query);
		return succeed(list);
	}

	@PostMapping("/vipPermissions")
	@ApiOperation(value = "查询vip权限")
	public HttpResponseResult<List<SysConfig>> vipPermissions() {
		Map<String,Object> params = new HashMap<>();
		params.put("group", "VIP_PERMISSION");
		List<SysConfig> configs = sysConfigService.findAll(params);
		return succeed(configs);
	}
}
