package com.ym.mec.web.controller;

import com.ym.mec.biz.dal.entity.MarketActivity;
import com.ym.mec.biz.service.MarketActivityService;
import com.ym.mec.common.controller.BaseController;
import com.ym.mec.common.page.QueryInfo;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RequestMapping("marketActivity")
@Api(tags = "营销活动")
@RestController
public class MarketActivityController extends BaseController {

	@Autowired
	private MarketActivityService marketActivityService;

	@ApiOperation("新增")
	@RequestMapping(value = "add")
	@PreAuthorize("@pcs.hasPermissions('marketActivity/add')")
	public Object add(MarketActivity marketActivity) {
		return succeed(marketActivityService.insert(marketActivity));
	}

	@ApiOperation("删除")
	@RequestMapping(value = "del")
	@PreAuthorize("@pcs.hasPermissions('marketActivity/del')")
	public Object del(Integer id) {
		return succeed(marketActivityService.delete(id));
	}

	@ApiOperation("修改")
	@RequestMapping(value = "update")
	@PreAuthorize("@pcs.hasPermissions('marketActivity/update')")
	public Object update(MarketActivity marketActivity) {
		return succeed(marketActivityService.update(marketActivity));
	}

	@ApiOperation("查询")
	@RequestMapping(value = "get")
	@PreAuthorize("@pcs.hasPermissions('marketActivity/get')")
	public Object get(Integer id) {
		return succeed(marketActivityService.get(id));
	}

	@ApiOperation("分页查询")
	@RequestMapping(value = "queryPage")
	@PreAuthorize("@pcs.hasPermissions('marketActivity/queryPage')")
	public Object queryPage(QueryInfo queryInfo) {
		return succeed(marketActivityService.queryPage(queryInfo));
	}
}
