package com.sv.api.controller;

import com.sv.service.api.VenueCardService;
import com.ydd.framework.core.common.Pagination;
import com.ydd.framework.core.common.dto.ResponseDTO;
import com.ydd.framework.core.controller.BaseApiController;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;

/**
 * Controller - 场馆会员卡
 *
 * @author lihong
 * @since 2018-08-02
 */
@RestController
public class VenueCardController extends BaseApiController {

	private final Logger logger = LoggerFactory.getLogger(VenueCardController.class);
	
	@Resource
	private VenueCardService venueCardService;

//	/**
//	 * 分页查询场馆会员卡
//	 */
//	@RequestMapping(value = "/venue/cards", method = RequestMethod.GET)
//	public ResponseDTO findPage(Pagination pagination) {
//		return ResponseDTO.ok()
//				.setPagination(venueCardService.findPage(pagination));
//	}

	/**
	 * 查询场馆会员卡信息
	 */
	@RequestMapping(value = "/venue/card/{id}", method = RequestMethod.GET)
	public ResponseDTO findById(@PathVariable("id") Integer id) {
		return ResponseDTO.ok()
				.addAttribute("venueCard", venueCardService.findById(id));
	}

	/**
	 * 删除场馆会员卡
	 */
	@RequestMapping(value = "/venue/card/delete", method = RequestMethod.POST)
	public ResponseDTO delete(@RequestParam("id[]") Integer[] ids) {
		venueCardService.deleteByIds(ids);
		return ResponseDTO.ok("删除成功");
	}

}
