package com.crm.manager.controller;

import com.crm.manager.service.risk.RiskSymbolLeverageSymbolFeignService;
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.leverage.symbol.RiskSymbolLeverageSymbolDto;
import com.crm.rely.backend.core.entity.base.SingleLongEntity;
import com.crm.rely.backend.core.entity.risk.symbol.leverage.symbol.RiskSymbolLeverageSymbolAddEntity;
import com.crm.rely.backend.core.entity.risk.symbol.leverage.symbol.RiskSymbolLeverageSymbolDeleteEntity;
import com.crm.rely.backend.core.entity.risk.symbol.leverage.symbol.RiskSymbolLeverageSymbolSearchEntity;
import com.crm.rely.backend.core.entity.risk.symbol.leverage.symbol.RiskSymbolLeverageSymbolUpdateEntity;
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;

import java.util.List;

/**
 * 货币配设置
 *
 * @author houn
 */
@RestController
@RequestMapping("/risk/symbol/leverage/symbol")
public class RiskSymbolLeverageSymbolController {

    @Autowired
    private RiskSymbolLeverageSymbolFeignService feignService;

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

        return feignService.add(entity);
    }

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

        return feignService.update(entity);
    }

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

        return feignService.delete(entity);
    }

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

        return feignService.pageList(entity);
    }

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

        return feignService.single(entity);
    }

    @PostMapping("/list")
    public BaseResultDto<List<RiskSymbolLeverageSymbolDto>> list() throws Exception {

        return feignService.list();
    }


}
