package com.crm.manager.controller;

import com.crm.login.rely.backend.controller.BaseLoginController;
import com.crm.manager.service.activity.WebActivityCustomDepositRafflePopupFeignService;
import com.crm.rely.backend.core.dto.base.BaseResultDto;
import com.crm.rely.backend.core.dto.base.ResultWithPagerDto;
import com.crm.rely.backend.core.dto.web.activity.custom.deposit.raffle.popup.WebActivityCustomDepositRafflePopupSearchDto;
import com.crm.rely.backend.core.entity.base.SingleLongEntity;
import com.crm.rely.backend.core.entity.web.activity.custom.deposit.raffle.popup.WebActivityCustomDepositRafflePopupAddEntity;
import com.crm.rely.backend.core.entity.web.activity.custom.deposit.raffle.popup.WebActivityCustomDepositRafflePopupDeleteEntity;
import com.crm.rely.backend.core.entity.web.activity.custom.deposit.raffle.popup.WebActivityCustomDepositRafflePopupSearchListEntity;
import com.crm.rely.backend.core.entity.web.activity.custom.deposit.raffle.popup.WebActivityCustomDepositRafflePopupUpdateEntity;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.validation.annotation.Validated;
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;

/**
 * @author: houn
 */
@RestController
@RequestMapping("/web/activity/custom/deposit/raffle/popup")
public class WebActivityCustomDepositRafflePopupController extends BaseLoginController {

    @Autowired
    private WebActivityCustomDepositRafflePopupFeignService service;


    /**
     * 添加信息
     *
     * @param entity
     * @return
     * @throws Exception
     */
    @PostMapping("/add")
    public BaseResultDto add(@RequestBody @Validated WebActivityCustomDepositRafflePopupAddEntity entity) throws Exception {


        return service.add(entity);
    }

    /**
     * 删除信息
     *
     * @param entity
     * @return
     * @throws Exception
     */
    @PostMapping("/delete")
    public BaseResultDto delete(@RequestBody @Validated WebActivityCustomDepositRafflePopupDeleteEntity entity) throws Exception {

        return service.delete(entity);
    }

    /**
     * 修改信息
     *
     * @param entity
     * @return
     * @throws Exception
     */
    @PostMapping("/update")
    public BaseResultDto update(@RequestBody @Validated WebActivityCustomDepositRafflePopupUpdateEntity entity) throws Exception {

        return service.update(entity);
    }

    /**
     * @param entity
     * @return
     * @throws Exception
     */
    @PostMapping("/search/list")
    public ResultWithPagerDto<WebActivityCustomDepositRafflePopupSearchDto> pageSearchList(@RequestBody @Validated WebActivityCustomDepositRafflePopupSearchListEntity entity) throws Exception {

        return service.pageSearchList(entity);
    }

    @PostMapping("/search/single")
    public BaseResultDto<WebActivityCustomDepositRafflePopupSearchDto> single(@RequestBody @Validated SingleLongEntity entity) throws Exception {

        return service.single(entity);
    }
}
