package com.crm.manager.controller;


import com.crm.manager.service.risk.RiskSymbolQuoteDateFeignService;
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.risk.symbol.qutoe.date.RiskSymbolQuoteDateDto;
import com.crm.rely.backend.core.entity.base.SingleLongEntity;
import com.crm.rely.backend.core.entity.risk.symbol.quote.date.RiskSymbolQuoteDateAddEntity;
import com.crm.rely.backend.core.entity.risk.symbol.quote.date.RiskSymbolQuoteDateDeleteEntity;
import com.crm.rely.backend.core.entity.risk.symbol.quote.date.RiskSymbolQuoteDateSearchEntity;
import com.crm.rely.backend.core.entity.risk.symbol.quote.date.RiskSymbolQuoteDateUpdateEntity;
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("/risk/symbol/quote/date")
public class RiskSymbolQuoteDateController {

    @Autowired
    private RiskSymbolQuoteDateFeignService feignService;

    /**
     * @param entity
     * @return
     * @throws Exception
     */
    @PostMapping("/add")
    public BaseResultDto add(@RequestBody @Validated RiskSymbolQuoteDateAddEntity entity) throws Exception {

        return feignService.add(entity);
    }

    @PostMapping("/update")
    public BaseResultDto update(@RequestBody @Validated RiskSymbolQuoteDateUpdateEntity entity) throws Exception {

        return feignService.update(entity);
    }

    @PostMapping("/delete")
    public BaseResultDto delete(@RequestBody @Validated RiskSymbolQuoteDateDeleteEntity entity) throws Exception {

        return feignService.delete(entity);
    }

    @PostMapping("/search/list")
    public ResultWithPagerDto<RiskSymbolQuoteDateDto> pageList(@RequestBody @Validated RiskSymbolQuoteDateSearchEntity entity) throws Exception {

        return feignService.pageList(entity);
    }

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

        return feignService.single(entity);
    }
}
